Jump to content

Karger's algorithm: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
The global minimum cut problem: more terminology: cutset
 
(78 intermediate revisions by 54 users not shown)
Line 1: Line 1:
{{Short description|Randomized algorithm for minimum cuts}}
[[File:Min cut.jpg|thumb|A graph with two cuts. The dotted line in red is a cut with three crossing edges. The dashed line in green is the min-cut of this graph, crossing only two edges.]]
[[File:Min cut example.svg|thumb|A graph and two of its cuts. The dotted line in red is a cut with three crossing edges. The dashed line in green is a min-cut of this graph, crossing only two edges.]]
In [[computer science]] and [[graph theory]], '''Karger's algorithm''' is a [[randomized algorithm]] to compute a [[minimum cut]] of a connected [[graph (mathematics)|graph]]. It was invented by [[David Karger]] and first published in 1993.<ref name="karger1993">{{cite conference
In [[computer science]] and [[graph theory]], '''Karger's algorithm''' is a [[randomized algorithm]] to compute a [[minimum cut]] of a connected [[Graph (discrete mathematics)|graph]]. It was invented by [[David Karger]] and first published in 1993.<ref name="karger1993">{{cite conference
|last=Karger
|last=Karger
|first=David
|first=David
|title=Global Min-cuts in RNC and Other Ramifications of a Simple Mincut Algorithm
|title=Global Min-cuts in RNC and Other Ramifications of a Simple Mincut Algorithm
|url=http://people.csail.mit.edu/karger/Papers/mincut.ps
|url=http://people.csail.mit.edu/karger/Papers/mincut.ps
|booktitle=Proc. 4th Annual ACM-SIAM Symposium on Discrete Algorithms
|book-title=Proc. 4th Annual ACM-SIAM Symposium on Discrete Algorithms
|date=1993
|date=1993
}}</ref>
}}</ref>


The idea of the algorithm is based on the concept of [[Edge contraction|contraction of an edge]] <math>(u, v)</math> in an undirected graph <math>G = (V, E)</math>. Informally speaking, the contraction of an edge merges the nodes <math>u</math> and <math>v</math> into one, reducing the total number of nodes of the graph by one. All other edges connecting either <math>u</math> or <math>v</math> 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 (graph theory)|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 idea of the algorithm is based on the concept of [[Edge contraction|contraction of an edge]] <math>(u, v)</math> in an undirected graph <math>G = (V, E)</math>. Informally speaking, the contraction of an edge merges the nodes <math>u</math> and <math>v</math> into one, reducing the total number of nodes of the graph by one. All other edges connecting either <math>u</math> or <math>v</math> 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 (graph theory)|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 ==
==The global minimum cut problem ==
{{main|Minimum cut}}
{{main|Minimum cut}}
A <i>cut</i> <math>(S,T)</math> in an undirected graph <math>G = (V, E)</math> is a partition of the vertices <math>V</math> into two non-empty, disjoint sets <math>S\cup T= V</math>.
A ''cut'' <math>(S,T)</math> in an undirected graph <math>G = (V, E)</math> is a partition of the vertices <math>V</math> into two non-empty, disjoint sets <math>S\cup T= V</math>. The ''cutset'' of a cut consists of the edges <math>\{\, uv \in E \colon u\in S, v\in T\,\}</math> 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,
The <i>cutset</i> of a cut consists of the edges <math>\{\, uv \in E \colon u\in S, v\in T\,\}</math> between the two parts.
The <i>size</i> (or <i>weight</i>) of a cut in an unweighted graph is the cardinality of the cutset, i.e., the number of edges between the two parts,
:: <math>w(S,T) = |\{\, uv \in E \colon u\in S, v\in T\,\}|\,.</math>
:: <math>w(S,T) = |\{\, uv \in E \colon u\in S, v\in T\,\}|\,.</math>
There are <math>2^{|V|}</math> ways of choosing for each vertex whether it belongs to <math>S</math> or to <math>T</math>, but two of these choices make <math>S</math> or <math>T</math> empty and do not give rise to cuts. Among the remaining choices, swapping the roles of <math>S</math> and <math>T</math> does not change the cut, so each cut is counted twice; therefore, there are <math>2^{|V|-1}-1</math> distinct cuts.
The <i>minimum cut problem</i> is to find a cut of smallest size among its <math>2^{|V|}-2</math> cuts.
The ''minimum cut problem'' is to find a cut of smallest size among these cuts.


