VIEWS: 33 PAGES: 19 POSTED ON: 1/28/2010
SLBS NETWORK FLOWS Consider the following network of one-way streets: A 40 S 45 B 35 D 20 25 10 30 15 C 25 T The number next to each arc is the maximum flow of traffic along that street, in vehicles per hour, which is the CAPACITY. “What is the maximum number of vehicles that can pass from S to T in a given time?” Definitions A vertex S is called a SOURCE if all arcs containing S are directed away from S S A vertex T is called a SINK if all arcs containing T are directed towards T (T is for Terminus) T JMcC 1 SLBS A FLOW in a network with a single source S and a single sink T is an assignment to each arc of a non-negative number (which could be zero) called the FLOW ALONG THE ARC If the flow along an arc is equal to the capacity of the arc, then the arc is said to be SATURATED A flow must satisfy two conditions: a) the feasibility condition which says that the flow along each arc cannot exceed the capacity of that arc. the conservation condition which expresses the fact that nothing is allowed to build up at an intermediate vertex V (i.e. any vertex other than S or T) 7 12 5 This is allowable V 5 This is not 7 11 b) Thus, sum of flows along arcs into V equals sum of flows along arcs out of V. Thus, sum of flows out of S equals sum of flows into T (this sum is known as the value of the flow) Be careful not to confuse capacity and flow. Flows are sometimes written in circles, e.g. Read pp 215-219 Examples 1 to 3 Ex 1A p219-220 JMcC 2 SLBS THE LABELLING PROCEDURE On the network, draw a pair of arrows on each arc, one going in the direction of the flow and one in the opposite direction A 45 B Use the forward facing arrow to indicate the spare capacity in that arc - the amount by which the flow can be increased - the excess capacity. Use the backward facing arrow to indicate the flow along the arc, i.e. the amount by which the flow could be decreased - the (back capacity). 15 30 A 45 B Note that the sum of the two numbers is equal to the original capacity of the arc. JMcC 3 SLBS Example A 5 S 6 B 2 3 3 C 4 T 8 4 4 D An initial flow may be like this: A 2 3 S 4 6 2 B 4 4 0 D 5 2 3 3 4 3 4 8 4 0 C 3 1 T 4 Path SACT Flow 3 (AC saturated) Path SBDT Flow 4 (BD is saturated) Initial Flow =7 (i.e. sum of flows out of S and sum of flows into T) Note that saturated paths have been marked with double bars. Read pp 221-223 Ex 8B p 224 We now need to try and improve on this flow if possible. JMcC 4 SLBS FLOW AUGMENTING PATHS We look for other paths from S to T which consist entirely of unsaturated arcs and add them to the network, amending the figures for the back and excess capacities. Returning to our example: A 2 3 S 4 6 2 B 4 4 0 D 5 2 3 0 3 4 3 4 8 4 C 3 1 T 4 One such path is SBCT which has a capacity of 1 Adding this gives: A 2 3 S 5 4 1 6 1 2 B 4 4 0 D 5 2 3 0 3 2 4 4 8 4 C 34 10 3 T 4 Path SBCT Flow 1 (CT is saturated) Total Flow = 8 JMcC 5 SLBS We can now add SBCDT which has a maximum flow of 1: A 2 3 S 65 4 1 6 2 B 4 2 1 4 0 3 D 45 5 2 3 3 2 1 1 4 4 8 0 C 34 10 3 T 43 0 Path SBCDT Flow 1 (SB is saturated) Total flow = 9 We can now add SABCDT which also has a flow of 1 available: 12 43 S 6 54 1 6 2 B 4 5 A 3 3 1 2 1 3 2 1 4 0 3 2 D 3 0 1 2 2 1 4 4 8 45 0 C 34 10 T 4 32 0 6 Path SABCDT Flow 1 (BC is saturated) Total Flow = 10 There are no other flows through the network as every route is now blocked by a saturated arc. JMcC 6 SLBS The final flow along each arc should then be represented on a fresh diagram: C A 3 4 S 6 B 4 D 1 3 2 6 4 T The final solution is a flow of 10. Notes: Cross out the working values on the network very lightly as the examiner will want to see all values that have been used! The back arrow shows the current flow through the arc and the forward arrow the spare capacity. In the exam, you will need to list each flow-augmenting route and the amount you are sending through it. JMcC 7 SLBS BACK FLOW The stage below was reached when trying to obtain the maximal flow by using flow-augmenting paths: A 0 6 S 4 2 2 0 1 1 2 C 2 B 6 5 4 1 0 T 0 Arcs SA, SC, AB and BT are saturated. At first sight there appears to be no more flow-augmenting paths as you would have to go along SB and then the flow along BC is in the wrong direction. Arc SB has excess capacity of 1 unit and arc BT has zero excess capacity, but we can decrease the flow on CB by up to 2 units as indicated by the back capacity. This is known as a back flow. A flow-augmenting path can then be completed using arc CT which has a non-zero excess capacity. Use SBCT Flow 1 JMcC 8 SLBS The modified path SBCT is then: S 1 0 3 2 2 1 2 2 B 4 5 3 T 1 C The final pattern, which is maximal, is: A 6 2 B 3 1 4 6 S T 4 C 3 Total Flow = 13 JMcC 9 SLBS We have a maximal flow when it is not possible to find any further flow-augmenting paths. But how can we be sure particularly if we have a large network? Consider the following network which has a bottleneck: A 7 S 5 B 5 7 C 8 4 D 4 F 4 E 8 T Although 12 units can flow from S and 12 units can flow into T, the maximum flow through the network is only 4 because all flow must pass through arc CD. A cut is a separation of the vertices into two sets, one containing S and the other containing T. The cut passes through arcs only - never vertices. To calculate the capacity of a cut you add together the flow along the cut arcs provided those arcs are directed from S to T. So, we could take a cut through SA and SB marked C1. A 7 S 5 B C1 5 7 C 8 4 D 4 F 4 E 8 T The capacity of C1 is 7 + 5 = 12 JMcC 10 SLBS If we consider other cuts through the network we can see that smallest capacity of any cut is the one that cuts through CD. This is called the minimum cut. The maximum flow cannot exceed the capacity of this cut since it separates S from T and so all flow must go through the arcs in the cut. Hence we have the Maximum Flow-Minimum Cut Theorem (First proved in 1955 by Ford and Fulkerson) The value of a maximum flow equals the value of a minimum cut To find the minimum cut you must use the value of the maximum capacity along each arc, therefore you must use the original diagram and certainly not the final diagram showing the maximum flow. So, if you find a cut on the original network whose value is equal to the total flow you have found, you have found the maximum flow. The minimum cut will always pass through arcs that become saturated when the maximum flow is found - so use saturated arcs to suggest possible cuts to try. The flow must be in the direction from the set of vertices containing S to the set of vertices containing T. If it is in the opposite direction it contributes 0 to the value of the cut. 5 S 7 C T Value of cut C = 5 + 0 = 5 JMcC 11 SLBS Returning to an earlier example: A 5 S 6 B 4 D 2 3 4 8 3 C 4 T Final Flow = 10 This is the original diagram, not the diagram showing the maximal flow We found a total flow of 10 A minimum cut of capacity 10 is found by cutting through AC, BC & BD. Thus maximum flow is confirmed as 10. A 5 S 6 B 4 D 2 3 4 8 3 C 4 T Capacity of cut C1 = 3 + 3 + 4 = 10 Hence, the maximum flow algorithm may be stated: Step 1 Step 2 Obtain an initial flow by inspection Find flow augmenting paths by using the labelling procedure until no further flow augmenting paths can be found. Check that the flow obtained is maximal by using the max flow - min cut theorem and finding a cut whose capacity is equal to the value of the flow. C1 Step 3 JMcC 12 SLBS Example A 20 14 B 10 8 F 20 8 8 D 5 H 11 E 18 G 40 T S 19 15 C 10 12 C2 C1 a) Calculate the values of cuts C1 and C2 Given that one of these cuts is a minimum cut, b) c) d) State the maximum flow Deduce the flow along GT, making your reasoning clear. By considering the flow into D, deduce that there are only two possible integer values for the flow along SA. For each of these two values found in part d), draw a complete maximum flow pattern. Deduce the number of different maximum flow patterns. e) f) JMcC 13 SLBS a) C1 = 8 + 8 + 8 + 5 + 11 = 40 C2 = 20 + 0 + 14 + 0 + 12 = 56 Note: the two zeros in the above line are because the flows along DF and EB are in the wrong direction. b) c) Maximum flow = Minimum cut = 40 Need to look at saturated arcs. The edges in a minimum cut must be saturated (otherwise you could push more along that edge) Saturated arcs are AF, DF, DG, DH & EH Flow into (and therefore out of) F = 8(AF) + 8(DF) = 16 Therefore flow into G = 16(FG) + 8(DG) = 24 Therefore flow along GT = 24 d) Flow into A = Flow out of A, therefore flow along AD ≤ 12 Flow into D = Flow out of D = 8(DF) + 8(DG) + 5(DH) = 21 So Flow along AD + Flow along BD = 21 So Flows could be 12 & 9 or 11 & 10 (Flow along BD ≤ 10) Possible Flows out of A are 8 + 12 or 8 + 11 So Flows along SA are 20 or 19 JMcC 14 SLBS e) A 20 S 9 or 8 B 12 9 D 0 or 1 11 C 11 or 12 E 8 F 16 8 8 5 H 16 SA = 20 G 24 T 11 or 12 A 19 S 10 or 9 B 11 10 8 F 16 8 8 D 5 H 11 E 16 SA = 19 G 24 T 11 or 12 C 0 or 1 11 or 12 f) There are 4 maximum flow patterns (two in each of the above cases) Read pp 228 - 232 Ex 8C pp 232-234 JMcC 15 SLBS MULTIPLE SOURCES AND SINKS Two reservoirs R1 and R2 supply water to two towns T1 and T2, via three pumping stations A, B and C as shown in the network below. The numbers represent the amount of water which can be pumped from station to station, in thousands of gallons per hour. A R1 7 6 2 B 6 8 T1 R2 6 8 2 4 10 T2 C We wish to find the maximum amount of water that can be pumped into both towns. We introduce a supersource S which feeds into R1 and R2. Since the total flow out of R1 is 13, the capacity of SR1 is also 13. Since the total flow out of R2 is 14, the capacity of SR2 is also 14. We introduce a supersink T into which T1 and T2 feed. Since the total flow into T1 is 14, the capacity of T1T is also 14. Since the total flow into T2 is 14, the capacity of T2T is also 14. JMcC 16 SLBS Hence we have an amended network: A R1 13 14 7 6 2 B 6 8 T1 14 14 S T 6 8 R2 2 4 10 T2 C Initial flow pattern: SR1AT1T Flow 6 SR2CT2T Flow 8 1 7 R 1 6 S 8 13 14 6 R2 6 7 6 B 6 8 8 0 4 10 8 C 2 2 A 6 6 8 0 T1 6 14 14 8 T 6 2 T2 8 JMcC 17 SLBS We then add the flow augmenting routes: SR1BT1T Flow 6 SR2BT2T Flow 4 SR2BCT2T Flow 2 SR1ABT1T Flow 1 10 0 1 13 12 6 S 7 R 1 13 76 7 6 6 0 20 8 0 2 2 A 6 1 6 1 4 0 10 10 8 20 8 76 4 2 1 0 13 12 T1 6 14 14 6 B 2 82 1 T 14 8 12 14 6 R 2 2 0 64 8 T2 0 C 12 14 8 620 JMcC 18 SLBS Removing the supersource and supersink, we have the final flow: A 7 6 1 6 B 6 8 4 10 7 R1 T1 R2 1 T2 C Hence, the total flow into T1 = 6 + 7 = 13 And the total flow into T2 = 4 + 10 = 14 Therefore the total flow into both towns = 13 + 14 = 27 Therefore, the maximum amount of water that can be supplied to both towns is 27 000 gallons. A 7 6 2 6 B 6 8 4 10 8 Capacity of cut =7+6+6+8 =27 R1 T1 R2 2 T2 C Read pp 234-236 Ex 8D p 237 JMcC 19