Lecture 16

55
Lecture 16 Max Flows 3 Preflow-Push Algorithms

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

Page 1: Lecture 16

Lecture 16

Max Flows 3

Preflow-Push Algorithms

Page 2: Lecture 16

Review

Page 3: Lecture 16
Page 4: Lecture 16
Page 5: Lecture 16

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

Page 6: Lecture 16
Page 7: Lecture 16
Page 8: Lecture 16
Page 9: Lecture 16
Page 10: Lecture 16
Page 11: Lecture 16
Page 12: Lecture 16

e(3)=1

Page 13: Lecture 16
Page 14: Lecture 16

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

Page 15: Lecture 16

The Goldberg-Tarjan Preflow Push Algorithm for the

Maximum Flow Problem

Page 16: Lecture 16

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.

Page 17: Lecture 16

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

Page 18: Lecture 16

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

Page 19: Lecture 16

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

Page 20: Lecture 16

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

Page 21: Lecture 16

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

Page 22: Lecture 16

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

Page 23: Lecture 16

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

Page 24: Lecture 16

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

Page 25: Lecture 16

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

Page 26: Lecture 16

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

Page 27: Lecture 16

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

Page 28: Lecture 16

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

Page 29: Lecture 16

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

Page 30: Lecture 16

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

Page 31: Lecture 16

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

Page 32: Lecture 16

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

Page 33: Lecture 16
Page 34: Lecture 16
Page 35: Lecture 16
Page 36: Lecture 16
Page 37: Lecture 16
Page 38: Lecture 16
Page 39: Lecture 16
Page 40: Lecture 16
Page 41: Lecture 16
Page 42: Lecture 16
Page 43: Lecture 16
Page 44: Lecture 16
Page 45: Lecture 16
Page 46: Lecture 16
Page 47: Lecture 16
Page 48: Lecture 16
Page 49: Lecture 16
Page 50: Lecture 16
Page 51: Lecture 16
Page 52: Lecture 16
Page 53: Lecture 16
Page 54: Lecture 16
Page 55: Lecture 16

Assignments

Read sections 7.3 and 7.6

Exercises

7.4