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.0.tar.gz (138.3 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.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (324.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

netgraph_core-0.2.0-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl (340.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ i686

netgraph_core-0.2.0-cp313-cp313-macosx_10_13_universal2.whl (537.5 kB view details)

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

netgraph_core-0.2.0-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.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (340.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ i686

netgraph_core-0.2.0-cp312-cp312-macosx_10_13_universal2.whl (537.5 kB view details)

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

netgraph_core-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (323.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

netgraph_core-0.2.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (339.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ i686

netgraph_core-0.2.0-cp311-cp311-macosx_10_9_universal2.whl (528.5 kB view details)

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

netgraph_core-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (323.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

netgraph_core-0.2.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (338.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ i686

netgraph_core-0.2.0-cp310-cp310-macosx_10_9_universal2.whl (525.3 kB view details)

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

netgraph_core-0.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (323.2 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

netgraph_core-0.2.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl (338.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ i686

netgraph_core-0.2.0-cp39-cp39-macosx_10_9_universal2.whl (525.6 kB view details)

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

File details

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

File metadata

  • Download URL: netgraph_core-0.2.0.tar.gz
  • Upload date:
  • Size: 138.3 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.0.tar.gz
Algorithm Hash digest
SHA256 c37bb6591fa82b3b4d8b24d0a2a725087c5c833d76ff727c16e2d22238030748
MD5 9b4ef24cee1fcd1dbb24813593fcfed4
BLAKE2b-256 53fa01b5f318edbd68ea230900c7423119a5a6689ec6bff4cde8c78dd19109bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.0.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.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 87cb627ee9a93179881755e41ccd98488908cdf1327c62cb5a2ee1d1ecaf6838
MD5 e2cf9961550cbce2d4ce50ac367543e2
BLAKE2b-256 e675941673f8fb75be33f07bb290cabdba81813411338286d4c0105b55ed1a15

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.0-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.0-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.0-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 071402708a98a647c77718f2ead885a55f6fc3296502dfb5c457ebdbf83ef575
MD5 1e22ff2d89c03bc64fa6621c990a877b
BLAKE2b-256 b701a1f8e18e8d95b19d5d46734e519ddf5ad20272b8b3c7ed8eb2714731ac84

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.0-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.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.0-cp313-cp313-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.0-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 d46c1facac50b61ea60ea944794250257b3d0e5571f5875c97149a6bb1519727
MD5 e0e39f7b894eea868b99cd0f7a520789
BLAKE2b-256 7c287f84ce61272d321acc435f5c0923339d2569c958c9615e5a9dc9f4c864e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.0-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.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c399d2e048f2642149c4a1f7822b42377c86d140517a843d55b63dcc0aab8200
MD5 d73f84e067ab0a9c24b28149347bc6fb
BLAKE2b-256 3073ccb5f2ce600670cbbb4e0d8985670dcf36777cc300e22dc7827237ba278b

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.0-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.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 9a7af9693a77f13c21934bd701fb8d9671dd093f8a0d241771ec75663afe7d76
MD5 6169ec93442183245cd569894e6b9279
BLAKE2b-256 c8c65f17a1f09ff4fefebc0b41aee3e6d4ff33501163bbe7410eaf6a1bd0f5f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.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.0-cp312-cp312-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.0-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 afd418e96c8aabec020e909371cb0f02b6b6d87aaee9c740363137b67fc18453
MD5 0e10c2f2f828e98c16789357730b0234
BLAKE2b-256 51b667239bbe2ef508348f4693fdb3d8cd1faa16e5fe0e331941bb8371250ed5

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.0-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.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d417403043f784458ac553239dd6e9a262c14f3b55c3828759616215a0223c52
MD5 a403d6f2d6c5588e3101009533ed3fdd
BLAKE2b-256 c62a7a2339f16f45b109c3a7bf10e1c0b1313deb9b510ae19482ef8fe8b6f50c

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.0-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.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 cc47e732b6a213a400cf7554d8568cba7bdda0442545fe9619b034fd60427026
MD5 cdabc2f12064e52cd57991cf0b187d93
BLAKE2b-256 ece359efc306291d6b4a7afbb80e7b49c1f590ed2f8d7ec2e5b328931bedff3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.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.0-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 64a1d37780795b8f43c19a548565dcb9c1f8341d017a4b4ba95ebe3873fcd2a0
MD5 b1df6852aee00a8c1ba8f5e2241a1213
BLAKE2b-256 690dc2f3d592acd517608cc14361016e80b686b7427bd69c5c154c28f2f641ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.0-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.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 64469a96d48383fd8582f1d345b201614eb9d1e52d78cb5f00848fd8fdc62438
MD5 600268a31a64d75033c3d01abd780272
BLAKE2b-256 f0535574a67f194c5cb34afba4e6cb7204917874571b177b9f21ac6fc00eaaad

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.0-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.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 91fab95ea94b53432157756b0763c715c1bf754ec2bc7d906582bee121441004
MD5 175c8b3c26212752e8548c8247e5458f
BLAKE2b-256 12bc3f3652d5898607e9ffd61434445744d4633ec38a93aaef4b1b0100cc1378

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.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.0-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 c89ca885f223cf9b316b41aea23281f21d221a1c2e442e2e336ab10b1350704a
MD5 c6cfd28bd580734c16dbf3a66db72b99
BLAKE2b-256 2765ffd5a77fa698ff6f011270f258517566e800e29ee91b21054281003750c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.0-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.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6378cc8a2a04e944baaabfda1d166c365526a51518c4323364347d02fb99c458
MD5 150896d8c81ae8feeb2b761f971f6148
BLAKE2b-256 8ddf64fd53a77866f48357e7e3ee486423842d5e8b7a141490549041324e912f

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.0-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.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 96cb1da9dc3767558195c394e7f7d0a56da96db2a9378e3d77ac52fdc43b96d2
MD5 d0bdf86b7c7ce1a3365037fd1e776a78
BLAKE2b-256 7c470167f04050158fbe7f325f47ce17dc3fa73613f561f99511acb22997daac

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.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.0-cp39-cp39-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.0-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 4c00c3e788286190a571f0344366a2348ba03a111c0abbe35d4e9e9c5194ce82
MD5 9e16a863b45a9761609b219f45500673
BLAKE2b-256 dd09df9241800036eecd7180a3d20c355dfea214a80dce19e3f58a84fcdd4676

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.0-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