fullscreen
timer
qrcode
plickers
selector
edit
reset

network flow (7)

max-flow and min-cut

flow network

A flow network is a tuple \(G = (V, E, s, t, c)\).

Intuition: Material flowing through a transportation network; material originates at source and is sent to sink.

minimum-cut problem

Defn: An \(st\)-cut is partition \((A,B)\) of nodes with \(s \in A\) and \(t \in B\)

Defn: Its capacity is the sum of capacities of edges from \(A\) to \(B\)

\[ \mathrm{cap}(A,B) = \sum_{e \text{ out of } A} c(e) \]

minimum-cut problem

Defn: An \(st\)-cut is partition \((A,B)\) of nodes with \(s \in A\) and \(t \in B\)

Defn: Its capacity is the sum of capacities of edges from \(A\) to \(B\)

\[ \mathrm{cap}(A,B) = \sum_{e \text{ out of } A} c(e) \]

minimum-cut problem

Defn: An \(st\)-cut is partition \((A,B)\) of nodes with \(s \in A\) and \(t \in B\)

Defn: Its capacity is the sum of capacities of edges from \(A\) to \(B\)

Min-cut problem: Find a cut of minimum capacity.

Quiz: Network Flow

live view ]

Which is the capacity of the given \(st\)-cut?

  1. 11 = 20 + 25 - 8 - 11 - 9 - 6
  2. 34 = 8 + 11 + 9 + 6
  3. 45 = 20 + 25
  4. 79 = 20 + 25 + 8 + 11 + 9 + 6

Maximum-flow problem

Defn: An \(st\)-flow \(f\) is a function that satisfies:

Maximum-flow problem

Defn: An \(st\)-flow \(f\) is a function that satisfies:

Defn: The value of a flow \(f\): \(\displaystyle\mathrm{val}(f) = \sum_{e\text{ out of }s} f(e) - \sum_{e\text{ in to }s}f(e)\)

Maximum-flow problem

Defn: An \(st\)-flow \(f\) is a function that satisfies:

Defn: The value of a flow \(f\): \(\displaystyle\mathrm{val}(f) = \sum_{e\text{ out of }s} f(e) - \sum_{e\text{ in to }s}f(e)\)

Max-flow Problem: Find a flow of maximum value.

network flow (7)

ford-fulkerson algorithm

toward a max-flow algorithm

Greedy algorithm (first attempt at max-flow)

toward a max-flow algorithm

Greedy algorithm (first attempt at max-flow)

Greedy algorithm above ended with flow value of 16, however the max-flow value is 19

why the greedy algorithm fails

Q: Why does the greedy algorithm fail?
A: Once greedy algorithm increases flow on an edge, it never decreases it

Ex: Consider flow network \(G\) below

Bottom line: need some mechanism to "undo" a bad decision

residual network

Original edge: \(e = (u,v) \in E\)

Reverse edge: \(e^\text{reverse} = (v,u)\)

Residual capacity: \( c_f(e) = \begin{cases} c(e) - f(e) & \text{if } e \in E \\ f(e) & \text{if } e^\text{reverse} \in E \end{cases} \)

Residual network: \(G_f = (V, E_f, s, t, c_f)\)

Augmenting path

Defn: An augmenting path is a simple \(s{\leadsto}t\) path (no repeat vertices) in the residual network \(G_f\)

Defn: The bottleneck capacity of an augmenting path \(P\) is the minimum residual capacity of any edge in \(P\)

Key property: Let \(f\) be a flow and let \(P\) be an augmenting path in \(G_f\). Then, after calling \(f' \leftarrow \mathrm{Augment}(f,c,P)\), the resulting \(f'\) is a flow and \(\mathit{val}(f') = \mathit{val}(f) + \mathit{bottleneck}(G_f,P)\).

Augment(f, c, P)
    delta <- bottleneck capacity of augmenting path P
    Foreach edge e in P
        if e in E: f(e)    <- f(e)    + delta
        else:      f(erev) <- f(erev) - delta
    Return f

Quiz: network flow

live view ]

Which is the augmenting path of highest bottleneck capacity?

  1. \(s \rightarrow e \rightarrow f \rightarrow t\)
  2. \(s \rightarrow a \rightarrow b \rightarrow c \rightarrow t\)
  3. \(s \rightarrow e \rightarrow a \rightarrow f \rightarrow t\)
  4. \(s \rightarrow e \rightarrow a \rightarrow f \rightarrow b \rightarrow c \rightarrow t\)

ford-fulkerson algorithm

Ford-Fulkerson augmenting path algorithm

Ford-Fulkerson(G)
    Foreach edge e in E: f(e) <- 0
    Gf <- residual network of G with respect to flow f
    While(there exists an s-t path P in Gf)  // P: augmenting path
        f <- Augment(f, c, P)
        Update Gf
    Return f

group: example network

group: example network

network flow (7)

max-flow min-cut theorem

relationship between flows and cuts

Flow Value lemma: Let \(f\) be any flow and let \((A,B)\) be any cut. Then, value of flow \(f\) equals the net flow across the cut \((A,B)\).

\[ \mathit{val}(f) = \sum_{e\text{ out of }A} f(e) - \sum_{e\text{ in to }A} f(e) \]

quiz: network flow

live view ]

