fn dinic_augment(
        &self,
        u: usize,
        t: usize,
        f: i64,
        dist: &[i64],
        adj: &mut [::std::iter::Peekable<AdjListIterator>],
        flow: &mut [i64],
    ) -> i64 {
        if u == t {
            return f;
        }
        let mut df = 0;

        while let Some(&(e, v)) = adj[u].peek() {
            let rem_cap = min(self.cap[e] - flow[e], f - df);
            if rem_cap > 0 && dist[v] == dist[u] + 1 {
                let cf = self.dinic_augment(v, t, rem_cap, dist, adj, flow);
                flow[e] += cf;
                flow[e ^ 1] -= cf;
                df += cf;
                if df == f {
                    break;
                }
            }
            // The current edge is either saturated or blocked.
            adj[u].next();
        }
        return df;
    }
// Pushes a blocking flow that increases the residual's s-t distance.
Pushes a blocking flow that increases the residual's s-t distance.
Pushes a blocking flow that increases the residual ' s s - t distance .
fn dinic_augment(
        &self,
        u: usize,
        t: usize,
        f: i64,
        dist: &[i64],
        adj: &mut [::std::iter::Peekable<AdjListIterator>],
        flow: &mut [i64],
    ) -> i64 {
        if u == t {
            return f;
        }
        let mut df = 0;
        while let Some(&(e, v)) = adj[u].peek() {
            let rem_cap = min(self.cap[e] - flow[e], f - df);
            if rem_cap > 0 && dist[v] == dist[u] + 1 {
                let cf = self.dinic_augment(v, t, rem_cap, dist, adj, flow);
                flow[e] += cf;
                flow[e ^ 1] -= cf;
                df += cf;
                if df == f {
                    break;
                }
            }
            // The current edge is either saturated or blocked.
            adj[u].next();
        }
        return df;
    }
fn dinic_augment ( & self , u : usize , t : usize , f : i64 , dist : & [ i64 ] , adj : & mut [ :: std :: iter :: Peekable < AdjListIterator > ] , flow : & mut [ i64 ] , ) -> i64 { if u == t { return f ; } let mut df = 0 ; while let Some ( & ( e , v ) ) = adj [ u ] . peek ( ) { let rem_cap = min ( self . cap [ e ] - flow [ e ] , f - df ) ; if rem_cap > 0 && dist [ v ] == dist [ u ] + 1 { let cf = self . dinic_augment ( v , t , rem_cap , dist , adj , flow ) ; flow [ e ] += cf ; flow [ e ^ 1 ] -= cf ; df += cf ; if df == f { break ; } } // The current edge is either saturated or blocked. adj [ u ] . next ( ) ; } return df ; }
Pushes a blocking flow that increases the residual's s-t distance.
Pushes a blocking flow that increases the residual ' s s - t distance .
&self
u
usize
t
usize
f
i64
dist
&[i64]
adj
&mut [::std::iter::Peekable<AdjListIterator>]
flow
&mut [i64]
&self
u
usize
t
usize
f
i64
dist
&[i64]
adj
&mut [::std::iter::Peekable<AdjListIterator>]
flow
&mut [i64]