princeton univ. F 15 cos 521: Advanced Algorithm Design Lecture 2: Karger s Min Cut Algorithm

Similar documents
Lecture Notes on Karger s Min-Cut Algorithm. Eric Vigoda Georgia Institute of Technology Last updated for Advanced Algorithms, Fall 2013.

1 Minimum Cut Problem

CPSC 536N: Randomized Algorithms Term 2. Lecture 10

CSCI 5454 Ramdomized Min Cut

Randomized Graph Algorithms

Design and Analysis of Algorithms (VII)

Outline. CS38 Introduction to Algorithms. Approximation Algorithms. Optimization Problems. Set Cover. Set cover 5/29/2014. coping with intractibility

Lecture 1: A Monte Carlo Minimum Cut Algorithm

Topic: Local Search: Max-Cut, Facility Location Date: 2/13/2007

A Randomized Algorithm for Minimum Cuts

Lecture 7: Asymmetric K-Center

13 Randomized Minimum Cut

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Shortest Paths Date: 10/13/15

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Sorting lower bound and Linear-time sorting Date: 9/19/17

CSE 203A: Karger s Min-Cut Algorithm (Lecture Date: 5/11/06)

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18

CS 598CSC: Approximation Algorithms Lecture date: March 2, 2011 Instructor: Chandra Chekuri

Lecture 1 August 31, 2017

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/18/14

1 Variations of the Traveling Salesman Problem

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1

1 Better Approximation of the Traveling Salesman

Topics in Algorithms 2005 Edge Splitting, Packing Arborescences. Ramesh Hariharan

K 4 C 5. Figure 4.5: Some well known family of graphs

6.856 Randomized Algorithms

Selection (deterministic & randomized): finding the median in linear time

Exact Algorithms Lecture 7: FPT Hardness and the ETH

(Refer Slide Time: 0:19)

Introduction to Randomized Algorithms

11.1 Facility Location

Theorem 2.9: nearest addition algorithm

Matching Algorithms. Proof. If a bipartite graph has a perfect matching, then it is easy to see that the right hand side is a necessary condition.

Randomized algorithms have several advantages over deterministic ones. We discuss them here:

Polynomial-Time Approximation Algorithms

12.1 Formulation of General Perfect Matching

In this lecture, we ll look at applications of duality to three problems:

Min-Cut and Randomization

Stanford University CS359G: Graph Partitioning and Expanders Handout 18 Luca Trevisan March 3, 2011

/ Approximation Algorithms Lecturer: Michael Dinitz Topic: Linear Programming Date: 2/24/15 Scribe: Runze Tang

CS369G: Algorithmic Techniques for Big Data Spring

1 Counting triangles and cliques

Lecture Overview. 2 Shortest s t path. 2.1 The LP. 2.2 The Algorithm. COMPSCI 530: Design and Analysis of Algorithms 11/14/2013

A Course in Machine Learning

Lecture 7. s.t. e = (u,v) E x u + x v 1 (2) v V x v 0 (3)

Algorithms, Games, and Networks February 21, Lecture 12

Scribe from 2014/2015: Jessica Su, Hieu Pham Date: October 6, 2016 Editor: Jimmy Wu

Random Contractions and Sampling for Hypergraph and Hedge Connectivity

Solution for Homework set 3

Lecture 20 : Trees DRAFT

Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 7

Discrete Mathematics for CS Spring 2008 David Wagner Note 13. An Introduction to Graphs

Clustering Using Graph Connectivity

V10 Metabolic networks - Graph connectivity

Trees. 3. (Minimally Connected) G is connected and deleting any of its edges gives rise to a disconnected graph.

Lecture 11: Clustering and the Spectral Partitioning Algorithm A note on randomized algorithm, Unbiased estimates

Binary Relations McGraw-Hill Education

Math 485, Graph Theory: Homework #3

Chapter 1 Divide and Conquer Algorithm Theory WS 2013/14 Fabian Kuhn

Today. Types of graphs. Complete Graphs. Trees. Hypercubes.

Union/Find Aka: Disjoint-set forest. Problem definition. Naïve attempts CS 445

