3/17/2003Tucker, Applied Combinatorics Section 4.2a 1 Network Flows Michael Duquette & Whitney Sherman Tucker, Applied Combinatorics, Section 4.2a, Group G
3/17/2003Tucker, Applied Combinatorics Section 4.2a 2 In this section we will be focusing on analyzing network flows in order to maximize a flow from a starting vertex to an ending vertex. Real World Applications: Maximizing the flow of oil between two cities using a large pipeline network. Maximizing the number of telephone calls possible between two places. Calculating the maximum bandwidth of a computer network. _________________________________________________
3/17/2003Tucker, Applied Combinatorics Section 4.2a 3 Assume initially that all networks are directed. Definitions: K(e) represents the capacity or upper bound for a particular edge e in a network. In(x) = Set of edges directed into x. Out(x) = Set of edges directed out from x. Source, a = Initial starting vertex. Sink, z = Ending vertex. _________________________________________________
3/17/2003Tucker, Applied Combinatorics Section 4.2a 4 Definitions: Continued a-z Flow, = Integer-valued function defined on each edge e that satisfies the following conditions: a) b) c) _________________________________________________
3/17/2003Tucker, Applied Combinatorics Section 4.2a 5 Sample Flow: Figure 4.2, pg 138 b a d c z e 8,8 5,5 4,3 4,0 5,5 3,2 4,1 7,6 7,4 8,6 Note: The numbers corresponding to each edge represent (K(e), (e)), the capacity and flow of each edge. _________________________________________________
3/17/2003Tucker, Applied Combinatorics Section 4.2a 6 Cut: Let denote the set of all edges with vertex This set is known as a cut. Note: denotes the complement of P. Example: b a d c z e 8,8 5,5 4,3 4,0 5,5 3,2 4,1 7,6 7,4 8,6 The cut ({a,b,c}, {d,e,z}) consists of the edges: Note: is not in the cut since it goes from to P. The dashed line represents the cut. Note: is considered an a-z cut if _________________________________________________
3/17/2003Tucker, Applied Combinatorics Section 4.2a 7 Let be an a-z flow in the network N and let P be a subset of vertices in N not containing a or z. If we sum together the conservation-of-flow equations from condition (c) on slide 4 for each we obtain: After some elimination of duplicate vertices (flows) we reach the following condition: ( ) For each vertex subset P not containing a or z, Meaning that the flow into P equals the flow out of P
3/17/2003Tucker, Applied Combinatorics Section 4.2a 8 Theorem 1: For any a-z flow in a network N, the flow out of a equals the flow into z. Proof: Assume temporarily that N contains no edge. Let P be all vertices in N except a and z. So Then consists of edges going into z (from P) and consists of edges going out of a (to P). Thus: Remember that the only flow into P from {a,z} must be from a, since condition (b) forbids flow from z. Similarly by condition (b), all flow out of P must go to z. The flow equality still holds if there is flow in an edge. _________________________________________________
3/17/2003Tucker, Applied Combinatorics Section 4.2a 9 Let denote the value of the a-z flow. This value equals the sum of the flow out of a, or equivalently the flow into z. Define the capacity of cut : Example: This tells us that no a-z flow in the network can have a value greater than 13. The capacity of the a-z cut where P = {a,b,c} = = 13. b a d c z e 8,8 5,5 4,3 4,0 5,5 3,2 4,1 7,6 7,4 8,6
3/17/2003Tucker, Applied Combinatorics Section 4.2a 10 Theorem 2: Informally, should equal the total flow from (which is bounded by ), but we cannot prove an equality of this type using condition ( ) without first modifying N. We cannot use ( ) in N because condition ( ) requires that P not contain the source a. Expand the network N by adding a new vertex with an edge of immense capacity. Note that will be part of. For any a-z flow and any a-z cut in a network N, Proof: _________________________________________________
3/17/2003Tucker, Applied Combinatorics Section 4.2a 11 Proof: Theorem 2 Continued Assign a flow value of to, yielding a valid flow in the expanded network. In effect, the old source a now gets its flow from the “super source”. In the new network, we can apply condition ( ) to P. It says that the flow into P, which is at least (other flow could come into P along edges from ), equals the flow out of P. Thus: _________________________________________________
3/17/2003Tucker, Applied Combinatorics Section 4.2a 12 Corollary 2a: For any a-z flow and any a-z cut in a network N, if and only if: (i)For each edge (ii)For each edge Further, when, is a maximal flow and is an a-z cut of minimal capacity. _________________________________________________
3/17/2003Tucker, Applied Combinatorics Section 4.2a 13 Proof: Corollary 2a Consider the following inequalities of the proceeding proof: The first inequality is an equality—the flow from into P (in the expanded network) equals –if condition (i) holds; otherwise the flow into P is greater than. The second inequality is an equality—the flow out of P equals –if condition (ii) holds; otherwise it is less. Thus the equality holds in the figure above if and only if conditions (i) and (ii) are both true. The last sentence in the corollary follows directly from Theorem 2. _________________________________________________
3/17/2003Tucker, Applied Combinatorics Section 4.2a 14 All normal flows can be decomposed into a sum of unit-flow paths from a to z, for short, a-z unit flows. An a-z unit flow along a-z path L is defined as if e is in L and = 0 if e is not in L. We will begin building up a flow in order to build a maximal flow by successively adding a-z unit flows together. Example: Note: Make sure that you do not exceed any edge’s capacity. b a d c z e 8,8 5,5 4,3 4,0 5,5 3,2 4,1 7,6 7,4 8,6
3/17/2003Tucker, Applied Combinatorics Section 4.2a 15 Unsaturated Edges: Edges where the present flow does not equal the capacity. Slack: Calculate the slack of edge e in flow by the following equation: Definitions: _________________________________________________
3/17/2003Tucker, Applied Combinatorics Section 4.2a 16 Example We start with no flow Find a path from a to z: The minimum slack on is 3 (at the start, the slack of each edge is just the capacity) Add to the initial zero flow All edges except are unsaturated a bd c e z Minimum slack = 3
3/17/2003Tucker, Applied Combinatorics Section 4.2a 17 a bd c e z Example Continued The next a-z path is which also has a minimum slack of 3 The current flow is The path with minimum slack 2 gives us Note that not all edges are saturated yet (see figure 2) Minimum slack = 3 a 2 ec b d z Figure 2: slack in unsaturated edges For. Minimum slack = 2
3/17/2003Tucker, Applied Combinatorics Section 4.2a 18 Example Continued There is only one path that can be formed from the previous figure 2 and that is having a minimum slack of 1 Now it is not possible to go anywhere except from a to c All of the edges have been saturated in the cut where The value of the final flow is 9 which equals the capacity of this cut By corollary 2 the flow must be maximal a bd c e z 5, 5 1, 1 6, 2 5, 4 3, 3 6, 5 6, 4
3/17/2003Tucker, Applied Combinatorics Section 4.2a 19 Augmenting Flow Algorithm Example We want to find the maximum flow from a to z Let the initial flow be where Now apply the labeling: label (by definition, there cannot be incoming edges to the source with flow) Edge has slack and b is unlabeled so label (2 is the minimum of and s(a, b)) Edge has no slack, edge has slack so label it a d c f be z K1K1 K2K2 K3K3 (-, ) c f e z 6,4 7,4 5,0 4,0 4,4 12,9 3,0 5,4 4,4 7,5 9,9 6,4 7,4 5,0 4,0 4,4 12,9 3,0 5,4 4,4 7,5 9,9
3/17/2003Tucker, Applied Combinatorics Section 4.2a 20 Example Continued Next scan b, (scan vertices in the order that they are labeled) There are two incoming edges, edge has but it is already labeled, edge has no flow, outgoing edge has slack and e is unlabeled, so label Scan d, edge comes from a labeled vertex, edge has and c is not labeled so using step 2a label edge is saturated No labeling can be done from e At c label f with At f label z with (-, ) 6,4 7,4 5,0 4,0 4,4 12,9 3,0 5,4 4,4 7,5 9,9
3/17/2003Tucker, Applied Combinatorics Section 4.2a 21 Class Example Find a maximal flow from a to z in this network. a be d cg f z