Lecture 16

Post on 31-Dec-2015

27 views 0 download

description

Lecture 16. Max Flows 3 Preflow-Push Algorithms. Review. 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); - PowerPoint PPT Presentation

Transcript of Lecture 16

Lecture 16

Max Flows 3

Preflow-Push Algorithms

Review

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

e(3)=1

Exact distance: d(i) equals the length of the shortest path from node i to node t in G(x)

The Goldberg-Tarjan Preflow Push Algorithm for the

Maximum Flow Problem

Preflow Push

4

11

4

21

2

3

3

1

s

2

4

5

3

t

This is the original network, and the original residual network.

Initialize Distances

4

11

4

21

2

3

3

1

s

2

4

5

3

t

The node label henceforth will be the distance label.

0

5

4

3

2

1

t

4 53

s2

d(j) is at most the distance of j to t in G(x)

02

2

1

1

1

Saturate Arcs out of node s

4

11

4

21

2

3

3

1

s

2

4

5

3

t

Saturate arcs out of node s.

0

5

4

3

2

1

t

4 53

s2

Move excess to the adjacent arcs

02

2

1

1

1

3

2

12

13

6s

s

Relabel node s after all incident arcs have been saturated.

2

3 4

Select, then relabel/push

4

11

4

21

2

3

3

1

s

2

4

5

3

t

Select an active node, that is, one with excess

0

5

4

3

2

1

t

4 53

s2

Push/Relabel

02

2

1

1

1

3

2

12

13

6s

s

Update excess after a push

11

Select, then relabel/push

4

11

4

21

2

3

3

1

s

2

4

5

3

t

Select an active node, that is, one with excess

0

5

4

3

2

1

t

4 53

s202

2

1

1

1

3

2

12

1

6s

s

No arc incident to the selected node is admissible. So relabel.

11

23

3

Select, then relabel/push

4

11

4

21

2

3

3

1

s

2

4

5

t

Select an active node, that is, one with excess

0

5

4

3

2

1

t

4 5

s202

2

1

1

3

2

26

s

s

Push/Relabel

1

2

3

21

31

2

3

Select, then relabel/push

4

11

4

21

2

3

3

1

s

2

4

5

t

Select an active node.

0

5

4

3

2

1

t

4 5

s202

2

1

1

3

2

26

s

s

Push/Relabel

1

2

3

21

31

2

3 31

32

2

1

5

Select, then relabel/push

4

11

4

21

2

3

3

1

s

2

4

5

t

Select an active node.

0

5

4

3

2

1

t

4 5

s202

2

1

12

26

s

s

Push/Relabel

1

2

3

21

31

2

31

3

2

1

Select, then relabel/push

4

11

4

21

2

3

3

1

s

2

4

5

t

Select an active node.

0

5

4

3

2

1

t

4 5

s202

2

1

12

26

s

s

There is no incident admissible arc. So Relabel.

1

2

3

21

31

2

31

3

2

12

5

5

Select, then relabel/push

4

11

4

21

2

3

3

1

s

2

4

5

t

Select an active node.

0

5

4

3

2

1

t

4

5s202

2

1

12

26

s

s

Push/Relabel

1

2

3

21

3

2

31

3

2

22

1

41

Select, then relabel/push

4

11

4

21

2

3

3

1

s

2

4

5

t

Select an active node.

0

5

4

3

2

1

t

4

5s202

2

1

12

26

s

s

There is no incident admissible arc. So relabel.

1

2

3

21

3

2

31

3

2

22

1

41

3

5

5

Select, then relabel/push

4

11

4

21

2

3

3

1

s

2

4

5

t

Select an active node.

0

5

4

3

2

1

t

4 5

s202

2

1

12

26

s

s

Push/Relabel

1

2

3

21

3

2

31

3

2

22

1

41

3

5

5

3

Select, then relabel/push

4

11

4

21

2

3

3

1

s

2

4

5

t

Select an active node.

0

5

4

3

2

1

t

4 5

s202

2

1

12

26

s

s

Push/Relabel

1

2

3

21

3

22

222

41

3

5

5

3

1

141

4

Select, then relabel/push

4

11

4

21

2

3

3

1

s

2

4

5

t

Select an active node.

0

5

4

3

2

1

t

4 5

s202

2

1

12

26

s

s

Push/Relabel

1

2

3

21

3

22

222

41

3

5

5

3

1

4

24

2

2

Select, then relabel/push

4

11

4

21

2

3

3

1

s

2

4

5

t

Select an active node.

0

5

4

3

2

1

t

4 5

s02

2

1

12

26

s

s

Push/Relabel

1

2

3

21

3

22

222

41

3

5

5

3

1

4

4

2

4

Select, then relabel/push

4

11

4

21

2

3

3

1

s

2

4

5

t

Select an active node.

0

5

4

3

2

1

t

4 5

s02

2

1

12

26

s

s

Push/Relabel

1

2

3

21

3

21

322

41

3

5

5

3

1

4

4

2

4 35

5

5

Select, then relabel/push

4

11

4

21

2

3

3

1

s

2

4

5

t

One can keep pushing flow between nodes 2 and 5 until eventually all flow returns to node s.

0

5

4

3

2

1

t

4 5

s02

2

1

12

26

s

s

There are no paths from nodes 2 and 5 to t, and there are ways to speed up the last iterations.

1

2

3

21

3

21

322

41

3

5

5

3

1

4

4

2

4 35

5

5

Assignments

Read sections 7.3 and 7.6

Exercises

7.4