Loading in 5 sec....

Max Flow – Min Cut ProblemPowerPoint Presentation

Max Flow – Min Cut Problem

- 140 Views
- Uploaded on
- Presentation posted in: General

Max Flow – Min Cut Problem

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

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

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

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 zero
Constraints on flow :

- Capacity constraint :
f(u, v) ≤ c(u, v), for all u, v Î V

- Skew symmetry constraint :
f(u, v) = - f(v, u)

j1

j2

j3

i

jn

k4

Flow Networks and Flows (Contd.)- Flow conservation constraint :
Total net flow at vertex must equal 0.

∑jf(i, j) - ∑kf(k, i) = 0 for all i Î V – {s, t}

flow in equals flow out

k1

k2

k3

(8/10)

(7/8)

(1/1)

s

t

(5/6)

(6/10)

2

Maximum Flow- We refer a flow f as maximum if it is feasible and maximize ∑kf(s, k).
Where f(s, k) is flow out of source s.

- Problem:
- Objective: To find a maximum flow

(flow/capacity)

s1

10

Warehouses

3

12

t1

s2

15

5

6

8

t2

s3

20

14

13

7

t3

s4

11

18

2

s5

Multiple source – Multiple sink NetworkConvert this problem to single source - single sink.

s1

10

3

Warehouses

12

t1

s2

15

5

Super-sink

6

Super-source

8

t2

t

s3

20

14

s

13

7

t3

s4

11

18

2

s5

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

tasks

1

5

2

6

3

7

4

8

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.

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

(7/8)

(8/10)

f (u, v) / c (u, v)

(1/1)

u

u

v

v

s

t

(5/6)

(6/10)

2

1

1

2

c (u, f) – f (u, v)

8

7

1

s

t

f (u, v)

4

1

2

6

5

The Residual NetworkFlow Network

(flow / capacity)

Residual Network

Residual capacity r (u ,v)

1

2

8

7

1

s

t

4

1

1

2

2

6

5

8

8

1

s

t

4

2

6

6

Augmenting Paths- An augmenting path is a path from s to t in the residual network.
- The Residual capacity of augmented path P is
d(P) = min {r(i, j):(i, j) P}

- Augmentation along P
- Add d(P) in each arc along P inflow network
- Modify residual capacities in residual network
r(u, v) = r(u, v) - d(P)andr(v, u) = r(v, u) + d(P)for u, v P

(8/8)

(9/10)

(1/1)

s

t

(6/6)

(7/10)

2

CutAn (S,T)-cut in a flow network G = (V,E) is a partition of

vertices V into two disjoint subsets S and T such that

s 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)

The Ford Fulkerson Maximum Flow Method

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);

:= d(P);

send units of flow along P;

update the residual capacities;

end

end {the flow x is now maximum}.

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 D of P is the smallest residual capacity on P, which is integral.

After updating, we modify residual capacities by 0, or D, and thus residual capacities stay integral.

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.

(8/8)

(9/10)

(1/1)

s

t

(6/6)

(7/10)

2

1

1

9

8

1

s

t

3

2

7

6

Indication of Optimum FlowThere is no augmenting path in the residual network.

(8/8)

(9/10)

(1/1)

s

t

(6/6)

(7/10)

2

Indication of Optimum Flow (Contd.)Flow across the network is equal to the capacity of some cut

(Max Flow Min Cut Theorem)

T

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 be

f(S,T) = iSjT f(i, j) - iSjT f(j, i)

(8/8)

(9/10)

(1/1)

s

t

(6/6)

(7/10)

2

1

(8/8)

(9/10)

S

(1/1)

s

t

(6/6)

(7/10)

T

2

S/T cut

1

(8/8)

(9/10)

(1/1)

s

t

(6/6)

(7/10)

2

Flowsacross different cutsIf 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

T

More on Flows Across CutsClaim:

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|.

- Sjf(i, j) - Skf(k, i) = 0 for each i {S} - s
- Sjf(s, j) = | f |

More on Flows Across Cuts

Claim:

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

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.

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.

.t

.s

0

Reachable from s

Not Reachable from s

S

T

Max Flow Min Cut Theorem Contd.

Thus iÎ S and j Î T Þf(i, j) = c(i, j)

iÎ T and jÎ S Þ f(i, j) = 0.

There is no arc from S to T in G(x)

It follows that

Fx(S,T) = iSjT f(i, j) - iSjT f(j, i)

= iSjT c(i, j) - iSjT 0 = CAP(S,T)

Limitation of Algorithm : example 1

1

M

M

s

t

1

M

M

2

- Termination even with integral flow and few nodes can take
- large no. of steps.
- Depends on path selection and capacity of flow network.

Î

Flow

M >> 1

Flow Network

27

Limitation of Algorithm (Non termination for irrational flow)

Flow Network

1

m

m

r

s

2

3

t

1

m

m

1

m

m

4

m >> 1

1/2 < r < 1

32

1

1

r

r

r

2

3

2

3

1-r

1-r

r

4

4

Residual Network

Flow in Flow Network

34

34

34

1

1

r

r

2

3

2

3

1

r

1-r

r

4

Residual Network

Flow in Flow Network

35

35

35

35

2r -1

1-r

1 - r

2

3

r

1

4

After 4th augmentation

1

1 - r

2

3

1 - r

1-r

4

Flow in Flow Network

Residual Network

36

36

36

36

36

1

2r -1

1-r

1-r

1-r

2

3

2

3

1

1 - r

r

1-r

4

4

After 5th augmentation

Flow in Flow Network

Residual Network

37

37

37

37

37

37

Non termination in irrational flow

1

1

ai+1

ai+1 - (ai - ai+1) = ai+3

3

2

3

2

ai

ai - ai+1 = ai+2

4

4

And this goes on …………….

38

Summary and Extensions

1. Augmenting path theorem

2. Ford-Fulkerson Algorithm

3. Duality Theory.

4. Computational Speedups.

39