Docsity

Minimum Cut Algorithm in Graph Theory, Study notes of Algorithms and Programming

Toggle sidebar
bg1
19: Min Cut
Sariel Har-Peled
April 7, 2006
473G - Algorithms
To acknowledge the corn - This purely American expression means to admit the losing of an argument, especially in
regard to a detail; to retract; to admit defeat. It is over a hundred years old. Andrew Stewart, a member of Congress,
is said to have mentioned it in a speech in 1828. He said that haystacks and cornfields were sent by Indiana, Ohio and
Kentucky to Philadelphia and New York. Charles A. Wickliffe, a member from Kentucky questioned the statement
by commenting that haystacks and cornfields could not walk. Stewart then pointed out that he did not mean literal
haystacks and cornfields, but the horses, mules, and hogs for which the hay and corn were raised. Wickliffe then
rose to his feet, and said, ”Mr. Speaker, I acknowledge the corn”.
– Funk, Earle, A Hog on Ice and Other Curious Expressions.
1 Min Cut
1.1 Problem Definition
Let G=(V,E) be undirected graph with nvertices, and medges. We are interested in the notion of a cut in
a graph.
Definition 1.1 Acut in Gis a partition of the vertices of Vinto two sets Sand V\S, where the edges of
the cut are
(S,V\S)=uv u∈S,v∈V\S,and uv ∈E,
where S,∅and V\S,∅. We will refer to the number of edges in the cut (S,V\S) as the size of the cut.
For an example of a cut, see Figure 1.
We are interested in the problem of computing the minimum cut, that is, the cut in the graph with
minimum cardinality. Compute the cut with minimum number of edges in the graph. Namely, find S⊆V
such that (S,V\S) is as small as possible, and Sis neither empty nor is V\S.
1.2 Some Definitions
Definition 1.2 The conditional probability of Xgiven Yis
PrX=x|Y=y=Pr(X=x)∩(Y=y)
PrY=y.
An equivalent, useful statement of this is that
Pr(X=x)∩(Y=y)=PrX=x|Y=y∗PrY=y.
Definition 1.3 Two events Xand Yare independent, if PrX=x∩Y=y=Pr[X=x]·PrY=y. In
particular, if Xand Yare independent, then
PrX=xY=y=Pr[X=x].
The following is easy to prove by induction.
1
pf3
pf4
pf5

Partial preview of the text

Download Minimum Cut Algorithm in Graph Theory and more Study notes Algorithms and Programming in PDF only on Docsity!

19: Min Cut

Sariel Har-Peled

April 7, 2006

473G - Algorithms

To acknowledge the corn - This purely American expression means to admit the losing of an argument, especially in regard to a detail; to retract; to admit defeat. It is over a hundred years old. Andrew Stewart, a member of Congress, is said to have mentioned it in a speech in 1828. He said that haystacks and cornfields were sent by Indiana, Ohio and Kentucky to Philadelphia and New York. Charles A. Wickliffe, a member from Kentucky questioned the statement by commenting that haystacks and cornfields could not walk. Stewart then pointed out that he did not mean literal haystacks and cornfields, but the horses, mules, and hogs for which the hay and corn were raised. Wickliffe then rose to his feet, and said, ”Mr. Speaker, I acknowledge the corn”.

  • Funk, Earle, A Hog on Ice and Other Curious Expressions.

1 Min Cut

1.1 Problem Definition

Let G = (V, E) be undirected graph with n vertices, and m edges. We are interested in the notion of a cut in a graph.

Definition 1.1 A cut in G is a partition of the vertices of V into two sets S and V \ S , where the edges of the cut are (S , V \ S ) =

uv

∣∣ u ∈ S , v ∈ V \ S , and uv ∈ E

where S , ∅ and V \ S , ∅. We will refer to the number of edges in the cut (S , V \ S ) as the size of the cut.

For an example of a cut, see Figure 1. We are interested in the problem of computing the minimum cut, that is, the cut in the graph with minimum cardinality. Compute the cut with minimum number of edges in the graph. Namely, find S ⊆ V such that (S , V \ S ) is as small as possible, and S is neither empty nor is V \ S.

1.2 Some Definitions

Definition 1.2 The conditional probability of X given Y is

Pr

[

X = x |Y = y

]

Pr

[

(X = x) ∩ (Y = y)

]

Pr

[

Y = y

].

An equivalent, useful statement of this is that

Pr

[

(X = x) ∩ (Y = y)

]

= Pr

[

X = x |Y = y

]

∗ Pr

[

Y = y

]

Definition 1.3 Two events X and Y are independent, if Pr

[

X = x ∩ Y = y

]

= Pr[X = x] · Pr

[

Y = y

]

. In particular, if X and Y are independent, then

Pr

[

X = x

∣∣ Y = y

]

= Pr[X = x].

The following is easy to prove by induction.

(a) (b) (c)

Figure 1: (a) A cut in the graph. (b) A contraction of an edge. (c) The resulting graph.

(a) (b)

Figure 2: (a) A multi-graph. (b) A minimum cut in the resulting multi-graph.

Lemma 1.4 Let η 1 ,... , ηn be n events which are not necessarily independent. Then,

Pr

[

∩ni= 1 ηi

]

= Pr

[

η 1

]

∗ Pr

[

η 2 |η 1

]

Pr

[

η 3 |η 1 ∩ η 2

]

∗... ∗ Pr

[

ηn

∣∣ η 1 ∩... ∩ ηn− 1

]

2 The Algorithm

