1 / 61

# Flows

Flows. t. s. source. sink. Flows. edge-weights = capacities. 2. 3. 5. 7. 4. 4. 2. 2. source. sink. Flows. edge-weights = capacities. 2. 2. 2. 3. 2. 5. 7. 2. 4. 4. 2. 2. 2. 2. 4 units of flow. source. sink. Flows. edge-weights = capacities. 2. 2. 2. 3. 4.

Télécharger la présentation

## Flows

E N D

### Presentation Transcript

1. Flows t s source sink

2. Flows edge-weights = capacities 2 3 5 7 4 4 2 2 source sink

3. Flows edge-weights = capacities 2 2 2 3 2 5 7 2 4 4 2 2 2 2 4 units of flow source sink

4. Flows edge-weights = capacities 2 2 2 3 4 5 7 2 2 4 4 4 2 2 2 6 units of flow source sink

5. Flows edge-weights = capacities 2 2 3 3 5 5 7 3 2 1 4 4 4 2 1 2 7 units of flow source sink

6. Optimal? 2 2 3 3 5 5 7 3 2 1 4 4 4 2 1 2 a larger flow?

7. Cuts capacity of a cut cap(C)= c(u,v) C s uC vV-C C  V s  C t  V-C for any cut and any flow flow  cut  max-flow  min-cut

8. Flows edge-weights = capacities 2 2 5 5 3 4 FLOW CONSERVATION

9. Skew symmetry edge-weights = capacities 2 2 5 5 3 4 x -x FLOW CONSERVATION

10. Flows edge-weights = capacities 2 2 -5 5 3  f(u,v) = 0 vV 4 x -x FLOW CONSERVATION

11. Flow – formal definition FLOW CONSERVATION CAPACITY CONSTRAINTS  f(u,v) = 0 vV f(u,v)  c(u,v) SKEW SYMMETRY f(u,v) = - f(v,u)

12. Max-flow problem INPUT: directed graph G=(V,E), source sV, sink tV a capacity c(e) for each edge eE OUTPUT: maximum flow from s to t

13. Max-flow problem F  zero-flow while can improve F improve F

14. Max-flow problem 2 2 2 2 3 2 3 3 4 5 5 5 7 7 3 2 2 2 1 4 4 4 4 4 4 2 2 2 1 2 2 improving can decrease flow on some edges

15. Augmenting path +1 +1 +1 +1 -1

16. Augmenting path +1 +1 +1 +1 +1

17. Augmenting path +1 +1 +1 +1 +1  can improve the flow Ford-Fulkerson algorithm F  zero-flow while  augmenting path p improve F along p

18. Residual capacity f(u,v) c(u,v) r(u,v) = c(u,v) – f(u,v) makes sense for negative f(u,v)

19. Residual network 2 2 5 2 3 7 2 4 2 4 4 4 2 2 2

20. Residual network 2 2 2 3 9 7 2 1 2 4 4 4 2 2 2

21. Residual network 2 2 2 3 9 7 2 1 2 4 4 4 2 2 2

22. Residual network 4 2 3 9 7 2 1 2 4 4 4 2 2 2

23. Residual network 4 2 3 9 7 2 1 2 4 4 4 2 2 2

24. Residual network 4 5 9 7 2 1 1 2 4 4 4 2 2 2

25. Residual network 4 5 6 9 7 1 1 7 2 8 4 4 Is there an augmenting path? Is there a path from s to t in the residual network?

26. Correct ? F  zero-flow while  augmenting path p improve F along p

27. Correct ? F  zero-flow while  augmenting path p improve F along p YES Theorem: no augmenting path  max-flow

28. Theorem: no augmenting path  max-flow Proof: no augmenting path  no path from s to t in the residual network s t

29. Theorem: no augmenting path  max-flow Proof: no augmenting path  no path from s to t in the residual network s t vertices to which we can get from s

30. Theorem: no augmenting path  max-flow Proof: no augmenting path  no path from s to t in the residual network all edges from C to V-C saturated C s t vertices to which we can get from s

31. Theorem: no augmenting path  max-flow Theorem 2: max-flow = min-cut

32. Is there an augmenting path? Is there a path from s to t in the residual network? time O(E) F  zero-flow while  augmenting path p improve F along p time = ?

33. F  zero-flow while  augmenting path p improve F along p 100 100 0 0 1 0 0 0 100 100

34. F  zero-flow while  augmenting path p improve F along p 100 100 0 0 1 0 0 0 100 100

35. F  zero-flow while  augmenting path p improve F along p 100 100 1 0 1 1 0 1 100 100

36. F  zero-flow while  augmenting path p improve F along p 100 100 1 0 1 1 0 1 100 100

37. F  zero-flow while  augmenting path p improve F along p 100 100 1 0 1 1 0 1 100 100

38. F  zero-flow while  augmenting path p improve F along p 100 100 1 2 1 -1 2 1 100 100

39. F  zero-flow while  augmenting path p improve F along p 100 100 1 2 1 -1 2 1 100 100

40. F  zero-flow while  augmenting path p improve F along p 100 100 3 2 1 1 2 3 100 100

41. F  zero-flow while  augmenting path p improve F along p Assume that the capacities are integers. Then the number of augementations is bounded by F* (=max-flow) running time O(E F*)

42. F  zero-flow while  augmenting path p improve F along p can a good choice of p improve the algorithm? running time O(E F*)

43. F  zero-flow while  augmenting path p improve F along p 1. choose path p which increases the flow the most (i.e., p has the maximum bottleneck capacity) 2. choose path p which has the fewest number of edges

44. 1. choose path p which increases the flow the most (i.e., p has the maximum bottleneck capacity) THEOREM: number of augmenting steps O(E log F*)

45. Graph G flow f in G Residual network Gf f’=flow in Gf Claim: h=f+f’ is a flow in G SKEW SYMMETRY: h(u,v)=f(u,v)+f’(u,v)=-f(v,u)-f’(v,u) = - (f(v,u) + f’(v,u)) = - h(v,u) FLOW CONSERVATION: u h(u,v) = u (f(u,v)+f’(u,v))= u f(u,v) + u f’(u,v) = 0

46. Graph G flow f in G Residual network Gf f’=flow in Gf Claim: h=f+f’ is a flow in G CAPACITY CONSTRAINTS: f’(u,v) c(u,v)-f(u,v) h(u,v)=f(u,v)+f’(u,v)  c(u,v)

47. Graph G flow f in G Residual network Gf f’=flow in Gf flow h in G Claim: f’=h-g is a flow in Gf CAPACITY CONSTRAINTS: f’(u,v)= h(u,v)-f(u,v)c(u,v)-f(u,v)

48. Claim: any flow f in G is a sum of at most |E| path flows Induction on the number of non-zero edges in f

49. Claim: any flow f in G is a sum of at most |{e E;f(e)0}| path flows Induction on the number of non-zero edges in f f = flow G’ with capacities c’(u,v)=max{0,f(u,v)} p = augmenting path from zero flow in G’ p has bottleneck edge  f-p has less non-zero edges than f f = p + (f-p)

More Related