Skip to main content

C++ implementation of graph algorithms for network flow analysis and traffic engineering with Python bindings

Project description

NetGraph-Core

C++ graph engine for network flow analysis, traffic engineering simulation, and capacity planning.

Overview

NetGraph-Core provides a specialized graph implementation for networking problems. Key design priorities:

  • Determinism: Guaranteed reproducible edge ordering by (cost, src, dst).
  • Flow Modeling: Native support for multi-commodity flow state, residual tracking, and ECMP/WCMP placement.
  • Performance: Immutable CSR (Compressed Sparse Row) adjacency and zero-copy NumPy views.

Core Features

1. Graph Representations

  • StrictMultiDiGraph: Immutable directed multigraph using CSR adjacency. Supports parallel edges (multi-graph), essential for network topologies.
  • FlowGraph: Topology overlay managing mutable flow state, per-flow edge allocations, and residual capacities.

2. Network Algorithms

  • Shortest Paths (SPF):

    • Modified Dijkstra returns a Predecessor DAG to capture all equal-cost paths.
    • Supports ECMP (Equal-Cost Multi-Path) routing.
    • Features node/edge masking and residual-aware tie-breaking.
  • K-Shortest Paths (KSP):

    • Yen's algorithm returning DAG-wrapped paths.
    • Configurable constraints on cost factors (e.g., paths within 1.5x of optimal).
  • Max-Flow:

    • Algorithm: Iterative augmentation using Successive Shortest Path on residual graphs, pushing flow across full ECMP/WCMP DAGs at each step.
    • Traffic Engineering (TE) Mode: Routing adapts to residual capacity (progressive fill).
    • IP Routing Mode: Cost-only routing (ECMP/WCMP) ignoring capacity constraints.
  • Analysis:

    • Sensitivity Analysis: Identifies bottleneck edges where capacity relaxation increases total flow. Supports shortest_path mode to analyze only edges used under ECMP routing (IP/IGP networks) vs. full max-flow (SDN/TE networks).
    • Min-Cut: Computes minimum cuts on residual graphs.

3. Flow Policy Engine

Unified configuration object (FlowPolicy) that models diverse routing behaviors:

  • Modeling: Unified configuration for IP Routing (static costs) and Traffic Engineering (dynamic residuals).
  • Placement Strategies:
    • EqualBalanced: ECMP (equal splitting) - equal distribution across next-hops and parallel edges.
    • Proportional: WCMP (weighted splitting) - distribution proportional to residual capacity.
  • Lifecycle Management: Handles demand placement, re-optimization of existing flows, and constraints (path cost, stretch factor, flow counts).

4. Python Integration

  • Zero-Copy: Exposes C++ internal buffers to Python as read-only NumPy arrays (float64/int64).
  • Concurrency: Releases the Python GIL during graph algorithms to enable threading.

Installation

pip install netgraph-core

Or from source:

pip install -e .

Repository Structure

src/                    # C++ implementation
include/netgraph/core/  # Public C++ headers
bindings/python/        # pybind11 bindings
python/netgraph_core/   # Python package
tests/cpp/              # C++ tests (googletest)
tests/py/               # Python tests (pytest)

Development

make dev        # Setup: venv, dependencies, pre-commit hooks
make check      # Run all tests and linting (auto-fix formatting)
make check-ci   # Strict checks without auto-fix (for CI)
make cpp-test   # C++ tests only
make py-test    # Python tests only
make cov        # Coverage report (C++ + Python)

Requirements

  • C++: C++20 compiler (GCC 10+, Clang 12+, MSVC 2019+)
  • Python: 3.9+
  • Build: CMake 3.15+, scikit-build-core
  • Dependencies: pybind11, NumPy

License

AGPL-3.0-or-later

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

netgraph_core-0.2.1.tar.gz (139.2 kB view details)

Uploaded Source

Built Distributions

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