The basic operation used by the algorithm is edge contraction, depicted in Figure 1. We take an edge e = xy and merge the two vertices into a single vertex. What we get is depicted in Figure 1 (c). The new graph is denoted by G/xy. Note, that we remove self loops. However, the resulting graph is no longer a regular graph, it has parallel edges – namely, it is a multi-graph. We represent a multi-graph, as a regular graph with multiplicities on the edges. See Figure 2. The edge contraction operation can be implemented in O(n) time for a graph with n vertices. This is done by Merging the adjacency lists of the two vertices being contracted, and then using hashing to do the fix-ups (i.e., we need to fix the adjacency list of the vertices that are connected to the two vertices). Note, that the cut is now computed counting multiplicities (i.e., if an edge is in the cut, and it has weight w we add w to the weight of the cut.

Observation 2.1 The size of the minimum cut in G/xy is at least as large as the minimum cut in G (as long as G/xy has at least one edge). Since any cut in G/xy has a corresponding cut of the same cardinality in G.

So, the main idea of our algorithm is to repeatedly perform contraction, which is beneficial since it shrinks the graph. And we would like to compute the cut in the resulting (smaller) graph. An “extreme”

Observation 2.6 The algorithm always outputs a cut, and the cut is not smaller than the minimum cut.

Lemma 2.7 MinCut outputs the min cut in probability ≥

n(n − 1)

Proof: Let ηi be the event that ei is not in the minimum cut of Gi. By Observation 2.2, MinCut outputs the minimum cut if the events η 0 ,... , ηn− 3 all happen (namely, all edges picked are outside the minimum cut).

By Lemma 2.4, it holds Pr

[

ηi |η 1 ∩... ∩ ηi− 1

]

|V(Gi)|

n − i

. Implying that

Pr

[

η 0 ∩... ∩ ηn− 2

]

= Pr

[

η 0

]

· Pr

[

η 1 |η 0

]

· Pr

[

η 2 |η 0 ∩ η 1

]

·... · Pr

[

ηn− 3 |η 0 ∩... ∩ ηn− 4

]

∏^ n−^3

i= 0

n − i

∏^ n−^3

i= 0

n − i − 2 n − i

=

n − 2 n

n − 3 n − 1

n − 4 n − 2

n · (n − 1)

Definition 2.8 (informal) Amplification is the process of running an experiment again and again till the things we want to happen, with good probability, do happen.

Let MinCutRep be the algorithm that runs MinCut n(n − 1) times and return the minimum cut computed in all those independent executions of MinCut.

Lemma 2.9 The probability that MinCutRep fails to return the minimum cut is < 0. 14.

Proof: The probability of failure is at most ( 1 −

n(n − 1)

)n(n−1) ≤ exp

n(n − 1) · n(n − 1)

= exp(−2) < 0. 14 ,

since 1 − x ≤ e−x^ for 0 ≤ x ≤ 1.

Theorem 2.10 One can compute the minimum cut in O(n^4 ) time with constant probability to get a correct result. In O

n^4 log n

time the minimum cut is returned with high probability.

3 A faster algorithm

The algorithm presented in the previous section is extremely simple. Which raises the question of whether we can complicate things, and get a faster algorithm? So, why is the algorithm needs so many executions? Well, the probability of success in the first l iterations, is

Pr

[

η 0 ∩... ∩ ηl− 1

]

∏^ l−^1

i= 0

n − i

∏^ l−^1

i= 0

n − i − 2 n − i

=

n − 2 n

n − 3 n − 1

n − 4 n − 2

(n − l)(n − l − 1) n · (n − 1)

Namely, this probability deteriorates very quickly toward the end of the execution, when the graph become small enough.

Contract( G, t ) begin while |(G)| > t do Pick a random edge e in G. G ← G/e return G end

FastCut(G = (V, E)) G – multi-graph begin n ← |V(G)| if n ≤ 6 then Compute (via brute force) minimum cut of G and return cut. t ←

1 + n/

H 1 ← Contract(G, t) H 2 ← Contract(G, t) /* Contract is randomized!!! */ X 1 ← FastCut(H 1 ), X 2 ← FastCut(H 2 ) return minimum cut out of X 1 and X 2. end

Figure 5: Contract(G, t) shrinks G till it has only t vertices. FastCut computes the minimum cut using Contract.

Observation 3.1 As the graph get smaller, the probability to make a bad choice increases. So, run the algorithm more times when the graph is smaller.

The basic new operation we use is Contract, depicted in Figure 5, which also depict the new algorithm FastCut.

Lemma 3.2 The running time of FastCut(G) is O

n^2 log n

, where n = |V(G)|.

Proof: Well, we perform two calls to Contract(G, t) which takes O(n^2 ) time. And then we perform two recursive calls, on the resulting graphs. We have:

T (n) = O

n^2

+ 2 T

n √ 2

The solution to this recurrence is O

n^2 log n

as one can easily (and should) verify.

Exercise 3.3 Show that one can modify FastCut so that it uses only O(n^2 ) space.

Lemma 3.4 The probability that Contract(G, n/

  1. had NOT contracted the minimum cut is at least 1 / 2.

Proof: Just plug in l = n − t = n −

1 + n/

into Eq. (1). We have

Pr

[

η 0 ∩... ∩ ηn−t

]

t(t − 1) n · (n − 1)

1 + n/

1 + n/

n(n − 1)

Theorem 3.5 FastCut finds the minimum cut with probability larger than Ω

1 / log n

Proof: Let P(n) be the probability that the algorithm succeeds on a graph with n vertices. The probability to succeed in the first call on H 1 is the probability that contract did not hit the minimum cut (this probability is larger than 1/2 by Lemma 3.4), times the probability that the algorithm succeeded on

References

[MR95] R. Motwani and P. Raghavan. Randomized Algorithms. Cambridge University Press, New York, NY, 1995.