HOME

TheInfoList



OR:

In
computer science Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to Applied science, practical discipli ...
and
graph theory In mathematics, graph theory is the study of '' graphs'', which are mathematical structures used to model pairwise relations between objects. A graph in this context is made up of '' vertices'' (also called ''nodes'' or ''points'') which are conn ...
, Karger's algorithm is a
randomized algorithm A randomized algorithm is an algorithm that employs a degree of randomness as part of its logic or procedure. The algorithm typically uses uniformly random bits as an auxiliary input to guide its behavior, in the hope of achieving good performa ...
to compute a minimum cut of a connected
graph Graph may refer to: Mathematics *Graph (discrete mathematics), a structure made of vertices and edges **Graph theory, the study of such graphs and their properties *Graph (topology), a topological space resembling a graph in the sense of discre ...
. It was invented by
David Karger David Ron Karger (born May 1, 1967) is a professor of computer science and a member of the Computer Science and Artificial Intelligence Laboratory (CSAIL) at the Massachusetts Institute of Technology. Education Karger received a Bachelor of Ar ...
and first published in 1993. The idea of the algorithm is based on the concept of contraction of an edge (u, v) in an undirected graph G = (V, E). Informally speaking, the contraction of an edge merges the nodes u and v into one, reducing the total number of nodes of the graph by one. All other edges connecting either u or v 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 In mathematics, an event that occurs with high probability (often shortened to w.h.p. or WHP) is one whose probability depends on a certain number ''n'' and goes to 1 as ''n'' goes to infinity, i.e. the probability of the event occurring can be ma ...
.


The global minimum cut problem

A ''cut'' (S,T) in an undirected graph G = (V, E) is a partition of the vertices V into two non-empty, disjoint sets S\cup T= V. 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, :: w(S,T) = , \, \,. There are 2^ ways of choosing for each vertex whether it belongs to S or to T, but two of these choices make S or T empty and do not give rise to cuts. Among the remaining choices, swapping the roles of S and T does not change the cut, so each cut is counted twice; therefore, there are 2^-1 distinct cuts. The ''minimum cut problem'' is to find a cut of smallest size among these cuts. For weighted graphs with positive edge weights w\colon E\rightarrow \mathbf R^+ the weight of the cut is the sum of the weights of edges between vertices in each part :: w(S,T) = \sum_ w(uv)\,, which agrees with the unweighted definition for w=1. A cut is sometimes called a “global cut” to distinguish it from an “s-t cut” for a given pair of vertices, which has the additional requirement that s\in S and t\in T. Every global cut is an s-t cut for some s,t\in V. Thus, the minimum cut problem can be solved in
polynomial time In computer science, the time complexity is the computational complexity that describes the amount of computer time it takes to run an algorithm. Time complexity is commonly estimated by counting the number of elementary operations performed by ...
by iterating over all choices of s,t\in V and solving the resulting minimum s-t cut problem using the max-flow min-cut theorem and a polynomial time algorithm for
maximum flow In optimization theory, maximum flow problems involve finding a feasible flow through a flow network that obtains the maximum possible flow rate. The maximum flow problem can be seen as a special case of more complex network flow problems, such ...
, 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 O(mn+n^2\log n).


Contraction algorithm

The fundamental operation of Karger’s algorithm is a form of edge contraction. The result of contracting the edge e=\ is new node uv. Every edge \ or \ for w\notin\ to the endpoints of the contracted edge is replaced by an edge \ to the new node. Finally, the contracted nodes u and v with all their incident edges are removed. In particular, the resulting graph contains no self-loops. The result of contracting edge e is denoted G/e. 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(G=(V,E)): while , V, > 2 choose e\in E uniformly at random G \leftarrow G/e return the only cut in G When the graph is represented using
adjacency list In graph theory and computer science, an adjacency list is a collection of unordered lists used to represent a finite graph. Each unordered list within an adjacency list describes the set of neighbors of a particular vertex in the graph. This is ...
s or an
adjacency matrix In graph theory and computer science, an adjacency matrix is a square matrix used to represent a finite graph. The elements of the matrix indicate whether pairs of vertices are adjacent or not in the graph. In the special case of a finite simp ...
, a single edge contraction operation can be implemented with a linear number of updates to the data structure, for a total running time of O(, V, ^2). Alternatively, the procedure can be viewed as an execution of
Kruskal’s algorithm Kruskal's algorithm finds a minimum spanning tree, minimum spanning forest of an undirected weighted graph, edge-weighted graph. If the graph is Connectivity (graph theory), connected, it finds a minimum spanning tree. (A minimum spanning tree of a ...
for constructing the
minimum spanning tree A minimum spanning tree (MST) or minimum weight spanning tree is a subset of the edges of a connected, edge-weighted undirected graph that connects all the vertices together, without any cycles and with the minimum possible total edge weight. ...
in a graph where the edges have weights w(e_i)=\pi(i) according to a random permutation \pi. 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 Kruskal's algorithm finds a minimum spanning tree, minimum spanning forest of an undirected weighted graph, edge-weighted graph. If the graph is Connectivity (graph theory), connected, it finds a minimum spanning tree. (A minimum spanning tree of a ...
in time O(, E, \log , E, ). The best known implementations use O(, E, ) time and space, or O(, E, \log , E, ) time and O(, V, ) space, respectively.


