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.0.tar.gz (160.8 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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0.tar.gz.

File metadata

  • Download URL: netgraph_core-0.4.0.tar.gz
  • Upload date:
  • Size: 160.8 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.0.tar.gz
Algorithm Hash digest
SHA256 99d1b518a1e92e0ae5730bfd83e863b60e94c75ad155a66d2eb792dae10447e3
MD5 4b0abeb6b81bd4904942e5f40189cf82
BLAKE2b-256 29cc0a3e97212bae58f6e2ed893b94628f65f8bd4be00d8289baf714b5ccd11b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5d04ef9ac4c749549a4b60c5723e8e0415c68c408c5e096952c5780dc6e5652a
MD5 b6fb30a5cbc62ba3c00d5c089bdbc425
BLAKE2b-256 2638c5b1dd8493933d9bb466b9ea79687140c5f442bc17b8f673ee4aed7140ab

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.0-cp314-cp314t-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 c4dd68881ccd12a0ee8817a66bfab6ac53020c3227a69af8f27685f52c6bb15d
MD5 ebf26378c688a168fb0e816e0692f80b
BLAKE2b-256 7287a668e76aac2f3523903cb6e2a107a3fa5cf66305be43d8e509fd52a5b5d9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4cc5a9f142b57d2bace52db40f18ffe9448e0ae5127faadb5e3026565f744375
MD5 bbc67fdf770b06572d5f64bd6cd16dc3
BLAKE2b-256 43fda094f066c28089930b038031cae4b194ac9a2ce0e847187399abdf07cff6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.0-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 9745eeee801b3700588907f785912ca8d924799e3b86507a81ec5b3edc0a40f0
MD5 fe70243bb0cd26926862a97176996c06
BLAKE2b-256 e4709ab979764d5ab5097d268cdb8009dd0d921b2108f06332e87a018fee5433

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 32da4c82876047d9b4e31b4fdd70edb70bb3e0a33c6c36f5881f12451b2b3d99
MD5 223719f42c0b96fd04baa4cfcb685896
BLAKE2b-256 51b53f45321533b4e4d927211c069372b7a5afc3c85c2b2c16972c3d1a90a4a6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.0-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 928e75e80e233537fb0c2c3bc6e9e4dc42f460bdca6aaecb849cd01fa1f800f3
MD5 c77114a9c51cf19e451a9b53dadd0498
BLAKE2b-256 dabb651a50786ce56cba01c3393e0308dae32e15ee60f8309164a74d5f16e608

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2925b244e0cf2dfefa609886ccb44cc906bb6f8ae02b7be476ff0134607871aa
MD5 41759a03f6cd095be069621d89eba93a
BLAKE2b-256 e344d0ae7c6db97c7ab7b5e84dfe1be7b6b81c6571b9bc8b74490dbaa5318573

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.0-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 180075984cc6e6f8f9d27c7bf42039205b723097443f6a528046389e317da2d0
MD5 5261648d0b31291dff542d54ab20680f
BLAKE2b-256 82e45ef3a59c687338a6ffafc7d9df0cc8a9fb5188c3a70649284fb2d96b33bd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b6d7485eddfe2cf86668311bf145fe9a60730e6fd69866cf33118d8860b09bb4
MD5 42d3bbc1d6083dab2bf4ca816adba09b
BLAKE2b-256 15db95ea907901c35987ac9cbf2676ab7a7e69ed97cc1f38f326796e45d9423e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for netgraph_core-0.4.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 60408c253d6f163cb124ec3d8ededce2765f7e8eac3b286431f3a3a7af5d2c13
MD5 74881d07ec227dc6fe72bf10680b919c
BLAKE2b-256 b9340fe868c3cf00f5560abdb0a3f13ce998e7c2e1b45cee58bd0b6669bea061

See more details on using hashes here.

Provenance

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