@graphty/algorithms / index / maxFlow
Function: maxFlow() ​
maxFlow(
s,sourceNode,sinkNode,options?):MaxFlowResult
Defined in: indexed/flow.ts:254
Maximum flow from source to sink by augmenting paths.
Paths, bottlenecks and per-edge flows equal the legacy edmondsKarp / fordFulkerson on a graph with no parallel edges and no two opposite directed edges: the residual is kept per node pair and searched in the legacy row order (see buildResidual). Where two opposite directed edges carry flow, legacy records every push on the edge in the push's direction, so one edge can show more flow than its capacity; this port reports the net flow of the pair on the edges in its direction instead, each within its capacity.
Parameters ​
s ​
GraphSnapshot
The snapshot
sourceNode ​
NodeRef
The source node: its index, or { id }
sinkNode ​
NodeRef
The sink node: its index, or { id }
options? ​
MaxFlowOptions = {}
The path search and the capacity override
Returns ​
The flow value, the per-edge flows, the source side and the cut edges
Throws ​
RangeError when source or sink is not a node index, or they are the same node