Top Banner
Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: uij is the capacity on arc (i,j). Find non-negative flow fij for each arc (i,j) such that for each node, except s and t, the total incoming flow is equal to the total outgoing flow (flow conservation), such that •fij is at most the capacity uij on arc (i,j); The total amount of flow going out of s (which is equal to the total amount of flow coming into t ) is maximized
28

Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

Dec 14, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

Max Flow Problem

• Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: uij is the capacity on arc (i,j).

• Find non-negative flow fij for each arc (i,j) such that for each node, except s and t, the total incoming flow is equal to the total outgoing flow (flow conservation), such that

• fij is at most the capacity uij on arc (i,j);• The total amount of flow going out of s (which is equal to

the total amount of flow coming into t ) is maximized

Page 2: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

3

t

4

1

2

s

2

1

4

2 3

2

1

4

34

1

the black numbers next to an arc is its capacity

Page 3: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

3

t

4

1

2

s

2

1

4

2 3

2

1

4

34

1

Cts= -1

Set costs all other arcs at 0

The minimum cost flow circulation (Af=0) maximises the s-t flow

Page 4: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

3

t

4

1

2

s

2

1

4

2 3

2

1

4

34

1

the black numbers next to an arc is its capacity

Push flow over the path s-1-4-tThe bottlenecks on this path are the edges {1,4} and{4,t}. So we can send flow 2 along this path

Page 5: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

3

t

4

1

2 2

s

2

1

4

2 2 3

2

1

4

2 3 4

1

the black number next to an arc is its capacitythe green number next to an arc is the flow on it

We can push another extra flow of 1 on the paths-1-3-t. The bottleneck is now {s,1} with remaining capacity 1.

Page 6: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

3

t

4

1

2 2

s

2

1

4

2 2 3

1 2

1

4

3 31 4

1

the black number next to an arc is its capacitythe green number next to an arc is the flow on it

Since {4,t} is on its capacity, the only path remaining through which we can send extra flow is s-2-4-3-t. Here {4,3} is the bottleneck and thus we can send extra flow of 1

Page 7: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

3

t

4

1

2 2

s

2

1

1 4

2 2 3

1 2

1

1 4

3 32 4

1 1

the black number next to an arc is its capacitythe green number next to an arc is the flow on it

There are no s-t paths left on which we can send extraflow. So is this the maximal flow?

Page 8: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

the residual graph3

t

4

1

2 2

s

2

1 1

1 3 4

2 2 3 3

1 1 2

1 1

1 3 4

3 3 2 2 4

1 1

blue arcs (i,j) are forward arcs (fij<uij)green arcs (j,i) are backward arcs (fij>0)the blue number is the residual capacity of a blue arcthe green number is the capacity of a green arcthe black number is the original capacity of the arc

Page 9: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

the residual graph3

t

4

1

2

s

2

1

1 3

2 3

1 1

1

1 3

2 2

1

red arcs form an s-t-path in the residual graph and therefore a flow-augmenting path in the original network

3

Page 10: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

the residual graph3

t

4

1

2

s

2

1

1 3

2 3

1 1

1

1 3

2 2

1

red arcs form an augmenting path

Augment the flow by the minimum capacity of a red arc, i.e, 1

3

Page 11: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

the residual graph3

t

4

1

2

s

2

1

1 3

2 3

1 1

1

1 3

2 2

1

Augment the flow by the minimum capacity of a red arc, i.e, 1:- increase the flow by 1 on all arcs corresponding toforward red arcs - decrease the flow by 1 on all arcs corresponding tobackward red arcs

3

Page 12: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

the residual graph3

t

4

1

2

s

2

1

2 2

3

2

1

2 2

3 1

1

Augment the flow by the minimum capacity of a red arc, i.e, 1:- increase the flow by 1 on all arcs corresponding toforward red arcs - decrease the flow by 1 on all arcs corresponding tobackward red arcs

Construct the new residual graph

3

1 1

Page 13: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

3

t

4

1

2

s

2

1

4

2 3

2

1

4

24

1

An s-t cut is defined by a set S of the nodes withs in S and t not in S.

Page 14: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

3

t

4

1

2

s

2

1

4

2 3

2

1

4

24

1

An s-t cut is defined by a set S of the nodes withs in S and t not in S.

S={s,1,2}

Page 15: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

3

t

4

1

2

s

2

1

4

2 3

2

1

4

24

1

An s-t cut is defined by a set S of the nodes withs in S and t not in S

Size of cut S is the sum of the capacities on the arcs from S to N\S.

S={s,1,2}

Page 16: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

3

t

4

1

2

s

2

1

4

2 3

2

1

4

24

1

