180 likes | 555 Views
Network Flow Multiple Sources and Sinks. Sometimes a network will have multiple sources and multiple sinks. We deal with this situation by introducing a supersource and a supersink. 8. 12. A. D. T 1. 9. 10. S 1. 3. 18. 30. 16. T 2. E. B. 15. S 2. 8. 10. 3. 17. T 3. 12.
E N D
Network Flow Multiple Sources and Sinks Sometimes a network will have multiple sources and multiple sinks. We deal with this situation by introducing a supersource and a supersink. 8 12 A D T1 9 10 S1 3 18 30 16 T2 E B 15 S2 8 10 3 17 T3 12 C F 5
S T Network Flow Multiple Sources and Sinks To obtain the capacities on the new edges, consider the max flow out of the sources. Max flow out of S1 = 9 + 18 = 27 so the capacity into S1must be at least 27. Max flow out of S2 = 15 + 17 = 32 so the capacity into S2must be at least 32. 8 12 A D T1 9 10 S1 3 27 18 30 16 T2 E B 15 32 S2 8 10 3 17 T3 12 C F 5
S T Network Flow Multiple Sources and Sinks Max flow into T1 = 12 + 10 = 22 so the capacity out of T1must be at least 22. Max flow into T2 = 16 + 3 = 19 so the capacity out of T2must be at least 19. Max flow into T3 = 12 so the capacity out of T3must be at least 12. 8 12 A D T1 9 22 10 S1 3 27 18 19 30 16 T2 E B 15 32 S2 8 10 3 12 17 T3 12 C F 5
S T Network Flow Multiple Sources and Sinks The minimum cut consists of edges AD, ED, ET2, EF ad CF and DT or vertex sets S, S1, S2, A, B, C, E and D, T1, T2, T3, T The capacity of the cut is 8 + 3 + 10 + 16 + 8 + 5 = 50 What is the minimum cut for this network? 8 12 A D T1 9 22 10 S1 3 27 18 19 30 16 T2 E B 15 32 S2 8 10 3 12 17 T3 12 C F 5
Network Flow Multiple Sources and Sinks We can now find flow augmenting paths to increase the flow. 8 12 A D T1 9 0 0 0 22 0 10 0 S1 3 27 18 0 0 S 0 19 30 16 T2 T E B 0 15 0 0 0 32 0 S2 0 0 8 3 0 10 12 0 0 17 0 T3 0 C F 12 5
Network Flow Multiple Sources and Sinks SS2BET2T can be increased by 15. 8 12 A D T1 9 0 0 0 22 0 10 0 S1 3 27 18 0 0 S 0 19 30 16 T2 T E B 0 15 0 0 0 32 0 S2 0 0 8 3 0 10 12 0 0 17 0 T3 0 C F 12 5
Network Flow Multiple Sources and Sinks SS1BET1T can be increased by 10. 8 12 A D T1 9 0 0 0 22 0 10 0 S1 3 27 18 0 0 S 0 4 15 1 T2 T E B 15 0 15 15 15 16 15 S2 0 0 8 3 0 10 12 0 0 17 0 T3 0 C F 12 5
Network Flow Multiple Sources and Sinks SS1ADT1T can be increased by 8. 8 12 A D T1 9 0 0 0 12 0 0 10 S1 3 17 8 10 10 S 10 4 5 1 T2 T E B 15 0 25 15 15 16 15 S2 0 0 8 3 0 10 12 0 0 17 0 T3 0 C F 12 5
Network Flow Multiple Sources and Sinks SS2CFT3T can be increased by 5. 0 4 A D T1 1 8 8 8 4 0 0 10 S1 3 9 8 18 18 S 10 4 5 1 T2 T E B 15 0 25 15 15 16 15 S2 0 0 8 3 0 10 12 0 0 17 0 T3 0 C F 12 5
Network Flow Multiple Sources and Sinks SS2CEFT2T can be increased by 3. 0 4 A D T1 1 8 8 8 4 0 0 10 S1 3 9 8 18 18 S 10 4 5 1 T2 T E B 20 0 25 15 15 11 15 S2 5 0 8 3 0 10 7 5 0 12 5 T3 5 C F 7 0
Network Flow Multiple Sources and Sinks SS2CEFT3T can be increased by 5. 0 4 A D T1 1 8 8 8 4 0 0 10 S1 3 9 8 18 18 S 10 1 5 1 T2 T E B 23 0 25 15 18 8 15 S2 5 3 5 0 3 7 7 8 3 9 5 T3 5 C F 7 0
Network Flow Multiple Sources and Sinks SS1BEDT1T can be increased by 3. 0 4 A D T1 1 8 8 8 4 0 0 10 S1 3 9 8 18 18 S 10 1 5 1 T2 T E B 28 0 25 15 18 3 15 S2 10 3 0 0 8 2 2 13 8 4 10 T3 5 C F 2 0
Network Flow Multiple Sources and Sinks SS1BET2T can be increased by 1. 0 1 A D T1 1 8 11 8 1 3 0 10 S1 0 6 5 21 21 S 13 1 2 1 T2 T E B 28 0 28 15 18 3 15 S2 10 3 0 0 8 2 2 13 8 4 10 T3 5 C F 2 0
Network Flow Multiple Sources and Sinks The flow out of the sources (28 + 22 = 50) and into the sinks (21 + 19 + 10 = 50) are both equal to the minimum cut of 50. We have therefore found the maximum flow. 11 0 1 A D T1 8 1 8 11 8 8 3 0 10 S1 0 3 4 14 29 10 14 1 0 T2 E B 0 29 16 15 15 8 16 S2 3 0 0 8 2 3 13 13 8 8 4 10 T3 5 C F 2 0 10 5