Which is the net flow across the given cut?

  1. \(11 = (20 + 25) - (8 + 11 + 9 + 6)\)
  2. \(26 = (20 + 22) - (8 + 4 + 4)\)
  3. \(42 = (20 + 22)\)
  4. \(45 = (20 + 25)\)

relationship between flows and cuts

Flow Value lemma: Let \(f\) be any flow and let \((A,B)\) be any cut. Then, value of flow \(f\) equals the net flow across the cut \((A,B)\).

Pf:

\[ \begin{eqnarray} \mathit{val}(f) & = & \sum_{e\text{ out of }s} f(e) - \sum_{e\text{ in to }s} f(e) \\ & =^\dagger & \sum_{v \in A}\left( \sum_{e\text{ out of }v} f(e) - \sum_{e\text{ in to }v} f(e) \right) \\ & = & \sum_{e\text{ out of }A} f(e) - \sum_{e\text{ in to }A} f(e) \quad\qed \end{eqnarray} \]

\(\dagger\): by flow conservation, all terms except for \(v=s\) are \(0\)

relationship between flows and cuts

Weak Duality: Let \(f\) be any flow and \((A,B)\) be any cut. Then, \(\mathit{val}(f) \leq \mathit{cap}(A,B)\).

Pf: \[ \mathit{val}(f) =^\dagger \sum_{e\text{ out of }A} f(e) - \sum_{e\text{ in to }A} f(e) \leq \sum_{e\text{ out of }A} f(e) \leq \sum_{e\text{ out of }A} c(e) = \mathit{cap}(A, B) \quad\qed \]

\(\dagger\): flow value lemma

certificate of optimality

Corollary: Let \(f\) be a flow and let \((A,B)\) be any cut. If \(\mathit{val}(f) = \mathit{cap}(A,B)\), then \(f\) is a max flow and \((A,B)\) is a min cut.

Pf:

max-flow min-cut theorem

Max-flow min-cut theorem: Value of max flow = capacity of min cut (strong duality)



[ 1956, 1955, 1956 ]

max-flow min-cut theorem

Max-flow min-cut theorem: Value of max flow = capacity of min cut (strong duality)

Augmenting path theorem: Flow \(f\) is max flow iff no augmenting paths

Pf: The following three conditions are equivalent for any flow \(f\):

  1. There exists a cut \((A,B)\) such that \(\mathit{cap}(A,B) = \mathit{val}(f)\)
  2. \(f\) is a max flow
  3. There is no augmenting path with respect to \(f\)
    (if Ford-Fulkerson terminates then \(f\) is max flow)

Pf 1 ⇒ 2:

max-flow min-cut theorem

Max-flow min-cut theorem: Value of max flow = capacity of min cut (strong duality)

Augmenting path theorem: Flow \(f\) is max flow iff no augmenting paths

Pf: The following three conditions are equivalent for any flow \(f\):

  1. There exists a cut \((A,B)\) such that \(\mathit{cap}(A,B) = \mathit{val}(f)\)
  2. \(f\) is a max flow
  3. There is no augmenting path with respect to \(f\)
    (if Ford-Fulkerson terminates then \(f\) is max flow)

Pf 2 ⇒ 3 (proved as contrapositive: ¬3 ⇒ ¬2)

max-flow min-cut theorem

Pf 3 ⇒ 1:

\[\begin{eqnarray} \mathit{val}(f) & = & \sum_{e\text{ out of }A} f(e) - \sum_{e\text{ in to }A} f(e) \\ & = & \sum_{e\text{ out of }A} c(e) - 0 \\ & = & \mathit{cap}(A, B) \quad\qed \end{eqnarray}\]

×