Skip to content

Commit 2233e31

Browse files
committed
Updated docstrings. Added tests for notebook analysis components and updated notebook export functionality.
1 parent c072440 commit 2233e31

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1309
-150
lines changed

docs/reference/api-full.md

Lines changed: 74 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ For a curated, example-driven API guide, see **[api.md](api.md)**.
1010
> - **[CLI Reference](cli.md)** - Command-line interface
1111
> - **[DSL Reference](dsl.md)** - YAML syntax guide
1212

13-
**Generated from source code on:** June 16, 2025 at 17:06 UTC
13+
**Generated from source code on:** June 16, 2025 at 20:37 UTC
1414

1515
**Modules auto-discovered:** 42
1616

1717
---
1818

1919
## ngraph.blueprints
2020

21+
Network topology blueprints and generation.
22+
2123
### Blueprint
2224

2325
Represents a reusable blueprint for hierarchical sub-topologies.
@@ -92,6 +94,8 @@ Returns:
9294

9395
## ngraph.cli
9496

97+
Command-line interface for NetGraph.
98+
9599
### main(argv: 'Optional[List[str]]' = None) -> 'None'
96100

97101
Entry point for the ``ngraph`` command.
@@ -104,6 +108,8 @@ Args:
104108

105109
## ngraph.components
106110

111+
Component and ComponentsLibrary classes for hardware cost modeling.
112+
107113
### Component
108114

109115
A generic component that can represent chassis, line cards, optics, etc.
@@ -196,7 +202,7 @@ Example (YAML-like):
196202

197203
## ngraph.config
198204

199-
Configuration for NetGraph.
205+
Configuration classes for NetGraph components.
200206

201207
### TrafficManagerConfig
202208

@@ -219,6 +225,8 @@ Configuration for traffic demand placement estimation.
219225

220226
## ngraph.explorer
221227

228+
NetworkExplorer class for analyzing network hierarchy and structure.
229+
222230
### ExternalLinkBreakdown
223231

224232
Holds stats for external links to a particular other subtree.
@@ -305,6 +313,8 @@ Attributes:
305313

306314
## ngraph.failure_manager
307315

316+
FailureManager class for running Monte Carlo failure simulations.
317+
308318
### FailureManager
309319

310320
Applies FailurePolicy to a Network, runs traffic placement, and (optionally)
@@ -331,6 +341,8 @@ Attributes:
331341

332342
## ngraph.failure_policy
333343

344+
FailurePolicy, FailureRule, and FailureCondition classes for failure modeling.
345+
334346
### FailureCondition
335347

336348
A single condition for matching an entity's attribute with an operator and value.
@@ -490,6 +502,8 @@ Args:
490502

491503
## ngraph.network
492504

505+
Network topology modeling with Node, Link, RiskGroup, and Network classes.
506+
493507
### Link
494508

495509
Represents a directed link between two nodes in the network.
@@ -623,6 +637,8 @@ Returns:
623637

624638
## ngraph.results
625639

640+
Results class for storing workflow step outputs.
641+
626642
### Results
627643

628644
A container for storing arbitrary key-value data that arises during workflow steps.
@@ -652,6 +668,8 @@ Example usage:
652668

653669
## ngraph.results_artifacts
654670

671+
CapacityEnvelope, TrafficMatrixSet, PlacementResultSet, and FailurePolicySet classes.
672+
655673
### CapacityEnvelope
656674

657675
Range of max-flow values measured between two node groups.
@@ -766,6 +784,8 @@ Attributes:
766784

767785
## ngraph.scenario
768786

787+
Scenario class for defining network analysis workflows from YAML.
788+
769789
### Scenario
770790

771791
Represents a complete scenario for building and executing network workflows.
@@ -804,6 +824,8 @@ Typical usage example:
804824

805825
## ngraph.traffic_demand
806826

827+
TrafficDemand class for modeling network traffic flows.
828+
807829
### TrafficDemand
808830

809831
Represents a single traffic demand in a network.
@@ -838,6 +860,8 @@ Attributes:
838860

839861
## ngraph.traffic_manager
840862

863+
TrafficManager class for placing traffic demands on network topology.
864+
841865
### TrafficManager
842866

843867
Manages the expansion and placement of traffic demands on a Network.
@@ -949,6 +973,8 @@ Examples:
949973

950974
## ngraph.lib.demand
951975

976+
Demand class for modeling traffic flows between node groups.
977+
952978
### Demand
953979

