Presentation is loading. Please wait.

Presentation is loading. Please wait.

Randomized Min-Cut Algorithm

Similar presentations


Presentation on theme: "Randomized Min-Cut Algorithm"— Presentation transcript:

1 Randomized Min-Cut Algorithm
Slides based on Slides by Amihood Amir

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(n²) using e.g. an adjacency matrix. Other implementations possible.

9 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. Question: Why should this work? Would the analogous algorithm work for spanning trees or shortest paths or sorting or some other problem?

10 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).

11 Example: F A B E G C D

12 Example: F A contract B E G C D

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

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

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

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

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

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

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

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

21 Probability calculation
Note: degree of every node in graph throughout contraction process ≥ c Contracting an edge only increases the value of the minimum cut. Because contraction destroys cuts and does not create any new cuts

22 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.

23 Probability calculation
Probability that one of the c edges is chosen at first stage: THIS IS A SMALL NUMBER! Probability that one of the C edges is chosen after stage i ≤: Probability of not choosing an edge of C at stage i ≥:

24 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 ≥ =

25 Probability calculation
What do we have?

26 Probability calculation
What do we have? Telescope cancellations: =

27 Conclude Run the algorithm O(n²) times and expect to get C with constant probability. Run the algorithm O(n² log n) times and find C with high probability. Total time: O(n4 log n) No better than Ford-Fulkerson! There are other algorithms that get O(nm) time bounds (Nagamochi-Ibaraki, Hao-Orling) Can we do better?

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

29 IDEA! Consider one run of the contraction algorithm
The probability of contracting a minimum cut edge is increasing over time. It is 2/3 for the last iteration Maybe we should stop earlier and switch to a higher probability, slower algorithm.

30 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 ≥

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

32 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! The higher probability, slower algorithm is the run the contraction algorithm twice!

33 Recursive Contraction Algorithm
RCA(G,n) if (n==2) output the trivial cut else repeat twice Contract G down to vertices. Call this graph G’. RCA(G’, )

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

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

36 Probability: Which solves to So in O(n2logn) time we find a cut with
Probability (1/log n), repeating O(log2n) Times we find a cut with high probability.


Download ppt "Randomized Min-Cut Algorithm"

Similar presentations


Ads by Google