Function rs_graph::maxflow::dinic::dinic

source ·
pub fn dinic<'a, G, F, Us>(
    g: &'a G,
    src: G::Node<'_>,
    snk: G::Node<'_>,
    upper: Us
) -> (F, Vec<(G::Edge<'a>, F)>, Vec<G::Node<'a>>)where
    G: IndexDigraph,
    F: 'a + NumAssign + Ord + Copy,
    Us: Fn(G::Edge<'_>) -> F,
Expand description

Solve the maxflow problem using the algorithm of Dinic.

The function solves the max flow problem from the source nodes src to the sink node snk with the given upper bounds on the edges.

The function returns the flow value, the flow on each edge and the nodes in a minimal cut.