954980
Represents a network demand between two nodes. It is realized via one or more
@@ -972,6 +998,8 @@ flows through a single FlowPolicy.
972998

973999
## ngraph.lib.flow
9741000

1001+
Flow and FlowIndex classes for traffic flow representation.
1002+
9751003
### Flow
9761004

9771005
Represents a fraction of demand routed along a given PathBundle.
@@ -1003,6 +1031,8 @@ Attributes:
10031031

10041032
## ngraph.lib.flow_policy
10051033

1034+
FlowPolicy and FlowPolicyConfig classes for traffic routing algorithms.
1035+
10061036
### FlowPolicy
10071037

10081038
Manages the placement and management of flows (demands) on a network graph.
@@ -1043,6 +1073,8 @@ Raises:
10431073

10441074
## ngraph.lib.graph
10451075

1076+
StrictMultiDiGraph class extending NetworkX with validation and utilities.
1077+
10461078
### StrictMultiDiGraph
10471079

10481080
A custom multi-directed graph with strict rules and unique edge IDs.
@@ -1166,6 +1198,8 @@ Returns:
11661198

11671199
## ngraph.lib.io
11681200

1201+
Graph serialization functions for node-link and edge-list formats.
1202+
11691203
### edgelist_to_graph(lines: 'Iterable[str]', columns: 'List[str]', separator: 'str' = ' ', graph: 'Optional[StrictMultiDiGraph]' = None, source: 'str' = 'src', target: 'str' = 'dst', key: 'str' = 'key') -> 'StrictMultiDiGraph'
11701204

11711205
Builds or updates a StrictMultiDiGraph from an edge list.
@@ -1271,6 +1305,8 @@ Returns:
12711305

12721306
## ngraph.lib.path
12731307

1308+
Path class for representing network routing paths.
1309+
12741310
### Path
12751311

12761312
Represents a single path in the network.
@@ -1305,6 +1341,8 @@ Attributes:
13051341

13061342
## ngraph.lib.path_bundle
13071343

1344+
PathBundle class for managing parallel routing paths.
1345+
13081346
### PathBundle
13091347

13101348
A collection of equal-cost paths between two nodes.
@@ -1341,6 +1379,8 @@ If it's not a DAG, the behavior is... an infinite loop. Oops.
13411379

13421380
## ngraph.lib.util
13431381

1382+
Graph conversion utilities between StrictMultiDiGraph and NetworkX graphs.
1383+
13441384
### from_digraph(nx_graph: networkx.classes.digraph.DiGraph) -> ngraph.lib.graph.StrictMultiDiGraph
13451385

13461386
Convert a revertible NetworkX DiGraph to a StrictMultiDiGraph.
@@ -1403,6 +1443,8 @@ Returns:
14031443

14041444
## ngraph.lib.algorithms.base
14051445

1446+
Base classes and enums for network analysis algorithms.
1447+
14061448
### EdgeSelect
14071449

14081450
Edge selection criteria determining which edges are considered
@@ -1420,6 +1462,8 @@ Types of path finding algorithms
14201462

14211463
## ngraph.lib.algorithms.calc_capacity
14221464

1465+
Capacity calculation algorithms for network analysis.
1466+
14231467
### calc_graph_capacity(flow_graph: 'StrictMultiDiGraph', src_node: 'NodeID', dst_node: 'NodeID', pred: 'Dict[NodeID, Dict[NodeID, List[EdgeID]]]', flow_placement: 'FlowPlacement' = <FlowPlacement.PROPORTIONAL: 1>, capacity_attr: 'str' = 'capacity', flow_attr: 'str' = 'flow') -> 'Tuple[float, Dict[NodeID, Dict[NodeID, float]]]'
14241468

14251469
Calculate the maximum feasible flow from src_node to dst_node (forward sense)
@@ -1464,6 +1508,8 @@ Raises:
14641508

14651509
## ngraph.lib.algorithms.edge_select
14661510

1511+
Edge selection algorithms for network routing.
1512+
14671513
### edge_select_fabric(edge_select: ngraph.lib.algorithms.base.EdgeSelect, select_value: Optional[Any] = None, edge_select_func: Optional[Callable[[ngraph.lib.graph.StrictMultiDiGraph, Hashable, Hashable, Dict[Hashable, Dict[str, Any]], Optional[Set[Hashable]], Optional[Set[Hashable]]], Tuple[Union[int, float], List[Hashable]]]] = None, excluded_edges: Optional[Set[Hashable]] = None, excluded_nodes: Optional[Set[Hashable]] = None, cost_attr: str = 'cost', capacity_attr: str = 'capacity', flow_attr: str = 'flow') -> Callable[[ngraph.lib.graph.StrictMultiDiGraph, Hashable, Hashable, Dict[Hashable, Dict[str, Any]], Optional[Set[Hashable]], Optional[Set[Hashable]]], Tuple[Union[int, float], List[Hashable]]]
14681514