For weighted graphs with positive edge weights <math>w\colon E\rightarrow \mathbf R^+</math> the weight of the cut is the sum of the weights of edges between vertices in each part
For weighted graphs with positive edge weights <math>w\colon E\rightarrow \mathbf R^+</math> the weight of the cut is the sum of the weights of edges between vertices in each part
Line 23: Line 23:
which agrees with the unweighted definition for <math>w=1</math>.
which agrees with the unweighted definition for <math>w=1</math>.


A cut is sometimes called a “global cut” to distinguish it from an “<math>s</math>-<math>t</math> cut” for a given pair of vertices, which has the additional requirement that <math>s\in S</math> and <math>t\in T</math>. Every global cut is an <math>s</math>-<math>t</math> cut for some <math>s,t\in V</math>. Thus, the minimum cut problem can be solved in [[polynomial time]] by iterating over all choices of <math>s,t\in V</math> and solving the resulting minimum <math>s</math>-<math>t</math> cut problem using the [[max-flow min-cut theorem]] and a polynomial time algorithm for [[maximum flow]], such as the [[Ford–Fulkerson algorithm]], though this approach is not optimal. There is a deterministic algorithm for the minimum cut problem with running time <math>O(mn+n^2\log n)</math>.<ref>M. Stoer and F. Wagner. A simple min-cut algorithm. Journal of the ACM, 44(4):585–591, 1997.</ref>
A cut is sometimes called a “global cut” to distinguish it from an “<math>s</math>-<math>t</math> cut” for a given pair of vertices, which has the additional requirement that <math>s\in S</math> and <math>t\in T</math>. Every global cut is an <math>s</math>-<math>t</math> cut for some <math>s,t\in V</math>. Thus, the minimum cut problem can be solved in [[polynomial time]] by iterating over all choices of <math>s,t\in V</math> and solving the resulting minimum <math>s</math>-<math>t</math> cut problem using the [[max-flow min-cut theorem]] and a polynomial time algorithm for [[maximum flow]], such as the [[push–relabel maximum flow algorithm|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 <math>O(mn+n^2\log n)</math>.<ref name="simplemincut">{{Cite journal | last1 = Stoer | first1 = M. | last2 = Wagner | first2 = F. | doi = 10.1145/263867.263872 | title = A simple min-cut algorithm | journal = Journal of the ACM | volume = 44 | issue = 4 | pages = 585 | year = 1997 | s2cid = 15220291 | doi-access = free }}</ref>


==Contraction algorithm==
==Contraction algorithm==


The fundamental operation of Karger’s algorithm is a form of [[edge contraction]]. The result of contracting the edge <math>e=\{u,v\}</math> is a new node <math>uv</math>. Every edge <math>\{w,u\}</math> or <math>\{w,v\}</math> for <math>w\notin\{u,v\}</math> to the endpoints of the contracted edge is replaced by an edge <math>\{w,uv\}</math> to the new node. Finally, the contracted nodes <math>u</math> and <math>v</math> with all their incident edges are removed. In particular, the resulting graph contains no self-loops. The result of contracting edge <math>e</math> is denoted <math>G/e</math>.


[[File:Edge contraction in a multigraph.svg|150px|The marked edge is contracted into a single node.]]
The fundamental operation of Karger’s algorithm is a form of [[edge contraction]]. The result of contracting the edge <math>e=\{u,v\}</math> is new node <math>uv</math>. Every edge <math>\{w,u\}</math> or <math>\{w,v\}</math> for <math>w\notin\{u,w\}</math> to the endpoints of the contracted edge is replaced by an edge <math>\{w,uv\}</math> to the new node. Finally, the contracted nodes <math>u</math> and <math>v</math> with all their incident edges are removed. In particular, the resulting graph <math>G/e</math> contains no self-loops.

[[File:Edge_contraction_in_a_multigraph.svg|150px|The marked edge is contracted into a single node.]]


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 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.
[[File:Single_run_of_Karger’s_Mincut_algorithm.svg|frame|center|Successful run of Karger’s algorithm on a 10-vertex graph. The minimum cut has size 3.]]


[[File:Single run of Karger’s Mincut algorithm.svg|frame|center|Successful run of Karger’s algorithm on a 10-vertex graph. The minimum cut has size 3.]]


'''procedure''' contract(<math>G=(V,E)</math>):
'''procedure''' contract(<math>G=(V,E)</math>):
Line 51: Line 51:
===Success probability of the contraction algorithm===
===Success probability of the contraction algorithm===


In a graph <math>G=(V,E)</math> with <math>n=|V|</math> vertices, the contraction algorithm returns a minimum cut with polynomially small probability <math>\binom{n}{2}^{-1}</math>. There are at most <math>\binom{n}{2}</math> minimum cuts among the graph’s <math>2^{n-1}</math> cuts, so this probability is much better than picking a cut at random.
In a graph <math>G=(V,E)</math> with <math>n=|V|</math> vertices, the contraction algorithm returns a minimum cut with polynomially small probability <math>\binom{n}{2}^{-1}</math>. Recall that every graph has <math>2^{n-1} -1 </math> cuts (by the discussion in the previous section), among which at most <math>\tbinom{n}{2}</math> 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 <math>\frac{\tbinom{n}{2}}{2^{n-1} -1}</math>.


For instance, the [[cycle graph]] on <math>n</math> vertices has exactly <math>\binom{n}{2}</math> minimum cuts, given by every choice of 2 edges. The contraction procedure finds each of these with equal probability.
For instance, the [[cycle graph]] on <math>n</math> vertices has exactly <math>\binom{n}{2}</math> minimum cuts, given by every choice of 2 edges. The contraction procedure finds each of these with equal probability.


To establish the bound on the success probability in general, let <math>C</math> denote the edges of a specific minimum cut of size <math>k</math>. The contraction algorithm returns <math>C</math> if none of the random edges belongs to the cutset of <math>C</math>. In particular, the first edge contraction avoids <math>C</math>, which happens with probability <math>1-k/|E|</math>. The minimum degree of <math>G</math> is at least <math>k</math> (otherwise a minimum degree vertex would induce a smaller cut), so <math>|E|\geq nk/2</math>. Thus, the probability that the contraction algorithm picks an edge from <math>C</math> is
To further establish the lower bound on the success probability, let <math>C</math> denote the edges of a specific minimum cut of size <math>k</math>. The contraction algorithm returns <math>C</math> if none of the random edges deleted by the algorithm belongs to the cutset <math>C</math>. In particular, the first edge contraction avoids <math>C</math>, which happens with probability <math>1-k/|E|</math>. The minimum [[Degree (graph theory)|degree]] of <math>G</math> is at least <math>k</math> (otherwise a minimum degree vertex would induce a smaller cut where one of the two partitions contains only the minimum degree vertex), so <math>|E|\geqslant nk/2</math>. Thus, the probability that the contraction algorithm picks an edge from <math>C</math> is
::::<math>\frac{k}{|E|} \leq \frac{k}{nk/2} = \frac{2}{n}.</math>
::::<math>\frac{k}{|E|} \leqslant \frac{k}{nk/2} = \frac{2}{n}.</math>
The probability <math>p_n</math> that the contraction algorithm on an <math>n</math>-vertex graph avoids <math>C</math> satisfies the recurrence <math>p_n \geq \bigl(1- \frac{2}{n}\bigr) p_{n-1}</math>, with <math>p_2 = 1</math>, which can be expanded as
The probability <math>p_n</math> that the contraction algorithm on an <math>n</math>-vertex graph avoids <math>C</math> satisfies the recurrence <math>p_n \geqslant \left( 1 - \frac{2}{n} \right) p_{n-1}</math>, with <math>p_2 = 1</math>, which can be expanded as
:::<math>
:::<math>
p_n \geq \prod_{i=0}^{n-3} \Bigl(1-\frac{2}{n-i}\Bigr) =
p_n \geqslant \prod_{i=0}^{n-3} \Bigl(1-\frac{2}{n-i}\Bigr) =
\prod_{i=0}^{n-3} {\frac{n-i-2}{n-i}}
\prod_{i=0}^{n-3} {\frac{n-i-2}{n-i}}
= \frac{n-2}{n}\cdot \frac{n-3}{n-1} \cdot \frac{n-4}{n-2}\cdots \frac{3}{5}\cdot \frac{2}{4} \cdot \frac{1}{3}
= \frac{n-2}{n}\cdot \frac{n-3}{n-1} \cdot \frac{n-4}{n-2}\cdots \frac{3}{5}\cdot \frac{2}{4} \cdot \frac{1}{3}
Line 67: Line 67:
===Repeating the contraction algorithm===
===Repeating the contraction algorithm===


[[File:10_repetitions_of_Karger’s_contraction_procedure.svg|thumb|10 repetitions of the contraction procedure. The 5th repetition finds the minimum cut of size 3.]]
[[File:10 repetitions of Karger’s contraction procedure.svg|thumb|10 repetitions of the contraction procedure. The 5th repetition finds the minimum cut of size 3.]]


By repeating the contraction algorithm <math> T = \binom{n}{2}\ln n </math> times with independent random choices and returning the smallest cut, the probability of not finding a minimum cut is
By repeating the contraction algorithm <math> T = \binom{n}{2}\ln n </math> times with independent random choices and returning the smallest cut, the probability of not finding a minimum cut is
:::<math>
:::<math>
\Bigl[1-\binom{n}{2}^{-1}\Bigr]^T
\left[1-\binom{n}{2}^{-1}\right]^T
\leq \frac{1}{e^{\ln n}} = \frac{1}{n}\,.
\leq \frac{1}{e^{\ln n}} = \frac{1}{n}\,.
</math>
</math>


The total running time for <math>T</math> repetitions is <math> O(Tm) = O(n^2 m \log n)</math>.
The total running time for <math>T</math> repetitions for a graph with <math>n</math> vertices and <math>m</math> edges is <math> O(Tm) = O(n^2 m \log n)</math>.


== The Karger–Stein's algorithm ==
== Karger–Stein algorithm ==
An extension of Karger’s algorithm due to [[David Karger]] and [[Clifford Stein]] achieves an order of magnitude improvement.<ref name= "faster">{{Cite journal | last1 = Karger | first1 = David R. | author-link1 = David Karger| last2 = Stein | first2 = Clifford| author-link2 = Clifford Stein | doi = 10.1145/234533.234534 | title = A new approach to the minimum cut problem | journal = Journal of the ACM | volume = 43 | issue = 4 | pages = 601 | year = 1996 | s2cid = 5385337 | url = http://www.columbia.edu/~cs2035/courses/ieor6614.S09/Contraction.pdf}}</ref>
This algorithm is developed by [[David Karger]] and [[Clifford Stein]]. And it is an order of magnitude improvement of the running time compared with Karger's Basic Algorithm.<ref name= "faster">
{{cite journal
|last=Karger
|first=David
|coauthors=[[Clifford Stein]]
|title=A New Approach to the Minimum Cut Problem
|journal=Journal of the ACM
|year=1996
|volume=43
|issue=4
|pages=601–640
|url=http://people.csail.mit.edu/karger/Papers/contract.ps
}}</ref><br />
Before we move forwards to the detailed description, we notice that when we do the contractions until ''i'' vertices are left, the probability that ''C'' survives is
:::<math>
\begin{align}
\Pr[C] &\ge \prod_{j=0}^{n-i} {(1-\frac{2}{n-j})}\\
&= \frac{n-2}{n}\cdot \frac{n-3}{n-1} \cdot \frac{n-4}{n-2}\cdots \frac{n-i}{n-i+2}\cdot \frac{n-i-1}{n-i+1} \cdot \frac{n-i-2}{n-i}\\
&= \frac{(n-i-1)(n-i-2)}{n(n-1)} \\
& \isin O\left(\frac{i^2}{n^2}\right)
\end{align}</math>


The basic idea is to perform the contraction procedure until the graph reaches <math>t</math> vertices.
=== Algorithm description ===
Inspired by the formula above, we can find that the less edges that left in this graph, the less chance that ''C'' survives. We, therefore, improve the basic algorithm that


'''INPUT:''' An undirected graph ''G'' = (''V'', ''E'')<br />
'''procedure''' contract(<math>G=(V,E)</math>, <math>t</math>):
'''OUTPUT:''' find the min-cut of '''''G'''''
'''while''' <math>|V| > t</math>
choose <math>e\in E</math> uniformly at random
'''function''' Karger–Stein's Min-Cut('''''G'''''):
<math>G \leftarrow G/e</math>
1, run the '''Karger's Basic Algorithm''' to ''i'' = {{math|{{Fraction |n|√2 }}}} twice getting {{math|G<sub>1</sub>}} and {{math|G<sub>2</sub>}},
'''return''' <math>G</math>
2, recursively run the '''Karger–Stein's Min-Cut Algorithm''' on {{math|G<sub>1</sub>}} and {{math|G<sub>2</sub>}}

'''end function'''
The probability <math>p_{n,t}</math> that this contraction procedure avoids a specific cut <math>C</math> in an <math>n</math>-vertex graph is
:::
<math>
p_{n,t} \ge \prod_{i=0}^{n-t-1} \Bigl(1-\frac{2}{n-i}\Bigr) = \binom{t}{2}\Bigg/\binom{n}{2}\,.
</math>

This expression is approximately <math>t^2/n^2</math> and becomes less than <math>\frac{1}{2}</math> around <math> t= n/\sqrt 2 </math>. In particular, the probability that an edge from <math>C</math> 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(<math>G= (V,E)</math>):
'''if''' <math>|V| \le 6</math>:
'''return''' contract(<math>G</math>, <math>2</math>)
'''else''':
<math>t\leftarrow \lceil 1 + |V|/\sqrt 2\rceil</math>
<math>G_1 \leftarrow </math> contract(<math>G</math>, <math>t</math>)
<math>G_2 \leftarrow </math> contract(<math>G</math>, <math>t</math>)
'''return''' min{fastmincut(<math>G_1</math>), fastmincut(<math>G_2</math>)}


=== Running time ===
=== Analysis ===
Then we can get the probability of min cut survive ''P''(''n'') (n is the number of vertices) meets this recurrence relation:
:::<math>P(n)= 1-\left(1-\frac{1}{2} P\left(\frac{n}{\sqrt{2}}\right)\right)^2</math>
Also, we can prove that <math>P(n) = O\left(\frac{1}{\ln n}\right)</math>. and the recurrence relation of running time is
:::<math>T(n)= 2T\left(\frac{n}{\sqrt{2}}\right)+O(n^2)\text{ and }T(n) = O(1)\text{ when }n \le 2.</math>
According to the [[Master theorem|Master Theorem]], <math>T(n)=O(n^2\ln n)</math>. Therefore the overall running time is <math>T(n) \cdot \frac{1}{P(n)} = O(n^2\ln ^2 n)</math>, which is an order of magnitude improvement.


The contraction parameter <math>t</math> is chosen so that each call to contract has probability at least 1/2 of success (that is, of avoiding the contraction of an edge from a specific cutset <math>C</math>). This allows the successful part of the recursion tree to be modeled as a [[random binary tree]] generated by a critical [[Galton–Watson process]], and to be analyzed accordingly.<ref name= "faster"/>
=== Finding all min-cuts ===
'''Theorem:''' With high probability we can find all min cuts in the running time of <math>O(n^2\ln ^3 n)</math>.


The probability <math>P(n)</math> that this random tree of successful calls contains a long-enough path to reach the base of the recursion and find <math>C</math> is given by the recurrence relation
'''Proof:''' Since we know that <math>P(n) = O\left(\frac{1}{\ln n}\right)</math>, therefore after running this algorithm <math>O(\ln ^2 n)</math> times The probability of missing a specific min-cut is
::::<math>\Pr[\text{miss a specific min-cut}] = (1-P(n))^{O(\ln ^2 n)} \le \left(1-\frac{c}{\ln n}\right)^{\frac{3\ln ^2 n}{c}} \le e^{-3\ln n} = \frac{1}{n^3}</math>.
:::<math>P(n)= 1-\left(1-\frac{1}{2} P\left(\Bigl\lceil 1 + \frac{n}{\sqrt{2}}\Bigr\rceil \right)\right)^2</math>
with solution <math>P(n) = \Omega\left(\frac{1}{\log n}\right)</math>. The running time of fastmincut satisfies
And there are at most <math>\binom{n}{2}</math> min-cuts, hence the probability of missing ant min-cut is
:::<math>\Pr[\text{miss any min-cut}] \le \binom{n}{2} \cdot \frac{1}{n^3} = O\left(\frac{1}{n}\right).</math>
:::<math>T(n)= 2T\left(\Bigl\lceil 1+\frac{n}{\sqrt{2}}\Bigr\rceil\right)+O(n^2)</math>
with solution <math>T(n)=O(n^2\log n)</math>. To achieve error probability <math>O(1/n)</math>, the algorithm can be repeated <math>O(\log n/P(n))</math> times, for an overall running time of <math>T(n) \cdot \frac{\log n}{P(n)} = O(n^2\log ^3 n)</math>. This is an order of magnitude improvement over Karger’s original algorithm.<ref name= "faster"/>
The probability of failures is considerably small when ''n'' is large enough.∎


=== Improvement bound ===
=== Improvement bound ===
To determine a min-cut, one has to touch every edge in the graph at least once, which is <math>O(n^2)</math> time. The Karger–Stein's min-cut algorithm takes the running time of <math>O(n^2\ln ^{O(1)} n)</math>, which is very close to that.
To determine a min-cut, one has to touch every edge in the graph at least once, which is <math>\Theta(n^2)</math> time in a [[dense graph]]. The Karger–Stein's min-cut algorithm takes the running time of <math>O(n^2\ln ^{O(1)} n)</math>, which is very close to that.


==References==
==References==
Line 134: Line 123:
[[Category:Graph algorithms]]
[[Category:Graph algorithms]]
[[Category:Graph connectivity]]
[[Category:Graph connectivity]]

[[th:ขั้นตอนวิธีของคาร์เกอร์]]
[[vi:Thuật toán Karger]]

Latest revision as of 19:56, 12 October 2024

A graph and two of its cuts. The dotted line in red is a cut with three crossing edges. The dashed line in green is a min-cut of this graph, crossing only two edges.

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

[edit]

A 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

[edit]

The fundamental operation of Karger’s algorithm is a form of edge contraction. The result of contracting the edge is a new node . Every edge or for to the endpoints of the contracted edge is replaced by an edge to the new node. Finally, the contracted nodes and with all their incident edges are removed. In particular, the resulting graph contains no self-loops. The result of contracting edge is denoted .

The marked edge is contracted into a single node.

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.

Successful run of Karger’s algorithm on a 10-vertex graph. The minimum cut has size 3.
   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 random edge choices in Karger’s algorithm correspond to an execution of Kruskal’s algorithm on a graph with random edge ranks until only two components remain.

The best known implementations use time and space, or time and space, respectively.[1]

Success probability of the contraction algorithm

[edit]

In 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 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 denote the edges of a specific minimum cut of size . The contraction algorithm returns if none of the random edges deleted by the algorithm belongs to the cutset . In particular, the first edge contraction avoids , which happens with probability . The minimum degree of is at least (otherwise a minimum degree vertex would induce a smaller cut where one of the two partitions contains only the minimum degree vertex), so . Thus, the probability that the contraction algorithm picks an edge from is

The probability that the contraction algorithm on an -vertex graph avoids satisfies the recurrence , with , which can be expanded as

Repeating the contraction algorithm

[edit]
10 repetitions of the contraction procedure. The 5th repetition finds the minimum cut of size 3.

By repeating the contraction algorithm times with independent random choices and returning the smallest cut, the probability of not finding a minimum cut is

The total running time for repetitions for a graph with vertices and edges is .

Karger–Stein algorithm

[edit]

An extension of Karger’s algorithm due to David Karger and Clifford Stein achieves an order of magnitude improvement.[3]

The basic idea is to perform the contraction procedure until the graph reaches vertices.

   procedure contract(, ):
   while 
       choose  uniformly at random
       
   return 

The probability that this contraction procedure avoids a specific cut in an -vertex graph is

This expression is approximately and becomes less than around . In particular, the probability that an edge from 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():
   if :
       return contract(, )
   else:
       
        contract(, )
        contract(, )
       return min{fastmincut(), fastmincut()}

Analysis

[edit]

The contraction parameter is chosen so that each call to contract has probability at least 1/2 of success (that is, of avoiding the contraction of an edge from a specific cutset ). This allows the successful part of the recursion tree to be modeled as a random binary tree generated by a critical Galton–Watson process, and to be analyzed accordingly.[3]

The probability that this random tree of successful calls contains a long-enough path to reach the base of the recursion and find is given by the recurrence relation

with solution . The running time of fastmincut satisfies

with solution . To achieve error probability , the algorithm can be repeated times, for an overall running time of . This is an order of magnitude improvement over Karger’s original algorithm.[3]

Improvement bound

[edit]

To determine a min-cut, one has to touch every edge in the graph at least once, which is time in a dense graph. The Karger–Stein's min-cut algorithm takes the running time of , which is very close to that.

References

[edit]
  1. ^ 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.
  2. ^ Stoer, M.; Wagner, F. (1997). "A simple min-cut algorithm". Journal of the ACM. 44 (4): 585. doi:10.1145/263867.263872. S2CID 15220291.
  3. ^ a b c Karger, David R.; Stein, Clifford (1996). "A new approach to the minimum cut problem" (PDF). Journal of the ACM. 43 (4): 601. doi:10.1145/234533.234534. S2CID 5385337.