Maximum Flow: Max-Flow Min-Cut Theorem (Ford Fukerson's Algorithm)
Maximum Flow: Max-Flow Min-Cut Theorem (Ford Fukerson's Algorithm)
Maximum Flow: Max-Flow Min-Cut Theorem (Ford Fukerson's Algorithm)
Flow network is a directed graph G=(V,E) such that each edge has a non-negative capacity c(u,v)0. Two distinguished vertices exist in G namely : Source (denoted by s) : In-degree of this vertex is 0. Sink (denoted by t) : Out-degree of this vertex is 0. Flow in a network is an integer-valued function f defined On the edges of G satisfying 0f(u,v)c(u,v), for every Edge (u,v) in E.
For each edge (u,v) in E, the flow f(u,v) is a real valued function that must satisfy following 3 conditions :
| f | f ( s, v ) f (v, t )
vV vV
The flow into the node is same as flow going out from the node and thus the flow is conserved. Also the total amount of flow from source s = total amount of flow into the sink t.
Example of a flow
10, 9 s 6, 6 1 1,1
Capacity Flow
8,8 t 10,7
Table illustrating Flows and Capacity across different edges of graph above: fs,1 = 9 , cs,1 = 10 (Valid flow since 10 > 9)
xi,j = flow on edge (i,j) ui,j= capacity of edge (i,j) s = source node t = sink node
In simple terms maximize the s to t flow, while ensuring that the flow is feasible.
Maximize Subject To
v jxij - jxji = 0 for each i s,t jxsj = v 0 xij uij for all (i,j) E.
9 15
10
15
10
8 6
10
15
15
10
30
uS ,v T
c(u, v)
9 15
5
10
15
10
8 6
10
15
15
10
Capacity = 30
4
30
Min Cut
Min s-t cut (Also called as a Min Cut) is a cut of minimum capacity
2
Min s-t Cut
9 15
10
15
10
8 6
10
15
15
10
Capacity = 28
4
30
Proof :
S
8
T
t
Methods
Max-Flow Min-Cut Theorem
The Ford-Fulkerson Method
c f (u , v ) c (u , v ) f (u , v )
1 1,1 8,8 t 10,7 1 9 0 6 2
Residual Network
10, 9 s
1 s
1
8
7 3
6, 6
2
Original Network
c f ( p ) min{ c f (u , v ) : (u , v ) is on p}
AUGMENT(f,P)
b bottleneck(P) FOREACH e P IF (e E) // backwards arc f(e) f(e) + b ELSE
// forward arc
f(eR) f(e) - b RETURN f
The Ford-Fulkerson Augmenting Path Algorithm for the Maximum Flow Problem 15.082 and 6.855J (MIT OCW)
2
3
2
5
1
1 2
s
3
4
1
2
3
This is the original network, and the original residual network.
2
3
2
5
1
1 2
s
3
4
1
2
3
Find any s-t path in G(x)
2
3
2
5
1
1 1 2
s
2 3 1
4
1
2 1
3
Determine the capacity D of the path. Send D units of flow in the path. Update residual capacities.
2
3
2
5
1
1 1 2
s
2 3 1
4
1
2 1
3
Find any s-t path
2
3
2 1
5
1
1 1 1 1
s
2 3 1
4
1
2 1 1 1
Determine the capacity D of the path. Send D units of flow in the path. Update residual capacities.
2
3
2 1
5
1
1 1 1 1
s
2 3 1
4
1
2 1 1 1
3
Find any s-t path
2
3
1
5
1
1 1 1 1 2
s
2 3 1
4
1
1 1 2 1
2
3
1 2
5
1
1 1 1 1 2
s
2 3 1
4
1
1 1 2 1
3
Find any s-t path
2
3
1 2
5
1
1 1 1 1 2
s
1 2 2 1
4
1
1 2 1
1 2
2
3
1 2
5
1
1 1 1 1 2
s
1 2 2 1
4
1
2 1
1 2
3
Find any s-t path
2
3 2
1
5
1 1
s
1 2 2 1
1 2
4
1
2 1
1 2
Determine the capacity D of the path. Send D units of flow in the path. Update residual capacities.
2
3 2
1
5
1 1
s
1 2 2 1
1 2
4
1
2 1
1 2
2
3 2
1
5
1 1
s
1 2 2 1
1 2
4
1
2 1
1 2
2
1
2
5
1
2
s
2
4
2
3
Here is the optimal flow