Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 6 Maximum Flow Problems Flows and Cuts Augmenting Path Algorithm.

Similar presentations

Presentation on theme: "Chapter 6 Maximum Flow Problems Flows and Cuts Augmenting Path Algorithm."— Presentation transcript:

1 Chapter 6 Maximum Flow Problems Flows and Cuts Augmenting Path Algorithm

2 2 Definitions/Assumptions Each arc (i, j) has an arc capacity u ij. The problem is to find the maximum flow from the source node, s, to the sink node, t. Assumptions: The network is directed All capacities are nonnegative integers There is no directed path from s to t composed only of infinite capacity arcs Each arc (i, j) has a corresponding reverse arc (j, i) (could have 0 capacity) There are no parallel arcs

3 3 Residual Network (see pp ) Given a set of flows x = {x ij }, the residual network tells what changes are feasible. For each arc (i, j), G(x) contains: A forward arc with residual capacity r ij = u ij – x ij (if > 0) A backward arc with capacity r ij = x ij (if > 0) The residual capacity of an s-t cut is the sum of the residual capacities of forward arcs in the cut. Facts: The value of any flow is less than or equal to the capacity of any s-t cut in the network. The additional flow that can be sent from s to t is no greater than the residual capacity of any s-t cut.

4 4 Generic Augmenting Path Algorithm algorithm augmenting path; begin x := 0; while G(x) contains a directed path from node s to node t do begin Identify an augmenting path P from node s to node t; augment  units of flow along P and update G(x); end;

5 5 Augmenting Paths An augmenting path is a directed path from the source to the sink in the residual network –Its capacity is the minimum (residual) capacity of the arcs it contains –If the network contains an augmenting path, then we can send more units of flow from the source to the sink An increase of  units on arc (i, j) in the residual network corresponds to, in the original network, increasing x ij by  units, or decreasing x ji by  units, or increasing x ij by a  units while decreasing x ji by (1-a)  units, 0 < a < 1 (i.e., an aug. path may actually subtract flows from some arcs) Residual capacities do not uniquely determine the flows in the original network. We will use the convention: –if u ij  r ij, set x ij = u ij - r ij and x ji = 0 –otherwise, set x ij = 0 and x ji = r ij - u ij

6 6 Labeling Algorithm Q.How to find an augmenting path? A.Use the search algorithm (from Chapter 3) to find nodes reachable from the source node in the residual network. If the sink is reachable then a path from the source can be traced backward using predecessor indices. If the search procedure fails to label the sink node as reachable, then it will have identified an s-t cut in the residual network with r ij = 0 for each arc (i, j) in the cut. Therefore, x ij = u ij for each arc in the cut, and the total flow from s to t equals the capacity of this cut.

7 7 The Labeling Algorithm (main)

8 8 Procedure augment

9 9 Max-Flow Min-Cut Theorem Since the labeling algorithm stops when it identifies an s-t cut whose capacity equals the flow from s to t, and since the capacity of any s-t cut is an upper bound on the total value of any feasible flow, it follows that (Max-Flow Min-Cut Theorem) The maximum value of the flow from a source node s to a sink node t in a capacitated network equals the minimum capacity among all s-t cuts. Also, A flow is a maximum flow if and only if the corresponding residual network contains no augmenting path, and If all arc capacities are integer, the maximum flow problem has an integer maximum flow.

10 10 Ch. 7: Distance Labels In maximum flow problems, measure the distance of a node from the sink node as the smallest number of arcs on any directed path from this node to the sink. t = 4: d(1) = 3, d(2) = 1, d(3) = 2, d(4) = 0 The shortest augmenting path algorithm identifies the augmenting path in the residual network containing the fewest arcs and runs in O(n 2 m) time (labeling algorithm is O(nmU), where U is the largest finite arc capacity)

11 11 Preflow-Push Algorithm Augmenting path algorithms can take excessive time by repeatedly sending flows down the same subpaths (see Fig.7.10). Sending a flow along a path takes O(n) time in the worst case. Note that augmenting path algorithms always maintain a feasible flow (satisfies capacity and flow conservation constraints). The preflow-push algorithm always obeys capacity constraints but does not satisfy the conservation constraints until it reaches the optimal solution. –A preflow is a set of arc flows in which the total flow into a node may exceed the total flow out of the node; –A push is the simple operation of sending flow down a single arc.

12 12 Excesses Given a flow x, the excess of each node i is given by In a preflow, e(i)  0 for each i  s. Node s is the only node with a negative excess (because no arcs are directed into it). Nodes i  t with e(i) > 0 are called active. Active nodes indicate infeasibility; the algorithm moves toward feasibility by trying to push the excess flow to the active node’s neighbors; in particular, to nodes closer to the sink (measured by “distance”). An admissible arc is an arc (i, j) for which d(i) = d(j) + 1.

13 13 Preflow-Push Subroutines procedure preprocess; begin x := 0; compute the exact distance labels d(i); x sj = u sj for each arc (s, j)  A(s); d(s) := n; end; procedure push/relabel(i); begin if the network contains an admissible arc (i, j) then push  = min{e(i), r ij } units of flow from i to j else replace d(i) by min{d(j) + 1 : (i, j)  A(i) and r ij > 0}; end;

14 14 Preflow-Push Algorithm algorithm preflow-push; begin preprocess; while the network contains an active node do begin select an active node i; push/relabel(i); end;

15 15 Termination & Complexity The preflow-push algorithm stops when all the excess is collected at the source or the sink, i.e., the current preflow is a feasible flow. The excess at the sink is the maximum flow value. This generic version runs in O(n 2 m) time. Depending on how the list of active nodes is maintained, variations of it run in O(n 3 ), O(n 2 m 1/2 ), or O(nm + n 2 log U) time, which may be smaller depending on the instance.

Download ppt "Chapter 6 Maximum Flow Problems Flows and Cuts Augmenting Path Algorithm."

Similar presentations

Ads by Google