Lecture 21 - Flowcut
Lecture 21 - Flowcut
Graph G = (V , E, c):
3/4
2 4 |f | = 18
2/4
/ 10 7/
8
⇠
8/ 10
10 0/2 8/ 6/6
⇠10
8
9/
⇠ ⇠
8/10 8/9 10/10
s 3 5 t
9/10 9/9
Residual Graph Gf = (V , Ef , cf ):
2
2 2 4
8
10
8
2 6 2
8 8
10
s 2 3 1 5 t
Lent 2015
Outline
Recap
Analysis of Ford-Fulkerson
za
SECRET
3
a)
Maximum Flow is 163,000 tons per day!
On,
LL,,
cCfl
(a
_Z
oS
70
21
Z
0!
E
w 0>a
0
a_
R
-C
=
Of
~0a
a cc
'ma
In
-05
0
0
7-
4'
s1 s1
10 10
12 12
3 3
∞
s2 t1 s2 t1
15 15
5 5
∞
∞
8 8
6 ∞ 6 ∞
s3 t2 s s3 t2 t
20 20
14 14
7 7
∞
13 13
s4 t3 s4 t3
18 18
∞
11 11
2 2
s5 s5
(a) (b)
26.1-2
Extend the flow properties and definitions to theT.S.
6.6: Maximum flow
multiple-source, multiple-sink
4
problem. Show that any flow in a multiple-source, multiple-sink flow network
Multiple Sources and Multiple Sinks (Figure 26.1)
26.1 Flow networks 713
s1 s1
10 10
12 12
3 3
∞
s2 t1 s2 t1
15 15
5 5
∞
∞
8 8
6 ∞ 6 ∞
s3 t2 s s3 t2 t
20 20
14 14
7 7
∞
13 13
s4 t3 s4 t3
18 18
∞
11 11
2 2
s5 s5
(a) (b)
26.1-2
Extend the flow properties and definitions to theT.S.
6.6: Maximum flow
multiple-source, multiple-sink
4
problem. Show that any flow in a multiple-source, multiple-sink flow network
Residual Graph
Original Edge
Edge e = (u, v ) ∈ E
Graph G:
flow f (u, v ) and capacity c(u, v )
6/17
u v
Residual Capacity
c(u, v ) − f (u, v )
if (u, v ) ∈ E ,
cf (u, v ) = f (v , u) if (v , u) ∈ E ,
0 otherwise.
Residual Gf :
11
Residual Graph
u v
Gf = (V , Ef , cf ), Ef := {(u, v ) : cf (u, v ) > 0} 6
Original Edge
Graph G:
Edge e = (u, v ) ∈ E (& possibly e0 = (v , u) ∈ E)
flow f (u, v ) and capacity c(u, v )
6/17
u v
Residual Capacity 2/4
Residual Gf :
Residual Graph
13
Gf = (V , Ef , cf ), Ef := {(u, v ) : cf (u, v ) > 0}
u v
8
1/14
2
5/1 2 4
0
s 4/1 1/6 3/4
Flow network G 5/8 3
3/7 t
4/7
3
1/
2/3
5
13
1
11 2 4
1
11 5 1
s 3
Residual Graph Gf 7 3 4
3 t
8
2
1
2 5
1
1/14
2
5/1 2 4
0
s 4/1 1/6 3/4
Flow network G 5/8 3
3/7 t
4/7
3
1/
2/3
5
1/14
2
5/1 2 4
0
s 4/1 1/6 2/3
Flow network G 5/8 3
2/6 t
4/7
2
0/
2/3
5
1/14
2
5/1 2 4
0
s 4/1 1/6 2/3
Flow network G 5/8 3
2/6 t
4/7
2
0/
2/3
5
1/14
2
5/1 2 4
0
4/1 1/6 2/3
s
Flow network G 5/8 3
2/6 t
4/7
2
0/
2/3
5
1/14
2
1/1 2 4
0
0/1 1/6 2/3
s
Flow network G 5/8 3
2/6 t
4/7
2
0/
2/3
5
1/14
2
1/1 2 4
0
s 0/1 1/6 2/3
Flow network G 5/8 3
2/6 t
4/7
2
0/
2/3
5
1/14
2
1/1 2 4
0
s 0/1 1/6 2/3
Flow network G 5/8 3
4/7 2/6 t
2
0/
2/3
5
1/14
2
1/1 2 4
0
s 0/1 1/6 2/3
Flow network G 1/8 3
0/7 2/6 t
2
0/
2/3
5
1/14
2
1/1 2 4
0
s 0/1 1/6 2/3
Flow network G 1/8 3
2/6 t
0/7
2
0/
2/3
5
2
0/
2/3
5
2
0/
2/3
5
2
0/
2/3
5
0/14
2
0/1 2 4
0
s 0/1 0/6 2/3
Flow network G 0/8 3
2/6 t
0/7
2
0/
2/3
5
0/14
2
0/1 2 4
0
s 0/1 0/6 2/3
Flow network G 0/8 3
2/6 t
0/7
2
0/
2/3
5
0/14
2
0/1 2 4
0
s 0/1 0/6 2/3
Flow network G 0/8 3
2/6 t
0/7
2
0/
2/3
5
0: def fordFulkerson(G)
1: initialize flow to 0 on all edges
2: while an augmenting path in Gf can be found:
3: push as much extra flow as possible through it
Questions:
How to find an augmenting path? X
Does this method terminate?
If it terminates, how good is the solution?
Recap
Analysis of Ford-Fulkerson
Graph G = (V , E, c):
4
2 4
10
10
2 6
10 9 10
s 3 5 t
Graph G = (V , E, c):
4
2 4
10
10
2 6
10 9 10
s 3 5 t
Graph G = (V , E, c):
4
2 4
10
10
2 6
10 9 10
s 3 5 t
Graph G = (V , E, c):
4
2 4
10
10
2 6
10 9 10
s 3 5 t
Graph G = (V , E, c): |f | = 16
0/4
2 4
8/
0
6/
/1
2/2 6/6
10
10
s 3 5 t
6/10 8/9 10/10
Graph G = (V , E, c): |f | = 16
0/4
2 4
8/
0
6/
/1
2/2 6/6
10
10
s 3 5 t
6/10 8/9 10/10
Graph G = (V , E, c): |f | = 16
0/4
2 4
8/
0
6/
/1
2/2 6/6
10
10
s 3 5 t
6/10 8/9 10/10
Graph G = (V , E, c): |f | = 16
0/4
2 4
8/
0
6/
/1
2/2 6/6
10
10
s 3 5 t
6/10 8/9 10/10
Graph G = (V , E, c): |f | = 16
0/4
2 4
8/
0
6/
/1
2/2 6/6
10
10
s 3 5 t
6/10 8/9 10/10
10 − 2 + 8 = 16
6.6: Maximum flow T.S. 11
From Flows to Cuts
Flow Value Lemma (Lemma 26.4)
Let f be a flow with source s and sink t, and let (S, T ) be any cut of G.
Then the value of the flow is equal to the net flow across the cut, i.e.,
X X
|f | = f (u, v ) − f (v , u).
(u,v )∈E(S,T ) (v ,u)∈E(T ,S)
Graph G = (V , E, c): |f | = 16
0/4
2 4
8/
0
6/
/1
2/2 6/6
10
10
s 3 5 t
6/10 8/9 10/10
Graph G = (V , E, c): |f | = 16
0/4
2 4
8/
0
6/
/1
2/2 6/6
10
10
s 3 5 t
6/10 8/9 10/10
Graph G = (V , E, c): |f | = 16
0/4
2 4
8/
0
6/
/1
2/2 6/6
10
10
s 3 5 t
6/10 8/9 10/10
8 + 8 − 6 + 6 = 16
6.6: Maximum flow T.S. 11
From Flows to Cuts
X X
|f | = f (u, v ) − f (v , u).
(u,v )∈E(S,T ) (v ,u)∈E(T ,S)
Graph G = (V , E, c): |f | = 16
0/4
2 4
8/
0
6/
/1
2/2 6/6
10
10
s 3 5 t
6/10 8/9 10/10
8 + 8 − 6 + 6 = 16
6.6: Maximum flow T.S. 11
From Flows to Cuts
X X
|f | = f (u, v ) − f (v , u).
(u,v )∈E(S,T ) (v ,u)∈E(T ,S)
|f | =
Graph G = (V , E, c): |f | = 16
0/4
2 4
8/
0
6/
/1
2/2 6/6
10
10
s 3 5 t
6/10 8/9 10/10
8 + 8 − 6 + 6 = 16
6.6: Maximum flow T.S. 11
From Flows to Cuts
X X
|f | = f (u, v ) − f (v , u).
(u,v )∈E(S,T ) (v ,u)∈E(T ,S)
X
|f | = f (s, w)
w∈V
Graph G = (V , E, c): |f | = 16
0/4
2 4
8/
0
6/
/1
2/2 6/6
10
10
s 3 5 t
6/10 8/9 10/10
8 + 8 − 6 + 6 = 16
6.6: Maximum flow T.S. 11
From Flows to Cuts
X X
|f | = f (u, v ) − f (v , u).
(u,v )∈E(S,T ) (v ,u)∈E(T ,S)
X X X X
|f | = f (s, w) = f (u, w) − f (w, u)
w∈V u∈S (u,w)∈E (w,u)∈E
Graph G = (V , E, c): |f | = 16
0/4
2 4
8/
0
6/
/1
2/2 6/6
10
10
s 3 5 t
6/10 8/9 10/10
8 + 8 − 6 + 6 = 16
6.6: Maximum flow T.S. 11
From Flows to Cuts
X X
|f | = f (u, v ) − f (v , u).
(u,v )∈E(S,T ) (v ,u)∈E(T ,S)
X X X X
|f | = f (s, w) = f (u, w) − f (w, u)
w∈V u∈S (u,w)∈E (w,u)∈E
X X
= f (u, v ) − f (v , u)
(u,v )∈E(S,T ) (v ,u)∈E(T ,S)
Graph G = (V , E, c): |f | = 16
0/4
2 4
8/
0
6/
/1
2/2 6/6
10
10
s 3 5 t
6/10 8/9 10/10
8 + 8 − 6 + 6 = 16
6.6: Maximum flow T.S. 11
Weak Duality betwen Flows and Cuts
Weak Duality (Corollary 26.5)
Let f be any flow and (S, T ) be any cut.
|f | ≤ c(S, T ).
|f | ≤ c(S, T ).
0/4
2 4
0
6/
8/
/1
2/2 6/6
10
8
10
s 3 5 t
6/10 8/9 10/10
|f | = 10 − 2 + 8 = 16
6.6: Maximum flow T.S. 12
Weak Duality betwen Flows and Cuts
Weak Duality (Corollary 26.5)
Let f be any flow and (S, T ) be any cut. Then the value of f is bounded
from above by the capacity of the cut (S, T ), i.e.,
|f | ≤ c(S, T ).
0/4 4
2 4 2 4
0
6/
8/
/1
10
10
2/2 6/6 2 6
8
10
8
10
10 9 10
s 3 5 t s 3 5 t
6/10 8/9 10/10
|f | = 10 − 2 + 8 = 16 c(S, T )=10+9=19
6.6: Maximum flow T.S. 12
Weak Duality betwen Flows and Cuts
Weak Duality (Corollary 26.5)
Let f be any flow and (S, T ) be any cut. Then the value of f is bounded
from above by the capacity of the cut (S, T ), i.e.,
|f | ≤ c(S, T ).
|f | =
0/4 4
2 4 2 4
0
6/
8/
/1
10
10
2/2 6/6 2 6
8
10
8
10
10 9 10
s 3 5 t s 3 5 t
6/10 8/9 10/10
|f | = 10 − 2 + 8 = 16 c(S, T )=10+9=19
6.6: Maximum flow T.S. 12
Weak Duality betwen Flows and Cuts
Weak Duality (Corollary 26.5)
Let f be any flow and (S, T ) be any cut. Then the value of f is bounded
from above by the capacity of the cut (S, T ), i.e.,
|f | ≤ c(S, T ).
X X
|f | = f (u, v ) − f (v , u)
(u,v )∈E(S,T ) (v ,u)∈E(T ,S)
0/4 4
2 4 2 4
0
6/
8/
/1
10
10
2/2 6/6 2 6
8
10
8
10
10 9 10
s 3 5 t s 3 5 t
6/10 8/9 10/10
|f | = 10 − 2 + 8 = 16 c(S, T )=10+9=19
6.6: Maximum flow T.S. 12
Weak Duality betwen Flows and Cuts
Weak Duality (Corollary 26.5)
Let f be any flow and (S, T ) be any cut. Then the value of f is bounded
from above by the capacity of the cut (S, T ), i.e.,
|f | ≤ c(S, T ).
X X
|f | = f (u, v ) − f (v , u)
(u,v )∈E(S,T ) (v ,u)∈E(T ,S)
X
≤ f (u, v )
(u,v )∈E(S,T )
0/4 4
2 4 2 4
0
6/
8/
/1
10
10
2/2 6/6 2 6
8
10
8
10
10 9 10
s 3 5 t s 3 5 t
6/10 8/9 10/10
|f | = 10 − 2 + 8 = 16 c(S, T )=10+9=19
6.6: Maximum flow T.S. 12
Weak Duality betwen Flows and Cuts
Weak Duality (Corollary 26.5)
Let f be any flow and (S, T ) be any cut. Then the value of f is bounded
from above by the capacity of the cut (S, T ), i.e.,
|f | ≤ c(S, T ).
X X
|f | = f (u, v ) − f (v , u)
(u,v )∈E(S,T ) (v ,u)∈E(T ,S)
X
≤ f (u, v )
(u,v )∈E(S,T )
X
≤ c(u, v )
(u,v )∈E(S,T )
0/4 4
2 4 2 4
0
6/
8/
/1
10
10
2/2 6/6 2 6
8
10
8
10
10 9 10
s 3 5 t s 3 5 t
6/10 8/9 10/10
|f | = 10 − 2 + 8 = 16 c(S, T )=10+9=19
6.6: Maximum flow T.S. 12
Weak Duality betwen Flows and Cuts
Weak Duality (Corollary 26.5)
Let f be any flow and (S, T ) be any cut. Then the value of f is bounded
from above by the capacity of the cut (S, T ), i.e.,
|f | ≤ c(S, T ).
X X
|f | = f (u, v ) − f (v , u)
(u,v )∈E(S,T ) (v ,u)∈E(T ,S)
X
≤ f (u, v )
(u,v )∈E(S,T )
X
≤ c(u, v ) = c(S, T ).
(u,v )∈E(S,T )
0/4 4
2 4 2 4
0
6/
8/
/1
10
10
2/2 6/6 2 6
8
10
8
10
10 9 10
s 3 5 t s 3 5 t
6/10 8/9 10/10
|f | = 10 − 2 + 8 = 16 c(S, T )=10+9=19
6.6: Maximum flow T.S. 12
Max-Flow Min-Cut Theorem
Theorem
The value of the max-flow is equal to the capacity of the min-cut, that is
Proof 3 ⇒ 1:
Proof 3 ⇒ 1:
Suppose that (S, T ) is a cut with c(S, T ) = |f |
3/4 4
G 2 4 Gf 2 4
10 10
0/
9/
7/
10
0/2 6/6 2 6
8
10
1
8
10 9 10
s 3 5 t s 3 5 t
9/10 9/9 10/10
Proof 3 ⇒ 1:
Suppose that (S, T ) is a cut with c(S, T ) = |f |
By Corollary 26.5, for any flow ef ,
3/4 4
G 2 4 Gf 2 4
10 10
0/
9/
7/
10
0/2 6/6 2 6
8
10
1
8
10 9 10
s 3 5 t s 3 5 t
9/10 9/9 10/10
Proof 3 ⇒ 1:
Suppose that (S, T ) is a cut with c(S, T ) = |f |
By Corollary 26.5, for any flow ef , |ef | ≤ c(S, T ) = |f |.
3/4 4
G 2 4 Gf 2 4
10 10
0/
9/
7/
10
0/2 6/6 2 6
8
10
1
8
10 9 10
s 3 5 t s 3 5 t
9/10 9/9 10/10
Proof 3 ⇒ 1:
Suppose that (S, T ) is a cut with c(S, T ) = |f |
By Corollary 26.5, for any flow ef , |ef | ≤ c(S, T ) = |f |.
Hence f is a maximum flow.
3/4 4
G 2 4 Gf 2 4
10 10
0/
9/
7/
10
0/2 6/6 2 6
8
10
1
8
10 9 10
s 3 5 t s 3 5 t
9/10 9/9 10/10
Proof 1 ⇒ 2:
Proof 1 ⇒ 2:
For the sake of contradicion, suppose there is an augmenting path with
respect to f .
0/4 4
G 2 4 Gf 2 4
10
0/ 4
6/
6
8/
10
2/2 6/6 2 6
8
10
1
8
6 8
10
s 3 5 t s 4 3 1 5 t
6/10 8/9 10/10
Proof 1 ⇒ 2:
For the sake of contradicion, suppose there is an augmenting path with
respect to f .
Then we can improve f by increasing the flow along this path.
0/4 4
G 2 4 Gf 2 4
10
0/ 4
6/
6
8/
10
2/2 6/6 2 6
8
10
1
8
6 8
10
s 3 5 t s 4 3 1 5 t
6/10 8/9 10/10
Proof 1 ⇒ 2:
For the sake of contradicion, suppose there is an augmenting path with
respect to f .
Then we can improve f by increasing the flow along this path.
Hence f cannot be a maximum flow.
0/4 4
G 2 4 Gf 2 4
10
0/ 4
6/
6
8/
10
2/2 6/6 2 6
8
10
1
8
6 8
10
s 3 5 t s 4 3 1 5 t
6/10 8/9 10/10
Proof 2 ⇒ 3:
Proof 2 ⇒ 3:
Let f be a flow with no augmenting paths.
3
3/4
G 2 4 Gf 2 1 4
10 7/
0/ 8
2 1 6 1
9/
9
10
0/2 6/6
10
1
9
9 10
s 3 5 t s 1 3 5 t
9/10 9/9 10/10
6.6: Maximum flow T.S. 14
Key Lemma
Proof 2 ⇒ 3:
Let f be a flow with no augmenting paths.
Let S be the nodes reachable from s in Gf , T := V \ S
3
3/4
G 2 4 Gf 2 1 4
10 7/
0/ 8
2 1 6 1
9/
9
10
0/2 6/6
10
1
9
9 10
s 3 5 t s 1 3 5 t
9/10 9/9 10/10
6.6: Maximum flow T.S. 14
Key Lemma
Proof 2 ⇒ 3:
Let f be a flow with no augmenting paths.
Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.
3
3/4
G 2 4 Gf 2 1 4
10 7/
0/ 8
2 1 6 1
9/
9
10
0/2 6/6
10
1
9
9 10
s 3 5 t s 1 3 5 t
9/10 9/9 10/10
6.6: Maximum flow T.S. 14
Key Lemma
Proof 2 ⇒ 3:
Let f be a flow with no augmenting paths.
Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.
(u, v ) ∈ E(S, T )
3
3/4
G 2 4 Gf 2 1 4
10 7/
0/ 8
2 1 6 1
9/
9
10
0/2 6/6
10
1
9
9 10
s 3 5 t s 1 3 5 t
9/10 9/9 10/10
6.6: Maximum flow T.S. 14
Key Lemma
Proof 2 ⇒ 3:
Let f be a flow with no augmenting paths.
Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.
(u, v ) ∈ E(S, T ) ⇒ f (u, v ) = c(u, v ).
3
3/4
G 2 4 Gf 2 1 4
/1
0 7/
8
2 1 6 1
9/
9
10 /10 0/2
10
6/6
10
9 9
9 10
s 3 5 t s 1 3 5 t
9/10 9/9 10/10
6.6: Maximum flow T.S. 14
Key Lemma
Proof 2 ⇒ 3:
Let f be a flow with no augmenting paths.
Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.
(u, v ) ∈ E(S, T ) ⇒ f (u, v ) = c(u, v ).
3
3/4
G 2 4 Gf 2 1 4
/1
0 7/
8
2 1 6 1
9/
9
10 /10 0/2
10
6/6
10
9 9
9 10
s 3 5 t s 1 3 5 t
9/10 9/9 10/10
6.6: Maximum flow T.S. 14
Key Lemma
Proof 2 ⇒ 3:
Let f be a flow with no augmenting paths.
Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.
(u, v ) ∈ E(S, T ) ⇒ f (u, v ) = c(u, v ).
3
3/4
G 2 4 Gf 2 1 4
10 7/
0/ 8
2 1 6 1
9/
9
10
0/2 6/6
10
1
9
9 10
s 3 5 t s 1 3 5 t
9/10 9/9 10/10
6.6: Maximum flow T.S. 14
Key Lemma
Proof 2 ⇒ 3:
Let f be a flow with no augmenting paths.
Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.
(u, v ) ∈ E(S, T ) ⇒ f (u, v ) = c(u, v ).
(v , u) ∈ E(T , S)
3
3/4
G 2 4 Gf 2 1 4
10 7/
0/ 8
2 1 6 1
9/
9
10
0/2 6/6
10
1
9
9 10
s 3 5 t s 1 3 5 t
9/10 9/9 10/10
6.6: Maximum flow T.S. 14
Key Lemma
Proof 2 ⇒ 3:
Let f be a flow with no augmenting paths.
Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.
(u, v ) ∈ E(S, T ) ⇒ f (u, v ) = c(u, v ).
(v , u) ∈ E(T , S) ⇒ f (v , u) = 0.
3
3/4
G 2 4 Gf 2 1 4
0 7
0/
1
/8 2 1 6 1
9/
9
1 1/2
10
0/2 6/6
10
9
9 10
s 3 5 t s 1 3 5 t
9/10 9/9 10/10
6.6: Maximum flow T.S. 14
Key Lemma
Proof 2 ⇒ 3:
Let f be a flow with no augmenting paths.
Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.
(u, v ) ∈ E(S, T ) ⇒ f (u, v ) = c(u, v ).
(v , u) ∈ E(T , S) ⇒ f (v , u) = 0.
3
3/4
G 2 4 Gf 2 1 4
0 7
0/
1
/8 2 1 6 1
9/
9
1 1/2
10
0/2 6/6
10
9
9 10
s 3 5 t s 1 3 5 t
9/10 9/9 10/10
6.6: Maximum flow T.S. 14
Key Lemma
Proof 2 ⇒ 3:
Let f be a flow with no augmenting paths.
Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.
(u, v ) ∈ E(S, T ) ⇒ f (u, v ) = c(u, v ).
(v , u) ∈ E(T , S) ⇒ f (v , u) = 0.
|f | =
Proof 2 ⇒ 3:
Let f be a flow with no augmenting paths.
Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.
(u, v ) ∈ E(S, T ) ⇒ f (u, v ) = c(u, v ).
(v , u) ∈ E(T , S) ⇒ f (v , u) = 0.
X X
|f | = f (u, v ) − f (v , u)
(u,v )∈E(S,T ) (v ,u)∈E(T ,S)
Proof 2 ⇒ 3:
Let f be a flow with no augmenting paths.
Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.
(u, v ) ∈ E(S, T ) ⇒ f (u, v ) = c(u, v ).
(v , u) ∈ E(T , S) ⇒ f (v , u) = 0.
X X
|f | = f (u, v ) − f (v , u)
(u,v )∈E(S,T ) (v ,u)∈E(T ,S)
X
= c(u, v )
(u,v )∈E(S,T )
Proof 2 ⇒ 3:
Let f be a flow with no augmenting paths.
Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.
(u, v ) ∈ E(S, T ) ⇒ f (u, v ) = c(u, v ).
(v , u) ∈ E(T , S) ⇒ f (v , u) = 0.
X X
|f | = f (u, v ) − f (v , u)
(u,v )∈E(S,T ) (v ,u)∈E(T ,S)
X
= c(u, v ) = c(S, T )
(u,v )∈E(S,T )
Theorem
The value of the max-flow is equal to the capacity of the min-cut, that is
Theorem
The value of the max-flow is equal to the capacity of the min-cut, that is
Proof of “≤”:
Theorem
The value of the max-flow is equal to the capacity of the min-cut, that is
Proof of “≤”:
For any flow f and cut (S, T ), |f | ≤ c(S, T ) (Corollary 26.5)
Theorem
The value of the max-flow is equal to the capacity of the min-cut, that is
Proof of “≤”:
For any flow f and cut (S, T ), |f | ≤ c(S, T ) (Corollary 26.5)
⇒
max |f | ≤ min c(S, T )
f S,T ⊆V
Theorem
The value of the max-flow is equal to the capacity of the min-cut, that is
Proof of “≥”:
Let fmax be a maximum flow
Theorem
The value of the max-flow is equal to the capacity of the min-cut, that is
Proof of “≥”:
Let fmax be a maximum flow
Key Lemma ⇒ there is a cut (S, T ) with c(S, T ) = |fmax |.
Theorem
The value of the max-flow is equal to the capacity of the min-cut, that is
Proof of “≥”:
Let fmax be a maximum flow
Key Lemma ⇒ there is a cut (S, T ) with c(S, T ) = |fmax |.
⇒
max |f | = |fmax | = c(S, T ) ≥ min c(S, T )
f S,T ⊆V
Recap
Analysis of Ford-Fulkerson
0: def FordFulkerson(G)
1: initialize flow to 0 on all edges
2: while an augmenting path in Gf can be found:
3: push as much extra flow as possible through it
0: def FordFulkerson(G)
1: initialize flow to 0 on all edges
2: while an augmenting path in Gf can be found:
3: push as much extra flow as possible through it
Lemma
If all capacities c(u, v ) are integral, then the flow at every iteration of
Ford-Fulkerson is integral.
0: def FordFulkerson(G)
1: initialize flow to 0 on all edges
2: while an augmenting path in Gf can be found:
3: push as much extra flow as possible through it
Lemma
If all capacities c(u, v ) are integral, then the flow at every iteration of
Ford-Fulkerson is integral.
0: def FordFulkerson(G)
1: initialize flow to 0 on all edges
2: while an augmenting path in Gf can be found:
3: push as much extra flow as possible through it
Lemma
If all capacities c(u, v ) are integral, then the flow at every iteration of
Ford-Fulkerson is integral.
Theorem
For integral capacities c(u, v ), Ford-Fulkerson terminates after V · C
iterations, where C := maxu,v c(u, v ) and returns the maximum flow.
0: def FordFulkerson(G)
1: initialize flow to 0 on all edges
2: while an augmenting path in Gf can be found:
3: push as much extra flow as possible through it
Lemma
If all capacities c(u, v ) are integral, then the flow at every iteration of
Ford-Fulkerson is integral.
Theorem
For integral capacities c(u, v ), Ford-Fulkerson terminates after V · C
iterations, where C := maxu,v c(u, v ) and returns the maximum flow.
u 0/1
000 000
0/1
s 0/1 t
0/1
000 000
v 0/1
u 0/1 u
000 000 0 100
0/1 100 0
s 0/1 t s 1 t
0/1 100
000 000 0 100
0
v 0/1 v
G Gf
u 0/1 u
000 000 0 100
0/1 100 0
s 0/1 t s 1 t
0/1 100
000 000 0 100
0
v 0/1 v
G Gf
u 0/1 u
000 000 0 100
1/1 100 0
s 1/1 t s 1 t
0/1 100
000 000 0 100
0
v 1/1 v
G Gf
u 0/1 u
000 000 100
1/1 999 0
1
s 1/1 t s 1 t
0/1 100
000 000 0 999
v 1/1 v 1
G Gf
u 0/1 u
000 000 100
1/1 999 0
1
s 1/1 t s 1 t
0/1 100
000 000 0 999
v 1/1 v 1
G Gf
u 1/1 u
000 000 100
1/1 999 0
1
s 0/1 t s 1 t
1/1 100
000 000 0 999
v 1/1 v 1
G Gf
u 1/1 u
000 000 999
1/1 999
1 1
s 0/1 t s 1 t
1/1
000 000 999
999
v 1/1 1 v 1
G Gf
u 1/1 u
000 000 999
1/1 999
1 1
s 0/1 t s 1 t
1/1
000 000 999
999
v 1/1 1 v 1
G Gf
u 1/1 u
000 000 999
2/1 999
1 1
s 1/1 t s 1 t
1/1
000 000 999
999
v 2/1 1 v 1
G Gf
u 1/1 u
000 000 999
2/1 998
2 1
s 1/1 t s 1 t
1/1
000 000 999
998
v 2/1 1 v 2
G Gf
u 1/1 u
000 000 999
2/1 998
2 1
s 1/1 t s 1 t
1/1
000 000 999
998
v 2/1 1 v 2
G Gf
u 2/1 u
000 000 999
2/1 998
2 1
s 0/1 t s 1 t
2/1
000 000 999
998
v 2/1 1 v 2
G Gf
u 2/1 u
000 000 998
2/1 998
2 2
s 0/1 t s 1 t
2/1
000 000 998
998
v 2/1 2 v 2
G Gf
u 2/1 u
000 000 998
2/1 998
2 2
s 0/1 t s 1 t
2/1
000 000 998
998
v 2/1 2 v 2
G Gf
u 2/1 u
000 000 998
3/1 998
2 2
s 1/1 t s 1 t
2/1
000 000 998
998
v 3/1 2 v 2
G Gf
u 2/1 u
000 000 998
3/1 997
3 2
s 1/1 t s 1 t
2/1
000 000 998
997
v 3/1 2 v 3
G Gf
u 2/1 u
000 000 998
3/1 997
3 2
s 1/1 t s 1 t
2/1
000 000 998
997
v 3/1 2 v 3
G Gf
u 3/1 u
000 000 998
3/1 997
3 2
s 0/1 t s 1 t
3/1
000 000 998
997
v 3/1 2 v 3
G Gf
u 3/1 u
000 000 997
3/1 997
3 3
s 0/1 t s 1 t
3/1
000 000 997
997
v 3/1 3 v 3
G Gf
u 3/1 u
000 000 997
3/1 997
3 3
s 0/1 t s 1 t
3/1
000 000 997
997
v 3/1 3 v 3
G Gf
u 3/1 u
000 000 997
3/1 997
3 3
s 0/1 t s 1 t
3/1
000 000 997
997
v 3/1 3 v 3
G Gf
2 3 4 5
2 3 4 5
./∞
./∞ ./∞
t
./∞
./∞ ./∞
t
./∞
./∞ ./∞
t
./∞
./∞ ./∞
t
1 1 φ
2 3 4 5
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
Iteration: 1, |f | = 0
1 1 φ
2 3 4 5
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
Iteration: 1, |f | = 0
1 1 φ
2 3 4 5
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
Iteration: 1, |f | = 1
1 1 φ
2 3 4 5
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
Iteration: 1, |f | = 1
1 1 φ
2 3 4 5
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
Iteration: 2, |f | = 1
1 1 φ
2 3 4 5
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
Iteration: 2, |f | = 1
1 1 φ
2 3 4 5
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
Iteration: 2, |f | = 1 + φ
1 1 φ
2 3 4 5
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
Iteration: 2, |f | = 1 + φ
1−φ φ
φ
2 3 4 5
φ 1−φ
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
Iteration: 3, |f | = 1 + φ
1−φ φ
φ
2 3 4 5
φ 1−φ
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
Iteration: 3, |f | = 1 + φ
1−φ φ
φ
2 3 4 5
φ 1−φ
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
Iteration: 3, |f | = 1 + 2 · φ
1−φ φ
φ
2 3 4 5
φ 1−φ
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
Iteration: 3, |f | = 1 + 2 · φ
1−φ
1 φ
2 3 4 5
φ
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
Iteration: 4, |f | = 1 + 2 · φ
1−φ
1 φ
2 3 4 5
φ
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
Iteration: 4, |f | = 1 + 2 · φ
1−φ
1 φ
2 3 4 5
φ
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
Iteration: 4, |f | = 1 + 2 · φ + φ2
1−φ
1 φ
2 3 4 5
φ
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
Iteration: 4, |f | = 1 + 2 · φ + φ2
1−φ φ3
1
2 3 4 5
φ φ − φ3
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
Iteration: 5, |f | = 1 + 2 · φ + φ2
1−φ φ3
1
2 3 4 5
φ φ − φ3
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
Iteration: 5, |f | = 1 + 2 · φ + φ2
1−φ φ3
1
2 3 4 5
φ φ − φ3
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
Iteration: 5, |f | = 1 + 2 · φ + 2 · φ2
1−φ φ3
1
2 3 4 5
φ φ − φ3
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
Iteration: 5, |f | = 1 + 2 · φ + 2 · φ2
1−φ φ3
1
2 3 4 5
φ 1−φ
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
1−φ φ3
1
2 3 4 5
φ 1−φ
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
./∞
./∞ ./∞
t
1−φ φ3
1
2 3 4 5
φ 1−φ
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
1−φ φ3
1
2 3 4 5
φ 1−φ
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
1−φ φ3
1
2 3 4 5
φ 1−φ
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
More generally, s
1−φ φ3
1
2 3 4 5
φ 1−φ
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
More generally, s
1−φ2i 1 φ−φ2i+1
For every i = 0, 1, . . . after iteration 1 + 4 · i: −→ , −→, ←−
1−φ φ3
1
2 3 4 5
φ 1−φ
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
More generally, s
1−φ2i 1 φ−φ2i+1
For every i = 0, 1, . . . after iteration 1 + 4 · i: −→ , −→, ←−
1 − φ does not terminate!
Ford-Fulkerson φ3
1
2 3 4 5
φ 1−φ
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
More generally, s
1−φ2i 1 φ−φ2i+1
For every i = 0, 1, . . . after iteration 1 + 4 · i: −→ , −→, ←−
1 − φ does not terminate!
Ford-Fulkerson φ3
1
2 3 4 5
|f | = 1 + 2 2i Φi < 7
P
φ k =1 1−φ
t
6.6: Maximum flow T.S. 19
Non-Termination of Ford-Fulkerson for Irrational Capacities
s
More generally, s
1−φ2i 1 φ−φ2i+1
For every i = 0, 1, . . . after iteration 1 + 4 · i: −→ , −→, ←−
1 − φ does not terminate!
Ford-Fulkerson φ3
1
2 3 4 5
|f | = 1 + 2 2i Φi < 7
P
φ k =1 1−φ
It does not even converge to a maximum flow!
t
6.6: Maximum flow T.S. 19
Summary and Outlook
Ford-Fulkerson Method
works only for integral (rational) capacities
Ford-Fulkerson Method
works only for integral (rational) capacities
Runtime: O(E · |f ∗ |) = O(E · V · C)
Ford-Fulkerson Method
works only for integral (rational) capacities
Runtime: O(E · |f ∗ |) = O(E · V · C)
Capacity-Scaling Algorithm
Ford-Fulkerson Method
works only for integral (rational) capacities
Runtime: O(E · |f ∗ |) = O(E · V · C)
Capacity-Scaling Algorithm
Idea: Find an augmenting path with high capacity
Consider subgraph of Gf consisting of edges (u, v ) with cf (u, v ) > ∆
scaling parameter ∆, which is initially 2dlog2 Ce and 1 after termination
Runtime: O(E 2 · log C)
Ford-Fulkerson Method
works only for integral (rational) capacities
Runtime: O(E · |f ∗ |) = O(E · V · C)
Capacity-Scaling Algorithm
Idea: Find an augmenting path with high capacity
Consider subgraph of Gf consisting of edges (u, v ) with cf (u, v ) > ∆
scaling parameter ∆, which is initially 2dlog2 Ce and 1 after termination
Runtime: O(E 2 · log C)
Edmonds-Karp Algorithm
Ford-Fulkerson Method
works only for integral (rational) capacities
Runtime: O(E · |f ∗ |) = O(E · V · C)
Capacity-Scaling Algorithm
Idea: Find an augmenting path with high capacity
Consider subgraph of Gf consisting of edges (u, v ) with cf (u, v ) > ∆
scaling parameter ∆, which is initially 2dlog2 Ce and 1 after termination
Runtime: O(E 2 · log C)
Edmonds-Karp Algorithm
Idea: Find the shortest augmenting path in Gf
Runtime: O(E 2 · V )