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

MIT License

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.7.0.tar.gz (152.6 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.7.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (437.4 kB view details)

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

netgraph_core-0.7.0-cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (409.5 kB view details)

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

netgraph_core-0.7.0-cp314-cp314t-macosx_10_15_universal2.whl (588.9 kB view details)

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

netgraph_core-0.7.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (439.5 kB view details)

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

netgraph_core-0.7.0-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (416.1 kB view details)

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

netgraph_core-0.7.0-cp314-cp314-macosx_10_15_universal2.whl (556.4 kB view details)

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

netgraph_core-0.7.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (438.5 kB view details)

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

netgraph_core-0.7.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (413.9 kB view details)

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

netgraph_core-0.7.0-cp313-cp313-macosx_10_13_universal2.whl (555.4 kB view details)

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

netgraph_core-0.7.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (438.7 kB view details)

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

netgraph_core-0.7.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (413.9 kB view details)

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

netgraph_core-0.7.0-cp312-cp312-macosx_10_13_universal2.whl (555.3 kB view details)

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

netgraph_core-0.7.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (433.9 kB view details)

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

netgraph_core-0.7.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (410.6 kB view details)

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

netgraph_core-0.7.0-cp311-cp311-macosx_10_9_universal2.whl (548.8 kB view details)

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

File details

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

File metadata

  • Download URL: netgraph_core-0.7.0.tar.gz
  • Upload date:
  • Size: 152.6 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.7.0.tar.gz
Algorithm Hash digest
SHA256 a8c97062ecea73508ccca648f5aea797aa321a65886c4b9ae91c71d46860fb3c
MD5 da464dbb0cd1cbb3fb651ff477d2df96
BLAKE2b-256 b94460eb7adbe081f7e28ee196a83ce020f9e337a68c035f799da95a50590b9e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.7.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 716511e6532169b356b52ba79d8cd6af8f44b11c65a2e2f0972eba22dd1eaf71
MD5 8ddb3e7710ee36afe5118f6cc80e213f
BLAKE2b-256 8f70c6f160e16191ce2cdc5911f997056286b3f328c265c4a09f42f1b5563b70

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.7.0-cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c1a370c127f2602743eb2c243ed2a8e11cda74a811bc35ea12416c2973687336
MD5 4fd30f7709d32ac4a3ef99a52fac4bd6
BLAKE2b-256 923ef7fa7128493fe494b3c2452337e4476d2c634ba173954ddb8f17aab0af5f

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.7.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.7.0-cp314-cp314t-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.7.0-cp314-cp314t-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 d35f41030173aae681246b37e0136ef6593c18c7c5243b154eb9c12fb2f57532
MD5 1743ac199ccf8e7630bcdabd6cc99b8e
BLAKE2b-256 a4c0ff64114b718e115b5607efadd2ebbc6fd665362faeebf9289a7f91659f01

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.7.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c7ec54e63ec55c358f46d3b201aabfda788c91fd818e30b7c4121e02051a1382
MD5 c3916a99e1c3b127cee32d979d939fbf
BLAKE2b-256 e43ee6e93045e3542e5744d08086e97d03b53a6128132d4127eaa020a9a6c339

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.7.0-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d2034b2750c12148c7e94dc21bfec92ab9ab71f56899641f9afc9a0a77b5723f
MD5 0bdbb68d67281953dbdc642654596ad0
BLAKE2b-256 aa131ba848d2dab1ebddc4401c1f4afbddb5cf1fd97a3c0d42513036951c70d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.7.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.7.0-cp314-cp314-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.7.0-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 4e0b633af817123d5ed0405e946f637d17efea7e5a903416fa80bdc4a1410802
MD5 43da5cc4dd52ceb4978deff989ba87ea
BLAKE2b-256 486dabc0cc416a953a6ab0a78298d36ec0ee3f0da96e2811751609384eebd742

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.7.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.7.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for netgraph_core-0.7.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ce837d4dc33f73d059894c6f35302670df332e809b08025c946ed337a81574cf
MD5 91691cf7a7306e4d3f547100a38227bc
BLAKE2b-256 3db576aeea399a111e346ba20f22fee0fbf6634710ec3ff7e5747524f65ff1b8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.7.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2af40d64f130952d5db5cf367dba3df2feeaf34237884ef4fe1a5892909616ee
MD5 4fdb6dd9f2fd97bd46b21235f686914c
BLAKE2b-256 5bb9fde74cfe12005a27025ed3d32eaad73821fe253413901f26d04237bd45a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.7.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.7.0-cp313-cp313-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.7.0-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 9932ec4aa2d16bbccc589dd69eaa991cd36b5a375856f7748fba42de0eb11419
MD5 7c610a064f28f609bfee94a3ce2f0d42
BLAKE2b-256 cfdfe2cb5c1392e761b4023e103e1795f998e1be2a9acc4e6044f8bd2acfcfb6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.7.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 94fe4cbdd9a7f892303016346e5d79b047637b6fe43d9c93aa81379499a5ae71
MD5 79b661e327afc2fa72fba8685488882e
BLAKE2b-256 4c2143af4ecbadca10f243100faedae79f86dce7729170af76b765d84042b9dd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.7.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e1e59f79265276059c91cca0fdbea106a375ab083a91807a4831139251d50647
MD5 743c934f203cc7b058b968a3c62d65e8
BLAKE2b-256 f209f94123c27d66e088dbcb266ad62442be774e76ac8ef984c84d459d5fe809

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.7.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.7.0-cp312-cp312-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.7.0-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 7bed431610d0453231ae1f8c85a3e33e7a25106c4683fb08b63eb9beb941dd22
MD5 617ff99b2799425837563873c067b53e
BLAKE2b-256 6e4e48491affcd197dc4b9ee8675503ffc91e1ee24707cf61cbe99acc5056ccd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.7.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8c4c68721b603d032ec4b22a590e12ccd9826f29eda85f62eabebfc5f53b1811
MD5 21a64b50c0ef3a1a41a68152c6209822
BLAKE2b-256 5b6da36112e2a662cef560f499ff127206812569a2ae6a90591cf5e60d2c4a76

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.7.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b341e3091e0413d4fbf2ef2636a35959fa8a507fafa91975e108e6b4b7a8e0b0
MD5 ffb5d79e78db5d80ba73bad52637a704
BLAKE2b-256 6022e3b1abb4a0554fd5d3fc05029991c210e333ecca0ec68f0d2fd918da20fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.7.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.7.0-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.7.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 8f5115c9f754c2f7ab673140783998d3295e64f068a70674e99122ed92d44009
MD5 768da9b8357446f4d9401e1265dc5f1e
BLAKE2b-256 38e1331f86dacf320004ae02e885482c7226209d9c3185cc8a9d1919d32a1147

See more details on using hashes here.

Provenance

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