Skip to main content

max_flow_adaptive

Function max_flow_adaptive 

Source
pub fn max_flow_adaptive(
    n: usize,
    source: usize,
    sink: usize,
    edges: &[(usize, usize, i64)],
) -> MaxFlowResult
Expand description

Compute max flow using adaptive Tide.

Starts with standard BFS tides. If the algorithm hasn’t converged after 5 tides, switches to hybrid mode (local relabeling between BFS tides). Best of both worlds: no overhead on easy graphs, BFS-skip savings on hard ones.