15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem.

19
15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem

Transcript of 15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem.

Page 1: 15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem.

15.082 and 6.855J

The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow

Problem

Page 2: 15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem.

4

114

21

2

3

3

1

s

2

4

5

3

t

Preflow Push

This is the original network, which is also the original residual network.

4

11

4

21

2

3

3

1

s

2

4

5

3

t

Page 3: 15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem.

4

114

21

2

3

3

1

s

2

4

5

3

t

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 4: 15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem.

4

114

21

2

3

3

1

s

2

4

5

3

t

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 5: 15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem.

4

114

21

2

3

3

1

s

2

4

5

3

t

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 6: 15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem.

4

114

21

2

3

3

1

s

2

4

5

3

t

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 7: 15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem.

4

114

21

2

3

3

1

s

2

4

5

3

t

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 8: 15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem.

4

114

21

2

3

3

1

s

2

4

5

3

t

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 9: 15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem.

4

114

21

2

3

3

1

s

2

4

5

3

t

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 10: 15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem.

4

114

21

2

3

3

1

s

2

4

5

3

t

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 11: 15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem.

4

114

21

2

3

3

1

s

2

4

5

3

t

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 12: 15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem.

4

114

21

2

3

3

1

s

2

4

5

3

t

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 13: 15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem.

4

114

21

2

3

3

1

s

2

4

5

3

t

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 14: 15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem.

4

114

21

2

3

3

1

s

2

4

5

3

t

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 15: 15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem.

4

114

21

2

3

3

1

s

2

4

5

3

t

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 16: 15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem.

4

114

21

2

3

3

1

s

2

4

5

3

t

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 17: 15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem.

4

114

21

2

3

3

1

s

2

4

5

3

t

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 18: 15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem.

4

114

21

2

3

3

1

s

2

4

5

3

t

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 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 19: 15.082 and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem.

MITOpenCourseWarehttp://ocw.mit.edu

15.082J / 6.855J / ESD.78J Network OptimizationFall 2010

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.