Max-Flow Problem and Augmenting Path Algorithm
Max-Flow Problem and Augmenting Path Algorithm
Lecture 20
Outline
Max-Flow problem Description Some examples Algorithm for solving max-ow problem Augmenting path algorithm
Lecture 20
Lecture 20
c i j
Lecture 20
Lecture 20
For small scale problems: Another alternative is to introduce a single dummy source node connected with all the original source nodes BUT
Each outgoing link from the dummy source node to an original source node s gets assigned a capacity that is equal to the total capacity of the outgoing links from s
Similarly, if there are multiple sink nodes, we introduce a single dummy sink node BUT
Each incoming link from an original sink node t to the dummy sink node gets assigned a capacity that is equal to the total capacity of the incoming links to sink t
Lecture 20
Lecture 20
xij = 0
for all i = s, t
Lecture 20
The objective is to maximize the outow from the source node s xsj
{j |(s,j )E }
xsj xi
{ |( ,i)E } {j |(i,j )E }
subject to
xij = 0
for all i = s, t
0 xij cij
Lecture 20
maximize subject to
x12 + x13 x12 x25 x24 = 0 balance for node 2 x13 x35 x34 = 0 balance for node 3 x24 + x34 x46 = 0 balance for node 4 x25 + x35 x56 = 0 balance for node 5 0 x12 5 0 x13 10 0 x24 4 0 x25 5 0 x34 5 0 x35 5 0 x46 8 0 x56 10
Lecture 20
Max-Flow Algorithms
For a given graph: n denotes the number of nodes m denotes the number of edges max |f | is the maximum amount of ow Method Complexity Description Simplex Constrained by legal ow Ford-Fulkerson algorithm O(m max |f |) Weights have to be integers Edmonds-Karp algorithm O(nm2) Based on Ford-Fulkerson Dinitz blocking ow algorithm O(n2m) Builds layered graphs General push-relabel algorithm O(n2m) Uses a preow Ford-Fulkerson Algorithm is also known as Augmenting Path algorithm We will also refer to it as Max-Flow Algorithm
10
Lecture 20
Max-Flow Algorithm
This is an iterative method (operates in stages)
At each iteration, the algorithm is searching for a path from the source node to the sink node along which it can send a positive ow Such a path is referred to as augmenting path After a ow is sent along an augmenting path the capacities of the links on that path are adjusted These adjusted capacities are referred to as residual capacities Correspondingly, the resulting network is referred to as residual network The algorithm terminates when an augmenting path cannot be found
11
Lecture 20
Suppose we choose to send the ow along path 1 3 5 6 Suppose we choose to send 4 units of ow along this path Then the residual capacities of links (1,2), (3,5) and (5,6) are 6, 1, and 6 respectively A better choice is to send 5 units along this path. In this case, the capacity of the link (3,5) is reached (its residual capacity becomes 0) We say that link (3,5) is saturated (no more ow can be sent)
Operations Research Methods 12
Lecture 20
The ow on a path that saturates at least one of its links is the capacity of the path In other words, the capacity of a path is the maximum possible amount that we can send along the path The capacity C (p) of the path p is given by
C (p) = min uij
(i,j )p
where uij is the capacity of the link (i, j ) If the path p under consideration is in the residual network then the links (i, j ) p are the links in the residual network and the capacities are residual capacities
13
Lecture 20
Residual Capacity
The links that have been used to send a ow get updated to reect the ow push Every such link (i, j ) gets a capacity label of the form a/b where
a is the remaining capacity of the link and b is the total ow sent along that link a is viewed as forward capacity of the link b is viewed as backward capacity of the link (capacity if we choose to traverse the link in the opposite direction) NOTE: a + b = cij The sum of these numbers is equal to the original capacity of the link
Operations Research Methods 14
Lecture 20
Link with residual capacity a/b with b > 0 can be traversed backward Traveling backward means that we are removing the ow from the link
For example the link (i, j ) with the capacity 10/3 can be used backward to send the ow of at most 3 units If we send 2 units backward [along (j, i)], the resulting residual capacity of the link is (12,1)
Operations Research Methods 15
Lecture 20
We will use fi to indicate the amount of ow sent in iteration i We will apply the algorithm that sends the maximum possible amount of ow at each iteration, i.e., the ow equal to the capacity of the path under consideration
16
Lecture 20
Iteration 1
We nd a path s 4 3 t that can carry a positive ow The maximum ow we can send along this path is f1 = min{2, 1, 1}. We send f1 = 1 unit of ow along this path
17
Lecture 20
We obtain a residual network with updated link capacities resulting from pushing the ow along the path
18
Lecture 20
Iteration 2
We nd a path s 1 2 t that can carry a positive ow The maximum ow we can send along this path is f2 = min{4, 4, 3}. We send f2 = 3 units of ow along this path
19
Lecture 20
We obtain a residual network with updated link capacities resulting from pushing the ow along this path
20
Lecture 20
Iteration 3
We nd a path s 4 t that can carry a positive ow The maximum ow we can send along this path is f3 = min{1, 3}. We send f3 = 1 unit of ow along this path
21
Lecture 20
We obtain a residual network with updated link capacities resulting from pushing the ow along this path
22
Lecture 20
Iteration 4
We nd a path s 1 3 4 t that can carry a positive ow The maximum ow we can send along this path is f4 = min{1, 2, 1, 2}. We send f4 = 1 unit of ow along this path
23
Lecture 20
We obtain a residual network with updated link capacities resulting from pushing the ow along this path
At this point we are done. The node 2 is disconnected from the rest of the nodes (forward capacity 0 on all outgoing links) There are no more augmenting paths.
Operations Research Methods 24
Lecture 20
25