Skip to main content

High-performance parallel graph processing engine (C++ + Python)

Project description

๐Ÿš€ PARAGON: Parallel Graph Processing Engine

PARAGON is a high-performance parallel graph processing engine written in modern C++ with Python bindings via pybind11. P It provides scalable implementations of core graph algorithms like:

  • Parallel BFS / DFS
  • Connected Components
  • PageRank (Pull + Push)
  • Single Source Shortest Path (SSSP)
  • Triangle Counting

Designed for:

  • โšก Multicore CPUs
  • ๐Ÿ“Š Large-scale graphs
  • ๐Ÿง  Systems + algorithm engineering

Architecture

C++ Core Engine (src/)
        โ†“
Parallel Algorithms (threaded)
        โ†“
pybind11 Bindings (bindings/)
        โ†“
Python API (python/paragon/)

Project Structure

paragon/
โ”œโ”€โ”€ include/              # Header files (Graph, algorithms, engine)
โ”œโ”€โ”€ src/                  # C++ implementations
โ”œโ”€โ”€ bindings/             # pybind11 bindings
โ”œโ”€โ”€ python/paragon/       # Python API layer
โ”‚   โ”œโ”€โ”€ core.py
โ”‚   โ”œโ”€โ”€ algorithms/
โ”‚   โ”‚   โ”œโ”€โ”€ bfs.py
โ”‚   โ”‚   โ”œโ”€โ”€ dfs.py
โ”‚   โ”‚   โ”œโ”€โ”€ pagerank.py
โ”‚   โ”‚   โ”œโ”€โ”€ sssp.py
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ examples/             # C++ examples
โ”œโ”€โ”€ benchmark/            # Performance benchmarks
โ”œโ”€โ”€ tests/                # Unit tests
โ”œโ”€โ”€ CMakeLists.txt
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ README.md

โš™๏ธ Installation

๐Ÿ”ด IMPORTANT

Windows users:

You MUST use MSVC (Visual Studio Build Tools)

โŒ MinGW WILL FAIL โŒ Python 3.13 + MinGW is incompatible

Recommended Setup

Python version

Python 3.8 โ€“ 3.11 (RECOMMENDED)

โš ๏ธ Avoid Python 3.13 for now (ABI issues with pybind11 + MinGW)

Windows Setup

1. Install Visual Studio Build Tools

Download: ๐Ÿ‘‰ https://visualstudio.microsoft.com/visual-cpp-build-tools/

Select:

  • โœ” C++ build tools
  • โœ” MSVC compiler
  • โœ” Windows SDK

2. Install package

pip install paragon-engine

Linux / Mac

Install dependencies

sudo apt install build-essential cmake python3-dev
pip install pybind11 scikit-build-core

Then:

pip install paragon-engine

๐Ÿงช Quick Start

from paragon import Graph
from paragon.algorithms import parallel_bfs, parallel_dfs

g = Graph(5)
g.add_edges([
    (0, 1),
    (1, 2),
    (2, 3),
    (3, 4)
])

print(parallel_bfs(g, 0))
print(parallel_dfs(g, 0))

API Overview

Graph

from paragon import Graph

g = Graph(5)
g.add_edge(0, 1)
g.add_edges([(1, 2), (2, 3)])

WeightedGraph

from paragon import WeightedGraph

g = WeightedGraph(5)
g.add_edge(0, 1, 2.5)

โšก Algorithms

๐Ÿ”น Parallel BFS

from paragon.algorithms import parallel_bfs

dist = parallel_bfs(g, source=0)

๐Ÿ”น Parallel DFS

from paragon.algorithms import parallel_dfs 

visited = parallel_dfs(g, 0)

๐Ÿ”น Connected Components

from paragon.algorithms import connected_components

labels = connected_components(g)

๐Ÿ”น PageRank

from paragon.algorithms import pagerank

ranks = pagerank(g)

๐Ÿ”น PageRank (Push / BFS-style)

from paragon.algorithms import pagerank_bfs

ranks = pagerank_bfs(g)

Example โ€” Shortest Path (SSSP)

from paragon import WeightedGraph
from paragon.algorithms import sssp

g = WeightedGraph(6)

g.add_edges([
    (0, 1, 4.0),
    (0, 2, 2.0),
    (1, 3, 5.0),
    (2, 1, 1.0),
    (2, 3, 8.0),
    (3, 4, 3.0),
    (4, 5, 1.0)
])

dist = sssp(g, source=0)

for i, d in enumerate(dist):
    print(f"Distance from 0 โ†’ {i}: {d}")

๐Ÿง  Whatโ€™s happening here?

  • Uses parallel relaxation
  • Similar to Bellman-Ford
  • Stops early if no updates
  • Handles large graphs efficiently

๐Ÿงต Parallel Engine Features

  • Thread pool via std::thread
  • Work partitioning (chunking)
  • Atomic operations for safety
  • Barrier synchronization
  • Lock-based + lock-free hybrid design

โšก Performance

PARAGON achieves:

  • ๐Ÿš€ Significant speedup on multicore CPUs
  • โšก Efficient memory access patterns
  • ๐Ÿง  Cache-aware adjacency traversal

๐Ÿง‘โ€๐Ÿ’ป Development

Build locally

pip install -e .

Build wheel

python -m build

Run examples (C++)

cmake -B build
cmake --build build
./build/example_bfs

Known Issues

MinGW + Python 3.13

You may see errors like:

undefined reference to Py_DecRefShared

Fix:

  • Use MSVC
  • OR use Python โ‰ค 3.11

๐Ÿ› ๏ธ Future Improvements

  • Prebuilt wheels (no compilation needed)
  • GPU support (CUDA / OpenMP)
  • Distributed graph processing
  • Graph streaming support

๐Ÿค Contributing

PRs welcome!

Suggested areas:

  • New algorithms (e.g., SCC, MST)
  • Performance optimizations
  • Python API improvements

๐Ÿ“œ License

MIT License

๐Ÿ‘ค Author

Saket Jha

โญ Final Note

PARAGON is not just a library โ€” itโ€™s a systems + algorithms project combining:

  • Parallel computing
  • Graph theory
  • High-performance engineering

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

paragon_engine-0.1.1.tar.gz (35.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

paragon_engine-0.1.1-cp311-cp311-win_amd64.whl (119.1 kB view details)

Uploaded CPython 3.11Windows x86-64

File details

Details for the file paragon_engine-0.1.1.tar.gz.

File metadata

  • Download URL: paragon_engine-0.1.1.tar.gz
  • Upload date:
  • Size: 35.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.1

File hashes

Hashes for paragon_engine-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fdd2c2727b459450835610a1246bf83addf58cf0597c4d94d28a6dce6965b281
MD5 690ca03f2a1322c2cb1fc10b70c48f5f
BLAKE2b-256 6a21a72629c1ad41663dbd7c15fdab56496db2cb62b69a694f807901991c5e6e

See more details on using hashes here.

File details

Details for the file paragon_engine-0.1.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for paragon_engine-0.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 679c6928c0a522035c667f2978aa748ae146c74ae518495a71bcde5bac1a36b7
MD5 3458704be74303c4b7a978d755e8030d
BLAKE2b-256 93f65fd103f919a0c8537eb0dcbf049445c9c2c4f0d1cbc60d7a3e4c7cfcad16

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page