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.3.tar.gz (140.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.2.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (324.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

netgraph_core-0.2.3-cp313-cp313-macosx_10_13_universal2.whl (537.2 kB view details)

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

netgraph_core-0.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (324.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

netgraph_core-0.2.3-cp312-cp312-macosx_10_13_universal2.whl (537.2 kB view details)

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

netgraph_core-0.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (324.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

netgraph_core-0.2.3-cp311-cp311-macosx_10_9_universal2.whl (528.2 kB view details)

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

netgraph_core-0.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (323.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

netgraph_core-0.2.3-cp310-cp310-macosx_10_9_universal2.whl (525.2 kB view details)

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

netgraph_core-0.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (323.6 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

netgraph_core-0.2.3-cp39-cp39-macosx_10_9_universal2.whl (525.4 kB view details)

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

File details

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

File metadata

  • Download URL: netgraph_core-0.2.3.tar.gz
  • Upload date:
  • Size: 140.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.2.3.tar.gz
Algorithm Hash digest
SHA256 9a66f79dc1c28e663fe428b775ad3155b5bbcb14ee9b85f91164d5c146c6f976
MD5 f5027375938d065d96d9d50ed269b0ea
BLAKE2b-256 8195b8217f75b65376db3eaf25a38aef9af5ee8fbc72acf45c90c28823aa35d0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.2.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3dfa5c0ba1c6fbb3253d9f8ed4e9fe8efd47868ec3146f16ddff9ca9c223acc0
MD5 db311f8b6b7008ec5e5d1c8754aa6175
BLAKE2b-256 366a428c52b1405fa722be8bceab11307f9f49b0f32d0e64a27158aff14ddb29

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.2.3-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 ac4732a03cb84d8b40723a4111e6359aad452dcc71717f884b1e77750f72dd6c
MD5 897ee811bf69350ccd7297c04e6122e2
BLAKE2b-256 54f86801d94b9950719fda4fd9b1a64119e373d4d1f57406e9fcc54168341a78

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3a9f12c676dfe2fade5d10250e894d16005eb31d7323b15e44fe69ad4233af67
MD5 1a55e0d71345b687d8c5646ef9e0a251
BLAKE2b-256 f0a6b47cac78d3648dba348ad064f0492df4c5ed904222fda374d9c85ec2fe0d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.2.3-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 6b0ebaf519a384e3c3c59cc72ba3421573dfb880e5af31ee8f229e6d66a45663
MD5 b9f8f706b92aa5389b065c1a298c0945
BLAKE2b-256 c410d8533809ac59d440c9f62945c40c70f12b3e7fae3003b6550ffae2e991ef

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d4d6b51b180155bc00423272f01b94a80c37ecb5eb3cdf50a99b511a8b24bc4c
MD5 db105daf3f14e6c582782b98547adcca
BLAKE2b-256 04cd72eee7f7f1f4188d2833a9c48cf080431306910db385d75633dcc2beb298

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.2.3-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 7b584216d52929f6aeeaca7e819fcf634230469b076d43938615de4a1cebbee5
MD5 a88f999ae28e753136927af2ab538db6
BLAKE2b-256 a81f9d61f305b734344a55852b720b62388b1a14746f7772adf5a90a7824303c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d4383265ee1015886397b9442b94232f57bb914b2435646718b387d94c842b11
MD5 a6405489651dcbc59f4a4044a2e01f3c
BLAKE2b-256 327e5d59e49de36b869ffea2ae61e2bb2607419bdc1690ad45daf26bf23fd69b

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.3-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.3-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.3-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 c3dbff161afb4cbe7c3a387572ba496e4e57a35ea7dc89bba578e8ece22dd977
MD5 8d7e3505908ba8f0e5ef5e6305dcedf3
BLAKE2b-256 3201b722724a7a71f61fe2bf8b851c10c851c528e7c08d12268c77349fa13a9e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9f5598b527b45a42ca599849556f61d9a99b27abc4e1999f7f7df78a5ba524ff
MD5 e2bbdd2bda8361a0fe8a1a52fa7014ae
BLAKE2b-256 ca5fe7fe3321a702461fac11d47212959fab42607ee748010c6c6ad3183ebbe8

See more details on using hashes here.

Provenance

The following attestation bundles were made for netgraph_core-0.2.3-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.3-cp39-cp39-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for netgraph_core-0.2.3-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 49c4557f18e67c11407567a40a3b78fe85a6335ccd67c38f09c762e8dcc2792c
MD5 ac3c016937ca431f8c8bb7a4ea06b690
BLAKE2b-256 8c2c66465c1ec4c5fd5b07a14337ce4c8d042e2acba15ea821bbb5228ca158b1

See more details on using hashes here.

Provenance

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