Skip to content

Commit b391fda

Browse files
committed
Refine README
1 parent 3fa3dc0 commit b391fda

2 files changed

Lines changed: 98 additions & 12 deletions

File tree

README.md

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22

33
[![Python-test](https://github.com/networmix/NetGraph/actions/workflows/python-test.yml/badge.svg?branch=main)](https://github.com/networmix/NetGraph/actions/workflows/python-test.yml)
44

5-
Scenario-driven network modeling and analysis framework combining Python's flexibility with high-performance C++ algorithms.
5+
Scenario-driven network modeling and analysis framework combining Python with C++ graph algorithms.
66

77
## Overview
88

9-
NetGraph enables declarative modeling of network topologies, traffic matrices, and failure scenarios. It delegates computationally intensive graph algorithms to [NetGraph-Core](https://github.com/networmix/NetGraph-Core) while providing a rich Python API and CLI for orchestration.
9+
NetGraph enables declarative modeling of network topologies, traffic matrices, and failure scenarios. It delegates computationally intensive graph algorithms to [NetGraph-Core](https://github.com/networmix/NetGraph-Core) while providing a Python API and CLI for orchestration.
1010

1111
## Architecture
1212

1313
NetGraph employs a **hybrid Python+C++ architecture**:
1414

1515
- **Python layer (NetGraph)**: Scenario DSL parsing, workflow orchestration, result aggregation, and high-level APIs.
16-
- **C++ layer (NetGraph-Core)**: Performance-critical graph algorithms (SPF, KSP, Max-Flow) executing in optimized C++ with the GIL released.
16+
- **C++ layer (NetGraph-Core)**: Graph algorithms (SPF, KSP, Max-Flow) executing in C++ with the GIL released.
1717

1818
## Key Features
1919

2020
### 1. Modeling & DSL
2121

2222
- **Declarative Scenarios**: Define topology, traffic, and workflows in validated YAML.
2323
- **Blueprints**: Reusable topology templates (e.g., Clos fabrics, regions) with parameterized expansion.
24-
- **Strict Multigraph**: Deterministic graph representation with stable edge IDs.
24+
- **Directed Multigraph**: Deterministic graph representation with stable edge IDs.
2525

2626
### 2. Failure Analysis
2727

@@ -31,15 +31,15 @@ NetGraph employs a **hybrid Python+C++ architecture**:
3131

3232
### 3. Traffic Engineering
3333

34-
- **Routing Modes**: Unified modeling of **IP Routing** (static costs, oblivious to congestion) and **Traffic Engineering** (dynamic residuals, congestion-aware).
34+
- **Routing Modes**: Cost-based routing (shortest paths, ignores capacity) and capacity-aware routing (considers residual capacity).
3535
- **Flow Placement**: Strategies for **ECMP** (Equal-Cost Multi-Path) and **WCMP** (Weighted Cost Multi-Path).
3636
- **Capacity Analysis**: Compute max-flow envelopes and demand allocation with configurable placement policies.
3737

3838
### 4. Workflow & Integration
3939

4040
- **Structured Results**: Export analysis artifacts to JSON for downstream processing.
41-
- **CLI**: Comprehensive command-line interface for validation and execution.
42-
- **Python API**: Full programmatic access to all modeling and solving capabilities.
41+
- **CLI**: Command-line interface for validation and execution.
42+
- **Python API**: Programmatic access to modeling and analysis capabilities.
4343

4444
## Installation
4545

@@ -64,10 +64,10 @@ make check # Run full test suite
6464

6565
```bash
6666
# Validate and inspect a scenario
67-
ngraph inspect scenarios/backbone_clos.yml --detail
67+
ngraph inspect scenarios/readme_example.yml --detail
6868

6969
# Run analysis workflow
70-
ngraph run scenarios/backbone_clos.yml --results clos.results.json
70+
ngraph run scenarios/readme_example.yml --results example.results.json
7171
```
7272

7373
### Python API
@@ -95,7 +95,7 @@ degraded = ctx.max_flow(excluded_nodes={"B"}) # Test failure scenario
9595

9696
## Example Scenario
9797

98-
NetGraph scenarios define topology, configuration, and analysis steps in a unified YAML file. This example demonstrates **blueprints** for modular topology definition:
98+
NetGraph scenarios define topology, configuration, and analysis steps in a unified YAML file. This example demonstrates **blueprints** for modular topology definition and a **flow analysis workflow** with Monte Carlo failure simulation:
9999

100100
```yaml
101101
seed: 42
@@ -130,6 +130,16 @@ network:
130130
capacity: 50
131131
cost: 10
132132

133+
# Define failure policy for Monte Carlo analysis
134+
failures:
135+
random_link:
136+
modes:
137+
- weight: 1.0
138+
rules:
139+
- scope: link
140+
mode: choice
141+
count: 1
142+
133143
# Define traffic demands
134144
demands:
135145
global_traffic:
@@ -139,7 +149,7 @@ demands:
139149
mode: combine
140150
flow_policy: SHORTEST_PATHS_ECMP
141151

142-
# Define analysis workflow
152+
# Analysis workflow: find max supported demand, then test under failures
143153
workflow:
144154
- type: NetworkStats
145155
name: stats
@@ -148,12 +158,19 @@ workflow:
148158
source: ^site1/leaf/
149159
target: ^site2/leaf/
150160
mode: combine
151-
shortest_path: false
152161
- type: MaximumSupportedDemand
153162
name: max_demand
154163
demand_set: global_traffic
164+
- type: TrafficMatrixPlacement
165+
name: placement_at_max
166+
demand_set: global_traffic
167+
alpha_from_step: max_demand # Use alpha_star from MSD step
168+
failure_policy: random_link
169+
iterations: 100
155170
```
156171
172+
The workflow demonstrates **step chaining**: `MaximumSupportedDemand` finds the maximum feasible demand multiplier (`alpha_star=1.0`), then `TrafficMatrixPlacement` uses that value via `alpha_from_step` to run Monte Carlo placement under random link failures. Results show baseline placement at 100% and worst-case failure at 50% (when a spine-to-spine link fails).
173+
157174
## Repository Structure
158175

159176
```text

scenarios/readme_example.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
seed: 42
2+
3+
# Define reusable topology templates
4+
blueprints:
5+
Clos_Fabric:
6+
nodes:
7+
spine: { count: 2, template: "spine{n}" }
8+
leaf: { count: 4, template: "leaf{n}" }
9+
links:
10+
- source: /leaf
11+
target: /spine
12+
pattern: mesh
13+
capacity: 100
14+
cost: 1
15+
- source: /spine
16+
target: /leaf
17+
pattern: mesh
18+
capacity: 100
19+
cost: 1
20+
21+
# Instantiate network from templates
22+
network:
23+
nodes:
24+
site1: { blueprint: Clos_Fabric }
25+
site2: { blueprint: Clos_Fabric }
26+
links:
27+
- source: { path: site1/spine }
28+
target: { path: site2/spine }
29+
pattern: one_to_one
30+
capacity: 50
31+
cost: 10
32+
33+
# Define failure policy for Monte Carlo analysis
34+
failures:
35+
random_link:
36+
modes:
37+
- weight: 1.0
38+
rules:
39+
- scope: link
40+
mode: choice
41+
count: 1
42+
43+
# Define traffic demands
44+
demands:
45+
global_traffic:
46+
- source: ^site1/leaf/
47+
target: ^site2/leaf/
48+
volume: 100.0
49+
mode: combine
50+
flow_policy: SHORTEST_PATHS_ECMP
51+
52+
# Analysis workflow: find max capacity, then test under failures
53+
workflow:
54+
- type: NetworkStats
55+
name: stats
56+
- type: MaxFlow
57+
name: site_capacity
58+
source: ^site1/leaf/
59+
target: ^site2/leaf/
60+
mode: combine
61+
- type: MaximumSupportedDemand
62+
name: max_demand
63+
demand_set: global_traffic
64+
- type: TrafficMatrixPlacement
65+
name: placement_at_max
66+
demand_set: global_traffic
67+
alpha_from_step: max_demand # Use alpha_star from MSD step
68+
failure_policy: random_link
69+
iterations: 100

0 commit comments

Comments
 (0)