Lecture 2. 1 Introduction. 2 The Set Cover Problem. COMPSCI 632: Approximation Algorithms August 30, 2017

1 Minimum Spanning Tree (MST)

CS270 Combinatorial Algorithms & Data Structures Spring Lecture 19:

arxiv:cs/ v1 [cs.ds] 20 Feb 2003

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Priority Queues / Heaps Date: 9/27/17

Lecture 6: Spectral Graph Theory I

Kruskal s MST Algorithm

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Algorithms and Game Theory Date: 12/3/15

Lecture Notes: Euclidean Traveling Salesman Problem

Towards the Proof of the PCP Theorem

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao,David Tse Note 8

Trapezoidal decomposition:

Formal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5

Clustering: Centroid-Based Partitioning

Graph Connectivity G G G

HW Graph Theory SOLUTIONS (hbovik) - Q

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

COMP260 Spring 2014 Notes: February 4th

Number Theory and Graph Theory

Lecture 16: Gaps for Max-Cut

Graph Contraction. Graph Contraction CSE341T/CSE549T 10/20/2014. Lecture 14

Lecture and notes by: Sarah Fletcher and Michael Xu November 3rd, Multicommodity Flow

CS 6783 (Applied Algorithms) Lecture 5

2 A Template for Minimum Spanning Tree Algorithms

arxiv: v1 [math.co] 28 Sep 2010

Lecture 1 Aug. 26, 2015

Great Theoretical Ideas in Computer Science

Algebraic method for Shortest Paths problems

Algortithms for the Min-Cut problem

1 The Traveling Salesperson Problem (TSP)

Lecture 4: Primal Dual Matching Algorithm and Non-Bipartite Matching. 1 Primal/Dual Algorithm for weighted matchings in Bipartite Graphs

Introduction to Graph Theory

Math 443/543 Graph Theory Notes 5: Planar graphs and coloring

CS473-Algorithms I. Lecture 13-A. Graphs. Cevdet Aykanat - Bilkent University Computer Engineering Department

Greedy Algorithms 1 {K(S) K(S) C} For large values of d, brute force search is not feasible because there are 2 d {1,..., d}.

Framework for Design of Dynamic Programming Algorithms

Lecture 25 November 26, 2013

MITOCW watch?v=tkwnms5irbu

Adjacent: Two distinct vertices u, v are adjacent if there is an edge with ends u, v. In this case we let uv denote such an edge.

Chapter 19. Sorting Networks Model of Computation. By Sariel Har-Peled, December 17,

Transcription:

princeton univ. F 5 cos 5: Advanced Algorithm Design Lecture : Karger s Min Cut Algorithm Lecturer: Pravesh Kothari Scribe:Pravesh (These notes are a slightly modified version of notes from previous offerings of the class scribed by Sanjeev.) Today s topic is simple but gorgeous: Karger s min cut algorithm and its extension. It is a simple randomized algorithm for finding the minimum cut in a graph: a subset of vertices S in which the set of edges leaving S, denoted E(S, S) has minimum size among all subsets. You may have seen an algorithm for this problem in your undergrad class that/ uses maximum flow. Karger s algorithm is elementary and and a great introduction to randomized algorithms. Karger s Algorithm The basic subroutine in Karger s algorithm is edge-contraction: given an edge e = {u, v} in a graph G with vertices V (of size n) and edges E, contraction of e produces a new graph G = G \ e with n size vertex set V \ {u, v} S u,v where S u,v is a super-node obtained by merging u and v. In this process, we remove all edges incident to either u or v and make them incident to S u,v instead, remove self-loops and retain parallel edges (so at any point in the sequence of edge-contractions, we will have a multigraph in general). Consider the following general procedure to obtain a cut: Choose an edge e, contract it and repeat. Each edge contraction decreases the number of vertices in the graph by. Thus, in n steps, the number of vertices remaining in the graph is. The two supernodes remaining then define a cut in the original graph given by the partition corresponding to the supernodes. We want to choose a sequence of edge contractions so that the supernodes remaining define a min-cut in the graph. Karger s algorithm makes this choice extremely simple- just choose an edge uniformly at random from the remaining edges in the graph! Formally, Karger s algorithm is:. Repeat the following until supernodes are left:. Pick a uniformly random edge e and perform edge-contraction with e. 3. Output the cut corresponding to the supernodes as the guess for a min-cut in the graph. Why should this algorithm work? The intuition is that a particular cut survives n contractions if every one of the n edges chosen in Karger s algorithm are not from the cut. If you pick a random edge, it is more likely to come from parts of the graph that contain more edges and thus, since a min-cut should contain a small number of edges, the probability that an edge is picked from it should be small. In fact, this algorithm provides a great heuristic to try on all kinds of real-life graphs, where one wants to cluster the nodes into tightly-knit portions. For example, social networks may cluster into communities;

