Lecture 13
Introduction to Maximum Flows
Flow Network





















V
y
V
y
f
v
y
s
f
f
t
s
V
x
y
x
f
V
y
x
x
y
f
y
x
f
V
y
x
y
x
u
y
x
f
R
V
V
f
G
t
s
y
x
u
E
y
x
y
x
u
E
y
x
E
V
G
))
(
(
)
,
(
|
|
}.
,
{
all
for
0
)
,
(
on)
conservati
(Flow
,
,
all
for
)
,
(
)
,
(
symmetry)
(Skew
,
,
all
for
)
,
(
)
,
(
)
constraint
(Capacity
such that
:
function
a
is
in
flow
A
.
sink
a
and
source
a
:
nodes
h two
distinguis
We
.
0
)
,
(
assume
,
)
,
(
For
.
0
)
,
(
capacity
e
nonnegativ
a
ha
)
,
(
edge
each
in which
graph
directed
a
is
)
,
(
network
flow
A
s t
out
flow
in
flow 
|
|
out
flow
f |
|
in
flow
f
 
 


V
y V
y
t
y
f
y
s
f
f )
,
(
)
,
(
|
|
4
The Ford Fulkerson Maximum Flow Algorithm
• Begin x := 0;
– create the residual network G(x);
– while there is some directed path from s to t in G(x)
do
• begin
• let P be a path from s to t in G(x);
• ∆:= δ(P);
• send ∆ units of flow along P;
• update the r's;
– End
• end {the flow x is now maximum}.
The Ford-Fulkerson Augmenting Path
Algorithm for the Maximum Flow Problem
Ford-Fulkerson Max Flow
4
1
1
2
2
1
2
3
3
1
s
2
4
5
3
t
This is the original network,
and the original residual
network.
4
1
1
2
2
1
2
3
3
1
Ford-Fulkerson Max Flow
Find any s-t path in G(x)
s
2
4
5
3
t
4
1
1
2
1
3
Ford-Fulkerson Max Flow
Determine the capacity D of the path.
Send D units of flow in the path.
Update residual capacities.
1
1
1
2
1
2
3
2
1
s
2
4
5
3
t
4
1
1
2
1
3
Ford-Fulkerson Max Flow
Find any s-t path
1
1
1
2
1
2
3
2
1
s
2
4
5
3
t
4
2
1
1
1
1
2
2
1
1
1
1
3
Ford-Fulkerson Max Flow
1
1
1
1
3
2
1
s
2
4
5
3
t
Determine the capacity D of the path.
Send D units of flow in the path.
Update residual capacities.
4
2
1
1
1
1
2
2
1
1
1
1
3
Ford-Fulkerson Max Flow
1
1
1
1
3
2
1
s
2
4
5
3
t
Find any s-t path
1
1 1
1
1
4
1
2
1
1
2
1
1
3
Ford-Fulkerson Max Flow
1
1
3
2
1
s
2
4
5
3
t
Determine the capacity D of the path.
Send D units of flow in the path.
Update residual capacities.
1
1 1
1
1
4
1
2
1
1
2
2
1
1
3
Ford-Fulkerson Max Flow
1
1
3
2
1
s
2
4
5
3
t
Find any s-t path
1
1
1
2 1 1
1
1
4
2
2
1
1
2
2
1
Ford-Fulkerson Max Flow
1
1
3
1
1
s
2
4
5
3
t
Determine the capacity D of the path.
Send D units of flow in the path.
Update residual capacities.
2
1
1
2 1 1
1
1
4
2
2
1
1
2
2
1
Ford-Fulkerson Max Flow
1
1
3
1
1
s
2
4
5
3
t
Find any s-t path
2
1
1
1
1
1
4
1
3
1
1
2 1 1
3
2
2
1
2
1
Ford-Fulkerson Max Flow
2
1
s
2
4
5
3
t
2
Determine the capacity D of the path.
Send D units of flow in the path.
Update residual capacities.
1
1
1
1
1
4
1
3
1
1
2 1 1
3
2
2
1
2
1
Ford-Fulkerson Max Flow
2
1
s
2
4
5
3
t
2
There is no s-t path in the residual
network. This flow is optimal
1
1
1
1
1
4
1
3
1
1
2 1 1
3
2
2
1
2
1
Ford-Fulkerson Max Flow
2
1
s
2
4
5
3
t
2
These are the nodes that are reachable
from node s.
s
2
4
5
3
Ford-Fulkerson Max Flow
1
1
2
2
2
1
2
s
2
4
5
3
t
Here is the optimal flow
Review for cutset theorem
s t
S T
cut
-
of
capacity
)
to
from
(flow
)
to
from
flow
(
)
to
from
flow
(
|
|
value
flow
t
s
T
S
S
T
T
S
f




s
s
S
t
t
S
T
T
x
G
G
i j
i
j
k
k
l
l
ij
ij u
x 
0

kl
x
0
in
exist
not
does
)
,
(
in
exist
not
does
)
,
(




kl
x
ij
ij
x
x
G
k
l
u
x
G
j
i
)
,
(
cut
of
capacity
to
from
flow
),
,
( T
S
T
S
u
x
j
i ij
ij 



0
to
from
flow
0
),
,
( 


 S
T
x
l
k kl
)
,
(
of
capacity
)
to
from
(flow
)
to
from
(flow
|
|
value
flow
T
S
S
T
T
S
x



Quiz Sample
time?
-
polynomial
in
runs
algorithm
Fulkersor
-
Ford
Does
No!
:
Answer
Polynomial-time
 
 
digits.
4
has
10)
(i.e.,
1010
number
binary
The
.
4
10
log
e.g.,
.
log
is
integer
an
of
size
input
The
size.
input
its
to
respect
ith
function w
a
as
polynomial
a
by
bounded
is
time
running
its
if
time
-
polynomial
is
algorithm
An
2
2

m
m

Flow networkFlow networkFlow networkFlow network

Editor's Notes

  • #9 Obtain a network, and use the same network to illustrate the shortest path problem for communication networks, the max flow problem, the minimum cost flow problem, and the multicommodity flow problem. This will be a very efficient way of introducing the four problems. (Perhaps under 10 minutes of class time.)