Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Shortest Augmenting Path Algorithm for the Maximum Flow Problem

Similar presentations


Presentation on theme: "The Shortest Augmenting Path Algorithm for the Maximum Flow Problem"— Presentation transcript:

1 The Shortest Augmenting Path Algorithm for the Maximum Flow Problem
and 6.855J The Shortest Augmenting Path Algorithm for the Maximum Flow Problem Obtain a network, and use the same network to illustrate the shortest path problem for communication networks, the max flow problem, the minimum cost flow problem, and the multicommodity flow problem. This will be a very efficient way of introducing the four problems. (Perhaps under 10 minutes of class time.)

2 Shortest Augmenting Path
4 2 5 1 3 1 1 2 4 s 4 t 3 2 1 3 This is the original network, and the original residual network.

3 Initialize Distances 2 2 1 5 2 s 1 4 t 1 3 4 5 4 3 2 1 1 3 1 1 2 4 3 2
5 4 3 2 1 1 3 1 1 2 4 2 s 1 4 t 3 2 2 s 1 3 4 5 1 3 t The node label henceforth will be the distance label. d(j) is at most the distance of j to t in G(x)

4 Representation of admissible arcs
4 2 2 1 5 5 4 3 2 1 1 3 1 1 2 4 s 2 4 1 t 3 2 2 s 1 3 4 5 3 1 t An arc (i,j) is admissible if d(i) = d(j) + 1. An s-t path of admissible arcs is a shortest path Admissible arcs will be represented with thick lines

5 Look for a shortest s-t path
4 2 2 1 5 5 4 3 2 1 1 3 1 1 2 2 4 4 2 2 s 1 1 4 t 3 2 2 s 1 3 4 5 1 3 t Start with s and do a depth first search using admissible arcs. Next. Send flow, and update the residual capacities.

6 Update residual capacities
4 2 2 1 5 5 4 3 2 1 1 3 1 1 2 4 2 s 2 1 4 t 2 3 2 2 s 1 3 4 5 1 3 t Here are the updated residual capacities. We will update distance labels later, as needed.

7 Look for a shortest s-t path
4 2 2 5 1 5 4 3 2 1 1 3 1 1 4 2 2 s 2 2 4 1 t 2 3 2 2 s 1 3 4 5 1 3 1 t Start with s and do a depth first search using admissible arcs. Next. Send flow, and update the residual capacities.

8 Update residual capacities
4 2 2 1 5 5 4 3 2 1 1 3 1 1 4 2 2 2 s 1 4 t 2 1 2 s 1 3 4 5 2 2 3 1 t Here are the updated residual capacities. We will update distance labels later, as needed.

9 Search for a shortest s-t path
4 2 2 1 5 5 4 3 2 1 1 3 1 1 4 2 2 s 2 2 1 4 t 2 1 2 s 1 3 4 5 2 2 1 3 1 t Start with s and do a depth first search using admissible arcs. If there are no admissible arcs from i, then relabel(i) and reverse along the path leading to i.

10 Update distances and path
4 2 2 1 5 5 4 3 2 1 1 3 1 1 2 4 2 2 s 2 1 4 t 2 1 2 s 3 1 4 5 2 2 1 2 3 1 t Start with s and do a depth first search using admissible arcs. If there are no admissible arcs from i, then relabel(i) and reverse one arc along the path leading from s .

11 Update distances and path
4 2 2 5 1 5 4 3 2 1 1 3 1 1 4 2 2 s 2 2 3 s 4 1 t 2 1 2 s 3 1 4 5 2 2 1 2 3 1 t Start with s and do a depth first search using admissible arcs. If there are no admissible arcs from i, then relabel(i) and reverse one arc along the path leading from s.

12 Look for a shortest s-t path
4 2 2 2 1 1 5 5 4 3 2 1 1 3 1 1 4 2 2 s s 3 2 2 4 1 t 2 1 2 3 1 4 5 2 2 1 3 2 1 t Continue the path from where it left off. If the path reaches t, then send flow and update residual capacities.

13 Update residual capacities
3 2 2 5 1 5 4 3 2 1 1 1 2 1 1 1 2 4 2 s 2 s 2 3 4 1 t 2 1 2 3 1 4 5 2 2 2 1 1 3 t Here are the updated residual capacities.

14 Search for a shortest s-t path
3 3 2 2 2 1 5 1 5 4 3 2 1 1 1 2 1 1 1 4 2 2 s 2 s 2 3 3 1 4 t 2 1 2 3 1 4 5 2 2 3 1 2 1 t Search for a shortest s-t path starting from s If there are no admissible arcs from i, then relabel(i) and reverse one arc along the path leading from s.

15 Search for a shortest s-t path
3 3 2 3 2 2 1 5 2 1 5 4 3 2 1 1 1 2 1 1 1 4 2 2 s 2 2 3 3 2 s 1 4 t 2 1 2 3 5 1 4 5 2 2 1 1 3 2 t Search for a shortest s-t path starting from s If there are no admissible arcs from i, then relabel(i) and reverse one arc along the path leading from s.

16 Search for a shortest s-t path
3 3 2 3 2 2 1 2 5 1 5 4 3 2 1 1 1 2 1 1 1 4 2 2 s 2 2 s 3 3 2 1 1 4 t 2 1 3 5 1 4 5 2 2 2 3 1 1 2 t Search for a shortest s-t path starting from s If the path reaches t, then send flow and update residual capacities.

17 update the residual capacities
3 3 2 3 2 2 1 1 2 5 5 4 3 2 1 1 1 2 1 1 1 1 4 2 s 2 2 3 2 s 4 1 t 3 3 5 1 4 5 3 2 1 1 3 2 t Here are the updated residual capacities

18 Search for a shortest s-t path
3 3 3 2 3 2 2 2 2 1 5 1 5 4 3 2 1 1 1 2 1 1 s 1 1 4 2 s 2 4 3 3 2 2 s 1 1 1 4 t 3 3 5 1 4 5 3 2 1 3 1 2 t Search for a shortest s-t path Next: update the residual capacities

19 Update the residual capacities
2 2 2 2 3 5 1 2 1 5 4 3 2 1 2 1 1 1 s 2 1 2 2 s 3 4 2 3 2 1 1 4 t 4 3 5 1 4 5 3 2 3 1 1 2 t Here are the updated residual capacities

20 Look for a shortest s-t path
2 5 3 2 3 2 2 1 4 1 2 5 2 5 4 3 2 1 2 2 1 1 1 s 5 2 1 2 2 3 4 6 2 4 2 s 3 4 1 1 t 4 3 5 1 4 5 3 2 2 3 1 1 t update distance labels and path If d(s) > n-1, then there is no path from s to t

21 These are the residual capacities for the optimum flow
2 3 2 2 5 2 5 1 4 1 2 5 4 5 4 3 2 1 2 2 1 1 1 5 2 1 2 2 3 4 6 2 6 2 s 3 4 1 1 t 4 3 5 1 4 5 3 2 2 3 1 1 t There is no s-t path in the residual network A min cut has S = {s, 2, 5}.


Download ppt "The Shortest Augmenting Path Algorithm for the Maximum Flow Problem"

Similar presentations


Ads by Google