6.6: Maximum flow - University of Cambridge · 6.6: Maximum flow Frank StajanoThomas Sauerwald...
Transcript of 6.6: Maximum flow - University of Cambridge · 6.6: Maximum flow Frank StajanoThomas Sauerwald...
-
6.6: Maximum flowFrank Stajano Thomas Sauerwald
Lent 2016
Illustration of the Ford-Fulkerson Method
s
2
3
4
5 t
Graph G = (V , E , c):
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
⇠⇠
0/10 ��0/8
⇠⇠0/108/1
0
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
⇠⇠
8/10 ��0/2
��0/9⇠⇠8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10⇠⇠0/10��2/9
��0/6⇠⇠0/1010
/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10⇠⇠6/10
��2/2
��0/4
⇠⇠6/1010/1
0
8/10
0/2 6/6
2/4
8/8
8/9
8/10
10/10
⇠⇠8/10 ��8/9
��8/8
��2/4⇠⇠8/1010
/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
s
2
3
4
5 t
Residual Graph Gf = (V , Ef , cf ):
10
10
2 6
4
8
9
10
10
2
8
10
2 6
4
8
9
10
2
8
10
10
2 6
4
8
7
2
10
10
10
4
6
2 6
4
8
1
8
4
6
10
10
2
8
2 6
2
2
8
1
8
2
8
10
10
1
9
2 6
1
3
7
1
9
1
9
10
|f | = 0|f | = 8|f | = 10|f | = 16
|f | = 18
|f | = 19
Is this a max-flow?
6.6: Maximum flow T.S. 9
-
Outline
Introduction
Ford-Fulkerson
A Glimpse at the Max-Flow Min-Cut Theorem
Analysis of Ford-Fulkerson
6.6: Maximum flow T.S. 2
-
History of the Maximum Flow Problem [Harris, Ross (1955)]
21 -C
-0
5
0! E
0
70 =
In 4'
oS 0
'ma
0
0 O
f
0
3
(a ~
0
za
~0aa)
On,
_Z
Z
a_
w 0>a
LL
,,
a cc
cCfl
SECR
ET R
7-
Maximum Flow is 163,000 tons per day!
6.6: Maximum flow T.S. 3
-
History of the Maximum Flow Problem [Harris, Ross (1955)]
21 -C
-0
5
0! E
0
70 =
In 4'
oS 0
'ma
0
0 O
f
0
3
(a ~
0
za
~0aa)
On,
_Z
Z
a_
w 0>a
LL
,,
a cc
cCfl
SECR
ET R
7-
Maximum Flow is 163,000 tons per day!
6.6: Maximum flow T.S. 3
-
Flow Network
Abstraction for material (one commodity!) flowing through the edges
G = (V ,E) directed graph without parallel edges
distinguished nodes: source s and sink t
every edge e has a capacity c(e)
Flow Network
s
2
3
4
5
6
6
7
t
10
5
15
4
9
4
15
8
6
16
1015
15 10
10
10/10
5/5
10/15
0/4
5/9
0/4
5/15
5/8
0/6
10/30
5/100/15
0/15 10/1
0
10/10
10/10
5/5
13/15
0/4
8/9
0/4
2/15
8/8
3/6
13/30
8/100/15
0/15 10/1
0
10/10
|f | = 5 + 10 + 10 = 25|f | = 8 + 10 + 10 = 28
How to find a Maximum Flow?
6.6: Maximum flow T.S. 4
-
Flow Network
Abstraction for material (one commodity!) flowing through the edges
G = (V ,E) directed graph without parallel edges
distinguished nodes: source s and sink t
every edge e has a capacity c(e)
Flow Network
Capacity function c : V × V → R+
s
2
3
4
5
6
6
7
t
10
5
15
4
9
4
15
8
6
16
1015
15 10
10
10/10
5/5
10/15
0/4
5/9
0/4
5/15
5/8
0/6
10/30
5/100/15
0/15 10/1
0
10/10
10/10
5/5
13/15
0/4
8/9
0/4
2/15
8/8
3/6
13/30
8/100/15
0/15 10/1
0
10/10
|f | = 5 + 10 + 10 = 25|f | = 8 + 10 + 10 = 28
How to find a Maximum Flow?
6.6: Maximum flow T.S. 4
-
Flow Network
Abstraction for material (one commodity!) flowing through the edges
G = (V ,E) directed graph without parallel edges
distinguished nodes: source s and sink t
every edge e has a capacity c(e)
Flow Network
Capacity function c : V × V → R+ c(u, v) = 0 ⇔ (u, v) 6∈ E
s
2
3
4
5
6
6
7
t
10
5
15
4
9
4
15
8
6
16
1015
15 10
10
10/10
5/5
10/15
0/4
5/9
0/4
5/15
5/8
0/6
10/30
5/100/15
0/15 10/1
0
10/10
10/10
5/5
13/15
0/4
8/9
0/4
2/15
8/8
3/6
13/30
8/100/15
0/15 10/1
0
10/10
|f | = 5 + 10 + 10 = 25|f | = 8 + 10 + 10 = 28
How to find a Maximum Flow?
6.6: Maximum flow T.S. 4
-
Flow Network
A flow is a function f : V × V → R that satisfies:
For every u, v ∈ V , f (u, v) ≤ c(u, v)For every u, v ∈ V , f (u, v) = −f (v , u)For every u ∈ V \ {s, t}, ∑v∈V f (u, v) = 0
The value of a flow is defined as |f | = ∑v∈V f (s, v)
Flow
s
2
3
4
5
6
6
7
t
10
5
15
4
9
4
15
8
6
16
1015
15 10
10
10/10
5/5
10/15
0/4
5/9
0/4
5/15
5/8
0/6
10/30
5/100/15
0/15 10/1
0
10/10
10/10
5/5
13/15
0/4
8/9
0/4
2/15
8/8
3/6
13/30
8/100/15
0/15 10/1
0
10/10
|f | = 5 + 10 + 10 = 25|f | = 8 + 10 + 10 = 28
How to find a Maximum Flow?
6.6: Maximum flow T.S. 4
-
Flow Network
A flow is a function f : V × V → R that satisfies:For every u, v ∈ V , f (u, v) ≤ c(u, v)
For every u, v ∈ V , f (u, v) = −f (v , u)For every u ∈ V \ {s, t}, ∑v∈V f (u, v) = 0
The value of a flow is defined as |f | = ∑v∈V f (s, v)
Flow
s
2
3
4
5
6
6
7
t
10
5
15
4
9
4
15
8
6
16
1015
15 10
10
10/10
5/5
10/15
0/4
5/9
0/4
5/15
5/8
0/6
10/30
5/100/15
0/15 10/1
0
10/10
10/10
5/5
13/15
0/4
8/9
0/4
2/15
8/8
3/6
13/30
8/100/15
0/15 10/1
0
10/10
|f | = 5 + 10 + 10 = 25|f | = 8 + 10 + 10 = 28
How to find a Maximum Flow?
6.6: Maximum flow T.S. 4
-
Flow Network
A flow is a function f : V × V → R that satisfies:For every u, v ∈ V , f (u, v) ≤ c(u, v)
For every u, v ∈ V , f (u, v) = −f (v , u)For every u ∈ V \ {s, t}, ∑v∈V f (u, v) = 0
The value of a flow is defined as |f | = ∑v∈V f (s, v)
Flow
s
2
3
4
5
6
6
7
t
10
5
15
4
9
4
15
8
6
16
1015
15 10
10
10/10
5/5
10/15
0/4
5/9
0/4
5/15
5/8
0/6
10/30
5/100/15
0/15 10/1
0
10/10
10/10
5/5
13/15
0/4
8/9
0/4
2/15
8/8
3/6
13/30
8/100/15
0/15 10/1
0
10/10
|f | = 5 + 10 + 10 = 25|f | = 8 + 10 + 10 = 28
How to find a Maximum Flow?
6.6: Maximum flow T.S. 4
-
Flow Network
A flow is a function f : V × V → R that satisfies:For every u, v ∈ V , f (u, v) ≤ c(u, v)For every u, v ∈ V , f (u, v) = −f (v , u)
For every u ∈ V \ {s, t}, ∑v∈V f (u, v) = 0The value of a flow is defined as |f | = ∑v∈V f (s, v)
Flow
s
2
3
4
5
6
6
7
t
10
5
15
4
9
4
15
8
6
16
1015
15 10
10
10/10
5/5
10/15
0/4
5/9
0/4
5/15
5/8
0/6
10/30
5/100/15
0/15 10/1
0
10/10
10/10
5/5
13/15
0/4
8/9
0/4
2/15
8/8
3/6
13/30
8/100/15
0/15 10/1
0
10/10
|f | = 5 + 10 + 10 = 25|f | = 8 + 10 + 10 = 28
How to find a Maximum Flow?
6.6: Maximum flow T.S. 4
-
Flow Network
A flow is a function f : V × V → R that satisfies:For every u, v ∈ V , f (u, v) ≤ c(u, v)For every u, v ∈ V , f (u, v) = −f (v , u)For every u ∈ V \ {s, t}, ∑v∈V f (u, v) = 0
The value of a flow is defined as |f | = ∑v∈V f (s, v)
Flow
s
2
3
4
5
6
6
7
t
10
5
15
4
9
4
15
8
6
16
1015
15 10
10
10/10
5/5
10/15
0/4
5/9
0/4
5/15
5/8
0/6
10/30
5/100/15
0/15 10/1
0
10/10
10/10
5/5
13/15
0/4
8/9
0/4
2/15
8/8
3/6
13/30
8/100/15
0/15 10/1
0
10/10
|f | = 5 + 10 + 10 = 25|f | = 8 + 10 + 10 = 28
How to find a Maximum Flow?
6.6: Maximum flow T.S. 4
-
Flow Network
A flow is a function f : V × V → R that satisfies:For every u, v ∈ V , f (u, v) ≤ c(u, v)For every u, v ∈ V , f (u, v) = −f (v , u)For every u ∈ V \ {s, t}, ∑v∈V f (u, v) = 0
Flow Conservation
The value of a flow is defined as |f | = ∑v∈V f (s, v)
Flow
s
2
3
4
5
6
6
7
t
10
5
15
4
9
4
15
8
6
16
1015
15 10
10
10/10
5/5
10/15
0/4
5/9
0/4
5/15
5/8
0/6
10/30
5/100/15
0/15 10/1
0
10/10
10/10
5/5
13/15
0/4
8/9
0/4
2/15
8/8
3/6
13/30
8/100/15
0/15 10/1
0
10/10
|f | = 5 + 10 + 10 = 25|f | = 8 + 10 + 10 = 28
How to find a Maximum Flow?
6.6: Maximum flow T.S. 4
-
Flow Network
A flow is a function f : V × V → R that satisfies:For every u, v ∈ V , f (u, v) ≤ c(u, v)For every u, v ∈ V , f (u, v) = −f (v , u)For every u ∈ V \ {s, t}, ∑v∈V f (u, v) = 0
Flow Conservation
The value of a flow is defined as |f | = ∑v∈V f (s, v)
Flow
s
2
3
4
5
6
6
7
t
10
5
15
4
9
4
15
8
6
16
1015
15 10
10
10/10
5/5
10/15
0/4
5/9
0/4
5/15
5/8
0/6
10/30
5/100/15
0/15 10/1
0
10/10
10/10
5/5
13/15
0/4
8/9
0/4
2/15
8/8
3/6
13/30
8/100/15
0/15 10/1
0
10/10
|f | = 5 + 10 + 10 = 25|f | = 8 + 10 + 10 = 28
How to find a Maximum Flow?
6.6: Maximum flow T.S. 4
-
Flow Network
A flow is a function f : V × V → R that satisfies:For every u, v ∈ V , f (u, v) ≤ c(u, v)For every u, v ∈ V , f (u, v) = −f (v , u)For every u ∈ V \ {s, t}, ∑v∈V f (u, v) = 0
Flow Conservation
The value of a flow is defined as |f | = ∑v∈V f (s, v)
Flow
s
2
3
4
5
6
6
7
t
10
5
15
4
9
4
15
8
6
16
1015
15 10
10
10/10
5/5
10/15
0/4
5/9
0/4
5/15
5/8
0/6
10/30
5/100/15
0/15 10/1
0
10/10
10/10
5/5
13/15
0/4
8/9
0/4
2/15
8/8
3/6
13/30
8/100/15
0/15 10/1
0
10/10
|f | = 5 + 10 + 10 = 25|f | = 8 + 10 + 10 = 28
How to find a Maximum Flow?
6.6: Maximum flow T.S. 4
-
Flow Network
A flow is a function f : V × V → R that satisfies:For every u, v ∈ V , f (u, v) ≤ c(u, v)For every u, v ∈ V , f (u, v) = −f (v , u)For every u ∈ V \ {s, t}, ∑v∈V f (u, v) = 0
Flow Conservation
The value of a flow is defined as |f | = ∑v∈V f (s, v)
Flow
s
2
3
4
5
6
6
7
t
10
5
15
4
9
4
15
8
6
16
1015
15 10
10
10/10
5/5
10/15
0/4
5/9
0/4
5/15
5/8
0/6
10/30
5/100/15
0/15 10/1
0
10/10
10/10
5/5
13/15
0/4
8/9
0/4
2/15
8/8
3/6
13/30
8/100/15
0/15 10/1
0
10/10
|f | = 5 + 10 + 10 = 25|f | = 8 + 10 + 10 = 28
How to find a Maximum Flow?
6.6: Maximum flow T.S. 4
-
Flow Network
A flow is a function f : V × V → R that satisfies:For every u, v ∈ V , f (u, v) ≤ c(u, v)For every u, v ∈ V , f (u, v) = −f (v , u)For every u ∈ V \ {s, t}, ∑v∈V f (u, v) = 0
The value of a flow is defined as |f | = ∑v∈V f (s, v)
Flow
s
2
3
4
5
6
6
7
t
10
5
15
4
9
4
15
8
6
16
1015
15 10
10
10/10
5/5
10/15
0/4
5/9
0/4
5/15
5/8
0/6
10/30
5/100/15
0/15 10/1
0
10/10
10/10
5/5
13/15
0/4
8/9
0/4
2/15
8/8
3/6
13/30
8/100/15
0/15 10/1
0
10/10
|f | = 5 + 10 + 10 = 25|f | = 8 + 10 + 10 = 28
How to find a Maximum Flow?
6.6: Maximum flow T.S. 4
-
Flow Network
A flow is a function f : V × V → R that satisfies:For every u, v ∈ V , f (u, v) ≤ c(u, v)For every u, v ∈ V , f (u, v) = −f (v , u)For every u ∈ V \ {s, t}, ∑v∈V f (u, v) = 0
The value of a flow is defined as |f | = ∑v∈V f (s, v)∑v∈V f (s, v) =
∑v∈V f (v , t)
Flow
s
2
3
4
5
6
6
7
t
10
5
15
4
9
4
15
8
6
16
1015
15 10
10
10/10
5/5
10/15
0/4
5/9
0/4
5/15
5/8
0/6
10/30
5/100/15
0/15 10/1
0
10/10
10/10
5/5
13/15
0/4
8/9
0/4
2/15
8/8
3/6
13/30
8/100/15
0/15 10/1
0
10/10
|f | = 5 + 10 + 10 = 25|f | = 8 + 10 + 10 = 28
How to find a Maximum Flow?
6.6: Maximum flow T.S. 4
-
Flow Network
A flow is a function f : V × V → R that satisfies:For every u, v ∈ V , f (u, v) ≤ c(u, v)For every u, v ∈ V , f (u, v) = −f (v , u)For every u ∈ V \ {s, t}, ∑v∈V f (u, v) = 0
The value of a flow is defined as |f | = ∑v∈V f (s, v)
Flow
s
2
3
4
5
6
6
7
t
10
5
15
4
9
4
15
8
6
16
1015
15 10
10
10/10
5/5
10/15
0/4
5/9
0/4
5/15
5/8
0/6
10/30
5/100/15
0/15 10/1
0
10/10
10/10
5/5
13/15
0/4
8/9
0/4
2/15
8/8
3/6
13/30
8/100/15
0/15 10/1
0
10/10
|f | = 5 + 10 + 10 = 25
|f | = 8 + 10 + 10 = 28
How to find a Maximum Flow?
6.6: Maximum flow T.S. 4
-
Flow Network
A flow is a function f : V × V → R that satisfies:For every u, v ∈ V , f (u, v) ≤ c(u, v)For every u, v ∈ V , f (u, v) = −f (v , u)For every u ∈ V \ {s, t}, ∑v∈V f (u, v) = 0
The value of a flow is defined as |f | = ∑v∈V f (s, v)
Flow
s
2
3
4
5
6
6
7
t
10
5
15
4
9
4
15
8
6
16
1015
15 10
10
10/10
5/5
10/15
0/4
5/9
0/4
5/15
5/8
0/6
10/30
5/100/15
0/15 10/1
0
10/10
10/10
5/5
13/15
0/4
8/9
0/4
2/15
8/8
3/6
13/30
8/100/15
0/15 10/1
0
10/10
|f | = 5 + 10 + 10 = 25
|f | = 8 + 10 + 10 = 28
How to find a Maximum Flow?
6.6: Maximum flow T.S. 4
-
Flow Network
A flow is a function f : V × V → R that satisfies:For every u, v ∈ V , f (u, v) ≤ c(u, v)For every u, v ∈ V , f (u, v) = −f (v , u)For every u ∈ V \ {s, t}, ∑v∈V f (u, v) = 0
The value of a flow is defined as |f | = ∑v∈V f (s, v)
Flow
s
2
3
4
5
6
6
7
t
10
5
15
4
9
4
15
8
6
16
1015
15 10
10
10/10
5/5
10/15
0/4
5/9
0/4
5/15
5/8
0/6
10/30
5/100/15
0/15 10/1
0
10/10
10/10
5/5
13/15
0/4
8/9
0/4
2/15
8/8
3/6
13/30
8/100/15
0/15 10/1
0
10/10
|f | = 5 + 10 + 10 = 25|f | = 8 + 10 + 10 = 28
How to find a Maximum Flow?
6.6: Maximum flow T.S. 4
-
Flow Network
A flow is a function f : V × V → R that satisfies:For every u, v ∈ V , f (u, v) ≤ c(u, v)For every u, v ∈ V , f (u, v) = −f (v , u)For every u ∈ V \ {s, t}, ∑v∈V f (u, v) = 0
The value of a flow is defined as |f | = ∑v∈V f (s, v)
Flow
s
2
3
4
5
6
6
7
t
10
5
15
4
9
4
15
8
6
16
1015
15 10
10
10/10
5/5
10/15
0/4
5/9
0/4
5/15
5/8
0/6
10/30
5/100/15
0/15 10/1
0
10/10
10/10
5/5
13/15
0/4
8/9
0/4
2/15
8/8
3/6
13/30
8/100/15
0/15 10/1
0
10/10
|f | = 5 + 10 + 10 = 25
|f | = 8 + 10 + 10 = 28
How to find a Maximum Flow?
6.6: Maximum flow T.S. 4
-
Flow Network
A flow is a function f : V × V → R that satisfies:For every u, v ∈ V , f (u, v) ≤ c(u, v)For every u, v ∈ V , f (u, v) = −f (v , u)For every u ∈ V \ {s, t}, ∑v∈V f (u, v) = 0
The value of a flow is defined as |f | = ∑v∈V f (s, v)
Flow
s
2
3
4
5
6
6
7
t
10
5
15
4
9
4
15
8
6
16
1015
15 10
10
10/10
5/5
10/15
0/4
5/9
0/4
5/15
5/8
0/6
10/30
5/100/15
0/15 10/1
0
10/10
10/10
5/5
13/15
0/4
8/9
0/4
2/15
8/8
3/6
13/30
8/100/15
0/15 10/1
0
10/10
|f | = 5 + 10 + 10 = 25|f | = 8 + 10 + 10 = 28
How to find a Maximum Flow?
6.6: Maximum flow T.S. 4
-
A First Attempt
Start with f (u, v) = 0 everywhereRepeat as long as possible:
Find a (s, t)-path p where each edge e = (u, v) has f (u, v) < c(u, v)Augment flow along p
Greedy Algorithm
s
2
3
4
5 t
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/10
8/10
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6
��0/1010/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10
|f | = 0
|f | = 8|f | = 10|f | = 16|f | = 19
10/10
9/10
0/2 5/6
4/4
6/8
9/9
9/10
10/10
Is this optimal?Greedy did not succeed!
6.6: Maximum flow T.S. 5
-
A First Attempt
Start with f (u, v) = 0 everywhereRepeat as long as possible:
Find a (s, t)-path p where each edge e = (u, v) has f (u, v) < c(u, v)Augment flow along p
Greedy Algorithm
s
2
3
4
5 t
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/10
8/10
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6
��0/1010/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10
|f | = 0
|f | = 8|f | = 10|f | = 16|f | = 19
10/10
9/10
0/2 5/6
4/4
6/8
9/9
9/10
10/10
Is this optimal?Greedy did not succeed!
6.6: Maximum flow T.S. 5
-
A First Attempt
Start with f (u, v) = 0 everywhereRepeat as long as possible:
Find a (s, t)-path p where each edge e = (u, v) has f (u, v) < c(u, v)Augment flow along p
Greedy Algorithm
s
2
3
4
5 t
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/10
8/10
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6
��0/1010/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10
|f | = 0
|f | = 8|f | = 10|f | = 16|f | = 19
10/10
9/10
0/2 5/6
4/4
6/8
9/9
9/10
10/10
Is this optimal?Greedy did not succeed!
6.6: Maximum flow T.S. 5
-
A First Attempt
Start with f (u, v) = 0 everywhereRepeat as long as possible:
Find a (s, t)-path p where each edge e = (u, v) has f (u, v) < c(u, v)Augment flow along p
Greedy Algorithm
s
2
3
4
5 t
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/10
8/10
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6
��0/1010/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10
|f | = 0
|f | = 8
|f | = 10|f | = 16|f | = 19
10/10
9/10
0/2 5/6
4/4
6/8
9/9
9/10
10/10
Is this optimal?Greedy did not succeed!
6.6: Maximum flow T.S. 5
-
A First Attempt
Start with f (u, v) = 0 everywhereRepeat as long as possible:
Find a (s, t)-path p where each edge e = (u, v) has f (u, v) < c(u, v)Augment flow along p
Greedy Algorithm
s
2
3
4
5 t
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/10
8/10
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6
��0/1010/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10
|f | = 0
|f | = 8
|f | = 10|f | = 16|f | = 19
10/10
9/10
0/2 5/6
4/4
6/8
9/9
9/10
10/10
Is this optimal?Greedy did not succeed!
6.6: Maximum flow T.S. 5
-
A First Attempt
Start with f (u, v) = 0 everywhereRepeat as long as possible:
Find a (s, t)-path p where each edge e = (u, v) has f (u, v) < c(u, v)Augment flow along p
Greedy Algorithm
s
2
3
4
5 t
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/10
8/10
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10
��0/10��2/9
��0/6
��0/1010/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10
|f | = 0
|f | = 8
|f | = 10|f | = 16|f | = 19
10/10
9/10
0/2 5/6
4/4
6/8
9/9
9/10
10/10
Is this optimal?Greedy did not succeed!
6.6: Maximum flow T.S. 5
-
A First Attempt
Start with f (u, v) = 0 everywhereRepeat as long as possible:
Find a (s, t)-path p where each edge e = (u, v) has f (u, v) < c(u, v)Augment flow along p
Greedy Algorithm
s
2
3
4
5 t
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/10
8/10
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10
��0/10��2/9
��0/6
��0/1010/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10
|f | = 0|f | = 8
|f | = 10
|f | = 16|f | = 19
10/10
9/10
0/2 5/6
4/4
6/8
9/9
9/10
10/10
Is this optimal?Greedy did not succeed!
6.6: Maximum flow T.S. 5
-
A First Attempt
Start with f (u, v) = 0 everywhereRepeat as long as possible:
Find a (s, t)-path p where each edge e = (u, v) has f (u, v) < c(u, v)Augment flow along p
Greedy Algorithm
s
2
3
4
5 t
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/10
8/10
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10
��0/10��2/9
��0/6
��0/1010/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10
|f | = 0|f | = 8
|f | = 10
|f | = 16|f | = 19
10/10
9/10
0/2 5/6
4/4
6/8
9/9
9/10
10/10
Is this optimal?Greedy did not succeed!
6.6: Maximum flow T.S. 5
-
A First Attempt
Start with f (u, v) = 0 everywhereRepeat as long as possible:
Find a (s, t)-path p where each edge e = (u, v) has f (u, v) < c(u, v)Augment flow along p
Greedy Algorithm
s
2
3
4
5 t
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/10
8/10
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10
��0/10��2/9
��0/6
��0/1010/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10
|f | = 0|f | = 8
|f | = 10
|f | = 16|f | = 19
10/10
9/10
0/2 5/6
4/4
6/8
9/9
9/10
10/10
Is this optimal?Greedy did not succeed!
6.6: Maximum flow T.S. 5
-
A First Attempt
Start with f (u, v) = 0 everywhereRepeat as long as possible:
Find a (s, t)-path p where each edge e = (u, v) has f (u, v) < c(u, v)Augment flow along p
Greedy Algorithm
s
2
3
4
5 t
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/10
8/10
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6
��0/10
10/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10
|f | = 0|f | = 8|f | = 10
|f | = 16
|f | = 19
10/10
9/10
0/2 5/6
4/4
6/8
9/9
9/10
10/10
Is this optimal?Greedy did not succeed!
6.6: Maximum flow T.S. 5
-
A First Attempt
Start with f (u, v) = 0 everywhereRepeat as long as possible:
Find a (s, t)-path p where each edge e = (u, v) has f (u, v) < c(u, v)Augment flow along p
Greedy Algorithm
s
2
3
4
5 t
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/10
8/10
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6
��0/10
10/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10
|f | = 0|f | = 8|f | = 10
|f | = 16
|f | = 19
10/10
9/10
0/2 5/6
4/4
6/8
9/9
9/10
10/10
Is this optimal?
Greedy did not succeed!
6.6: Maximum flow T.S. 5
-
A First Attempt
Start with f (u, v) = 0 everywhereRepeat as long as possible:
Find a (s, t)-path p where each edge e = (u, v) has f (u, v) < c(u, v)Augment flow along p
Greedy Algorithm
s
2
3
4
5 t
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/10
8/10
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6
��0/1010/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10
|f | = 0|f | = 8|f | = 10|f | = 16
|f | = 19
10/10
9/10
0/2 5/6
4/4
6/8
9/9
9/10
10/10
Is this optimal?
Greedy did not succeed!
6.6: Maximum flow T.S. 5
-
Outline
Introduction
Ford-Fulkerson
A Glimpse at the Max-Flow Min-Cut Theorem
Analysis of Ford-Fulkerson
6.6: Maximum flow T.S. 6
-
Residual Graph
Edge e = (u, v) ∈ Eflow f (u, v) and capacity c(u, v)
Original Edge
cf (u, v) =
c(u, v)− f (u, v) if (u, v) ∈ E ,f (v , u) if (v , u) ∈ E ,0 otherwise.
Residual Capacity
Gf = (V ,Ef , cf ), Ef := {(u, v) : cf (u, v) > 0}Residual Graph
Graph G:
u v6/17
Residual Gf :
u v
11
6
6.6: Maximum flow T.S. 7
-
Residual Graph
Edge e = (u, v) ∈ Eflow f (u, v) and capacity c(u, v)
Original Edge
cf (u, v) =
c(u, v)− f (u, v) if (u, v) ∈ E ,f (v , u) if (v , u) ∈ E ,0 otherwise.
Residual Capacity
Gf = (V ,Ef , cf ), Ef := {(u, v) : cf (u, v) > 0}Residual Graph
Graph G:
u v6/17
Residual Gf :
u v
11
6
6.6: Maximum flow T.S. 7
-
Residual Graph
Edge e = (u, v) ∈ Eflow f (u, v) and capacity c(u, v)
Original Edge
cf (u, v) =
c(u, v)− f (u, v) if (u, v) ∈ E ,f (v , u) if (v , u) ∈ E ,0 otherwise.
Residual Capacity
Gf = (V ,Ef , cf ), Ef := {(u, v) : cf (u, v) > 0}Residual Graph
Graph G:
u v6/17
Residual Gf :
u v
11
6
6.6: Maximum flow T.S. 7
-
Residual Graph
Edge e = (u, v) ∈ Eflow f (u, v) and capacity c(u, v)
Original Edge
cf (u, v) =
c(u, v)− f (u, v) if (u, v) ∈ E ,f (v , u) if (v , u) ∈ E ,0 otherwise.
Residual Capacity
Gf = (V ,Ef , cf ), Ef := {(u, v) : cf (u, v) > 0}Residual Graph
Graph G:
u v6/17
Residual Gf :
u v
11
6
6.6: Maximum flow T.S. 7
-
Residual Graph
Edge e = (u, v) ∈ Eflow f (u, v) and capacity c(u, v)
Original Edge
cf (u, v) =
c(u, v)− f (u, v) if (u, v) ∈ E ,f (v , u) if (v , u) ∈ E ,0 otherwise.
Residual Capacity
Gf = (V ,Ef , cf ), Ef := {(u, v) : cf (u, v) > 0}Residual Graph
Graph G:
u v6/17
Residual Gf :
u v
11
6
6.6: Maximum flow T.S. 7
-
Residual Graph with anti-parallel edges
Edge e = (u, v) ∈ E (& possibly e′ = (v , u) ∈ E)flow f (u, v) and capacity c(u, v)
Original Edge
For every pair (u, v) ∈ V × V ,
cf (u, v) = c(u, v)− f (u, v).
Residual Capacity
Gf = (V ,Ef , cf ), Ef := {(u, v) : cf (u, v) > 0}Residual Graph
Graph G:
u v
6/17
2/4
Residual Gf :
u v
??
??
17-(6-2)
4-(2-6)
13
8
6.6: Maximum flow T.S. 7
-
Residual Graph with anti-parallel edges
Edge e = (u, v) ∈ E (& possibly e′ = (v , u) ∈ E)flow f (u, v) and capacity c(u, v)
Original Edge
For every pair (u, v) ∈ V × V ,
cf (u, v) = c(u, v)− f (u, v).
Residual Capacity
Gf = (V ,Ef , cf ), Ef := {(u, v) : cf (u, v) > 0}Residual Graph
Graph G:
u v
6/17
2/4
Residual Gf :
u v
??
??
17-(6-2)
4-(2-6)
13
8
6.6: Maximum flow T.S. 7
-
Residual Graph with anti-parallel edges
Edge e = (u, v) ∈ E (& possibly e′ = (v , u) ∈ E)flow f (u, v) and capacity c(u, v)
Original Edge
For every pair (u, v) ∈ V × V ,
cf (u, v) = c(u, v)− f (u, v).
Residual Capacity
Gf = (V ,Ef , cf ), Ef := {(u, v) : cf (u, v) > 0}Residual Graph
Graph G:
u v
6/17
2/4
Residual Gf :
u v
??
??
17-(6-2)
4-(2-6)
13
8
6.6: Maximum flow T.S. 7
-
Residual Graph with anti-parallel edges
Edge e = (u, v) ∈ E (& possibly e′ = (v , u) ∈ E)flow f (u, v) and capacity c(u, v)
Original Edge
For every pair (u, v) ∈ V × V ,
cf (u, v) = c(u, v)− f (u, v).
Residual Capacity
Gf = (V ,Ef , cf ), Ef := {(u, v) : cf (u, v) > 0}Residual Graph
Graph G:
u v
6/17
2/4
Residual Gf :
u v
??
??
17-(6-2)
4-(2-6)
13
8
6.6: Maximum flow T.S. 7
-
Residual Graph with anti-parallel edges
Edge e = (u, v) ∈ E (& possibly e′ = (v , u) ∈ E)flow f (u, v) and capacity c(u, v)
Original Edge
For every pair (u, v) ∈ V × V ,
cf (u, v) = c(u, v)− f (u, v).
Residual Capacity
Gf = (V ,Ef , cf ), Ef := {(u, v) : cf (u, v) > 0}Residual Graph
Graph G:
u v
6/17
2/4
Residual Gf :
u v
??
??
17-(6-2)
4-(2-6)
13
8
6.6: Maximum flow T.S. 7
-
Residual Graph with anti-parallel edges
Edge e = (u, v) ∈ E (& possibly e′ = (v , u) ∈ E)flow f (u, v) and capacity c(u, v)
Original Edge
For every pair (u, v) ∈ V × V ,
cf (u, v) = c(u, v)− f (u, v).
Residual Capacity
Gf = (V ,Ef , cf ), Ef := {(u, v) : cf (u, v) > 0}Residual Graph
Graph G:
u v
6/17
2/4
Residual Gf :
u v
??
??
17-(6-2)
4-(2-6)
13
8
6.6: Maximum flow T.S. 7
-
Example of a Residual Graph (Handout)
Flow network Gs
2
3
4
5
t
1/14
1/6
2/3
4/105/12
5/8
4/7
3/4
1/3
3/7
3/4
1/3
3/7
2/4
0/3
2/7
2/4
0/3
2/7
4/105/12
0/101/12
0/101/12
5/8
4/7
1/8
0/7
1/8
0/7
1/8
1/121/14
1/61/8
1/121/14
1/60/8
0/120/14
0/6
0/8
0/120/14
0/6
Residual Graph Gfs
2
3
4
5
t
1111
131
51
78
13
21
43
1 2
By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.
6.6: Maximum flow T.S. 7
-
Example of a Residual Graph (Handout)
Flow network Gs
2
3
4
5
t
1/14
1/6
2/3
4/105/12
5/8
4/7
3/4
1/3
3/7
3/4
1/3
3/7
2/4
0/3
2/7
2/4
0/3
2/7
4/105/12
0/101/12
0/101/12
5/8
4/7
1/8
0/7
1/8
0/7
1/8
1/121/14
1/61/8
1/121/14
1/60/8
0/120/14
0/6
0/8
0/120/14
0/6
Residual Graph Gfs
2
3
4
5
t
1111
131
51
78
13
21
43
1 2
By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.
6.6: Maximum flow T.S. 7
-
Example of a Residual Graph (Handout)
Flow network Gs
2
3
4
5
t
1/14
1/6
2/3
4/105/12
5/8
4/7
3/4
1/3
3/7
3/4
1/3
3/7
2/4
0/3
2/7
2/4
0/3
2/7
4/105/12
0/101/12
0/101/12
5/8
4/7
1/8
0/7
1/8
0/7
1/8
1/121/14
1/61/8
1/121/14
1/60/8
0/120/14
0/6
0/8
0/120/14
0/6
Residual Graph Gfs
2
3
4
5
t
1111
131
51
78
13
21
43
1 2
By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.
6.6: Maximum flow T.S. 7
-
Example of a Residual Graph (Handout)
Flow network Gs
2
3
4
5
t
1/14
1/6
2/3
4/105/12
5/8
4/7
3/4
1/3
3/7
3/4
1/3
3/7
2/4
0/3
2/7
2/4
0/3
2/7
4/105/12
0/101/12
0/101/12
5/8
4/7
1/8
0/7
1/8
0/7
1/8
1/121/14
1/61/8
1/121/14
1/60/8
0/120/14
0/6
0/8
0/120/14
0/6
Residual Graph Gfs
2
3
4
5
t
1111
131
51
78
13
21
43
1 2
By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.
6.6: Maximum flow T.S. 7
-
Example of a Residual Graph (Handout)
Flow network Gs
2
3
4
5
t
1/14
1/6
2/3
4/105/12
5/8
4/7
3/4
1/3
3/7
3/4
1/3
3/7
2/4
0/3
2/7
2/4
0/3
2/7
4/105/12
0/101/12
0/101/12
5/8
4/7
1/8
0/7
1/8
0/7
1/8
1/121/14
1/61/8
1/121/14
1/60/8
0/120/14
0/6
0/8
0/120/14
0/6
Residual Graph Gfs
2
3
4
5
t
1111
131
51
78
13
21
43
1 2
By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.
6.6: Maximum flow T.S. 7
-
Example of a Residual Graph (Handout)
Flow network Gs
2
3
4
5
t
1/14
1/6
2/3
4/105/12
5/8
4/7
3/4
1/3
3/7
3/4
1/3
3/7
2/4
0/3
2/7
2/4
0/3
2/7
4/105/12
0/101/12
0/101/12
5/8
4/7
1/8
0/7
1/8
0/7
1/8
1/121/14
1/61/8
1/121/14
1/60/8
0/120/14
0/6
0/8
0/120/14
0/6
Residual Graph Gfs
2
3
4
5
t
1111
131
51
78
13
21
43
1 2
By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.
6.6: Maximum flow T.S. 7
-
Example of a Residual Graph (Handout)
Flow network Gs
2
3
4
5
t
1/14
1/6
2/3
4/105/12
5/8
4/7
3/4
1/3
3/7
3/4
1/3
3/7
2/4
0/3
2/7
2/4
0/3
2/7
4/105/12
0/101/12
0/101/12
5/8
4/7
1/8
0/7
1/8
0/7
1/8
1/121/14
1/61/8
1/121/14
1/60/8
0/120/14
0/6
0/8
0/120/14
0/6
Residual Graph Gfs
2
3
4
5
t
1111
131
51
78
13
21
43
1 2
By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.
6.6: Maximum flow T.S. 7
-
Example of a Residual Graph (Handout)
Flow network Gs
2
3
4
5
t
1/14
1/6
2/3
4/105/12
5/8
4/7
3/4
1/3
3/7
3/4
1/3
3/7
2/4
0/3
2/7
2/4
0/3
2/7
4/105/12
0/101/12
0/101/12
5/8
4/7
1/8
0/7
1/8
0/7
1/8
1/121/14
1/61/8
1/121/14
1/60/8
0/120/14
0/6
0/8
0/120/14
0/6
Residual Graph Gfs
2
3
4
5
t
1111
131
51
78
13
21
43
1 2
By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.
6.6: Maximum flow T.S. 7
-
Example of a Residual Graph (Handout)
Flow network Gs
2
3
4
5
t
1/14
1/6
2/3
4/105/12
5/8
4/7
3/4
1/3
3/7
3/4
1/3
3/7
2/4
0/3
2/7
2/4
0/3
2/7
4/105/12
0/101/12
0/101/12
5/8
4/7
1/8
0/7
1/8
0/7
1/8
1/121/14
1/61/8
1/121/14
1/60/8
0/120/14
0/6
0/8
0/120/14
0/6
Residual Graph Gfs
2
3
4
5
t
1111
131
51
78
13
21
43
1 2
By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.
6.6: Maximum flow T.S. 7
-
Example of a Residual Graph (Handout)
Flow network Gs
2
3
4
5
t
1/14
1/6
2/3
4/105/12
5/8
4/7
3/4
1/3
3/7
3/4
1/3
3/7
2/4
0/3
2/7
2/4
0/3
2/7
4/105/12
0/101/12
0/101/12
5/8
4/7
1/8
0/7
1/8
0/7
1/8
1/121/14
1/61/8
1/121/14
1/60/8
0/120/14
0/6
0/8
0/120/14
0/6
Residual Graph Gfs
2
3
4
5
t
1111
131
51
78
13
21
43
1 2
By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.
6.6: Maximum flow T.S. 7
-
Example of a Residual Graph (Handout)
Flow network Gs
2
3
4
5
t
1/14
1/6
2/3
4/105/12
5/8
4/7
3/4
1/3
3/7
3/4
1/3
3/7
2/4
0/3
2/7
2/4
0/3
2/7
4/105/12
0/101/12
0/101/12
5/8
4/7
1/8
0/7
1/8
0/7
1/8
1/121/14
1/61/8
1/121/14
1/60/8
0/120/14
0/6
0/8
0/120/14
0/6
Residual Graph Gfs
2
3
4
5
t
1111
131
51
78
13
21
43
1 2
By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.
6.6: Maximum flow T.S. 7
-
Example of a Residual Graph (Handout)
Flow network Gs
2
3
4
5
t
1/14
1/6
2/3
4/105/12
5/8
4/7
3/4
1/3
3/7
3/4
1/3
3/7
2/4
0/3
2/7
2/4
0/3
2/7
4/105/12
0/101/12
0/10
1/12
5/8
4/7
1/8
0/7
1/8
0/7
1/8
1/121/14
1/6
1/8
1/121/14
1/60/8
0/120/14
0/6
0/8
0/120/14
0/6
Residual Graph Gfs
2
3
4
5
t
1111
131
51
78
13
21
43
1 2
By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.
6.6: Maximum flow T.S. 7
-
Example of a Residual Graph (Handout)
Flow network Gs
2
3
4
5
t
1/14
1/6
2/3
4/105/12
5/8
4/7
3/4
1/3
3/7
3/4
1/3
3/7
2/4
0/3
2/7
2/4
0/3
2/7
4/105/12
0/101/12
0/10
1/12
5/8
4/7
1/8
0/7
1/8
0/7
1/8
1/121/14
1/6
1/8
1/121/14
1/6
0/8
0/120/14
0/6
0/8
0/120/14
0/6
Residual Graph Gfs
2
3
4
5
t
1111
131
51
78
13
21
43
1 2
By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.
6.6: Maximum flow T.S. 7
-
Example of a Residual Graph (Handout)
Flow network Gs
2
3
4
5
t
1/14
1/6
2/3
4/105/12
5/8
4/7
3/4
1/3
3/7
3/4
1/3
3/7
2/4
0/3
2/7
2/4
0/3
2/7
4/105/12
0/101/12
0/10
1/12
5/8
4/7
1/8
0/7
1/8
0/7
1/8
1/121/14
1/61/8
1/121/14
1/6
0/8
0/120/14
0/6
0/8
0/120/14
0/6
Residual Graph Gfs
2
3
4
5
t
1111
131
51
78
13
21
43
1 2
By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.
6.6: Maximum flow T.S. 7
-
Example of a Residual Graph (Handout)
Flow network Gs
2
3
4
5
t
1/14
1/6
2/3
4/105/12
5/8
4/7
3/4
1/3
3/7
3/4
1/3
3/7
2/4
0/3
2/7
2/4
0/3
2/7
4/105/12
0/101/12
0/10
1/12
5/8
4/7
1/8
0/7
1/8
0/7
1/8
1/121/14
1/61/8
1/121/14
1/60/8
0/120/14
0/6
0/8
0/120/14
0/6
Residual Graph Gfs
2
3
4
5
t
1111
131
51
78
13
21
43
1 2
By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.
6.6: Maximum flow T.S. 7
-
Example of a Residual Graph (Handout)
Flow network Gs
2
3
4
5
t
1/14
1/6
2/3
4/105/12
5/8
4/7
3/4
1/3
3/7
3/4
1/3
3/7
2/4
0/3
2/7
2/4
0/3
2/7
4/105/12
0/101/12
0/10
1/12
5/8
4/7
1/8
0/7
1/8
0/7
1/8
1/121/14
1/61/8
1/121/14
1/60/8
0/120/14
0/6
0/8
0/120/14
0/6
Residual Graph Gfs
2
3
4
5
t
1111
131
51
78
13
21
43
1 2
By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.
6.6: Maximum flow T.S. 7
-
The Ford-Fulkerson Method (“Enhanced Greedy”)
0: def fordFulkerson(G)1: initialize flow to 0 on all edges2: while an augmenting path in Gf can be found:3: push as much extra flow as possible through it
Augmenting path: Pathfrom source to sink in Gf
If f ′ is a flow in Gf and f a flowin G, then f + f ′ is a flow in G
Questions:How to find an augmenting path?Does this method terminate?If it terminates, how good is the solution?
Using BFS or DFS, we can find anaugmenting path in O(V + E) time.
6.6: Maximum flow T.S. 8
-
The Ford-Fulkerson Method (“Enhanced Greedy”)
0: def fordFulkerson(G)1: initialize flow to 0 on all edges2: while an augmenting path in Gf can be found:3: push as much extra flow as possible through it
Augmenting path: Pathfrom source to sink in Gf
If f ′ is a flow in Gf and f a flowin G, then f + f ′ is a flow in G
Questions:How to find an augmenting path?Does this method terminate?If it terminates, how good is the solution?
Using BFS or DFS, we can find anaugmenting path in O(V + E) time.
6.6: Maximum flow T.S. 8
-
The Ford-Fulkerson Method (“Enhanced Greedy”)
0: def fordFulkerson(G)1: initialize flow to 0 on all edges2: while an augmenting path in Gf can be found:3: push as much extra flow as possible through it
Augmenting path: Pathfrom source to sink in Gf
If f ′ is a flow in Gf and f a flowin G, then f + f ′ is a flow in G
Questions:How to find an augmenting path?Does this method terminate?If it terminates, how good is the solution?
Using BFS or DFS, we can find anaugmenting path in O(V + E) time.
6.6: Maximum flow T.S. 8
-
The Ford-Fulkerson Method (“Enhanced Greedy”)
0: def fordFulkerson(G)1: initialize flow to 0 on all edges2: while an augmenting path in Gf can be found:3: push as much extra flow as possible through it
Augmenting path: Pathfrom source to sink in Gf
If f ′ is a flow in Gf and f a flowin G, then f + f ′ is a flow in G
Questions:How to find an augmenting path?Does this method terminate?If it terminates, how good is the solution?
Using BFS or DFS, we can find anaugmenting path in O(V + E) time.
6.6: Maximum flow T.S. 8
-
The Ford-Fulkerson Method (“Enhanced Greedy”)
0: def fordFulkerson(G)1: initialize flow to 0 on all edges2: while an augmenting path in Gf can be found:3: push as much extra flow as possible through it
Augmenting path: Pathfrom source to sink in Gf
If f ′ is a flow in Gf and f a flowin G, then f + f ′ is a flow in G
Questions:How to find an augmenting path?Does this method terminate?If it terminates, how good is the solution?
Using BFS or DFS, we can find anaugmenting path in O(V + E) time.
6.6: Maximum flow T.S. 8
-
Illustration of the Ford-Fulkerson Method
s
2
3
4
5 t
Graph G = (V ,E , c):
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/108/1
0
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6��0/1010
/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10��6/10
��2/2
��0/4
��6/1010/1
0
8/10
0/2 6/6
2/4
8/8
8/9
8/10
10/10��8/10 ��8/9
��8/8
��2/4��8/1010
/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
s
2
3
4
5 t
Residual Graph Gf = (V ,Ef , cf ):
10
10
2 6
4
8
9
10
10
2
8
10
2 6
4
8
9
10
2
8
10
10
2 6
4
8
7
2
10
10
10
4
6
2 6
4
8
1
8
4
6
10
10
2
8
2 6
2
2
8
1
8
2
8
10
10
1
9
2 6
1
37
1
9
1
9
10
|f | = 0
|f | = 8|f | = 10|f | = 16|f | = 18|f | = 19
Is this a max-flow?
6.6: Maximum flow T.S. 9
-
Illustration of the Ford-Fulkerson Method
s
2
3
4
5 t
Graph G = (V ,E , c):
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/108/1
0
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6��0/1010
/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10��6/10
��2/2
��0/4
��6/1010/1
0
8/10
0/2 6/6
2/4
8/8
8/9
8/10
10/10��8/10 ��8/9
��8/8
��2/4��8/1010
/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
s
2
3
4
5 t
Residual Graph Gf = (V ,Ef , cf ):
10
10
2 6
4
8
9
10
10
2
8
10
2 6
4
8
9
10
2
8
10
10
2 6
4
8
7
2
10
10
10
4
6
2 6
4
8
1
8
4
6
10
10
2
8
2 6
2
2
8
1
8
2
8
10
10
1
9
2 6
1
37
1
9
1
9
10
|f | = 0
|f | = 8|f | = 10|f | = 16|f | = 18|f | = 19
Is this a max-flow?
6.6: Maximum flow T.S. 9
-
Illustration of the Ford-Fulkerson Method
s
2
3
4
5 t
Graph G = (V ,E , c):
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/108/1
0
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6��0/1010
/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10��6/10
��2/2
��0/4
��6/1010/1
0
8/10
0/2 6/6
2/4
8/8
8/9
8/10
10/10��8/10 ��8/9
��8/8
��2/4��8/1010
/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
s
2
3
4
5 t
Residual Graph Gf = (V ,Ef , cf ):
10
10
2 6
4
8
9
10
10
2
8
10
2 6
4
8
9
10
2
8
10
10
2 6
4
8
7
2
10
10
10
4
6
2 6
4
8
1
8
4
6
10
10
2
8
2 6
2
2
8
1
8
2
8
10
10
1
9
2 6
1
37
1
9
1
9
10
|f | = 0
|f | = 8|f | = 10|f | = 16|f | = 18|f | = 19
Is this a max-flow?
6.6: Maximum flow T.S. 9
-
Illustration of the Ford-Fulkerson Method
s
2
3
4
5 t
Graph G = (V ,E , c):
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/10
8/10
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6��0/1010
/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10��6/10
��2/2
��0/4
��6/1010/1
0
8/10
0/2 6/6
2/4
8/8
8/9
8/10
10/10��8/10 ��8/9
��8/8
��2/4��8/1010
/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
s
2
3
4
5 t
Residual Graph Gf = (V ,Ef , cf ):
10
10
2 6
4
8
9
10
10
2
8
10
2 6
4
8
9
10
2
8
10
10
2 6
4
8
7
2
10
10
10
4
6
2 6
4
8
1
8
4
6
10
10
2
8
2 6
2
2
8
1
8
2
8
10
10
1
9
2 6
1
37
1
9
1
9
10
|f | = 0
|f | = 8
|f | = 10|f | = 16|f | = 18|f | = 19
Is this a max-flow?
6.6: Maximum flow T.S. 9
-
Illustration of the Ford-Fulkerson Method
s
2
3
4
5 t
Graph G = (V ,E , c):
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/10
8/10
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6��0/1010
/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10��6/10
��2/2
��0/4
��6/1010/1
0
8/10
0/2 6/6
2/4
8/8
8/9
8/10
10/10��8/10 ��8/9
��8/8
��2/4��8/1010
/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
s
2
3
4
5 t
Residual Graph Gf = (V ,Ef , cf ):
10
10
2 6
4
8
9
10
10
2
8
10
2 6
4
8
9
10
2
8
10
10
2 6
4
8
7
2
10
10
10
4
6
2 6
4
8
1
8
4
6
10
10
2
8
2 6
2
2
8
1
8
2
8
10
10
1
9
2 6
1
37
1
9
1
9
10
|f | = 0
|f | = 8
|f | = 10|f | = 16|f | = 18|f | = 19
Is this a max-flow?
6.6: Maximum flow T.S. 9
-
Illustration of the Ford-Fulkerson Method
s
2
3
4
5 t
Graph G = (V ,E , c):
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/108/1
0
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10
��0/10��2/9
��0/6��0/1010
/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10��6/10
��2/2
��0/4
��6/1010/1
0
8/10
0/2 6/6
2/4
8/8
8/9
8/10
10/10��8/10 ��8/9
��8/8
��2/4��8/1010
/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
s
2
3
4
5 t
Residual Graph Gf = (V ,Ef , cf ):
10
10
2 6
4
8
9
10
10
2
8
10
2 6
4
8
9
10
2
8
10
10
2 6
4
8
7
2
10
10
10
4
6
2 6
4
8
1
8
4
6
10
10
2
8
2 6
2
2
8
1
8
2
8
10
10
1
9
2 6
1
37
1
9
1
9
10
|f | = 0
|f | = 8
|f | = 10|f | = 16|f | = 18|f | = 19
Is this a max-flow?
6.6: Maximum flow T.S. 9
-
Illustration of the Ford-Fulkerson Method
s
2
3
4
5 t
Graph G = (V ,E , c):
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/108/1
0
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10
��0/10��2/9
��0/6��0/1010
/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10��6/10
��2/2
��0/4
��6/1010/1
0
8/10
0/2 6/6
2/4
8/8
8/9
8/10
10/10��8/10 ��8/9
��8/8
��2/4��8/1010
/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
s
2
3
4
5 t
Residual Graph Gf = (V ,Ef , cf ):
10
10
2 6
4
8
9
10
10
2
8
10
2 6
4
8
9
10
2
8
10
10
2 6
4
8
7
2
10
10
10
4
6
2 6
4
8
1
8
4
6
10
10
2
8
2 6
2
2
8
1
8
2
8
10
10
1
9
2 6
1
37
1
9
1
9
10
|f | = 0|f | = 8
|f | = 10
|f | = 16|f | = 18|f | = 19
Is this a max-flow?
6.6: Maximum flow T.S. 9
-
Illustration of the Ford-Fulkerson Method
s
2
3
4
5 t
Graph G = (V ,E , c):
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/108/1
0
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10
��0/10��2/9
��0/6��0/1010
/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10��6/10
��2/2
��0/4
��6/1010/1
0
8/10
0/2 6/6
2/4
8/8
8/9
8/10
10/10��8/10 ��8/9
��8/8
��2/4��8/1010
/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
s
2
3
4
5 t
Residual Graph Gf = (V ,Ef , cf ):
10
10
2 6
4
8
9
10
10
2
8
10
2 6
4
8
9
10
2
8
10
10
2 6
4
8
7
2
10
10
10
4
6
2 6
4
8
1
8
4
6
10
10
2
8
2 6
2
2
8
1
8
2
8
10
10
1
9
2 6
1
37
1
9
1
9
10
|f | = 0|f | = 8
|f | = 10
|f | = 16|f | = 18|f | = 19
Is this a max-flow?
6.6: Maximum flow T.S. 9
-
Illustration of the Ford-Fulkerson Method
s
2
3
4
5 t
Graph G = (V ,E , c):
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/108/1
0
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10
��0/10��2/9
��0/6��0/1010
/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10
��6/10
��2/2
��0/4
��6/1010/1
0
8/10
0/2 6/6
2/4
8/8
8/9
8/10
10/10��8/10 ��8/9
��8/8
��2/4��8/1010
/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
s
2
3
4
5 t
Residual Graph Gf = (V ,Ef , cf ):
10
10
2 6
4
8
9
10
10
2
8
10
2 6
4
8
9
10
2
8
10
10
2 6
4
8
7
2
10
10
10
4
6
2 6
4
8
1
8
4
6
10
10
2
8
2 6
2
2
8
1
8
2
8
10
10
1
9
2 6
1
37
1
9
1
9
10
|f | = 0|f | = 8
|f | = 10
|f | = 16|f | = 18|f | = 19
Is this a max-flow?
6.6: Maximum flow T.S. 9
-
Illustration of the Ford-Fulkerson Method
s
2
3
4
5 t
Graph G = (V ,E , c):
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/108/1
0
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6��0/10
10/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10
��6/10
��2/2
��0/4
��6/1010/1
0
8/10
0/2 6/6
2/4
8/8
8/9
8/10
10/10��8/10 ��8/9
��8/8
��2/4��8/1010
/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
s
2
3
4
5 t
Residual Graph Gf = (V ,Ef , cf ):
10
10
2 6
4
8
9
10
10
2
8
10
2 6
4
8
9
10
2
8
10
10
2 6
4
8
7
2
10
10
10
4
6
2 6
4
8
1
8
4
6
10
10
2
8
2 6
2
2
8
1
8
2
8
10
10
1
9
2 6
1
37
1
9
1
9
10
|f | = 0|f | = 8|f | = 10
|f | = 16
|f | = 18|f | = 19
Is this a max-flow?
6.6: Maximum flow T.S. 9
-
Illustration of the Ford-Fulkerson Method
s
2
3
4
5 t
Graph G = (V ,E , c):
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/108/1
0
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6��0/10
10/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10
��6/10
��2/2
��0/4
��6/1010/1
0
8/10
0/2 6/6
2/4
8/8
8/9
8/10
10/10��8/10 ��8/9
��8/8
��2/4��8/1010
/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
s
2
3
4
5 t
Residual Graph Gf = (V ,Ef , cf ):
10
10
2 6
4
8
9
10
10
2
8
10
2 6
4
8
9
10
2
8
10
10
2 6
4
8
7
2
10
10
10
4
6
2 6
4
8
1
8
4
6
10
10
2
8
2 6
2
2
8
1
8
2
8
10
10
1
9
2 6
1
37
1
9
1
9
10
|f | = 0|f | = 8|f | = 10
|f | = 16
|f | = 18|f | = 19
Is this a max-flow?
6.6: Maximum flow T.S. 9
-
Illustration of the Ford-Fulkerson Method
s
2
3
4
5 t
Graph G = (V ,E , c):
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/108/1
0
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6��0/1010
/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10
��6/10
��2/2
��0/4
��6/1010/1
0
8/10
0/2 6/6
2/4
8/8
8/9
8/10
10/10
��8/10 ��8/9
��8/8
��2/4��8/1010
/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
s
2
3
4
5 t
Residual Graph Gf = (V ,Ef , cf ):
10
10
2 6
4
8
9
10
10
2
8
10
2 6
4
8
9
10
2
8
10
10
2 6
4
8
7
2
10
10
10
4
6
2 6
4
8
1
8
4
6
10
10
2
8
2 6
2
2
8
1
8
2
8
10
10
1
9
2 6
1
37
1
9
1
9
10
|f | = 0|f | = 8|f | = 10
|f | = 16
|f | = 18|f | = 19
Is this a max-flow?
6.6: Maximum flow T.S. 9
-
Illustration of the Ford-Fulkerson Method
s
2
3
4
5 t
Graph G = (V ,E , c):
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/108/1
0
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6��0/1010
/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10��6/10
��2/2
��0/4
��6/10
10/10
8/10
0/2 6/6
2/4
8/8
8/9
8/10
10/10
��8/10 ��8/9
��8/8
��2/4��8/1010
/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
s
2
3
4
5 t
Residual Graph Gf = (V ,Ef , cf ):
10
10
2 6
4
8
9
10
10
2
8
10
2 6
4
8
9
10
2
8
10
10
2 6
4
8
7
2
10
10
10
4
6
2 6
4
8
1
8
4
6
10
10
2
8
2 6
2
2
8
1
8
2
8
10
10
1
9
2 6
1
37
1
9
1
9
10
|f | = 0|f | = 8|f | = 10|f | = 16
|f | = 18
|f | = 19
Is this a max-flow?
6.6: Maximum flow T.S. 9
-
Illustration of the Ford-Fulkerson Method
s
2
3
4
5 t
Graph G = (V ,E , c):
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/108/1
0
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6��0/1010
/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10��6/10
��2/2
��0/4
��6/10
10/10
8/10
0/2 6/6
2/4
8/8
8/9
8/10
10/10
��8/10 ��8/9
��8/8
��2/4��8/1010
/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
s
2
3
4
5 t
Residual Graph Gf = (V ,Ef , cf ):
10
10
2 6
4
8
9
10
10
2
8
10
2 6
4
8
9
10
2
8
10
10
2 6
4
8
7
2
10
10
10
4
6
2 6
4
8
1
8
4
6
10
10
2
8
2 6
2
2
8
1
8
2
8
10
10
1
9
2 6
1
37
1
9
1
9
10
|f | = 0|f | = 8|f | = 10|f | = 16
|f | = 18
|f | = 19
Is this a max-flow?
6.6: Maximum flow T.S. 9
-
Illustration of the Ford-Fulkerson Method
s
2
3
4
5 t
Graph G = (V ,E , c):
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/108/1
0
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6��0/1010
/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10��6/10
��2/2
��0/4
��6/1010/1
0
8/10
0/2 6/6
2/4
8/8
8/9
8/10
10/10
��8/10 ��8/9
��8/8
��2/4��8/1010
/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
s
2
3
4
5 t
Residual Graph Gf = (V ,Ef , cf ):
10
10
2 6
4
8
9
10
10
2
8
10
2 6
4
8
9
10
2
8
10
10
2 6
4
8
7
2
10
10
10
4
6
2 6
4
8
1
8
4
6
10
10
2
8
2 6
2
2
8
1
8
2
8
10
10
1
9
2 6
1
37
1
9
1
9
10
|f | = 0|f | = 8|f | = 10|f | = 16
|f | = 18
|f | = 19
Is this a max-flow?
6.6: Maximum flow T.S. 9
-
Illustration of the Ford-Fulkerson Method
s
2
3
4
5 t
Graph G = (V ,E , c):
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/108/1
0
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6��0/1010
/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10��6/10
��2/2
��0/4
��6/1010/1
0
8/10
0/2 6/6
2/4
8/8
8/9
8/10
10/10��8/10 ��8/9
��8/8
��2/4��8/10
10/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
s
2
3
4
5 t
Residual Graph Gf = (V ,Ef , cf ):
10
10
2 6
4
8
9
10
10
2
8
10
2 6
4
8
9
10
2
8
10
10
2 6
4
8
7
2
10
10
10
4
6
2 6
4
8
1
8
4
6
10
10
2
8
2 6
2
2
8
1
8
2
8
10
10
1
9
2 6
1
37
1
9
1
9
10
|f | = 0|f | = 8|f | = 10|f | = 16|f | = 18
|f | = 19
Is this a max-flow?
6.6: Maximum flow T.S. 9
-
Illustration of the Ford-Fulkerson Method
s
2
3
4
5 t
Graph G = (V ,E , c):
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/108/1
0
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6��0/1010
/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10��6/10
��2/2
��0/4
��6/1010/1
0
8/10
0/2 6/6
2/4
8/8
8/9
8/10
10/10��8/10 ��8/9
��8/8
��2/4��8/10
10/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
s
2
3
4
5 t
Residual Graph Gf = (V ,Ef , cf ):
10
10
2 6
4
8
9
10
10
2
8
10
2 6
4
8
9
10
2
8
10
10
2 6
4
8
7
2
10
10
10
4
6
2 6
4
8
1
8
4
6
10
10
2
8
2 6
2
2
8
1
8
2
8
10
10
1
9
2 6
1
37
1
9
1
9
10
|f | = 0|f | = 8|f | = 10|f | = 16|f | = 18
|f | = 19
Is this a max-flow?
6.6: Maximum flow T.S. 9
-
Illustration of the Ford-Fulkerson Method
s
2
3
4
5 t
Graph G = (V ,E , c):
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/108/1
0
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6��0/1010
/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10��6/10
��2/2
��0/4
��6/1010/1
0
8/10
0/2 6/6
2/4
8/8
8/9
8/10
10/10��8/10 ��8/9
��8/8
��2/4��8/10
10/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
s
2
3
4
5 t
Residual Graph Gf = (V ,Ef , cf ):
10
10
2 6
4
8
9
10
10
2
8
10
2 6
4
8
9
10
2
8
10
10
2 6
4
8
7
2
10
10
10
4
6
2 6
4
8
1
8
4
6
10
10
2
8
2 6
2
2
8
1
8
2
8
10
10
1
9
2 6
1
37
1
9
1
9
10
|f | = 0|f | = 8|f | = 10|f | = 16|f | = 18
|f | = 19
Is this a max-flow?
6.6: Maximum flow T.S. 9
-
Illustration of the Ford-Fulkerson Method
s
2
3
4
5 t
Graph G = (V ,E , c):
0/10
0/10
0/2 0/6
0/4
0/8
0/9
0/10
0/10
��
0/10 ��0/8
��0/108/1
0
0/10
0/2 0/6
0/4
8/8
0/9
0/10
8/10
��
8/10 ��0/2
��0/9��8/10
10/10
0/10
2/2 0/6
0/4
8/8
2/9
0/10
10/10��0/10��2/9
��0/6��0/1010
/10
6/10
2/2 6/6
0/4
8/8
8/9
6/10
10/10��6/10
��2/2
��0/4
��6/1010/1
0
8/10
0/2 6/6
2/4
8/8
8/9
8/10
10/10��8/10 ��8/9
��8/8
��2/4��8/10
10/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
s
2
3
4
5 t
Residual Graph Gf = (V ,Ef , cf ):
10
10
2 6
4
8
9
10
10
2
8
10
2 6
4
8
9
10
2
8
10
10
2 6
4
8
7
2
10
10
10
4
6
2 6
4
8
1
8
4
6
10
10
2
8
2 6
2
2
8
1
8
2
8
10
10
1
9
2 6
1
37
1
9
1
9
10
|f | = 0|f | = 8|f | = 10|f | = 16|f | = 18
|f | = 19
Is this a max-flow?
6.6: Maximum flow T.S. 9
-
Outline
Introduction
Ford-Fulkerson
A Glimpse at the Max-Flow Min-Cut Theorem
Analysis of Ford-Fulkerson
6.6: Maximum flow T.S. 10
-
From Flows to Cuts
A cut (S,T ) is a partition of V into S and T = V \ S such that s ∈ Sand t ∈ T .
The capacity of a cut (S,T ) is the sum of capacities of the edgesfrom S to T :
c(S,T ) =∑
u∈S,v∈T
c(u, v) =∑
(u,v)∈E(S,T )
c(u, v)
A minimum cut of a network is a cut whose capacity is minimumover all cuts of the network.
Cut
s
2
3
4
5 t
Graph G = (V ,E , c):
10
10
2 6
4
8
9
10
10
c({s, 3}, {2, 4, 5, t}) =
10 + 9 = 19
|f | = 19
10/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
10− 0 + 9 = 199 + 7− 6 + 9 = 19
6.6: Maximum flow T.S. 11
-
From Flows to Cuts
A cut (S,T ) is a partition of V into S and T = V \ S such that s ∈ Sand t ∈ T .
The capacity of a cut (S,T ) is the sum of capacities of the edgesfrom S to T :
c(S,T ) =∑
u∈S,v∈T
c(u, v) =∑
(u,v)∈E(S,T )
c(u, v)
A minimum cut of a network is a cut whose capacity is minimumover all cuts of the network.
Cut
s
2
3
4
5 t
Graph G = (V ,E , c):
10
10
2 6
4
8
9
10
10
c({s, 3}, {2, 4, 5, t}) =
10 + 9 = 19
|f | = 19
10/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
10− 0 + 9 = 199 + 7− 6 + 9 = 19
6.6: Maximum flow T.S. 11
-
From Flows to Cuts
A cut (S,T ) is a partition of V into S and T = V \ S such that s ∈ Sand t ∈ T .The capacity of a cut (S,T ) is the sum of capacities of the edgesfrom S to T :
c(S,T ) =∑
u∈S,v∈T
c(u, v) =∑
(u,v)∈E(S,T )
c(u, v)
A minimum cut of a network is a cut whose capacity is minimumover all cuts of the network.
Cut
s
2
3
4
5 t
Graph G = (V ,E , c):
10
10
2 6
4
8
9
10
10
c({s, 3}, {2, 4, 5, t}) =
10 + 9 = 19
|f | = 19
10/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
10− 0 + 9 = 199 + 7− 6 + 9 = 19
6.6: Maximum flow T.S. 11
-
From Flows to Cuts
A cut (S,T ) is a partition of V into S and T = V \ S such that s ∈ Sand t ∈ T .The capacity of a cut (S,T ) is the sum of capacities of the edgesfrom S to T :
c(S,T ) =∑
u∈S,v∈T
c(u, v) =∑
(u,v)∈E(S,T )
c(u, v)
A minimum cut of a network is a cut whose capacity is minimumover all cuts of the network.
Cut
s
2
3
4
5 t
Graph G = (V ,E , c):
10
10
2 6
4
8
9
10
10
c({s, 3}, {2, 4, 5, t}) = 10 + 9 = 19
|f | = 19
10/10
9/10
0/2 6/6
3/4
7/8
9/9
9/10
10/10
10− 0 + 9 = 199 + 7− 6 + 9 = 19
6.6: Maximum flow T.S. 11
-
From Flows to Cuts
A cut (S,T ) is a partition of V into S and T = V \ S such that s ∈ Sand t ∈ T .The capacity of a cut (S,T ) is the sum of capacities of the edgesfrom S to T :
c(S,T ) =∑
u