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 .

Build Optimizations

Default builds include LTO and loop unrolling. For local development:

make install-native   # CPU-specific optimizations (not portable)

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 test       # Python tests with coverage
make cpp-test   # C++ tests only
make cov        # Combined coverage report (C++ + Python)

Requirements

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

License

GPL-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.5.0.tar.gz (161.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.5.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (429.8 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

netgraph_core-0.5.0-cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (406.9 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

netgraph_core-0.5.0-cp314-cp314t-macosx_10_15_universal2.whl (576.9 kB view details)

Uploaded CPython 3.14tmacOS 10.15+ universal2 (ARM64, x86-64)

netgraph_core-0.5.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (432.2 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

netgraph_core-0.5.0-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (413.4 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

netgraph_core-0.5.0-cp314-cp314-macosx_10_15_universal2.whl (545.0 kB view details)

Uploaded CPython 3.14macOS 10.15+ universal2 (ARM64, x86-64)

netgraph_core-0.5.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (431.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

netgraph_core-0.5.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (411.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

netgraph_core-0.5.0-cp313-cp313-macosx_10_13_universal2.whl (543.6 kB view details)

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

netgraph_core-0.5.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (431.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

netgraph_core-0.5.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (411.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

netgraph_core-0.5.0-cp312-cp312-macosx_10_13_universal2.whl (543.5 kB view details)

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

netgraph_core-0.5.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (426.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

netgraph_core-0.5.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (409.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

netgraph_core-0.5.0-cp311-cp311-macosx_10_9_universal2.whl (536.7 kB view details)

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

File details

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

File metadata

  • Download URL: netgraph_core-0.5.0.tar.gz
  • Upload date:
  • Size: 161.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.5.0.tar.gz
Algorithm Hash digest
SHA256 76b608a601721a99fd1e75c089a7024fbc55c5c24612e5a28eb6dc8b8bd4fc67
MD5 e5600ce6c8018d337d48b124b84c76b7
BLAKE2b-256 bde99b068f6a5b8a80686b3c10995b5b96d0707805dbd257603f476af0f75e9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.5.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.5.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for netgraph_core-0.5.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 47534bd2c0b61569ce34eb6ce9b892c9907e7ad48b4c080e7bd623e9ff70db8d
MD5 43bfb81f90cda6dbe2c5e984c7f35ebc
BLAKE2b-256 7a2e0e63b0052e9dbd41268bd2a2fea8a127f75ae209e3075adf774809c860ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.5.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_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.5.0-cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for netgraph_core-0.5.0-cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c86c71273744c0a6201c8fecff0af11498d375d95df0cd5866212e84bf9dae12
MD5 6d07fa1693a222c12405aa6b2acc31a2
BLAKE2b-256 bb80e2257cad20f7165be4719a0a560b69725a3d19fa3de66f8af5b31bebcced

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.5.0-cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.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.5.0-cp314-cp314t-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.5.0-cp314-cp314t-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 c449f494e713a03eba69537cb7e5a7811678fe69dcc80e8147b5f260de5ab435
MD5 cf7bb2e65955c35918723a2a18d405bd
BLAKE2b-256 9a96261e4b81f8f7ccfe7e233b2ec2fa7a9fbdc5dc2f6377988e07293f064e56

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.5.0-cp314-cp314t-macosx_10_15_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.5.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for netgraph_core-0.5.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1c73b72937a313b341d874d0fb29dc1e997e5311013107d7521c6f6ee2ebed0c
MD5 783b27eae88f2d90bf52838dc47be2be
BLAKE2b-256 971831026172f4002cccce6701bba121eb1b78a0a4ce4f53f7faf6168ce5ce87

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.5.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_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.5.0-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for netgraph_core-0.5.0-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1b61feb266517aee31cafea9b4e474c9018dea78b61ee9484720fb64dddf976b
MD5 fb66d7a1c8771f7135bb005deb886039
BLAKE2b-256 d93eff5dd04b131e911cffcceeb1f3fc25c2694efa1845c2db42daa8cc82ec7d

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.5.0-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.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.5.0-cp314-cp314-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.5.0-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 0045b185802ff21ed19c4f5cb9722d7e195ecde5b1dd10ac638827ed757856a2
MD5 21e4e60228c0e199f0bedb12b2307b15
BLAKE2b-256 8fde318b8c253d2d101e4e340c4903316af8cdf0e8b6f28faebbfefd64a66587

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.5.0-cp314-cp314-macosx_10_15_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.5.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for netgraph_core-0.5.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 84831a92d345073c4ae45b2bb22dadd471cda22b1fc1618b3cf8c2d90cfd3ba8
MD5 02a7b6c062aa9b9dd005921fc7a3c3f6
BLAKE2b-256 41827a0c4dd68e32b08f61cf526e14d72840fc5e9a67844dbe7be5a8bc2a4d2d

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.5.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_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.5.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for netgraph_core-0.5.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 56979292696f0e86b8ac7df3f813621cc705cc079688771781d917db189a3da7
MD5 eb05e818366de35331ecb6fba3488549
BLAKE2b-256 5f9654b4b644a2ae3bfb1b32224f28921e01159ba490315e68666f498ed76f90

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.5.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.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.5.0-cp313-cp313-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.5.0-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 512c9e39379d38746070415b0d7f1d773b639b8f3517e2ce4515993b13031957
MD5 6ab8007f04429b98e9e7cf1110dc5e92
BLAKE2b-256 3b97fcaaa994600ef97cd4ea0a89e98966953632a9585148472907d345ed89aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.5.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.5.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for netgraph_core-0.5.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 676c1a37df311c98146340e51ce3b49008a5886e1d90a197ca0eaa8658ca1992
MD5 8bd97732c63c4ceacc592a0572646900
BLAKE2b-256 c98c5f1b4fdbf6aa0c890a9be47eae0c0bad0b6008355e500585c934346cdbed

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.5.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_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.5.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for netgraph_core-0.5.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 82a004abc9aa51225c46677a5d7494e7db6945aa184096fcf1773f34f6d05229
MD5 0ad85313551ba394bd533e2ab7b01142
BLAKE2b-256 9c93e04f90da746d3fcdb5129684c37cb5eb198d4f7dd3485a2ea091966893ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.5.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.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.5.0-cp312-cp312-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.5.0-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 36b826c947ac57426ee3c36d4341530c31d69a2f2447a0a467d507ea5cb99f15
MD5 74ddaa6549bbe5861c9da665a1dd9ac2
BLAKE2b-256 441977f254a5d86777f9c102372c8c9f69adb5b14089f228c525209f65dcc9e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.5.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.5.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for netgraph_core-0.5.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9c57902d58599a04f52f1c4b75e1a72f0210bb35537aa7d4b76abe607281aa2a
MD5 baace7959dc3353d3cd4ff94e5ab5f47
BLAKE2b-256 6bc97b8369982e9ff7554c208c4fb388823814eabe05f3b788c417898b9d1bb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.5.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_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.5.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for netgraph_core-0.5.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 66291c18696e403dd838e412b3112d4af436cbe6c4e9afc00d454655dff35c4c
MD5 dfba6a483c7ec0f7e6dadcb28865d770
BLAKE2b-256 c0f7123ab2311b46304bc45a286776814b11058ccfb225d2b0065226fe03ade7

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.5.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.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.5.0-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.5.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 3d8a2ecb701216c036de55042813a90c96dd971ff0efff7cb8aa372f3c3407d0
MD5 f43465b3c83c02164e8eade5efefd4ff
BLAKE2b-256 a336f819d5ba46ea399a0a648e278f109da04621b20299749f8bcb5e6d6fc608

See more details on using hashes here.

Provenance

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

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