netgraph_core-0.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (324.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

netgraph_core-0.2.1-cp313-cp313-macosx_10_13_universal2.whl (537.9 kB view details)

Uploaded CPython 3.13macOS 10.13+ universal2 (ARM64, x86-64)

netgraph_core-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (323.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

netgraph_core-0.2.1-cp312-cp312-macosx_10_13_universal2.whl (537.8 kB view details)

Uploaded CPython 3.12macOS 10.13+ universal2 (ARM64, x86-64)

netgraph_core-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (323.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

netgraph_core-0.2.1-cp311-cp311-macosx_10_9_universal2.whl (528.9 kB view details)

Uploaded CPython 3.11macOS 10.9+ universal2 (ARM64, x86-64)

netgraph_core-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (323.1 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

netgraph_core-0.2.1-cp310-cp310-macosx_10_9_universal2.whl (525.7 kB view details)

Uploaded CPython 3.10macOS 10.9+ universal2 (ARM64, x86-64)

netgraph_core-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (323.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

netgraph_core-0.2.1-cp39-cp39-macosx_10_9_universal2.whl (525.9 kB view details)

Uploaded CPython 3.9macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file netgraph_core-0.2.1.tar.gz.

File metadata

  • Download URL: netgraph_core-0.2.1.tar.gz
  • Upload date:
  • Size: 139.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for netgraph_core-0.2.1.tar.gz
Algorithm Hash digest
SHA256 7f2ae2559077d98a30d6501c2770e24329eaf4451b854fb5329f7e77b701a54c
MD5 61a071613d7b0f4d607e17ebaa9606ea
BLAKE2b-256 96ce60682bef84582d19180c35bbdbce8ed95769f1f84ee91e646140e7432952

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.1.tar.gz:

Publisher: release.yml on networmix/NetGraph-Core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file netgraph_core-0.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 340b029db1ad2eb5a1374384eed8c46ce1a8ea3a3fdecb180be1bc98dc444584
MD5 7b6928ca4f7dfd0c086ac37d6378a379
BLAKE2b-256 c4e9c5cac978974d062284fb8f434374038c6a7476efd82dec40d0aa5dfb6eb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on networmix/NetGraph-Core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file netgraph_core-0.2.1-cp313-cp313-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.1-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 54789ac6a3a91bab14b07fd8dbacc7564b1121e12424641feb942e243afba1de
MD5 314f76255d931f71d36378847be1443e
BLAKE2b-256 364cf0124ed9915fede8ec6660a71483576c923c0acfe1ec3ecc7706c2c54c5a

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.1-cp313-cp313-macosx_10_13_universal2.whl:

Publisher: release.yml on networmix/NetGraph-Core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file netgraph_core-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a884ccdb72927d3a95db4851b7dd2eca1517d602f2f43770501eddae320c68a4
MD5 624553c79a2b5fb19693755dfbbd547f
BLAKE2b-256 fb403495ce3d0fdf88342c9f7cac6b84444d666fea724a3417760eba214695bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on networmix/NetGraph-Core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file netgraph_core-0.2.1-cp312-cp312-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.1-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 fd0717d38dbb5ab45772c0f87d176eec58c982e47b71f5cd9df6781791b3dcff
MD5 a4ff43c79560ef441102c7ffbfd117be
BLAKE2b-256 6b278e23d3a4299f0b1b086e80e33a80cdef407b9138fa1331e70ea35237853d

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.1-cp312-cp312-macosx_10_13_universal2.whl:

Publisher: release.yml on networmix/NetGraph-Core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file netgraph_core-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6065674bdfaf27b88e7a90d5c772ae99a6bbaf13eb960afff107e689f349ceee
MD5 2f39f5aabb3c6f5c927ee31a056edbfc
BLAKE2b-256 c762282b7ac6b2eaf6e852dd6d697424d4b605c31ca786373d0ec96c9f074c50

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on networmix/NetGraph-Core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file netgraph_core-0.2.1-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 6dbca743c55bc111eee09b97daff82e478bf72e787adbdce501fc57d26128597
MD5 f737fddf7ad3e65f17c48d0a8203b48a
BLAKE2b-256 9db952295c2c24d014fbbaddd4d69ff0f873059f273c1f1f3aef1a854cc8c314

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.1-cp311-cp311-macosx_10_9_universal2.whl:

Publisher: release.yml on networmix/NetGraph-Core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file netgraph_core-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ea60fee5af508cf86982a981fd9ba8989962a6c5c5b0314b5b97675164c281ee
MD5 d9ed8cbe62ddca7d6820f80c1a44da65
BLAKE2b-256 5581531e103c1f7389f3aa45d906b89615f463acf9ccf86c5f186c61895e2212

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on networmix/NetGraph-Core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file netgraph_core-0.2.1-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ab60e8b9338914af7fd5e6fefeb915324d1e3985495f60e3b70bcbc5d593dfe0
MD5 fa2f6b2c7c6dd0bf3845fe816bfa638b
BLAKE2b-256 86a1bf8e9072048a56806421d41e1450b6a5a67c85dfbfa3e943a86960037c81

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.1-cp310-cp310-macosx_10_9_universal2.whl:

Publisher: release.yml on networmix/NetGraph-Core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file netgraph_core-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 40df43838f014c8a840d91dd164286b85c6df4a2227e0c2531050b4e08722f75
MD5 526bf7d28b5fc2a82ee74d6d842b0bc9
BLAKE2b-256 4c8077d55ba9b41d806cee1ee4e8a7cf75db58ce308ca690b3b02067a615ebdf

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on networmix/NetGraph-Core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file netgraph_core-0.2.1-cp39-cp39-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.1-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 6b32ce4e0eb162459f24f713144da4b89131fb78130c5174e7be60eace719316
MD5 6bcd16b2b8f7730a4480acbfc6dd5df9
BLAKE2b-256 42df671ae3ba7682309d069c30bd2b519824c3cfc258f6b8014262c93eff2b76

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.1-cp39-cp39-macosx_10_9_universal2.whl:

Publisher: release.yml on networmix/NetGraph-Core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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