Lecture 21
Lecture 21
6.046J/18.401J
LECTURE 21
Network Flow II
• Max-flow, min-cut theorem
• Ford-Fulkerson algorithm
and analysis
• Edmonds-Karp algorithm
and analysis
• Best algorithms to date
ss uu vv
path in Gf S T
We must have cf (u, v) = 0, since if cf (u, v) > 0, then v ∈ S,
not v ∈ T as assumed. Thus, f (u, v) = c(u, v), since cf (u, v)
= c(u, v) – f (u, v). Summing over all u ∈ S and v ∈ T
yields f (S, T) = c(S, T), and since | f | = f (S, T), the theorem
follows.
© 2001–4 by Charles E. Leiserson Introduction to Algorithms November 29, 2004 L21.6
Ford-Fulkerson max-flow
algorithm
Algorithm:
f [u, v] ← 0 for all u, v ∈ V
while an augmenting path p in G wrt f exists
do augment f by cf (p)
G: ss 1 tt
109 109
G: ss 0:1 tt
0:109 0:109
G: ss 0:1 tt
0:109 0:109
G: ss 1:1 tt
0:109 1:109
G: ss 1:1 tt
0:109 1:109
G: ss 0:1 tt
1:109 1:109
G: ss 0:1 tt
1:109 1:109
G: ss 1:1 tt
1:109 2:109
G: ss 1:1 tt
1:109 2:109
Case 1: (u, v) ∈ Ef .
We have
δ(v) ≤ δ(u) + 1 (triangle inequality)
≤ δ′(u) + 1 (induction)
= δ′(v) (breadth-first path),
and thus monotonicity of δ(v) is established.