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

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.4.1.tar.gz (160.9 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.4.1-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (429.4 kB view details)

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

netgraph_core-0.4.1-cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (406.6 kB view details)

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

netgraph_core-0.4.1-cp314-cp314t-macosx_10_15_universal2.whl (576.5 kB view details)

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

netgraph_core-0.4.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (431.9 kB view details)

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

netgraph_core-0.4.1-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (413.0 kB view details)

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

netgraph_core-0.4.1-cp314-cp314-macosx_10_15_universal2.whl (544.6 kB view details)

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

netgraph_core-0.4.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (431.2 kB view details)

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

netgraph_core-0.4.1-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (410.7 kB view details)

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

netgraph_core-0.4.1-cp313-cp313-macosx_10_13_universal2.whl (543.3 kB view details)

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

netgraph_core-0.4.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (431.2 kB view details)

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

netgraph_core-0.4.1-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (410.6 kB view details)

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

netgraph_core-0.4.1-cp312-cp312-macosx_10_13_universal2.whl (543.2 kB view details)

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

netgraph_core-0.4.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (425.9 kB view details)

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

netgraph_core-0.4.1-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (408.9 kB view details)

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

netgraph_core-0.4.1-cp311-cp311-macosx_10_9_universal2.whl (536.3 kB view details)

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

File details

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

File metadata

  • Download URL: netgraph_core-0.4.1.tar.gz
  • Upload date:
  • Size: 160.9 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.4.1.tar.gz
Algorithm Hash digest
SHA256 35e0239e726c4a0101fb634583beae5ee9a72814c164be176eb6c1f9234e6a09
MD5 a0d120d30204f259d0ae3113dd7129b6
BLAKE2b-256 92c077e895bfb56ebdb0dbfadeb0f2b5d91d72a1d7dcc0e6d2cf251cf7e09b9c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.1-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 77608b08af76c7aa050ba0bbadeb8be23bbb72ee5b2dd96b1c6a8889a7a56c1e
MD5 83e080baf0ed674785784eaac7c4dd53
BLAKE2b-256 5cff2eec753a9b0e38c1f0da16a8b3851975c5c78a7789b2b8b9c848eeb8e809

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.1-cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 bccf84b02b8a2e6dadfea34612a0976142759434a993055efe48070649bc015b
MD5 7e213bb380ece6e8f4667d22fa010a48
BLAKE2b-256 391cb730a8c1803e0b31252f7872e594aaf3ae4173e3bf6c3dfc511295b54486

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.1-cp314-cp314t-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 0ef034a8f28a6be662e073e7766cde937df05821b31354bb19f32bf56f322671
MD5 949816b715a77994a83d82909beb1017
BLAKE2b-256 6dc8b6f0c31028dec5d5dc8154436b0369d00816998d9487c0ad54d4eaa7150a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8ded54e5d602c9c21be5bd8b9b289b35a00f6bdd7cd03bbd154eea15b957ed7d
MD5 2d1ceb06227c6640200ab530d255315c
BLAKE2b-256 175b40d766627828e449b226d3f49267e554409535ba6c315be00da991d45de4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.1-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 518872b7fc24e34df68ea309d76a1ee549bc9aef0ebf94ddac641fdfea777068
MD5 c502ceddf6ae15c4b221c51264055585
BLAKE2b-256 c5e8457a088e46c22fca7b4525999ba416da1a8196597ccd8caa837c6c0cfe08

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.1-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 944599b78299ec7d7a82cf4e039cc804e9b2225e438ecc99d8dba88a109f47fa
MD5 88f226c2c63272694952dbd3fcb31114
BLAKE2b-256 25cf19e7a29d66a843b1d87fb204ade2f31806963d7f81cdcf230341c509fa52

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2f487623d7a2f7a4e0a90ec1198b3e54f4ecedc290f5a8ed9df377c6662b76d5
MD5 4157da1425d07e39bd3986189931081b
BLAKE2b-256 f6679b77cddfc30bb7d6828345ef27cfc6c7eb3c9bde5ad587f9fdc623a7fd55

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.1-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 31b0cba35b649bd9a8333bb333a3e996430de197db9cae8a3ae08498597380e0
MD5 d833a7ea48dc40dd2f3b20cf8939eb9d
BLAKE2b-256 e5b2a00d87f65e75933405bab9957d4c093d33e1d8e9bfaaf37996503017196d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.1-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 f823c29cbcebd8d430b8804a18adcceec99fba92e63254a75cfd13938b254eaa
MD5 b45b18097ed4343812bf3aa183897e95
BLAKE2b-256 f3fc18e38171aba96abbcf9f36b172aacd54d554c859726f6ba5a359ba79b6eb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 94fb7a5c3a674dbe79e2db7b0bb279161906eed0724e670153237b4bf63b8bec
MD5 660810a069deb71b8fd46c103da3656c
BLAKE2b-256 922c1406bd1fe975deadb59957c90fb7729a0c93385babbe1f566699159c9eea

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.1-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c66f776cbe699e471e09131c37c9ee236eaf696c310de8d35ad07e97b468d8bd
MD5 a7b5dcb4a79cbdcb6e9a86f04603d1dc
BLAKE2b-256 136039a136360d74c5ac461dda8404b1bf805810a933e8f0f5c348e7b1139717

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.1-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 eafc30baf639d7e73b92d44ed7bb4883426f21ab51ff8bd183a9561cc8aaee59
MD5 2f1c21fb5cc1ed147b7c2399f51ab832
BLAKE2b-256 ddc6b26a6f5c45077a77c16e813b5c326e5cb674fed1ed08b6eafde8c36cf9fa

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ceb5fdd9091ed30c37b9ed760667ec0a9b5f062ea646dc3934051fa60ebe5277
MD5 7ac6bde9bdbc8f6f136ad33654b53bf8
BLAKE2b-256 be65d82c082410ba365954aef2f4b091813fc34fc17c25e8fb6ebd6ad6c7b003

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.1-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 61986bae7cd4e8da9d88f6c83de0a174016d6639f6fa922f967a411c7419ebb0
MD5 5bd496313e50e833d274b3ce008883c2
BLAKE2b-256 886e0bdc71cd631abaf13fcdb8e0a5294ae2388908a1ca44a2d458e048a5dbda

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 fc893a7bb6f669a8dbacf759c3cd7e9491fb78e98bf49ed6719201294dac4d7e
MD5 16ac52304b0e6968b8292260cb7adfca
BLAKE2b-256 f6cdafc53bcf32d660acb24ce4567d063318783d799245e8cd23c0546d993c41

See more details on using hashes here.

Provenance

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

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