14691515
Creates a function that selects edges between two nodes according
@@ -1491,6 +1537,8 @@ Returns:
14911537

14921538
## ngraph.lib.algorithms.flow_init
14931539

1540+
Flow graph initialization and setup utilities.
1541+
14941542
### init_flow_graph(flow_graph: 'StrictMultiDiGraph', flow_attr: 'str' = 'flow', flows_attr: 'str' = 'flows', reset_flow_graph: 'bool' = True) -> 'StrictMultiDiGraph'
14951543

14961544
Ensure that every node and edge in the provided `flow_graph` has
@@ -1517,6 +1565,8 @@ Returns:
15171565

15181566
## ngraph.lib.algorithms.max_flow
15191567

1568+
Maximum flow algorithms and network flow computations.
1569+
15201570
### calc_max_flow(graph: ngraph.lib.graph.StrictMultiDiGraph, src_node: Hashable, dst_node: Hashable, *, return_summary: bool = False, return_graph: bool = False, flow_placement: ngraph.lib.algorithms.base.FlowPlacement = <FlowPlacement.PROPORTIONAL: 1>, shortest_path: bool = False, reset_flow_graph: bool = False, capacity_attr: str = 'capacity', flow_attr: str = 'flow', flows_attr: str = 'flows', copy_graph: bool = True) -> Union[float, tuple]
15211571

15221572
Compute the maximum flow between two nodes in a directed multi-graph,
@@ -1636,6 +1686,8 @@ Returns:
16361686

16371687
## ngraph.lib.algorithms.path_utils
16381688

1689+
Path manipulation and utility functions.
1690+
16391691
### resolve_to_paths(src_node: 'NodeID', dst_node: 'NodeID', pred: 'Dict[NodeID, Dict[NodeID, List[EdgeID]]]', split_parallel_edges: 'bool' = False) -> 'Iterator[PathTuple]'
16401692

16411693
Enumerate all source->destination paths from a predecessor map.
@@ -1653,6 +1705,8 @@ Yields:
16531705

16541706
## ngraph.lib.algorithms.place_flow
16551707

1708+
Flow placement algorithms for traffic routing.
1709+
16561710
### FlowPlacementMeta
16571711

16581712
Metadata capturing how flow was placed on the graph.
@@ -1708,6 +1762,8 @@ Args:
17081762

17091763
## ngraph.lib.algorithms.spf
17101764

1765+
Shortest path first (SPF) algorithms and implementations.
1766+
17111767
### ksp(graph: ngraph.lib.graph.StrictMultiDiGraph, src_node: Hashable, dst_node: Hashable, edge_select: ngraph.lib.algorithms.base.EdgeSelect = <EdgeSelect.ALL_MIN_COST: 1>, edge_select_func: Optional[Callable[[ngraph.lib.graph.StrictMultiDiGraph, Hashable, Hashable, Dict[Hashable, Dict[str, Any]], Set[Hashable], Set[Hashable]], Tuple[Union[int, float], List[Hashable]]]] = None, max_k: Optional[int] = None, max_path_cost: Union[int, float] = inf, max_path_cost_factor: Optional[float] = None, multipath: bool = True, excluded_edges: Optional[Set[Hashable]] = None, excluded_nodes: Optional[Set[Hashable]] = None) -> Iterator[Tuple[Dict[Hashable, Union[int, float]], Dict[Hashable, Dict[Hashable, List[Hashable]]]]]
17121768

17131769
Generator of up to k shortest paths from src_node to dst_node using a Yen-like algorithm.
@@ -1798,6 +1854,8 @@ Attributes:
17981854

17991855
## ngraph.workflow.base
18001856

1857+
Base classes and utilities for workflow components.
1858+
18011859
### WorkflowStep
18021860

18031861
Base class for all workflow steps.
@@ -1835,6 +1893,8 @@ A decorator that registers a WorkflowStep subclass under `step_type`.
18351893

18361894
## ngraph.workflow.build_graph
18371895

1896+
Graph building workflow component.
1897+
18381898
### BuildGraph
18391899