An s-t cut is defined by a set S of the nodes withs in S and t not in S

Size of cut S is the sum of the capacities on the arcs from S to N\S.

C(S)=u13+u14+u24= 2+2+4=8

Page 17: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

3

t

4

1

2

s

2

1

4

2 3

2

1

4

24

1

C(S1)=us1+u24= 2+4=6

S1

Page 18: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

3

t

4

1

2

s

2

1

4

2 3

2

1

4

24

1

C(S1)=us1+u24= 2+4=6

C(S2)=u13+u43+u4t= 2+1+2=5

S1 S2

Page 19: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

3

t

4

1

2

s

2

1

4

2 3

2

1

4

24

1

C(S2)=u13+u43+u4t= 2+1+2=5

S2

Max Flow ≤ Min Cut

Page 20: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

3

t

4

1

2

s

2

1

4

2 3

2

1

4

24

1

C(S2)=u13+u43+u4t= 2+1+2=5

S2

Max Flow ≤ Min Cut fs1+fs2 ≤ Min Cut ≤ 5

Page 21: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

t

4

1

2

s

2

1

2 2

3

2

1

2 2

3 1

1

3

1 1

the residual graph

Max Flow = Min Cut

fs1+fs2=2+3=5 = C(S2)=u13+u43+u4t= 2+1+2=5

S2

Page 22: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

t

4

1

2

s

2

1

2 2

3

2

1

2 2

3 1

1

3

1 1

the residual graph

Max Flow = Min Cut

fs1+fs2=2+3=5 = C(S2)=u13+u43+u4t= 2+1+2=5

S2

Theorem: Max Flow = Min Cut

Page 23: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

t

4

1

2

s

2

1

2 2

3

2

1

2 2

3 1

1

3

1 1

Proof sketch of Max Flow=Min Cut

fs1+fs2=2+3=5 = C(S2)=u13+u43+u4t= 2+1+2=5

S2

There is no s-t-path in the residual graph!!!

S2={s,1,2,4} the set of nodes reachable from S

Page 24: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

3

t

4

1

2 2

s

2

1 0

4 2

2 1 3 0

2 2

1 0

4 3

2 24 3

1 1

C(S2)=u13+u43+u4t= 2+1+2=5

S2

fs1+fs2=2+3=5 =

Proof sketch of Max Flow=Min Cut

from S2={s,1,2,4} to {3,t} f13 = u13 = 2 f43 = u43 = 1 f4t = u4t = 2

Page 25: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

3

t

4

1

2 2

s

2

1 0

4 2

2 1 3 0

2 2

1 0

4 3

2 24 3

1 1

C(S2)=u13+u43+u4t= 2+1+2=5

S2

fs1+fs2=2+3=5 =from S2={s,1,2,4} to {3,t} f13 = u13 = 2 f43 = u43 = 1 f4t = u4t = 2 Full capacity of cut is used

Proof sketch of Max Flow=Min Cut

Page 26: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

3

t

4

1

2 2

s

2

1 0

4 2

2 1 3 0

2 2

1 0

4 3

2 24 3

1 1

C(S2)=u13+u43+u4t= 2+1+2=5

S2

fs1+fs2=2+3=5 =from S2={s,1,2,4} to {3,t} f13 = u13 = 2 f43 = u43 = 1 f4t = u4t = 2 Full capacity of cut is used

from {3,t} to {S2={s,1,2,4} f32 = 0 f34 = 0

Proof sketch of Max Flow=Min Cut

Page 27: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

3

t

4

1

2 2

s

2

1 0

4 2

2 1 3 0

2 2

1 0

4 3

2 24 3

1 1

C(S2)=u13+u43+u4t= 2+1+2=5

S2

fs1+fs2=2+3=5 =from S2={s,1,2,4} to {3,t} f13 = u13 = 2 f43 = u43 = 1 f4t = u4t = 2 Full capacity of cut is used

from {3,t} to {S2={s,1,2,4} f32 = 0 f34 = 0 nothing flows back across the cut

Proof sketch of Max Flow=Min Cut

Page 28: Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: u ij is the capacity on arc (i,j). Find non-negative flow f ij.

3

t

4

1

2 2

s

2

1 0

4 2

2 1 3 0

2 2

1 0

4 3

2 24 3

1 1

C(S2)=u13+u43+u4t= 2+1+2=5

S2

fs1+fs2=2+3=5 =from S2={s,1,2,4} to {3,t} f13 = u13 = 2 f43 = u43 = 1 f4t = u4t = 2

from {3,t} to {S2={s,1,2,4} f32 = 0 f34 = 0

Proof sketch of Max Flow=Min Cut

Capacity of the cut is equal to the flow from s to t