graphs capturing similarity of pixels may cluster to give different portions of the image (sky, grass, road etc.). Thus instead of continuing Karger s algorithm until you have two supernodes left, you could stop it when there are k supernodes and try to understand whether these correspond to a reasonable clustering. Today we will first see that the above version of the algorithm yields the optimum min cut with probability at least /n. Thus we can repeat it say 0n times, and output the smallest cut seen in any iteration. The probability that the optimum cut is not seen in any repetition is at most ( /n ) 0n < 0.0. Unfortunately, this simple version has running time about n 4 which is not great. So then we see a better version with a simple tweak that brings the running time down to closer to n. The idea is that roughly that repetition ensures fault tolerance. The real-life advice of making two backups of your hard drive is related to this: the probability that both fail is much smaller than one does. In case of Karger s algorithm, the overall probability of success is too low. But if run part of the way until the graph has n/ supernodes, the chance that the mincut hasn t changed is at least /. So you make two independent runs that go down to n/ supernodes, and recursively solve both of these. Thus the expected number of instances that will yield the correct mincut is =. (Unwrapping the recursion, you see that each instance of size n/ will generate two instances of size n/, and so on.) Simple induction shows that this -wise repetition is enough to bring the probability of success above / log n. As you might suspect, this is not the end of the story but improvements beyond this get more hairy. If anybody is interested I can give more pointers. Also this algorithm forms the basis of other algorithms for other tasks. Again, talk to me for pointers. Analysis of Karger s algorithm Clearly, the two supernodes at the end correspond to a cut of the original graph, so the algorithm does always return a cut. Let s analyze what happens to a given cut under a sequence of edge contractions. The following observation is easy to verify but quite useful. Observation Let G be obtained by a sequence of edge contractions of G. Then, there s a one-one correspondence between every cut (Y, Ȳ ) of G and the cut (X, X) obtained by taking the union of nodes of G in the supernodes in Y. Let s now formalizing the intuition that an edge is likely not to be from a min-cut. In the following, the notation e E will denote a uniformly random draw of an edge e from E. Lemma Let (X, X) be a min-cut of a graph G on n vertices. Let G be a graph obtained by a sequence of t edge contractions for n t 0 obtained by a sequence of edge contractions where each of the chosen edges are not from the cut (X, X). Then, Pr e E(G )[e (X, X)] /n.

