pub fn max_flow(
n: usize,
source: usize,
sink: usize,
edges: &[(usize, usize, i64)],
) -> MaxFlowResultExpand description
Compute the maximum flow in a network using the Tide algorithm.
§Arguments
n- Number of vertices (0-indexed)source- Source vertexsink- Sink vertexedges- List of (from, to, capacity) tuples
§Returns
A MaxFlowResult containing the max flow value, step count, and per-edge flows.
§Example
use tide_maxflow::max_flow;
let result = max_flow(4, 0, 3, &[(0, 1, 10), (0, 2, 10), (1, 3, 10), (2, 3, 10)]);
assert_eq!(result.flow, 20);