valve_segments#
module wntr.metrics.topographic
- valve_segments(G, valve_layer)[source]#
Valve segmentation
- Parameters:
G (networkx MultiDiGraph) – Graph
valve_layer (pandas DataFrame) – Valve layer, defined by node and link pairs (for example, valve 0 is on link A and protects node B). The valve_layer DataFrame is indexed by valve number, with columns named ‘node’ and ‘link’.
- Returns:
node_segments (pandas Series) – Segment number for each node, indexed by node name
link_segments (pandas Series) – Segment number for each link, indexed by link name
segment_size (pandas DataFrame) – Number of nodes and links in each segment. The DataFrame is indexed by segment number, with columns named ‘node’ and ‘link’.