Success probability of the contraction algorithm

In a graph G=(V,E) with n=, V, vertices, the contraction algorithm returns a minimum cut with polynomially small probability \binom^. Every graph has 2^ -1 cuts,. among which at most \tbinom 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 \tbinom/( 2^ -1 ). For instance, the
cycle graph In graph theory, a cycle graph or circular graph is a graph that consists of a single cycle, or in other words, some number of vertices (at least 3, if the graph is simple) connected in a closed chain. The cycle graph with vertices is called ...
on n vertices has exactly \binom minimum cuts, given by every choice of 2 edges. The contraction procedure finds each of these with equal probability. To further establish the lower bound on the success probability, let C denote the edges of a specific minimum cut of size k. The contraction algorithm returns C if none of the random edges belongs to the cutset of C. In particular, the first edge contraction avoids C, which happens with probability 1-k/, E, . The minimum degree of G is at least k (otherwise a minimum degree vertex would induce a smaller cut where one of the two partitions contains only the minimum degree vertex), so , E, \geqslant nk/2. Thus, the probability that the contraction algorithm picks an edge from C is ::::\frac \leqslant \frac = \frac. The probability p_n that the contraction algorithm on an n-vertex graph avoids C satisfies the recurrence p_n \geqslant \left( 1 - \frac \right) p_, with p_2 = 1, which can be expanded as ::: p_n \geqslant \prod_^ \Bigl(1-\frac\Bigr) = \prod_^ = \frac\cdot \frac \cdot \frac\cdots \frac\cdot \frac \cdot \frac = \binom^\,.


Repeating the contraction algorithm

By repeating the contraction algorithm T = \binom\ln n times with independent random choices and returning the smallest cut, the probability of not finding a minimum cut is ::: \left -\binom^\rightT \leq \frac = \frac\,. The total running time for T repetitions for a graph with n vertices and m edges is O(Tm) = O(n^2 m \log n).


Karger–Stein algorithm

An extension of Karger’s algorithm due to
David Karger David Ron Karger (born May 1, 1967) is a professor of computer science and a member of the Computer Science and Artificial Intelligence Laboratory (CSAIL) at the Massachusetts Institute of Technology. Education Karger received a Bachelor of Ar ...
and Clifford Stein achieves an order of magnitude improvement. The basic idea is to perform the contraction procedure until the graph reaches t vertices. procedure contract(G=(V,E), t): while , V, > t choose e\in E uniformly at random G \leftarrow G/e return G The probability p_ that this contraction procedure avoids a specific cut C in an n-vertex graph is ::: p_ \ge \prod_^ \Bigl(1-\frac\Bigr) = \binom\Bigg/\binom\,. This expression is approximately t^2/n^2 and becomes less than \frac around t= n/\sqrt 2 . In particular, the probability that an edge from C is contracted grows towards the end. This motivates the idea of switching to a slower algorithm after a certain number of contraction steps. procedure fastmincut(G= (V,E)): if , V, \le 6: return mincut(V) else: t\leftarrow \lceil 1 + , V, /\sqrt 2\rceil G_1 \leftarrow contract(G, t) G_2 \leftarrow contract(G, t) return min


Analysis

The probability P(n) the algorithm finds a specific cutset C is given by the recurrence relation :::P(n)= 1-\left(1-\frac P\left(\Bigl\lceil 1 + \frac\Bigr\rceil \right)\right)^2 with solution P(n) = \Omega\left(\frac\right). The running time of fastmincut satisfies :::T(n)= 2T\left(\Bigl\lceil 1+\frac\Bigr\rceil\right)+O(n^2) with solution T(n)=O(n^2\log n). To achieve error probability O(1/n), the algorithm can be repeated O(\log n/P(n)) times, for an overall running time of T(n) \cdot \frac = O(n^2\log ^3 n). This is an order of magnitude improvement over Karger’s original algorithm.


Improvement bound

To determine a min-cut, one has to touch every edge in the graph at least once, which is \Theta(n^2) time in a
dense graph In mathematics, a dense graph is a graph in which the number of edges is close to the maximal number of edges (where every pair of vertices is connected by one edge). The opposite, a graph with only a few edges, is a sparse graph. The distincti ...
. The Karger–Stein's min-cut algorithm takes the running time of O(n^2\ln ^{O(1)} n), which is very close to that.


References

Graph algorithms Graph connectivity