Skip to content

Commit 43f4f57

Browse files
committed
normalised expansion modes to "combine" and "pairwise"
1 parent 495d0e6 commit 43f4f57

12 files changed

Lines changed: 30 additions & 30 deletions

File tree

docs/reference/api-full.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Quick links:
1212
- [CLI Reference](cli.md)
1313
- [DSL Reference](dsl.md)
1414

15-
Generated from source code on: August 09, 2025 at 03:28 UTC
15+
Generated from source code on: August 09, 2025 at 04:04 UTC
1616

1717
Modules auto-discovered: 59
1818

@@ -1688,11 +1688,11 @@ per-demand `FlowPolicy` instances.
16881688

16891689
Manage expansion and placement of traffic demands on a `Network`.
16901690

1691-
This class:
1691+
This class:
16921692

16931693
1) Builds (or rebuilds) a StrictMultiDiGraph from the given Network.
1694-
2) Expands each TrafficDemand into one or more Demand objects based
1695-
on a configurable 'mode' (e.g., 'combine' or 'full_mesh').
1694+
2) Expands each TrafficDemand into one or more Demand objects based
1695+
on a configurable 'mode' ("combine" or "pairwise").
16961696
3) Each Demand is associated with a FlowPolicy, which handles how flows
16971697
are placed (split across paths, balancing, etc.).
16981698
4) Provides methods to place all demands incrementally with optional
@@ -1707,7 +1707,7 @@ In particular:
17071707
demand's `source_path` and `sink_path`). A single Demand is created
17081708
from the pseudo-source to the pseudo-sink, with the full volume.
17091709

1710-
- 'full_mesh' mode:
1710+
- 'pairwise' mode:
17111711
- All matched sources form one group, all matched sinks form another group.
17121712

17131713
A separate Demand is created for each (src_node, dst_node) pair,
@@ -1788,7 +1788,7 @@ Attributes:
17881788
``flow_policy`` is not provided.
17891789
flow_policy: Concrete policy instance. If set, it overrides
17901790
``flow_policy_config``.
1791-
mode: Expansion mode, e.g. ``"combine"`` or ``"full_mesh"``.
1791+
mode: Expansion mode, ``"combine"`` or ``"pairwise"``.
17921792
attrs: Arbitrary user metadata.
17931793
id: Unique identifier assigned at initialization.
17941794

@@ -2362,7 +2362,7 @@ YAML Configuration Example:
23622362
name: "capacity_envelope_monte_carlo" # Optional: Custom name for this step
23632363
source_path: "^datacenter/.*" # Regex pattern for source node groups
23642364
sink_path: "^edge/.*" # Regex pattern for sink node groups
2365-
mode: "combine" # "combine" or "pairwise" flow analysis
2365+
mode: "combine" # "combine" or "pairwise" flow analysis
23662366
failure_policy: "random_failures" # Optional: Named failure policy to use
23672367
iterations: 1000 # Number of Monte-Carlo trials
23682368
parallelism: 4 # Number of parallel worker processes

