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.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.3.0.tar.gz (141.0 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.3.0-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.3.0-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.3.0-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.3.0-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.3.0-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.3.0-cp311-cp311-macosx_10_9_universal2.whl (528.2 kB view details)

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

File details

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

File metadata

  • Download URL: netgraph_core-0.3.0.tar.gz
  • Upload date:
  • Size: 141.0 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.3.0.tar.gz
Algorithm Hash digest
SHA256 0a66596246cf9f2b3676974468fb681f563fa6f31a9d3d01dadbee654376e763
MD5 7506e9564bb981efc9fc1beb903117fb
BLAKE2b-256 6377497bf042fd3bf4b4a3f3c5562fb890aca6a594893a5a798321d38d19e036

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ce5ff309198081ddf43994c8e85a62ae70b8e27ae89901129537c79b71f42ebb
MD5 5053d959d2dd6020aec82e945c701d99
BLAKE2b-256 05999648c0a0760bd9d4ca432077b0a621ac0a7321ab0c15d0022583ce587131

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.3.0-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 5308f03bcea3af5b70c7c481c6ccaea15e0ffc58414613b8413fb59c29c82091
MD5 4761e244921ab8ec4fb8ede2d0ccd230
BLAKE2b-256 f4d6ab5ead7dfeab0e39b24f593a24024587ccf8b2ff3176e8f93f91c40d9745

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4c8e14ade3c54e8955d5bac2fb1938823a76460c4428d85b01c646d9f707a6e5
MD5 34eba5ee991adf8291de1d9b9f6e9921
BLAKE2b-256 54150f65b7dafbbb8f9c0581a1b6d0a22089be09155143b81b10a467c27f8c09

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.3.0-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 2bdec11d29705ed7821baa2d6c330a668ca9e487793f946653cdc3c7b81d89ae
MD5 1a810ee290d8fb88d41b6b7958293878
BLAKE2b-256 1f74cbe65ef4a4b2106d08892feca3a8d5aec9c4ae2134e1c0463ff88a29721a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9a4d7538de802cdf0b91bccfc8fa81f39f157a93adc77c1ea326a730a5fb5c4e
MD5 74a585c813dd8a8df385c0360daa4bea
BLAKE2b-256 6ad71321d70fc9b9cf52e8ab88b75f32cee813ba2dc57b3c29812b87436abe7f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.3.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 3cf3618b5a90b7e03284bfbecf379993a0667d3148556f3cd4f5b4b02c4c1d92
MD5 b8aa7ad98de93fbd65710235005ea257
BLAKE2b-256 32ba6cce70b7948179a247c3b0a171c0034c535c9dd139e6a259f81f09f594b3

See more details on using hashes here.

Provenance

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