1 / 36

Karger’s Min-Cut Algorithm

Karger’s Min-Cut Algorithm. Amihood Amir Bar-Ilan University, 2009. The Problem. INPUT: Undirected Graph G=(V,E) OUTPUT: A smallest-size set of edges such that G’=(V,E-E 1 ) is not connected. Example. F. A. B. E. G. C. D. Example.

saxton
Télécharger la présentation

Karger’s Min-Cut Algorithm

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Karger’sMin-Cut Algorithm Amihood Amir Bar-Ilan University, 2009

  2. The Problem INPUT: Undirected Graph G=(V,E) OUTPUT: A smallest-size set of edges such that G’=(V,E-E1) is not connected.

  3. Example F A B E G C D

  4. Example F A B E G C D E1 = BE

  5. Immediate Solution For every pair of nodes s,t find the min-cut Ms,t Choose the pair <s,t> with the smallest Ms,t. Time= O(n² T(min-cut) )

  6. Time for Min-Cut Ford-Fulkerson:O(|E|flow) In our case: max flow ≤ n so: O(n² |E|n) = O(n² n³) This can be improved

  7. Improvement We don’t need all pairs. Why? Every node is in one side of a cut. Therefore: Fix node s. Try all other n-1 options as node t. Time:

  8. Randomized Solution Repeat Until 2 nodes left: 1. choose edge at random 2. “contract” edge When only 2 node left: Take all edges between them as the min-cut. Time:O(|E|)=O(n²)

  9. Meaning of “contraction” Make edge ab with its two adjacent nodes a,b into a single node ab. All edges of a and b will now be edges from ab (creating a multigraph).

  10. Example: F A B E G C D

  11. Example: F A contract B E G C D

  12. Example: F A contract B E G C D FG A B E C D

  13. Example: F A contract B E G C D FG A B E C D contract

  14. Example: F A contract B E G C D FG FGD A A B E B E C D C contract

  15. Is output min-cut? Not necessarily. Is it a cut? • yes.

  16. Is output min-cut? Not necessarily. Is it a cut? • yes. Could there be an edge between these sides that was deleted?

  17. Is output min-cut? Not necessarily. Is it a cut? • yes. No. The only deleted edges were within the contractions.

  18. Is output min-cut? Not necessarily. Is it a cut? • yes. cut C={e1,…,ec} No. The only deleted edges were within the contractions.

  19. When is C a min-cut? When none of the edges in C={e1,…,ec} are chosen to be contracted. What is the probability of that happening?

  20. Probability calculation Note: We can assume that degree of every node in graph throughout contraction process ≥ c

  21. Probability calculation Note: We can assume that degree of every node in graph throughout contraction process ≥ c Otherwise: Cut node and get cut of size < c.

  22. Probability calculation Probability that one of the C edges is chosen at first stage: Probability that one of the C edges is chosen after stage i ≤: Probability of not choosing an edge of C at stage i ≥:

  23. Probability calculation Note: The algorithm has n-2 stages (at that point 2 nodes are left). Probability of not choosing an edge from C at any stage ≥ =

  24. Probability calculation What do we have?

  25. Probability calculation What do we have? Telescope cancellations: =

  26. Conclude Run the algorithm O(n²) times and expect to get C with constant probability. Total time: No better than Ford-Fulkerson! Can we do better?

  27. IDEA! The situation: n² results, one of which is expected to be good. O(n²) time

  28. What if? Could compute: n² results, one of which is expected to be good. O(log n) time

  29. This is not quite the situation… But note: The probability of not hitting C at stage 1 is (almost 1). It grows as we run more and more stages. What happens if we stop in the middle? The probability that C not touched in the first i steps ≥

  30. So what is the situation? When is the probability of not hitting C exactly ½ ? -- When nodes are left. Because take then

  31. This means If we run two times until nodes are left we expect that one of them still did not touch C So, for each of these runs, when nodes are left, stop running and recurse!

  32. Time: The closed form is: Much better! But what is the overall probability?

  33. Probability: Assume we are in level d of the recursion tree, with the leaves being level 1. Let Pd(x) be the probability that there is a path from node x at level d that does not touch C. We have: Pd(x)= ½ (Probability that at least one of the two recursions does not touch C)

  34. Probability: Recall: Pr(A or B)= Pr(A)+Pr(B)-Pr(A and B) We have: Pd(x)= ½(2Pd-1-(Pd-1)²)Where Pd-1 is the probability that a child of x does not hit C. = Pd-1 – ½ (Pd-1)² Claim: For d >1, Pd >1/d Proof:Note that in the interval [0,1) the function x – ½ x² decreases monotonically.

  35. Probability: We have: Pd = Pd-1 – ½ (Pd-1)². Inductively: Pd-1 >1/(d-1). So, because of monotonicity, Pd-1– ½ (Pd-1)² >

  36. Probability: Conclude: Plog n(x) > 1/log n Which means:If we run the algorithm log n times, we get constant probability. So… Total time: O(n² log² n)

More Related