
In computer science and graph theory, Karger's algorithm is a randomized algorithm to compute a minimum cut of a connected graph. It was invented by David Karger and first published in 1993.[1]
The idea of the algorithm is based on the concept of contraction of an edge in an undirected graph . Informally speaking, the contraction of an edge merges the nodes and into one, reducing the total number of nodes of the graph by one. All other edges connecting either or are "reattached" to the merged node, effectively producing a multigraph. Karger's basic algorithm iteratively contracts randomly chosen edges until only two nodes remain; those nodes represent a cut in the original graph. By iterating this basic algorithm a sufficient number of times, a minimum cut can be found with high probability.
The global minimum cut problem
editA cut in an undirected graph is a partition of the vertices into two non-empty, disjoint sets . The cutset of a cut consists of the edges between the two parts. The size (or weight) of a cut in an unweighted graph is the cardinality of the cutset, i.e., the number of edges between the two parts,
There are ways of choosing for each vertex whether it belongs to or to , but two of these choices make or empty and do not give rise to cuts. Among the remaining choices, swapping the roles of and does not change the cut, so each cut is counted twice; therefore, there are distinct cuts. The minimum cut problem is to find a cut of smallest size among these cuts.
For weighted graphs with positive edge weights the weight of the cut is the sum of the weights of edges between vertices in each part
which agrees with the unweighted definition for .
A cut is sometimes called a “global cut” to distinguish it from an “ - cut” for a given pair of vertices, which has the additional requirement that and . Every global cut is an - cut for some . Thus, the minimum cut problem can be solved in polynomial time by iterating over all choices of and solving the resulting minimum - cut problem using the max-flow min-cut theorem and a polynomial time algorithm for maximum flow, such as the push-relabel algorithm, though this approach is not optimal. Better deterministic algorithms for the global minimum cut problem include the Stoer–Wagner algorithm, which has a running time of .[2]
Contraction algorithm
editThe fundamental operation of Karger’s algorithm is a form of edge contraction. In the edge contraction process, we randomly select an edge from the graph. We then merge the two nodes and into a single node, and reattach any edges that were connected to either or to the newly merged node. Self-loops (edges from a node to itself) are removed during this process. This contraction reduces the number of nodes in the graph by one, and we repeat this process until only two nodes remain, which defines the final cut in the graph.
The contraction algorithm repeatedly contracts random edges in the graph, until only two nodes remain, at which point there is only a single cut.
The key idea of the algorithm is that it is far more likely for non min-cut edges than min-cut edges to be randomly selected and lost to contraction, since min-cut edges are usually vastly outnumbered by non min-cut edges. Subsequently, it is plausible that the min-cut edges will survive all the edge contraction, and the algorithm will correctly identify the min-cut edge.
procedure contract( ): while choose uniformly at random return the only cut in
When the graph is represented using adjacency lists or an adjacency matrix, a single edge contraction operation can be implemented with a linear number of updates to the data structure, for a total running time of . Alternatively, the procedure can be viewed as an execution of Kruskal’s algorithm for constructing the minimum spanning tree in a graph where the edges have weights according to a random permutation . Removing the heaviest edge of this tree results in two components that describe a cut. In this way, the contraction procedure can be implemented like Kruskal’s algorithm in time .
The best known implementations use time and space, or time and space, respectively.[1]
Success probability of the contraction algorithm
editIn a graph with vertices, the contraction algorithm returns a minimum cut with polynomially small probability . Recall that every graph has cuts (by the discussion in the previous section), among which at most can be minimum cuts. Therefore, the success probability for this algorithm is much better than the probability for picking a cut at random, which is at most .
For instance, the cycle graph on vertices has exactly possible cuts, all of which are minimum cuts. The probability of returning the minimum cut by randomly selecting an edge and contracting it is . This probability increases with every repetition of the algorithm. After repeating the algorithm times, the probability of finding the minimum cut approaches 1.
Improvements
editThe time complexity of the algorithm can be improved by using parallelism or optimization techniques. A parallel implementation, for instance, can perform edge contractions simultaneously on multiple parts of the graph, which may significantly reduce the overall runtime.
Category:Graph algorithms Category:Randomized algorithms Category:Computational geometry Category:1993 introductions
- ^ a b Karger, David (1993). "Global Min-cuts in RNC and Other Ramifications of a Simple Mincut Algorithm". Proc. 4th Annual ACM-SIAM Symposium on Discrete Algorithms.
- ^ Stoer, M.; Wagner, F. (1997). "A simple min-cut algorithm". Journal of the ACM. 44 (4): 585. doi:10.1145/263867.263872. S2CID 15220291.