Skip to content

@graphty/algorithms / index / indexed / minSTCut

Function: minSTCut() ​

minSTCut(s, sourceNode, sinkNode, options?): MinCutResult

Defined in: indexed/flow.ts:395

Minimum s-t cut: the source side and value of a maximum flow (max-flow min-cut theorem). The side is the set reachable from the source in the final residual graph, which is the same for every maximum flow, so the path search does not change it. The search defaults to "ford-fulkerson", as the legacy minSTCut uses: on weights that are not binary fractions another search adds the bottlenecks in another order and the value can differ in its last bits.

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 ​

MinCutResult

The cut value, the source side and the cut edges

Throws ​

RangeError as maxFlow does