3 Proof: It is easy to show this lemma for the case of t = 0 (i.e. when G = G.) Suppose that the size of the min-cut in the graph G is k. Then, observe that the degree of every vertex must be at least k (otherwise, the vertex v forms a cut (v, V \ v) of size smaller than k). Thus, the total number of edges in the graph must be at least nk/ and a uniformly random edge has probability of being inside a given min-cut is at most /n. For the general case, we only need observe that the min-cut of G is of size exactly k. This is because by Observation above, every cut in G corresponds to a cut in G which has size at least k and the cut (X, X) has a corresponding cut in G by the assumption about the edges contracted in the process of obtaining G. The above estimate shows that as edge-contraction process succeeds, it becomes more and more likely that we pick an edge from a given min-cut. Nevertheless, we can obtain a decent bound on the probability that we never pick an edge from a given min-cut in all of the n steps. Lemma Suppose we run Karger s algorithm till the point that there are l supernodes left for l. Then, the probability that no edge is contracted from a given min-cut (X, X) in this process is at least (l ). In particular (by choosing l = ), the cut at the end is a minimum cut of ( n ) the original cut with probability at least n(n ). Proof: Let e, e,..., e n l be the sequence of edges contracted in the algorith. We can estimate this probability as: Pr[e (X, X)] Pr[e (X, X) e (X, X)] Pr[e n l (X, X) e, e,..., e n l (X, X)]. Using Lemma, the above product can be estimated from below by: ( n ) ( n ) ( l + ) The above expression can be easily seen to be equal to (l ) ( n ). Thus, repeating the algorithm K times for K = t ( n ) and taking the smallest of all the cuts found in the K runs will yield a min-cut with probability at least ( n(n ) )K e t. By making t = log (/ɛ), we can make the probability of Karger s algorithm succeeding in finding a min-cut to be at least ɛ. (Aside: The sequence ( /K) K is monotonnically increasing and converges to /e very fast - for large enough K, we can thus approximate it by /e. This is a useful technical tool and will appear in later lectures.) It is relatively easy using data structures you learnt in undergrad algorithms to implement each repetition of the algorithm in O(n ) time. So the overall running time is O(n 4 ). Aside: We have proven a stronger result than we had needed to: every minimum cut remains at the end with probability at least n(n ). This implies in particular that the number of minimum cuts in an undirected graph is at most ( n ) (Note that the number of cuts in the graph is the set of all nonempty subsets, which is n, so this implies only a tiny number of all cuts can be minimum cuts.) This upper bound has had great impact in

4 subsequent theory of algorithms, though we will not have occasion to explore that in this course. 3 Improvement by Karger-Stein Karger and Stein improved the algorithm to run in O(n log (n)) time. The idea is roughly that repetition ensures fault tolerance. The real-life advice of making two backups of your hard drive is related to this: the probability that both fail is much smaller than one does. In case of Kargers algorithm, the overall probability of success is too low at n(n ). But if run part of the way until the graph has then Lemma shows that the probability that the mincut has survived (i.e. no edge in it has been contracted ) is at least. So you make two independent runs that go down to n/ supernodes, and recursively solve both of these with the same Karger-Stein algorithm. Then return the smaller of the two cuts returned by the recursive calls. The running time for such an algorithm satisfies the recurrence T (n) = O(n ) + T (n/ ) () One can now use the Master theorem to show that the above recurrence has the solution: T (n) = O(n log (n)). As you might suspect, this is not the end of the story but improvements beyond this get more hairy. If anybody is interested I can give more pointers. The major remaining claim of the analysis is to estimate that a given min-cut survives a run of the Karger-Stein algorithm. Lemma 3 Let (X, X) be a min-cut of G. Then, the probability that Karger-Stein algorithm outputs (X, X) is at least for some constant c > 0. c log (n) Thus repeating the algorithm Cc log (n)) times gives a success probability at least e c from a calculation as before and a running time of O(n log (n)). Proof: To prove the lemma, we again write a recurrence relationship for the probability of survival of a min-cut (X, X) in a Karger-Stein run. If P (n) is this probability, then it must satisfy: P (n) ( P (n/ )) () where ( P (n/ )) represents the probability of the event that a minimum cut survived in the shrinkage to n/ vertices, and the recursive call then recovered this minimum cut. To see that this has the solution P (n) c/ log (n), we can do a simple induction, where the inductive step needs to verify that: log (n) ( log (n) 0.5 ) = ( log (n) = 0.5 4(log (n) 0.5) Hush, hush, dont tell anybody, but most researchers dont use the Master theorem, even though it was stressed a lot in undergrad algorithms. When we need to solve such recurrences, we just unwrap the recurrence a few times and see that there are O(log (n)) levels, and each involves O(n ) time operations )

5 which is true using the approximation: log (n) = 0.5 log (n) + 0.5 log (n) Bibliography. Global min-cuts in RNC, and other ramifications of a simple min-cut algorithm. David Karger, Proc. ACM-SIAM SODA 993.. A new approach to the minimum cut problem. David Karger and Cliff Stein, JACM 43(4):60640, 996.