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.2.tar.gz (140.5 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.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (325.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

netgraph_core-0.2.2-cp313-cp313-macosx_10_13_universal2.whl (538.1 kB view details)

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

netgraph_core-0.2.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (323.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

netgraph_core-0.2.2-cp312-cp312-macosx_10_13_universal2.whl (538.0 kB view details)

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

netgraph_core-0.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (323.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

netgraph_core-0.2.2-cp311-cp311-macosx_10_9_universal2.whl (529.0 kB view details)

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

netgraph_core-0.2.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (323.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

netgraph_core-0.2.2-cp310-cp310-macosx_10_9_universal2.whl (525.9 kB view details)

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

netgraph_core-0.2.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (323.4 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

netgraph_core-0.2.2-cp39-cp39-macosx_10_9_universal2.whl (526.1 kB view details)

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

File details

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

File metadata

  • Download URL: netgraph_core-0.2.2.tar.gz
  • Upload date:
  • Size: 140.5 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.2.tar.gz
Algorithm Hash digest
SHA256 a1fcde2c511f615058f1ec73f7b0ac62754ae6f3fd8bb3dea7dda996002640ef
MD5 71bab3ff02cc6b977d135a03670c58eb
BLAKE2b-256 62c5864ef557027a488c7432c0c47faddd56c7668acb28b51029cbd1926f86ba

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.2.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 82512be1503264f5472237089b87617aa848e1aa57ac71bcb379dadaadae4b53
MD5 9367f772c0ce5b6dbb10a9c3e63c439e
BLAKE2b-256 12857b2c6b7692335ccd2b602f7f6d107a5a869b18e35f111ef99030d5f76cdf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.2.2-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 b017d095327db0ed062ea1bca0edad4beef05af5a73eee2a68e92a5a87d7cd9d
MD5 ba1ff41558c32bc8f3299f4fc560ab30
BLAKE2b-256 660794e40d53d678346b462091607ebe66dbea093367941f71ccfbbbc980b386

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.2.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0b94ce771bd92126cae40509cf58b477903f80dfa13c76739582ed8f30e9f297
MD5 87cb234223de2e9a9fd2171561befb9d
BLAKE2b-256 afa42a128defed6b6feaebc959430e378e77ecc4726c3d8481063122c22c8ac2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.2.2-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 47e6f712fe5e8cf91f33fbe2c9c24bae2ecd1e33e44a18dd2ccd2ceae67e5954
MD5 749a55d3872933b27d72c2aa0791fc2b
BLAKE2b-256 59762dfb60a9cac1c17e405539bff8666fbe84aa83f4e1af119e95e84670c076

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b3628f2db1698313569b59cef0fe33650e294d80b7b52d98ff5f1a0470f333ef
MD5 4cc40119c586d0f67718df4c96157ec0
BLAKE2b-256 fea650be520387a57dce2c33a12408d77c03fbe74695b086cf77b3065d2e4ad8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.2.2-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 882b886f55a14591a0dbb429329e59cb3b346bb47b7b2a498a2c9bafee285d0a
MD5 533bc1774baf9e16024ae8670cfc5a2a
BLAKE2b-256 fab284ed23fbd12c9f4421b5d69f4cc05c37ff971d78ef591c05bc0819e26d63

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.2.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 57c6e907c16a82761e3b32bc794e63308adbf6b002c3479945aa27e4b990a40a
MD5 eba6711cde919f240545210d2e32728d
BLAKE2b-256 183292c3ff32d70c4f8509c2e677fe106468ac36badcbe4a7ddc8b46473769dc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.2.2-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 9ac6483d671133b48ce4a85102ea895990f0b9d172720e8236872e02a1923514
MD5 3202939fdeaaeab1846536a7facb0fe7
BLAKE2b-256 6f57e16497c00ef9658d5721fb9d05930cb6f505a1378f7445d64f3f6a098ca6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.2.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3bd463c9a4c16bce11dfc467765035fb574d74f8cedf4b869cf3c43a6b7e6cf6
MD5 ca3fb42de4d69ecaa3107e04c344c1e4
BLAKE2b-256 e6f92019e6b13e506960ed16f71afcfab5fbe4dbef9cd1e00a2581e418ca9670

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.2.2-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 6e93e76ec4cd8fabcc374321962c301f652de30c0de9865e0a114cb788465b60
MD5 8a1f2a6d7290864f0ba65f8076aa943b
BLAKE2b-256 a29216a2f7dc6634d272cfff0bfc5f1b7d26d3788d6f7a696388bd282d8dafca

See more details on using hashes here.

Provenance

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