18401900
A workflow step that builds a StrictMultiDiGraph from scenario.network.
@@ -1864,6 +1924,8 @@ YAML Configuration:
18641924

18651925
## ngraph.workflow.capacity_envelope_analysis
18661926

1927+
Capacity envelope analysis workflow component.
1928+
18671929
### CapacityEnvelopeAnalysis
18681930

18691931
A workflow step that samples maximum capacity between node groups across random failures.
@@ -1922,6 +1984,8 @@ Attributes:
19221984

19231985
## ngraph.workflow.capacity_probe
19241986

1987+
Capacity probing workflow component.
1988+
19251989
### CapacityProbe
19261990

19271991
A workflow step that probes capacity (max flow) between selected groups of nodes.
@@ -2076,6 +2140,8 @@ Example of how the new approach works.
20762140

20772141
## ngraph.workflow.notebook_export
20782142

2143+
Jupyter notebook export and generation functionality.
2144+
20792145
### NotebookExport
20802146

20812147
Export scenario results to a Jupyter notebook with external JSON data file.
@@ -2091,20 +2157,12 @@ YAML Configuration:
20912157
name: "export_analysis" # Optional: Custom name for this step
20922158
notebook_path: "analysis.ipynb" # Optional: Notebook output path (default: "results.ipynb")
20932159
json_path: "results.json" # Optional: JSON data output path (default: "results.json")
2094-
output_path: "analysis.ipynb" # Optional: Backward compatibility alias for notebook_path
2095-
include_visualizations: true # Optional: Include plots (default: true)
2096-
include_data_tables: true # Optional: Include data tables (default: true)
2097-
max_data_preview_rows: 100 # Optional: Max rows in data previews
20982160
allow_empty_results: false # Optional: Allow notebook creation with no results
20992161
```
21002162

21012163
Attributes:
21022164
notebook_path: Destination notebook file path (default: "results.ipynb").
21032165
json_path: Destination JSON data file path (default: "results.json").
2104-
output_path: Backward compatibility alias for notebook_path (default: "results.ipynb").
2105-
include_visualizations: Whether to include visualization cells (default: True).
2106-
include_data_tables: Whether to include data table displays (default: True).
2107-
max_data_preview_rows: Maximum number of rows to show in data previews (default: 100).
21082166
allow_empty_results: Whether to create a notebook when no results exist (default: False).
21092167
If False, raises ValueError when results are empty.
21102168

@@ -2113,10 +2171,6 @@ Attributes:
21132171
- `name` (str)
21142172
- `notebook_path` (str) = results.ipynb
21152173
- `json_path` (str) = results.json
2116-
- `output_path` (str) = results.ipynb
2117-
- `include_visualizations` (bool) = True
2118-
- `include_data_tables` (bool) = True
2119-
- `max_data_preview_rows` (int) = 100
21202174
- `allow_empty_results` (bool) = False
21212175

21222176
**Methods:**
@@ -2132,15 +2186,6 @@ Attributes:
21322186

21332187
Code serialization for notebook generation.
21342188

2135-
### ExecutableNotebookExport
2136-
2137-
Notebook export using executable Python classes.
2138-
2139-
**Methods:**
2140-
2141-
- `create_notebook(self, results_dict: Dict[str, Any]) -> nbformat.notebooknode.NotebookNode`
2142-
- Create notebook using executable classes.
2143-
21442189
### NotebookCodeSerializer
21452190

21462191
Converts Python classes into notebook cells.
@@ -2162,6 +2207,8 @@ Converts Python classes into notebook cells.
21622207

21632208
## ngraph.transform.base
21642209

2210+
Base classes for network transformations.
2211+
21652212
### NetworkTransform
21662213

21672214
Stateless mutator applied to a :class:`ngraph.scenario.Scenario`.
@@ -2205,6 +2252,8 @@ Raises:
22052252

22062253
## ngraph.transform.distribute_external
22072254

2255+
Network transformation for distributing external connectivity.
2256+
22082257
### DistributeExternalConnectivity
22092258

22102259
Attach (or create) remote nodes and link them to attachment stripes.
@@ -2246,6 +2295,8 @@ Args:
22462295

22472296
## ngraph.transform.enable_nodes
22482297

2298+
Network transformation for enabling/disabling nodes.
2299+
22492300
### EnableNodesTransform
22502301

22512302
Enable *count* disabled nodes that match *path*.

0 commit comments

Comments
 (0)