Skip to content

Commit a2187bb

Browse files
committed
Update documentation for clarity and consistency
1 parent 4000bbc commit a2187bb

File tree

8 files changed

+142
-205
lines changed

8 files changed

+142
-205
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@
44

55
[![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)
66

7-
NetGraph is a scenario-based network modeling and analysis framework written in Python. Design, simulate, and evaluate complex network topologies from small test cases to massive Data Center fabrics and WAN networks.
7+
NetGraph is a scenario-based network modeling and analysis framework written in Python. It allows you to design, simulate, and evaluate complex network topologies - ranging from small test cases to massive Data Center fabrics and WAN networks.
88

99
## Key Features
1010

11-
- **Scenario-Based Modeling** [DONE]: Define complete network scenarios in YAML with topology, failures, traffic, and workflows
12-
- **Hierarchical Blueprints** [DONE]: Reusable network templates with nested structures and bracket expansion
13-
- **Flow Analysis** [DONE]: Calculate capacity with different flow placement strategies (e.g., shortest path only, ECMP/UCMP, etc.)
11+
- **Scenario-Based Modeling** [DONE]: Define complete network scenarios in YAML with topology, failures, traffic, and workflow
12+
- **Hierarchical Blueprints** [DONE]: Reusable network templates with nested structures and parameterization
13+
- **Demand Placement** [DONE]: Place traffic demands on the network with various flow placement strategies (e.g., shortest path only, ECMP/UCMP, etc.)
14+
- **Capacity Calculation** [DONE]: Calculate capacity with different flow placement strategies
1415
- **Failure Simulation** [DONE]: Model component and risk groups failures for availability analysis
16+
- **Network Analysis** [IN PROGRESS]: Analyze capacity, failure tolerance, and efficiency
1517

1618
## Quick Start
1719

18-
### Docker (Recommended)
20+
### Docker with JupyterLab (Recommended)
1921

2022
```bash
2123
git clone https://github.com/networmix/NetGraph
@@ -39,7 +41,7 @@ pip install -e '.[dev]'
3941
from ngraph.scenario import Scenario
4042
from ngraph.lib.flow_policy import FlowPlacement
4143

42-
# Define a 3-tier Clos network with inter-fabric connectivity
44+
# Define two 3-tier Clos networks with inter-fabric connectivity
4345
clos_scenario_yaml = """
4446
blueprints:
4547
brick_2tier:
@@ -108,7 +110,7 @@ max_flow = network.max_flow(
108110
flow_placement=FlowPlacement.EQUAL_BALANCED
109111
)
110112
print(f"Maximum flow: {max_flow}")
111-
# Result: {('b1|b2', 'b1|b2'): 256.0}
113+
# Maximum flow: {('b1|b2', 'b1|b2'): 256.0}
112114
```
113115

114116
## Documentation

docs/examples/basic.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
# Basic Examples
1+
# Basic Example
22

3-
This guide demonstrates basic NetGraph functionality using a couple of simple examples. These fundamentals will help you understand the more complex scenarios in the [Clos Fabric Analysis](clos-fabric.md) example.
4-
5-
## Calculating MaxFlow
6-
7-
In this example, we'll create a simple network with parallel edges and alternative paths, then run max flow analysis with different flow placement policies.
3+
In this toy example, we'll create a simple graph with parallel edges and alternative paths, then run max flow analysis with different flow placement policies.
84

95
### Creating a Simple Network
106

@@ -82,6 +78,8 @@ scenario = Scenario.from_yaml(scenario_yaml)
8278
network = scenario.network
8379
```
8480

81+
Note that here we used a simple `nodes` and `links` structure to directly define the network topology. In more complex scenarios, you would typically use `groups` and `adjacency` to define groups of nodes and their connections, or even leverage the `blueprints` to create reusable components. This advanced functionality is explained in the [DSL Reference](../reference/dsl.md) and used in the [Clos Fabric Analysis](clos-fabric.md) example.
82+
8583
### Flow Analysis Variants
8684

8785
Now let's run MaxFlow using the high-level Network API:
@@ -112,17 +110,17 @@ print(f"Equal-balanced flow: {max_flow_shortest_balanced}")
112110
# Result: 2.0 (splits flow equally across parallel edges in A→B and B→C)
113111
```
114112

115-
### Key Concepts
113+
### Results Interpretation
116114

117115
- **"True" MaxFlow**: Uses all available paths regardless of their cost
118-
- **Shortest Path**: Only uses paths with minimum cost
119-
- **EQUAL_BALANCED Flow Placement**: Distributes equally across parallel paths. Flow can be limited by the smallest capacity path.
116+
- **Shortest Path**: Only uses paths with the minimum cost
117+
- **EQUAL_BALANCED Flow Placement**: Distributes flows equally across all parallel paths. The toal flow can be limited by the smallest capacity path.
120118

121119
Note that `EQUAL_BALANCED` flow placement is only applicable when calculating MaxFlow on shortest paths.
122120

123121
## Next Steps
124122

125-
- **[Clos Fabric Analysis](clos-fabric.md)** - More complex example
126123
- **[Tutorial](../getting-started/tutorial.md)** - Build complete network scenarios
124+
- **[Clos Fabric Analysis](clos-fabric.md)** - More complex example
127125
- **[DSL Reference](../reference/dsl.md)** - Learn the full YAML syntax for scenarios
128126
- **[API Reference](../reference/api.md)** - Explore the Python API for advanced usage

docs/examples/clos-fabric.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,8 @@ costs, pred = spf(network.to_strict_multidigraph(), src_node)
168168
paths = list(resolve_to_paths(src_node, dst_node, pred))
169169
print(f"Found {len(paths)} paths between segments")
170170
```
171+
172+
## Next Steps
173+
174+
- **[DSL Reference](../reference/dsl.md)** - Learn the complete YAML syntax
175+
- **[API Reference](../reference/api.md)** - Explore the Python API in detail

docs/getting-started/installation.md

Lines changed: 45 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,32 @@ NetGraph can be used in two ways:
1414

1515
1. Clone the repository:
1616

17-
```bash
18-
git clone https://github.com/networmix/NetGraph
19-
```
17+
```bash
18+
git clone https://github.com/networmix/NetGraph
19+
```
2020

2121
2. Build the Docker image:
2222

23-
```bash
24-
cd NetGraph
25-
./run.sh build
26-
```
23+
```bash
24+
cd NetGraph
25+
./run.sh build
26+
```
2727

2828
3. Start the container with JupyterLab server:
2929

30-
```bash
31-
./run.sh run
32-
```
30+
```bash
31+
./run.sh run
32+
```
3333

3434
4. Open the JupyterLab URL in your browser:
3535

36-
```bash
37-
http://127.0.0.1:8788/
38-
```
36+
```bash
37+
http://127.0.0.1:8788/
38+
```
3939

4040
5. Jupyter will show the content of `notebooks` directory and you can start using the provided notebooks (e.g., open scenario_dc.ipynb) or create your own.
4141

42-
**Note**: Docker is instructed to mount the content of `NetGraph` directory into the `/root/env` directory inside container, so any changes made to any files in the `NetGraph` directory will be reflected in the container and vice versa. The `ngraph` package is installed in the container in editable mode, so you can make changes to the code and leverage them immediately in JupyterLab. But don't forget to restart the JupyterLab kernel to see the changes.
42+
**Note**: Docker is instructed to mount the content of `NetGraph` directory into the `/root/env` directory inside container, so any changes made to any files in the `NetGraph` directory will be reflected in the container and vice versa. The `ngraph` package is installed in the container in editable mode, so you can make changes to the code and leverage them immediately in JupyterLab. But **don't forget to restart the JupyterLab kernel** after making changes to the package code to see the effects in the running notebook.
4343

4444
To exit the JupyterLab server, press `Ctrl+C` in the terminal where the server is running. To stop the remaining Docker container, run:
4545

@@ -60,31 +60,41 @@ To exit the JupyterLab server, press `Ctrl+C` in the terminal where the server i
6060

6161
1. Install the package using pip:
6262

63-
```bash
64-
pip install ngraph
65-
```
63+
```bash
64+
pip install ngraph
65+
```
6666

6767
2. Use the package in your Python code:
6868

69-
```python
70-
from ngraph.scenario import Scenario
71-
from ngraph.explorer import NetworkExplorer
72-
73-
scenario_yaml = """
74-
network:
75-
groups:
76-
servers:
77-
node_count: 2
78-
name_template: "server-{node_num}"
79-
"""
80-
81-
scenario = Scenario.from_yaml(scenario_yaml)
82-
network = scenario.network
83-
explorer = NetworkExplorer.explore_network(network)
84-
explorer.print_tree(skip_leaves=True, detailed=False)
85-
```
69+
```python
70+
from ngraph.scenario import Scenario
71+
72+
scenario_yaml = """
73+
network:
74+
name: "Two-Tier Clos Fabric"
75+
groups:
76+
leaf:
77+
node_count: 4
78+
name_template: "leaf-{node_num}"
79+
spine:
80+
node_count: 2
81+
name_template: "spine-{node_num}"
82+
adjacency:
83+
- source: /leaf
84+
target: /spine
85+
pattern: mesh
86+
link_params:
87+
capacity: 10
88+
cost: 1
89+
"""
90+
91+
scenario = Scenario.from_yaml(scenario_yaml)
92+
network = scenario.network
93+
print(f"Created Clos fabric with {len(network.nodes)} nodes and {len(network.links)} links")
94+
```
8695

8796
## Next Steps
8897

8998
- **[Quick Tutorial](tutorial.md)** - Build your first network scenario
90-
- **[DSL Reference](../reference/dsl.md)** - Learn the YAML syntax
99+
- **[DSL Reference](../reference/dsl.md)** - Learn the complete YAML syntax
100+
- **[API Reference](../reference/api.md)** - Explore the Python API in detail

0 commit comments

Comments
 (0)