Sei sulla pagina 1di 17

Randomized Min-cut Algorithm

9/16/2004

Cpr E 594, Fall 2004

Min Cut in a Graph


B

Min Cut is the smallest edge set C such that removing C disconnects the graph

9/16/2004

Cpr E 594, Fall 2004

Applications
Network Reliability: If a graph has a small min-cut, then it is poorly connected Clustering:
Web pages = nodes Hyperlinks = edges Divide graph into clusters, little connection between different clusters
9/16/2004 Cpr E 594, Fall 2004 3

Min Cut
Fact: Size of a min-cut is smaller than the smallest degree in the graph (it could be strictly smaller).

Example 1
9/16/2004 Cpr E 594, Fall 2004

Example 2
4

Edge Contraction
When edge (u,v) is contracted, vertices u and v are merged, and edge (u,v) is eliminated
u Contract (u,v) {u,v} v
9/16/2004

w
Cpr E 594, Fall 2004 5

Intuition
Focus on a single min-cut of the graph C. Choose random edge e, Unlikely that e in C Contracting e will preserve the min-cut C Reason: 1. Degree of every vertex in G >= |C| 2. Number of edges in G = sum of degrees/2 >= n|C|/2 3. If random edge is chosen, then probability it belongs in C <= 2/n
9/16/2004 Cpr E 594, Fall 2004 6

Algorithm Contract
Input: multigraph G(V,E), |V|=n Output: min-cut C 1. Start with H=G 2. Repeat (n-2) times
1. Choose a random edge e in H 2. Contract edge e

3. Finally, H has only two vertices Return the resulting cut as the min-cut
9/16/2004 Cpr E 594, Fall 2004 7

Example Executions
I: Successful

II:

Unsuccessful
9/16/2004 Cpr E 594, Fall 2004 8

Analysis
Fact: Every cut of the final 2-vertex graph is a cut of the input graph. Converse is not true: A cut of input graph may not be a cut of the final 2-vertex graph Question: What is the chance that the min-cut of input graph is the cut of the final graph?
9/16/2004 Cpr E 594, Fall 2004 9

Analysis
For the analysis, focus on a single min-cut C of the graph (C is unknown!) Definitions:
Ei = no edge of C was contracted during iteration i Fi = no edge of C was contracted during iterations 1,2,.i

Fi = E1 I E2 I E3...I Ei

We are interested in F(n2)


9/16/2004 Cpr E 594, Fall 2004 10

Probabilities
By the chain rule,

Fi = E1 I E2 I E3...I Ei

Pr[ F( n 2 ) ] = Pr[ E1 ]. Pr[ E2 | E1 ]. Pr[ E3 | E2 , E1 ].... Pr[ E( n 2 ) | E( n 3) ,..., E1 ]


Pr[E1] = Pr[no edge of C was chosen during first iteration] >= 1- |C|/(n|C|/2) = 1- 2/n Why? What happens if E1 is true?
C is still the mincut of the graph after the first iteration Pr[E2|E1] = Pr[no edge of C is chosen in the second iteration] >= 1-2/(n-1)

Similarly, Pr[E3|E1,E2] >= 1-2/(n-2) , and Pr[E(n-2)|F(n-3)]>=1-2/(3)

9/16/2004

Cpr E 594, Fall 2004

11

Analysis
Pr[ F( n 2 ) ] = Pr[ E1 ]. Pr[ E2 | E1 ]. Pr[ E3 | E2 , E1 ].... Pr[ E( n 2 ) | E( n 3) ,..., E1 ]

2 2 2 Pr[ F( n 2) ] 1 1 .....1 n n 1 3 2 n 2 n 3 n 4 1 = ... = n n 1 n 2 3 n(n 1)

9/16/2004

Cpr E 594, Fall 2004

12

Analysis (continued)
Probability of ending up with a min-cut is at least 2/n(n-1) Might look small, but can improve by repeating the algorithm Repeat k times, the failure probability is
2 1 n ( n 1 ) n ( n1 ) / 2

k 2 1 n ( n 1)

If k= n(n-1)/2, this is If k= n(n 1) log n this is very small (less than 1/n) 2
9/16/2004 Cpr E 594, Fall 2004 13

Monte Carlo Algorithm


The above algorithm may not return a mincut algorithm with a small probability Can this be converted into a Las Vegas algorithm?
Las vegas algorithm always returns the mincut, but its running time may be unbounded

9/16/2004

Cpr E 594, Fall 2004

14

Running Time Analysis


Each run of the min-cut algorithm has (n-2) iterations Time complexity of each iteration = O(n) Total time = (number of runs)*(iters per run)*O(n)
= (n 2 log n) (n 2) O(n)
= O(n 4 log n)

Failure Probability <= 1/n


9/16/2004 Cpr E 594, Fall 2004 15

With High Probability


If n is the size of the input (number of vertices in graph, say), then w.h.p = with high probability 1 1 c = with probability at least n where c is a constant >0

9/16/2004

Cpr E 594, Fall 2004

16

Questions
Suppose we used edge deletion instead of edge contraction? Suppose we chose a random pair of connected vertices to contract, rather than a random edge? What if we were looking for the Max cut? What about min 3-cut choose a set of edges to divide the graph into 3 parts?
9/16/2004 Cpr E 594, Fall 2004 17

Potrebbero piacerti anche