Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

[ACM-ICPC] Minimum Cut

1,607 views

Published on

Published in: Education
  • Be the first to comment

[ACM-ICPC] Minimum Cut

  1. 1. Minimum Cut 郭至軒(KuoE0) KuoE0.tw@gmail.com KuoE0.ch
  2. 2. Cut
  3. 3. cut (undirected)
  4. 4. A partition of the vertices of a graph into twodisjoint subsets 3 1 7 4 6 9 2 8 5 undirected graph
  5. 5. A partition of the vertices of a graph into twodisjoint subsets 3 1 7 4 6 9 2 8 5 undirected graph
  6. 6. A partition of the vertices of a graph into twodisjoint subsets 3 1 7 4 6 9 2 8 5 undirected graph
  7. 7. A partition of the vertices of a graph into twodisjoint subsets 1 4 2 6 3 7 5 8 9 undirected graph
  8. 8. Cut-set of the cut is the set of edges whoseend points are in different subsets. 1 4 2 6 3 7 5 8 9 undirected graph
  9. 9. Cut-set of the cut is the set of edges whoseend points are in different subsets. 1 4 2 6 3 7 5 8 9 Cut-set undirected graph
  10. 10. weight = number of edges or sum of weighton edges 1 4 2 6 3 7 5 8 9 weight is 7 undirected graph
  11. 11. cut (directed)
  12. 12. A partition of the vertices of a graph into twodisjoint subsets 3 1 7 4 6 9 2 8 5 directed graph
  13. 13. A partition of the vertices of a graph into twodisjoint subsets 3 1 7 4 6 9 2 8 5 directed graph
  14. 14. A partition of the vertices of a graph into twodisjoint subsets 3 1 7 4 6 9 2 8 5 directed graph
  15. 15. A partition of the vertices of a graph into twodisjoint subsets 1 4 2 6 3 7 5 8 9 directed graph
  16. 16. Cut-set of the cut is the set of edges whoseend points are in different subsets. 1 4 2 6 3 7 5 8 9 directed graph
  17. 17. Cut-set of the cut is the set of edges whoseend points are in different subsets. 1 4 2 6 3 7 5 8 9 directed graph
  18. 18. Cut-set of the cut is the set of edges whoseend points are in different subsets. 1 4 2 6 3 7 5 8 9 Cut-set directed graph
  19. 19. weight = number of edges or sum of weighton edges 1 4 2 6 3 7 5 8 9 weight is 5⇢ or 2⇠ directed graph
  20. 20. s-t cut1. one side is source2. another side is sink3. cut-set only consists of edges goingfrom source’s side to sink’s side
  21. 21. Source Sink Other 31 7 4 6 92 8 5 flow network
  22. 22. Source Sink 31 7 4 6 92 8 5 flow network
  23. 23. Source Sink 31 7 4 6 92 8 5 flow network
  24. 24. cut-set only consists of edges goingfrom source’s side to sink’s side 1 4 2 6 3 7 5 8 9 flow network
  25. 25. cut-set only consists of edges goingfrom source’s side to sink’s side 1 4 2 6 3 7 5 8 9 weight is 6 flow network
  26. 26. Max-Flow Min-Cut Theorem
  27. 27. Observation 1The network flow sent across any cut is equal to theamount reaching sink. 4/4 2 4 3/3 4/4 1 1/4 6 3/8 2/3 3 5 2/2 total flow = 6, flow on cut = 3 + 3 = 6
  28. 28. Observation 1The network flow sent across any cut is equal to theamount reaching sink. 4/4 2 4 3/3 4/4 1 1/4 6 3/8 2/3 3 5 2/2 total flow = 6, flow on cut = 3 + 3 = 6
  29. 29. Observation 1The network flow sent across any cut is equal to theamount reaching sink. 4/4 2 4 3/3 4/4 1 1/4 6 3/8 2/3 3 5 2/2 total flow = 6, flow on cut = 3 + 4 - 1 = 6
  30. 30. Observation 1The network flow sent across any cut is equal to theamount reaching sink. 4/4 2 4 3/3 4/4 1 1/4 6 3/8 2/3 3 5 2/2 total flow = 6, flow on cut = 3 + 4 - 1 = 6
  31. 31. Observation 1The network flow sent across any cut is equal to theamount reaching sink. 4/4 2 4 3/3 4/4 1 1/4 6 3/8 2/3 3 5 2/2 total flow = 6, flow on cut = 4 + 2= 6
  32. 32. Observation 1The network flow sent across any cut is equal to theamount reaching sink. 4/4 2 4 3/3 4/4 1 1/4 6 3/8 2/3 3 5 2/2 total flow = 6, flow on cut = 4 + 2= 6
  33. 33. Observation 1The network flow sent across any cut is equal to theamount reaching sink. 4/4 2 4 3/3 4/4 1 1/4 6 3/8 2/3 3 5 2/2 total flow = 6, flow on cut = 4 + 2= 6
  34. 34. Observation 1The network flow sent across any cut is equal to theamount reaching sink. 4/4 2 4 3/3 4/4 1 1/4 6 3/8 2/3 3 5 2/2 total flow = 6, flow on cut = 4 + 2= 6
  35. 35. Observation 2Then the value of the flow is at most the capacity ofany cut. 4 2 4 3 4 1 4 6 8 3 3 5 2 It’s trivial!
  36. 36. Observation 2Then the value of the flow is at most the capacity ofany cut. 4 2 4 3 4 1 4 6 8 3 3 5 2 It’s trivial!
  37. 37. Observation 3Let f be a flow, and let (S,T) be an s-t cut whosecapacity equals the value of f. 4/4 2 4 3/3 4/4 1 1/4 6 3/8 2/3 3 5 2/2 f is the maximum flow (S,T) is the minimum cut
  38. 38. Observation 3Let f be a flow, and let (S,T) be an s-t cut whosecapacity equals the value of f. 4/4 2 4 3/3 4/4 1 1/4 6 3/8 2/3 3 5 2/2 f is the maximum flow (S,T) is the minimum cut
  39. 39. Max-FlowEQUALMin-Cut
  40. 40. Example
  41. 41. 4 2 4 3 41 4 6 8 3 3 5 2
  42. 42. Maximum Flow = 6 4/4 2 4 3/3 4/41 1/4 6 3/8 2/3 3 5 2/2
  43. 43. Residual Network 0/4 2 4 0/3 0/41 3/4 6 5/8 1/3 3 5 0/2
  44. 44. Minimum Cut = 6 0/4 2 4 0/3 0/41 3/4 6 5/8 1/3 3 5 0/2
  45. 45. Minimum Cut = 6 0/4 2 4 0/3 0/41 3/4 6 5/8 1/3 3 5 0/2
  46. 46. Minimum Cut = 6 0/4 2 4 0/3 0/41 3/4 6 5/8 1/3 3 5 0/2
  47. 47. Minimum Cut = 6 0/4 2 4 0/3 0/41 3/4 6 5/8 1/3 3 5 0/2
  48. 48. The minimum capacity limit the maximum flow!
  49. 49. find a s-t cut
  50. 50. Maximum Flow = 6 4/4 2 4 3/3 4/41 1/4 6 3/8 2/3 3 5 2/2
  51. 51. Travel on Residual Network 0/4 2 4 0/3 0/41 3/4 6 5/8 1/3 3 5 0/2
  52. 52. start from source 0/4 2 4 0/3 0/41 3/4 6 5/8 1/3 3 5 0/2
  53. 53. don’t travel through full edge 0/4 2 4 0/3 0/41 3/4 6 5/8 1/3 3 5 0/2
  54. 54. don’t travel through full edge 0/4 2 4 0/3 0/41 3/4 6 5/8 1/3 3 5 0/2
  55. 55. no residual edge 0/4 2 4 0/3 0/41 3/4 6 5/8 1/3 3 5 0/2
  56. 56. no residual edge 0/4 2 4 0/3 0/41 3/4 6 5/8 1/3 3 5 0/2
  57. 57. s-t cut 0/4 2 4 0/3 0/41 3/4 6 5/8 1/3 3 5 0/2
  58. 58. s-t cut 0/4 2 4 0/3 0/41 3/4 6 5/8 1/3 3 5 0/2
  59. 59. result of starting from sink 0/4 2 4 0/3 0/41 3/4 6 5/8 1/3 3 5 0/2
  60. 60. result of starting from sink 0/4 2 4 0/3 0/41 3/4 6 5/8 1/3 3 5 0/2
  61. 61. Minimum cut is non-unique!
  62. 62. time complexity:based on max-flow algorithm Ford-Fulkerson algorithm O(EF) Edmonds-Karp algorithm O(VE2) Dinic algorithm O(V2E)
  63. 63. Stoer Wagner only for undirected graphtime complexity: O(N3) or O(N2log2N)
  64. 64. Practice Now UVa 10480 - Sabotage
  65. 65. Problem List UVa 10480 UVa 10989 POJ 1815 POJ 2914 POJ 3084 POJ 3308 POJ 3469
  66. 66. Reference• http://www.flickr.com/photos/dgjones/335788038/• http://www.flickr.com/photos/njsouthall/3181945005/• http://www.csie.ntnu.edu.tw/~u91029/Cut.html• http://en.wikipedia.org/wiki/Cut_(graph_theory)• http://en.wikipedia.org/wiki/Max-flow_min-cut_theorem• http://www.cs.princeton.edu/courses/archive/spr04/cos226/lectures/ maxflow.4up.pdf• http://www.cnblogs.com/scau20110726/archive/ 2012/11/27/2791523.html
  67. 67. Thank You for Your Listening.

×