Approximate Max-integral-flow/min-cut Theorems Kenji Obata UC Berkeley June 15, 2004.
Max Flow – Min Cut Problem
description
Transcript of Max Flow – Min Cut Problem
![Page 1: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/1.jpg)
Max Flow – Min Cut Problem
![Page 2: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/2.jpg)
Directed Graph Applications
Shortest Path Problem(Shortest path from one point to another)
Max Flow problems(Maximum material flow through conduit) Liquid flow through pipes Parts through assembly line Current through electrical network, etc
![Page 3: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/3.jpg)
Flow Networks
Directed graph G = (V, E) Only one Source(s) and one Sink(t) Weight on each edge = Capacity of the edge if (u, v) E then Capacity is non-negative,
i.e. c(u, v) ≥ 0 if (u, v) E then Capacity is assumed zero,
i.e. c(u, v) = 0
![Page 4: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/4.jpg)
Flow Networks and Flows
flow(f) in Flow Network(G) is a real-valued function f: V x V → R
f(u, v) is flow from vertex u to vertex v. flow f(u, v) can be positive, negative or zeroConstraints on flow :1. Capacity constraint :
f(u, v) ≤ c(u, v), for all u, v V2. Skew symmetry constraint :
f(u, v) = - f(v, u)
![Page 5: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/5.jpg)
Flow Networks and Flows (Contd.)
3. Flow conservation constraint :Total net flow at vertex must equal 0.
∑j f(i, j) - ∑
k f(k, i) = 0 for all i V – {s, t}
flow in equals flow out
i
j1
j3
j2
k3
k2
k1
jnk4
![Page 6: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/6.jpg)
Maximum Flow
We refer a flow f as maximum if it is feasible and maximize ∑
k f(s, k).
Where f(s, k) is flow out of source s. Problem:
Objective: To find a maximum flow
s t
2
1
(6/10)
(7/8)
(1/1)
(5/6)
(8/10)(flow/capacity)
![Page 7: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/7.jpg)
Multiple source – Multiple sink Network
Convert this problem to single source - single sink.
s3
s4
s5
s2
s1
t3
t2
t1
103
12
5 15
814 20
6
711
13
18
2
Factories
Warehouses
![Page 8: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/8.jpg)
Conversion to flow Network
Add a super – source with infinite weighted edges emanting out to original sources
Add a super – sink with edges of infinite weight from original sinks
s3
s4
s5
s2
s1
t3
t2
t1
103
12
5 15
8
14 20
6
711
13
18
2
Super-source
Factories
Warehouses
Super-sink
st
![Page 9: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/9.jpg)
Another Example : Find a feasible match
Assign persons to tasks such that each task is assigned to a person and each person is assigned to a task in feasible manner.
1
2
3
4
5
6
7
8
persons tasks
![Page 10: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/10.jpg)
Transformation to maximum flow problem
1
2
3
4
5
6
7
8
persons tasks
s
1
11
1
t
1
1
1
1
![Page 11: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/11.jpg)
Ford-Fulkerson Algorithm for Max Flow Key ingredients:-
Residual Networks Augmenting Paths Cut
Limitations :- Flow should be integral or rational On each iteration residual capacity should be
integral
![Page 12: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/12.jpg)
The Residual Network
s
1
2
t
(8/10) (7/8)
(1/1)
(6/10)(5/6)
s
1
2
t
2 1
141
8
5 6
7
u vf (u, v) / c (u, v)
u vc (u, f) – f (u, v)
f (u, v)
Flow Network
Residual Network
(flow / capacity)
Residual capacity r (u ,v)
![Page 13: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/13.jpg)
Augmenting Paths
An augmenting path is a path from s to t in the residual network.
The Residual capacity of augmented path P is P= min {r(i, j): (i, j) P}
Augmentation along P Add Pin each arc along P inflow network Modify residual capacities in residual networkr(u, v) = r(u, v) - Pandr(v, u) = r(v, u) + Pfor u,
v P
s
1
2
t
2 1
141
8
5 6
7s
1
2
t
2
14
8
6 6
8
![Page 14: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/14.jpg)
Cut
An (S,T)-cut in a flow network G = (V,E) is a partition ofvertices V into two disjoint subsets S and T such thats S, t T
e.g., S = { s, 1 } and T = { 2, t }.The capacity of a cut (S,T) is
CAP(S,T) = uSvT c(u,v)
s
1
2
t
(9/10) (8/8)
(1/1)
(7/10)(6/6)
![Page 15: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/15.jpg)
The Ford Fulkerson Maximum Flow Method
Beginx := 0;create the residual network G(x);while there is some directed path from s to t in G(x) dobegin
let P be a path from s to t in G(x); := (P);send units of flow along P; update the residual capacities;
end
end {the flow x is now maximum}.
![Page 16: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/16.jpg)
Proof of Correctness of the Algorithm
Assume that all data are integral.Lemma:
At each iteration all residual capacities are integral.Proof:
By assumption it is true at beginning. Assume it is true after the first k-1 augmentations, and consider augmentation k along path P. The residual capacity of P is the smallest residual capacity on P, which is integral. After updating, we modify residual capacities by 0, or , and thus residual capacities stay integral.
![Page 17: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/17.jpg)
Proof of finiteness of Algorithm
Proof: The capacity of each augmenting path is at least 1. The augmentation reduces the residual capacity of some arc (s, j) and does not increase the residual capacity of (s, i) for any i.So, the sum of the residual capacities of arcs out of s keeps decreasing, and is bounded below by 0.Number of augmentations is O(nU), where U is the largest capacity in the network.
![Page 18: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/18.jpg)
Indication of Optimum Flow
There is no augmenting path in the residual network.
s
1
2
t
(9/10) (8/8)
(1/1)
(7/10)(6/6)
s
1
2
t
1
13
9
6 7
8
![Page 19: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/19.jpg)
Indication of Optimum Flow (Contd.)
Flow across the network is equal to the capacity of some cut(Max Flow Min Cut Theorem)
s
1
2
t
(9/10) (8/8)
(1/1)
(7/10)(6/6)
![Page 20: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/20.jpg)
Weak Duality Theorem for the Max Flow ProblemTheorem:
If f is any feasible flow and if (S,T) is an (s,t)-cut, then the flow | f | from source to sink in the network is at most CAP(S,T).
Proof: We define the flow across the cut (S,T) to bef(S,T) = iSjT f(i, j) - iSjT f(j, i)
S T
![Page 21: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/21.jpg)
Flows across different cuts
s
1
2
t
(9/10) (8/8)
(1/1)
(7/10)(6/6)
s
1
2
t
(9/10) (8/8)
(1/1)
(7/10)(6/6)
s
1
2
t
(9/10) (8/8)
(1/1)
(7/10)(6/6)
S T
S/T cut
If S = {s}, then the flow across (S, T) is 9 + 6 = 15
If S = {s,1}, then the flow across (S, T) is 8 + 1 + 6 = 15
If S = {s,2}, then the flow across (S, T) is 9 + 7 – 1 = 15
![Page 22: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/22.jpg)
More on Flows Across Cuts
Claim: Let (S,T) be any s-t cut. Then f(S,T) = | f | = flow into t.
Proof: Add the conservation of flow constraints for each node i S - {s} to the constraint that the flow leaving s is |f|. The resulting equality is f(S,T) = |f|.
j f(i, j) - k f(k, i) = 0 for each i {S} - s
j f(s, j) = | f | S T
![Page 23: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/23.jpg)
More on Flows Across CutsClaim:
The flow across (S,T) is at most the capacity of a cut.Proof:
If i S, and j T, then f(i, j) c(i, j). If i T, and j S, then f(i, j) 0.
f(S,T) = iSjT f(i, j) - iSjT f(j, i)
CAP(S,T) = iSjT c(i, j) - iSjT 0
![Page 24: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/24.jpg)
Max Flow Min Cut Theorem
Theorem: (Optimality conditions for max flows). The following are equivalent.1. A flow x is maximum.2. There is no augmenting path in G(x). 3. There is an s-t cutset (S, T) whose capacity is the flow value
of x.
Corollary: (Max-flow Min-Cut). The maximum flow value is the minimum value of a cut.
Proof of Theorem: 1 2. (not 2 not 1)Suppose that there is an augmenting path in G(x). Then x is not maximum.
![Page 25: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/25.jpg)
Max Flow Min Cut Theorem Contd.
3 1. Let v = Fx(S, T) be the flow from s to t. By assumption, v = CAP(S, T). By weak duality, the maximum flow is at most CAP(S, T). Thus the flow is maximum.
2 3. Suppose there is no augmenting path in G(x).
Claim: Let S be the set of nodes reachable from s in G(x). Let T = N\S. Then there is no arc in G(x) from S to T.
![Page 26: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/26.jpg)
Thus i S and j T f(i, j) = c(i, j)i T and j S f(i, j) = 0.
It follows that Fx(S,T) = iSjT f(i, j) - iSjT f(j, i)
= iSjT c(i, j) - iSjT 0 = CAP(S,T)
There is no arc from S to T in G(x)
Max Flow Min Cut Theorem Contd.
S T
Saturated
Reachable from s
Not Reachable from s
.s .t0
![Page 27: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/27.jpg)
27
Limitation of Algorithm : example 1
s
1
2
t
M M
MM1
M >> 1
• Termination even with integral flow and few nodes can take large no. of steps.• Depends on path selection and capacity of flow network.
Flow Network
Flow
![Page 28: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/28.jpg)
28
After 1st augmentation
s
1
2
t
M-1 M
M-1M1
1
1
Residual Network
![Page 29: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/29.jpg)
29
After 2nd augmentation
s
1
2
t
M-1 M-1
M-1M-11
1
1
1
1
![Page 30: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/30.jpg)
30
After 3rd augmentation
s
1
2
t
M-2 M-1
M-2M-11
2
2
1
1
![Page 31: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/31.jpg)
31
After 2M augmentations
s
1
2
tM
M
M
M
1
![Page 32: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/32.jpg)
32
s 3
4
t
m r
mm
Flow Network 1
2
m m
m
1
1
m >> 1
1/2 < r < 1
Limitation of Algorithm (Non termination for irrational flow)
![Page 33: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/33.jpg)
3333
Flow in Flow Network Residual Network
3
4
r
1
2 1
1
32 tS 1 1 1
After 1st augmentation
![Page 34: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/34.jpg)
343434
Flow in Flow Network Residual Network
r
r3
4
r
1
2 1-r
1-r
3
4
r
1
2
After 2nd augmentation
![Page 35: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/35.jpg)
35353535
Flow in Flow Network Residual Network
1-r
3
4
r
1
2 1
r r
3
r
1
2
After 3rd augmentation
![Page 36: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/36.jpg)
3636363636Flow in Flow Network Residual Network
3
4
2r -11
2 r
1
1-r1 - r
1-r
3
4
1 - r
1
2 1 - r
After 4th augmentation
![Page 37: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/37.jpg)
373737373737Residual NetworkFlow in Flow Network
3
4
2r -1
1
2 1r
1-r
1-r
3
4
1
2
1 - r
1-r1-r
After 5th augmentation
![Page 38: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/38.jpg)
Non termination in irrational flow
38
3
4
1
2
ai
ai+1
3
4
1
2
ai - ai+1 = ai+2
ai+1 - (ai - ai+1) = ai+3
And this goes on …………….
![Page 39: Max Flow – Min Cut Problem](https://reader033.fdocuments.us/reader033/viewer/2022042512/56814a5b550346895db781a2/html5/thumbnails/39.jpg)
39
Summary and Extensions
1. Augmenting path theorem
2. Ford-Fulkerson Algorithm
3. Duality Theory.
4. Computational Speedups.