Unit 8: Network Flows, Max-Flow Min-Cut Theorem & Combinatorial Optimization
Algorithmic network flow theory and combinatorial duality: flow networks, conservation laws and skew symmetry, residual networks and bottleneck capacities, the Ford-Fulkerson augmenting path method, Edmonds-Karp BFS polynomial bound ($O(V E^2)$), the Max-Flow Min-Cut Theorem with complete duality proof, Dinic's blocking flow algorithm, push-relabel schemes, and reductions to Maximum Bipartite Matching, Hall's Marriage Theorem, and Menger's Theorem for edge-disjoint paths.
§8.1 Flow Networks, Capacities, Conservation Laws & Residual Graphs
1. The Mathematical Flow Network
A flow network $G = (V, E, c, s, t)$ is a directed graph where:
- Each directed edge $(u, v) \in E$ has a non-negative capacity $c(u, v) \ge 0$. (If $(u, v) \notin E$, $c(u, v) = 0$).
- There is a designated source vertex $s \in V$ and sink vertex $t \in V$ ($s \ne t$).
Definition 8.1 (Feasible Flow): A flow is a real-valued function $f: V \times V \to \mathbb{R}$ satisfying two fundamental physical axioms:
- Capacity Constraint: For all $u, v \in V$:
- Conservation of Flow: For every vertex $u \in V \setminus \{s, t\}$:
(Total inflow into $u$ strictly equals total outflow from $u$).
The net value of the flow $|f|$ is the total net flow exiting the source $s$:
By conservation of flow across all intermediate nodes, this equals the net flow entering the sink $t$.
2. Residual Networks and Augmenting Paths
Given a flow $f$ in network $G$, the residual network $G_f = (V, E_f)$ models the remaining capacity available to send additional flow or cancel existing flow:
- The residual capacity $c_f(u, v)$ is:
- The residual edge set is $E_f = \{(u, v) \in V \times V \mid c_f(u, v) > 0\}$.
An augmenting path $p$ is a simple directed path from source $s$ to sink $t$ in the residual graph $G_f$. The bottleneck capacity of an augmenting path $p$ is:
§8.2 The Ford-Fulkerson Method & Edmonds-Karp BFS Algorithm
1. The Ford-Fulkerson Method
Lester Ford and Delbert Fulkerson (1956) proposed the general augmenting path framework:
- Initialize flow $f(u, v) = 0$ for all $(u, v) \in E$.
- While there exists an augmenting path $p$ from $s$ to $t$ in residual network $G_f$:
- Compute bottleneck $\Delta = c_f(p) = \min_{(u, v) \in p} c_f(u, v)$.
- Augment flow $f$ along path $p$ by $\Delta$:
- Return flow $f$.
Caveat on Path Selection: If augmenting paths are chosen arbitrarily using DFS with irrational capacities, the Ford-Fulkerson method may fail to terminate or converge to a value strictly less than the maximum flow! Even with integer capacities, running time is $O(|E| \cdot |f^*|)$, which is pseudo-polynomial.
2. The Edmonds-Karp Algorithm ($O(|V| |E|^2)$)
Jack Edmonds and Richard Karp (1972) solved the convergence problem by selecting the augmenting path using Breadth-First Search (BFS), choosing the shortest path in terms of the number of edges.
Theorem 8.1 (Edmonds-Karp Shortest-Path Monotonicity): When BFS is used to find augmenting paths, for all vertices $v \in V \setminus \{s, t\}$, the shortest-path distance $\delta_f(s, v)$ in the residual network $G_f$ increases monotonically with each augmentation:
Theorem 8.2 (Edmonds-Karp Complexity): The total number of augmentations performed by the Edmonds-Karp algorithm is at most $O(|V| \cdot |E|)$. Since each BFS takes $O(|E|)$ time, the total running time is:
§8.3 The Max-Flow Min-Cut Theorem & Capacity Cuts
1. Cuts in Flow Networks
Definition 8.2 (Cut): An $(s, t)$-cut in a flow network $G = (V, E)$ is a partition of $V$ into two disjoint subsets $S$ and $T = V \setminus S$ such that $s \in S$ and $t \in T$.
The capacity of the cut $(S, T)$ is the sum of the capacities of all edges going from $S$ into $T$:
(Note: Edges going backwards from $T$ to $S$ do NOT contribute to the cut capacity).
The net flow across the cut $(S, T)$ is:
Lemma 8.1 (Flow Equivalence Across Any Cut): For any feasible flow $f$ and any $(s, t)$-cut $(S, T)$:
Corollary 8.1 (Weak Duality / Cut Capacity Upper Bound): For any feasible flow $f$ and any $(s, t)$-cut $(S, T)$:
Proof: $|f| = f(S, T) = \sum_{u \in S, v \in T} f(u, v) - \sum_{v \in T, u \in S} f(v, u) \le \sum_{u \in S, v \in T} f(u, v) \le \sum_{u \in S, v \in T} c(u, v) = c(S, T)$. $\blacksquare$
2. The Max-Flow Min-Cut Theorem
Theorem 8.3 (Max-Flow Min-Cut Theorem - Ford & Fulkerson, 1956): Let $f$ be a flow in a flow network $G = (V, E, c, s, t)$. The following three conditions are logically equivalent:
- $f$ is a maximum flow in $G$.
- The residual network $G_f$ contains no augmenting paths from $s$ to $t$.
- $|f| = c(S, T)$ for some $(s, t)$-cut $(S, T)$ (which is necessarily a minimum cut).
In particular:
§8.4 Advanced Flow Algorithms: Dinic's & Push-Relabel Schemes
1. Dinic's Blocking Flow Algorithm ($O(|V|^2 |E|)$)
Yefim Dinic (1970) introduced the concept of layered networks and blocking flows:
- Construct the layered network $G_L$ using BFS from $s$, where vertices are assigned level numbers $\text{level}(v) = \text{dist}(s, v)$. Edges only go from level $k$ to level $k+1$.
- In the layered network $G_L$, find a blocking flow using DFS (a flow where every path from $s$ to $t$ contains at least one saturated edge).
- Update the residual network and repeat.
Dinic's algorithm requires at most $|V|-1$ phase iterations. Finding a blocking flow takes $O(|V| |E|)$ time, yielding total time:
On unit networks (where capacities are 1, e.g., bipartite matching), Dinic runs in $O(|E| \sqrt{|V|})$ time!
2. Goldberg-Tarjan Push-Relabel Algorithm
Unlike Ford-Fulkerson which maintains flow conservation at all times, the push-relabel method allows nodes to store excess flow (preflow):
- Vertices are assigned height/distance labels $h(u)$, initialized with $h(s) = |V|$ and $h(t) = 0$.
- Push Operation: If $e(u) > 0$, $c_f(u, v) > 0$, and $h(u) = h(v) + 1$, push $\min(e(u), c_f(u, v))$ flow from $u$ to $v$.
- Relabel Operation: If $e(u) > 0$ and no push is possible, increase height: $h(u) \gets 1 + \min \{h(v) \mid (u, v) \in E_f\}$.
Running time with highest-label selection is $O(|V|^2 \sqrt{|E|})$, outperforming augmenting paths on dense graphs.
§8.5 Bipartite Matching, Hall's Theorem & Interactive Max-Flow Simulator
1. Reduction: Maximum Bipartite Matching to Max-Flow
Let $G = (X \cup Y, E)$ be an undirected bipartite graph. Construct directed flow network $G' = (V', E', c)$ by:
- $V' = X \cup Y \cup \{s, t\}$.
- Add directed edges $(s, x)$ for all $x \in X$ with capacity $c(s, x) = 1$.
- Add directed edges $(y, t)$ for all $y \in Y$ with capacity $c(y, t) = 1$.
- Direct all bipartite edges from $X$ to $Y$: $(x, y)$ with capacity $c(x, y) = \infty$ (or 1).
Integrality Theorem: If all edge capacities are integers, the maximum flow computed by Ford-Fulkerson is strictly integer-valued ($f(e) \in \{0, 1\}$). The edges between $X$ and $Y$ with $f(x, y) = 1$ form a maximum matching of $G$, and $|f^*| = \text{max matching size}$.
2. Hall's Marriage Theorem via Max-Flow Min-Cut
Theorem 8.4 (Hall's Marriage Theorem, 1935): A bipartite graph $G = (X \cup Y, E)$ has a matching that saturates every vertex in $X$ if and only if Hall's Condition holds:
where $N(A) = \{y \in Y \mid \exists x \in A, \{x, y\} \in E\}$ is the neighborhood of $A$.
Proof via Min-Cut Duality: If the max flow is less than $|X|$, then by Max-Flow Min-Cut, there exists a cut $(S, T)$ with capacity $c(S, T) < |X|$. Let $A = X \setminus S$ (the vertices of $X$ on the sink side of the cut). The edges crossing the cut are $(s, x)$ for $x \in X \setminus A$ and $(y, t)$ for $y \in N(A) \cap S$. Calculating capacity: $c(S, T) = (|X| - |A|) + |N(A)|$. Since $c(S, T) < |X|$, we have $|X| - |A| + |N(A)| < |X| \implies |N(A)| < |A|$, which directly violates Hall's condition! $\blacksquare$
3. Interactive Max-Flow Min-Cut Simulator
The simulation below demonstrates network flow dynamics:
- Augmenting Path Tracer: Step-by-step BFS finding augmenting paths and bottleneck residual capacities.
- Residual Graph Display: Toggle between real-time flow and residual edge capacities.
- Minimum Cut Visualizer: Visualizes reachable vertices $S$ from source $s$, highlighting the bottleneck saturated edges crossing into $T$.
Rigorous Tiered Solved Examination Problems
Step-by-step unskipped derivations, complete proofs, and verification across Foundational, Advanced, and Honors tiers.
Consider the flow network $G = (V, E)$ with vertices $V = \{s, A, B, C, D, t\}$ and directed edge capacities:
- $(s, A): 10$, $(s, C): 10$
- $(A, B): 4$, $(A, C): 2$, $(A, D): 8$
- $(C, D): 9$
- $(B, t): 10$
- $(D, B): 6$, $(D, t): 10$
- Trace the Edmonds-Karp algorithm step-by-step:
- Identify each augmenting path $p$ selected by Breadth-First Search (BFS).
- Compute the bottleneck capacity $c_f(p)$ for each path.
- Update the residual capacities of forward and backward edges.
- Calculate the final maximum flow value $|f^*|$.
- Identify the subset $S \subseteq V$ of vertices reachable from $s$ in the final residual graph $G_f$, and compute the capacity of the resulting minimum cut $(S, V \setminus S)$ to verify the Max-Flow Min-Cut theorem.
1. Step-by-Step Edmonds-Karp Trace
Initial flow: $f(e) = 0$ for all edges.
Augmentation 1:
- BFS searches for the shortest path in edge count from $s$ to $t$:
Path $p_1: s \to A \to B \to t$ (length 3 edges).
- Capacities along $p_1$:
$c_f(s, A) = 10, \; c_f(A, B) = 4, \; c_f(B, t) = 10$.
- Bottleneck: $\Delta_1 = \min(10, 4, 10) = 4$.
- Update flow:
$f(s, A) = 4, \; f(A, B) = 4, \; f(B, t) = 4$.
- Residual capacity updates:
$c_f(s, A) = 6, \; c_f(A, s) = 4$. $c_f(A, B) = 0$ (Saturated!), $c_f(B, A) = 4$. $c_f(B, t) = 6, \; c_f(t, B) = 4$.
- Flow value: $|f| = 4$.
Augmentation 2:
- BFS finds the next shortest path:
Path $p_2: s \to C \to D \to t$ (length 3 edges).
- Capacities along $p_2$:
$c_f(s, C) = 10, \; c_f(C, D) = 9, \; c_f(D, t) = 10$.
- Bottleneck: $\Delta_2 = \min(10, 9, 10) = 9$.
- Update flow:
$f(s, C) = 9, \; f(C, D) = 9, \; f(D, t) = 9$.
- Residual capacities:
$c_f(s, C) = 1, \; c_f(C, s) = 9$. $c_f(C, D) = 0$ (Saturated!), $c_f(D, C) = 9$. $c_f(D, t) = 1, \; c_f(t, D) = 9$.
- Flow value: $|f| = 4 + 9 = 13$.
Augmentation 3:
- BFS shortest path:
Path $p_3: s \to A \to D \to t$ (length 3 edges).
- Capacities along $p_3$:
$c_f(s, A) = 6, \; c_f(A, D) = 8, \; c_f(D, t) = 1$.
- Bottleneck: $\Delta_3 = \min(6, 8, 1) = 1$.
- Update flow:
$f(s, A) = 4 + 1 = 5$. $f(A, D) = 1$. $f(D, t) = 9 + 1 = 10$ (Saturated!).
- Residual capacities:
$c_f(s, A) = 5, \; c_f(A, s) = 5$. $c_f(A, D) = 7, \; c_f(D, A) = 1$. $c_f(D, t) = 0$ (Saturated!), $c_f(t, D) = 10$.
- Flow value: $|f| = 13 + 1 = 14$.
Augmentation 4:
- BFS shortest path:
Path $p_4: s \to A \to D \to B \to t$ (length 4 edges).
- Capacities along $p_4$:
$c_f(s, A) = 5, \; c_f(A, D) = 7, \; c_f(D, B) = 6, \; c_f(B, t) = 6$.
- Bottleneck: $\Delta_4 = \min(5, 7, 6, 6) = 5$.
- Update flow:
$f(s, A) = 5 + 5 = 10$ (Saturated!). $f(A, D) = 1 + 5 = 6$. $f(D, B) = 5$. $f(B, t) = 4 + 5 = 9$.
- Residual capacities:
$c_f(s, A) = 0$ (Saturated!), $c_f(A, s) = 10$. $c_f(A, D) = 2, \; c_f(D, A) = 6$. $c_f(D, B) = 1, \; c_f(B, D) = 5$. $c_f(B, t) = 1, \; c_f(t, B) = 9$.
- Flow value: $|f| = 14 + 5 = 19$.
Augmentation 5:
- Looking for path from $s$:
$c_f(s, A) = 0$. Only outgoing edge from $s$ with residual capacity $>0$ is $(s, C)$ with $c_f(s, C) = 1$.
- From $C$:
$c_f(C, D) = 0$. No other outgoing edges from $C$.
- BFS terminates: No path exists from $s$ to $t$ in $G_f$!
2. Maximum Flow Value
The maximum flow achieved is:
3. Reachability Set and Minimum Cut Verification
In the final residual network $G_f$, find all vertices reachable from $s$:
- Start at $s$.
- Can reach $C$ via edge $(s, C)$ because $c_f(s, C) = 1 > 0$.
- From $C$: no outgoing residual edges with capacity $> 0$.
- From $s$: edge to $A$ has $c_f(s, A) = 0$.
Thus, the set of reachable vertices from $s$ is:
The complement set is:
Calculate the cut capacity $c(S, T)$:
(Note: edge $(A, C)$ goes from $T$ to $S$, so it is NOT included).
Since $|f^*| = 19 = c(S, T)$, the Max-Flow Min-Cut theorem is verified with exact equality! $\blacksquare$
Let $G = (V, E, c, s, t)$ be a flow network with real capacities $c: E \to \mathbb{R}^+$.
- Prove the Flow Conservation Lemma Across Cuts: For any feasible flow $f$ and any $(s, t)$-cut $(S, T)$, the net flow across $(S, T)$ satisfies:
- Prove Weak Duality: For any feasible flow $f$ and any $(s, t)$-cut $(S, T)$, $|f| \le c(S, T)$.
- Prove Strong Duality (Max-Flow Min-Cut Theorem): If a feasible flow $f^$ admits no augmenting path in the residual network $G_{f^}$, then there exists an $(s, t)$-cut $(S^, T^)$ such that:
thereby proving that $f^$ is a maximum flow and $(S^, T^*)$ is a minimum cut.
1. Proof of Flow Conservation Lemma Across Cuts
Let $(S, T)$ be any $(s, t)$-cut, so $s \in S$ and $t \in T = V \setminus S$. By definition of flow value, for the source node $s$:
For every intermediate node $u \in S \setminus \{s\}$ (since $t \notin S$):
Summing these expressions over all vertices $u \in S$:
Now split the summation over $v \in V$ into $v \in S$ and $v \in T$:
In the first two double sums, both indices $u$ and $v$ range over $S$. Renaming dummy variables reveals that $\sum_{u \in S}\sum_{v \in S} f(u, v)$ and $\sum_{u \in S}\sum_{v \in S} f(v, u)$ are identical sums of internal edge flows, so they cancel completely! What remains is:
Thus, the net flow across any cut $(S, T)$ strictly equals $|f|$. $\blacksquare$
2. Proof of Weak Duality
By part 1:
By the capacity constraint, flow is non-negative, so $f(v, u) \ge 0$, which implies $-\sum_{v \in T}\sum_{u \in S} f(v, u) \le 0$. Furthermore, $f(u, v) \le c(u, v)$ for all edges. Therefore:
Hence, the capacity of any cut is an upper bound on the value of any feasible flow:
3. Proof of Strong Duality (Max-Flow Min-Cut Theorem)
Let $f^$ be a feasible flow such that the residual network $G_{f^}$ contains no augmenting paths from $s$ to $t$. Define the set:
and let $T^ = V \setminus S^$.
1. $(S^*, T^*)$ is a valid $(s, t)$-cut:
- Clearly $s \in S^*$ (path of length 0).
- Since $G_{f^}$ contains no path from $s$ to $t$, $t \notin S^$, which means $t \in T^*$.
2. Analysis of edges crossing from $S^*$ to $T^*$:
Let $u \in S^$ and $v \in T^$. Suppose for contradiction that $(u, v) \in E$ and $f^*(u, v) < c(u, v)$. Then the residual capacity is:
This implies that $(u, v)$ is an edge in the residual graph $G_{f^*}$! Since $u \in S^$, there is a path from $s$ to $u$ in $G_{f^}$. Appending edge $(u, v)$ yields a path from $s$ to $v$ in $G_{f^}$, meaning $v \in S^$. This contradicts $v \in T^*$! Therefore, for every edge $(u, v) \in E$ with $u \in S^, v \in T^$, we must have:
3. Analysis of backward edges from $T^*$ to $S^*$:
Suppose for contradiction that $(v, u) \in E$ with $v \in T^, u \in S^$ and $f^*(v, u) > 0$. Then the backward residual capacity is:
This again implies $(u, v) \in E_{f^}$, making $v$ reachable from $s$ in $G_{f^}$ ($v \in S^*$), another contradiction! Therefore, for every edge $(v, u) \in E$ with $v \in T^, u \in S^$:
Now compute the net flow across $(S^, T^)$ using Lemma 8.1:
By Weak Duality, no flow can exceed $c(S^, T^)$, so $f^$ achieves the absolute maximum possible flow, and $(S^, T^*)$ achieves the absolute minimum possible cut capacity. Hence:
Let $G = (X \cup Y, E)$ be a finite bipartite graph with vertex bipartition $(X, Y)$.
- Construct the canonical flow network reduction $G' = (V', E', c)$ for finding a maximum bipartite matching.
- Prove that the Integrality Theorem guarantees that the maximum flow in $G'$ corresponds to a maximum matching in $G$.
- Prove Hall's Marriage Theorem as an immediate consequence of the Max-Flow Min-Cut Theorem:
$G$ has a matching covering all vertices in $X$ if and only if for all $A \subseteq X$, $|N(A)| \ge |A|$.
- Show how Menger's Theorem (the maximum number of edge-disjoint paths between $s$ and $t$ equals the minimum size of an edge cut separating $s$ and $t$) follows directly from unit network flow duality.
1. Construction of Canonical Flow Network $G'$
Given bipartite graph $G = (X \cup Y, E)$:
- Vertex set: $V' = X \cup Y \cup \{s, t\}$, where $s$ is a new source and $t$ is a new sink.
- Directed edge set and capacities:
- For each $x \in X$, add edge $(s, x)$ with capacity $c(s, x) = 1$.
- For each $y \in Y$, add edge $(y, t)$ with capacity $c(y, t) = 1$.
- For each undirected edge $\{x, y\} \in E$ with $x \in X, y \in Y$, add directed edge $(x, y)$ with capacity $c(x, y) = \infty$ (or $c(x, y) = 1$).
2. Integrality and Matching Equivalence
By the Integrality Theorem for Network Flows: If all edge capacities are integers, the Ford-Fulkerson algorithm (with integer additions) terminates with a flow where $f(e) \in \mathbb{Z}$ for every edge $e$.
- For each edge $(s, x)$, capacity is 1, so $f(s, x) \in \{0, 1\}$.
- For each edge $(y, t)$, capacity is 1, so $f(y, t) \in \{0, 1\}$.
- By conservation of flow at $x \in X$: $\sum_{y \in Y} f(x, y) = f(s, x) \le 1$. Thus, at most one outgoing edge from $x$ carries flow 1.
- By conservation of flow at $y \in Y$: $\sum_{x \in X} f(x, y) = f(y, t) \le 1$. Thus, at most one incoming edge into $y$ carries flow 1.
Therefore, the set of edges:
is a valid matching in $G$ (no two edges share a vertex). The size of the matching is:
Conversely, any matching $M$ of size $k$ yields a valid integer flow of value $k$. Thus:
3. Proof of Hall's Marriage Theorem via Max-Flow Min-Cut
Necessity ($\implies$):
If a matching $M$ saturates all of $X$, then for any subset $A \subseteq X$, the edges of $M$ incident with $A$ match each element of $A$ to a distinct element in $Y$. All these targets belong to $N(A)$. Therefore, $|N(A)| \ge |A|$.
Sufficiency ($\impliedby$):
Assume Hall's condition holds: $\forall A \subseteq X, |N(A)| \ge |A|$. We must prove that the maximum flow satisfies $|f^*| = |X|$. Suppose for contradiction that $|f^*| < |X|$. By the Max-Flow Min-Cut Theorem, there exists an $(s, t)$-cut $(S, T)$ with capacity:
where $s \in S$ and $t \in T$.
Define the partition of $X$ and $Y$ by the cut:
Now examine the edges crossing from $S$ to $T$:
- Edges from $s$ to $X_T$: Each has capacity 1. There are $|X_T|$ such edges.
- Edges from $Y_S$ to $t$: Each has capacity 1. There are $|Y_S|$ such edges.
- Edges from $X_S$ to $Y_T$: Each has capacity $\infty$.
Since $c(S, T) < |X| < \infty$, the cut capacity must be finite! Therefore, there can be no edges from $X_S$ to $Y_T$:
This implies that all neighbors of $X_S$ in $G$ must lie inside $Y_S$:
Now calculate the capacity of the cut:
Since $X$ is partitioned into $X_S$ and $X_T$, $|X_T| = |X| - |X_S|$. Substitute this into the inequality:
Subtracting $|X|$ from both sides:
Since $|N(X_S)| \le |Y_S|$, we obtain:
Letting $A = X_S \subseteq X$, we have constructed a subset $A$ such that:
This directly contradicts Hall's Condition! Therefore, the contradiction assumption was false. We must have $|f^*| = |X|$, guaranteeing a matching that saturates all of $X$. $\blacksquare$
4. Menger's Theorem for Edge-Disjoint Paths
Let $G = (V, E)$ be a directed graph with source $s$ and sink $t$. Assign every edge unit capacity $c(e) = 1$.
- By the Integrality Theorem, the maximum flow $f^$ is an integer flow with $f^(e) \in \{0, 1\}$.
- By flow decomposition, any $0-1$ flow can be decomposed into $|f^*|$ edge-disjoint directed paths from $s$ to $t$.
- By the Max-Flow Min-Cut Theorem, $|f^| = c(S^, T^*)$.
- Since every edge has capacity 1, $c(S^, T^)$ is precisely the number of edges crossing from $S^$ to $T^$, which forms a minimal edge cut disconnecting $s$ from $t$.
Hence, the maximum number of edge-disjoint paths from $s$ to $t$ equals the minimum number of edges whose removal disconnects $s$ and $t$. $\blacksquare$