docs/reference/dsl.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,14 +355,14 @@ traffic_matrix_set:
355355
source_path: "^dc1/.*"
356356
sink_path: "^dc2/.*"
357357
demand: 500
358-
mode: "full_mesh" # Distributed demand
358+
mode: "pairwise" # Distributed demand
359359
priority: 2
360360
```
361361

362362
**Traffic Modes:**
363363

364364
- `combine`: Single aggregate flow between source and sink groups
365-
- `full_mesh`: Individual flows between all source-sink node pairs
365+
- `pairwise`: Individual flows between all source-sink node pairs
366366

367367
**Flow Policies:**
368368

ngraph/demand/manager/manager.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ class TrafficResult(NamedTuple):
5858
class TrafficManager:
5959
"""Manage expansion and placement of traffic demands on a `Network`.
6060
61-
This class:
61+
This class:
6262
6363
1) Builds (or rebuilds) a StrictMultiDiGraph from the given Network.
64-
2) Expands each TrafficDemand into one or more Demand objects based
65-
on a configurable 'mode' (e.g., 'combine' or 'full_mesh').
64+
2) Expands each TrafficDemand into one or more Demand objects based
65+
on a configurable 'mode' ("combine" or "pairwise").
6666
3) Each Demand is associated with a FlowPolicy, which handles how flows
6767
are placed (split across paths, balancing, etc.).
6868
4) Provides methods to place all demands incrementally with optional
@@ -75,7 +75,7 @@ class TrafficManager:
7575
demand's `source_path` and `sink_path`). A single Demand is created
7676
from the pseudo-source to the pseudo-sink, with the full volume.
7777
78-
- 'full_mesh' mode:
78+
- 'pairwise' mode:
7979
* All matched sources form one group, all matched sinks form another group.
8080
A separate Demand is created for each (src_node, dst_node) pair,
8181
skipping self-pairs. The total volume is split evenly across the pairs.
@@ -156,9 +156,9 @@ def expand_demands(self) -> None:
156156
self._expand_combine(demands_of_td, td, src_groups, snk_groups)
157157
expanded.extend(demands_of_td)
158158
self._td_to_demands[td.id] = demands_of_td
159-
elif td.mode == "full_mesh":
159+
elif td.mode == "pairwise":
160160
demands_of_td: List[Demand] = []
161-
self._expand_full_mesh(demands_of_td, td, src_groups, snk_groups)
161+
self._expand_pairwise(demands_of_td, td, src_groups, snk_groups)
162162
expanded.extend(demands_of_td)
163163
self._td_to_demands[td.id] = demands_of_td
164164
else:
@@ -450,14 +450,14 @@ def _expand_combine(
450450
)
451451
)
452452

453-
def _expand_full_mesh(
453+
def _expand_pairwise(
454454
self,
455455
expanded: List[Demand],
456456
td: TrafficDemand,
457457
src_groups: Dict[str, List[Node]],
458458
snk_groups: Dict[str, List[Node]],
459459
) -> None:
460-
"""Expand a single demand using the ``full_mesh`` mode.
460+
"""Expand a single demand using the ``pairwise`` mode.
461461
462462
Creates one `Demand` for each valid source-destination pair (excluding
463463
self-pairs) and splits total volume evenly across pairs.

ngraph/demand/spec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class TrafficDemand:
2626
``flow_policy`` is not provided.
2727
flow_policy: Concrete policy instance. If set, it overrides
2828
``flow_policy_config``.
29-
mode: Expansion mode, e.g. ``"combine"`` or ``"full_mesh"``.
29+
mode: Expansion mode, ``"combine"`` or ``"pairwise"``.
3030
attrs: Arbitrary user metadata.
3131
id: Unique identifier assigned at initialization.
3232
"""

ngraph/failure/manager/manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ def run_demand_placement_monte_carlo(
12891289
"source_path": demand.source_path,
12901290
"sink_path": demand.sink_path,
12911291
"demand": demand.demand,
1292-
"mode": getattr(demand, "mode", "full_mesh"),
1292+
"mode": getattr(demand, "mode", "pairwise"),
12931293
"flow_policy_config": getattr(demand, "flow_policy_config", None),
12941294
"priority": getattr(demand, "priority", 0),
12951295
}

ngraph/monte_carlo/functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def demand_placement_analysis(
107107
source_path=config["source_path"],
108108
sink_path=config["sink_path"],
109109
demand=config["demand"],
110-
mode=config.get("mode", "full_mesh"),
110+
mode=config.get("mode", "pairwise"),
111111
flow_policy_config=config.get("flow_policy_config"),
112112
priority=config.get("priority", 0),
113113
)

ngraph/workflow/capacity_envelope_analysis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
name: "capacity_envelope_monte_carlo" # Optional: Custom name for this step
1616
source_path: "^datacenter/.*" # Regex pattern for source node groups
1717
sink_path: "^edge/.*" # Regex pattern for sink node groups
18-
mode: "combine" # "combine" or "pairwise" flow analysis
18+
mode: "combine" # "combine" or "pairwise" flow analysis
1919
failure_policy: "random_failures" # Optional: Named failure policy to use
2020
iterations: 1000 # Number of Monte-Carlo trials
2121
parallelism: 4 # Number of parallel worker processes

tests/demand/test_spec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test_custom_assignment_including_policy_config() -> None:
4343
demand=42.5,
4444
demand_placed=10.0,
4545
attrs={"description": "test"},
46-
mode="full_mesh",
46+
mode="pairwise",
4747
flow_policy_config=FlowPolicyConfig.SHORTEST_PATHS_ECMP,
4848
)
4949

@@ -53,5 +53,5 @@ def test_custom_assignment_including_policy_config() -> None:
5353
assert demand.demand == 42.5
5454
assert demand.demand_placed == 10.0
5555
assert demand.attrs == {"description": "test"}
56-
assert demand.mode == "full_mesh"
56+
assert demand.mode == "pairwise"
5757
assert demand.flow_policy_config == FlowPolicyConfig.SHORTEST_PATHS_ECMP

tests/integration/scenario_4.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ traffic_matrix_set:
251251
- source_path: "dc1_pod[ab]_rack.*/servers/.*"
252252
sink_path: "dc1_pod[ab]_rack.*/servers/.*"
253253
demand: 5.0 # 5 Gb/s east-west traffic
254-
mode: "full_mesh"
254+
mode: "pairwise"
255255
attrs:
256256
traffic_type: "east_west"
257257

@@ -268,7 +268,7 @@ traffic_matrix_set:
268268
- source_path: "dc1_poda_rack1/servers/srv-[1-4]"
269269
sink_path: "dc1_poda_rack1/servers/srv-[1-4]"
270270
demand: 20.0 # 20 Gb/s HPC collective communication
271-
mode: "full_mesh"
271+
mode: "pairwise"
272272
attrs:
273273
traffic_type: "hpc_collective"
274274

tests/integration/test_scenario_4.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def test_traffic_matrix_configuration(self, helper):
313313
for demand in default_matrix:
314314
assert hasattr(demand, "attrs")
315315
if demand.attrs.get("traffic_type") == "east_west":
316-
assert demand.mode == "full_mesh"
316+
assert demand.mode == "pairwise"
317317
elif demand.attrs.get("traffic_type") == "inter_dc":
318318
assert demand.mode == "combine"
319319

0 commit comments

Comments
 (0)