Beruflich Dokumente
Kultur Dokumente
Algorithms
6.046J/18.401J
LECTURE 13
Network Flow
Flow networks
Maximum-flow problem
Cuts
Residual networks
Augmenting paths
Max-flow min-cut theorem
Flow networks
2
3
3
3
s
2
200115 by Leiserson et al
3
2
3
Design and Analysis of Algorithms
L13.2
A flow on a network
capacity
flow
2:2
2:3
1:3
1:3
s
2:2
1:3
1:2
2:3
Flow into u is 2 + 1 = 3.
Flow out of u is 1 + 2 = 3.
INTUITION: View flow as a rate, not a quantity.
200115 by Leiserson et al
L13.3
2:3
0:3
s
2:2
1:3
2:2
3:3
200115 by Leiserson et al
L13.4
s
2
200115 by Leiserson et al
1
2
u
u
L13.5
Net Flow
f (u, v) = 0.
vV
Note: CLRS defines positive flows and net flows; these are
200115 by Leiserson et al
L13.6
Notation
= f (s,V ) .
Implicit summation notation: A set used in
an arithmetic formula represents a sum over
the elements of the set.
Example flow conservation:
200115 by Leiserson et al
L13.7
Lemma.
f (X, X) = 0,
f (X, Y) = f (Y, X),
f (XY, Z) = f (X, Z) + f (Y, Z) if XY = .
Theorem. | f | = f (V, t).
Proof.
|f| =
=
=
=
=
200115 by Leiserson et al
f (s, V)
f (V, V) f (Vs, V)
Omit braces.
f (V, Vs)
f (V, t) + f (V, Vst)
f (V, t).
Design and Analysis of Algorithms
L13.8
2:2
2:3
2:3
0:3
2:2
2:2
3:3
| f | = f (s, V) = 4
200115 by Leiserson et al
1:3
f (V, t) = 4
L13.9
Cuts
2:3
0:3
s
2:2
1:3
S
T
2:2
3:3
f (S, T) = (2 + 2) + ( 2 + 1 1 + 2) = 4
200115 by Leiserson et al
L13.10
Another characterization of
flow value
Lemma. For any flow f and any cut (S, T), we
have | f | = f (S, T).
Proof.
200115 by Leiserson et al
L13.11
Capacity of a cut
Definition. The capacity of a cut (S, T) is c(S, T).
2:2
2:3
2:3
0:3
s
2:2
1:3
2:2
3:3
c(S, T) = (3 + 2) + (1 + 3) = 9
200115 by Leiserson et al
L13.12
f = f (S,T )
= f (u, v)
uS vT
c(u, v)
uS vT
= c(S,T ) .
200115 by Leiserson et al
L13.13
Residual network
|Ef | 2 |E|.
200115 by Leiserson et al
L13.14
1:3
1:3
2:2
s
2
2:3
1:3
2
1
2:3
Gf
2:2
1
2
1
1
2
1
1:2
t
1
2
200115 by Leiserson et al
L13.15
Augmenting paths
Gf
s
2
v
2
1
1
2
1
t
1
200115 by Leiserson et al
L13.16
2:3
2:2
0:3
s
2:2
3:3
1:3
2:3
1:2
L13.17
200115 by Leiserson et al
L13.18
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)
200115 by Leiserson et al
L13.19
MIT OpenCourseWare
http://ocw.mit.edu
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.