build_residual_network(G, capacity)
The residual network R
from an input graph G
has the same nodes as G
. R
is a DiGraph that contains a pair of edges (u, v)
and (v, u)
iff (u, v)
is not a self-loop, and at least one of (u, v)
and (v, u)
exists in G
.
For each edge (u, v)
in R
, R[u][v]['capacity']
is equal to the capacity of (u, v)
in G
if it exists in G
or zero otherwise. If the capacity is infinite, R[u][v]['capacity']
will have a high arbitrary finite value that does not affect the solution of the problem. This value is stored in R.graph['inf']
. For each edge (u, v)
in R
, R[u][v]['flow']
represents the flow function of (u, v)
and satisfies R[u][v]['flow'] == -R[v][u]['flow']
.
The flow value, defined as the total flow into t
, the sink, is stored in R.graph['flow_value']
. If cutoff
is not specified, reachability to t
using only edges (u, v)
such that R[u][v]['flow'] < R[u][v]['capacity']
induces a minimum s
- t
cut.
Build a residual network and initialize a zero flow.
The following pages refer to to this document either explicitly or contain code examples using this.
networkx.algorithms.connectivity.disjoint_paths.edge_disjoint_paths
networkx.algorithms.connectivity.connectivity.local_node_connectivity
networkx.algorithms.connectivity.cuts.minimum_st_edge_cut
networkx.algorithms.connectivity.connectivity.local_edge_connectivity
networkx.algorithms.connectivity.cuts.minimum_st_node_cut
networkx.algorithms.connectivity.disjoint_paths.node_disjoint_paths
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them