Randomized Algorithms
-
Upload
khangminh22 -
Category
Documents
-
view
2 -
download
0
Transcript of Randomized Algorithms
Questions from Discrete Mathematics Question: (min-cuts)
How many min-cuts can there be in a graph on ๐ vertices ?
Question: (Geometry)
There is a set ๐ท of ๐๐๐ points in plane and no three of them are collinear.
What can be the max. no. of acute triangles formed by these points ?
Question: (Number theory)
There is a set ๐จ of ๐ positive integers. Aim is to compute a large subset ๐บ โ ๐จ s.t.
there do not exist three elements ๐, ๐,๐ โ ๐บ such that
๐ + ๐ = ๐
How large can ๐บ be for any arbitrary ๐จ?
Theorem: (max-cut)
Every graph on ๐ vertices and ๐ edges has a cut of size โฅ โฆ.. 2
๐/๐
At least ๐/๐
At most ๐๐%
๐ถ(๐๐)
Probabilistic methods
Methods that use
โข Probability theory
โข Randomized algorithm
to prove deterministic combinatorial results
4
Min-Cut
๐ฎ = (๐ฝ, ๐ฌ) : undirected connected graph
Definition (cut):
A subset ๐ช โ ๐ฌ whose removal disconnects the graph.
Definition (min-cut): A cut of smallest size.
Question: How many cuts can there be in a graph?
Question: How many min-cuts can there be in a graph?
6
๐๐ โ ๐
๐
Algorithm for min-cut
Min-cut(๐ฎ):
{ Repeat ๐ โ ๐ times
{
Let ๐ โ๐ ๐ฎ;
๐ฎ Contract(๐ฎ, ๐).
}
return the edges of multi-graph ๐ฎ;
}
Running time: ๐ถ(๐๐)
Question: What is the sample space of the output of the algorithm ?
Answer: all-cuts of ๐ฎ.
7
Analysis of Algorithm for min-cut
Let ๐ช be any arbitrary min-cut.
Question: What is probability that ๐ช is preserved during the algorithm ?
Answer: 1 โ๐
๐. 1 โ
๐
๐โ๐. 1 โ
๐
๐โ๐โฆ
3
5.2
4.1
3
= ๐โ๐
๐.
๐โ๐
๐โ๐.
๐โ๐
๐โ๐โฆ
3
5.2
4.1
3
= ๐
๐.
๐
๐โ๐
8
Number of min-cuts
Let there be ๐ min-cuts in ๐ฎ.
Let these min-cuts be ๐ช๐, ๐ช๐, โฆ , ๐ช๐.
Define event โฐ๐ : โoutput of the algorithm Min-cut(๐ฎ) is ๐ช๐โ.
P(โฐ๐) โฅ ?
P(โช๐ โฐ๐) ? P(โฐ๐)+P(โฐ๐)+...P(โฐ๐)
โฅ ๐๐
๐(๐โ๐)
Surely P(โช๐ โฐ๐) โค 1
1 โฅ ๐๐
๐(๐โ๐)
๐ โค ๐(๐โ๐)
๐
9
๐
๐(๐ โ ๐)
=
This is because at the end of the algorithm, we are left with a
multigraph with 2 vertices. This defines a cut uniquely.
Number of min-cuts
Let there be ๐ min-cuts in ๐ฎ.
Let these min-cuts be ๐ช๐, ๐ช๐, โฆ , ๐ช๐.
Define event โฐ๐ : โoutput of the algorithm Min-cut(๐ฎ) is ๐ช๐โ.
P(โฐ๐) โฅ ?
P(โช๐ โฐ๐) ? P(โฐ๐)+P(โฐ๐)+...P(โฐ๐)
โฅ ๐๐
๐(๐โ๐)
Surely P(โช๐ โฐ๐) โค 1
1 โฅ ๐๐
๐(๐โ๐)
๐ โค ๐(๐โ๐)
๐
10
๐
๐(๐ โ ๐)
=
How many acute triangles
Problem Definition:
There is a set ๐ท of ๐๐๐ points in plane and no three of them are collinear.
How many triangles formed by these points are acute ?
Answer:
At most ๐๐%
Solution:
Let ๐ : probability that a triangle formed by 3 random points from ๐ท is acute.
๐ =Total number of acute triangles
All possible triangles using๐ท points
Show that ๐ โค ๐. ๐
12
๐ points
Case 1:
Sum of the four angles is ๐๐๐.
at least one of them has to be โฅ 90
Hence, at least one of the four triangles is non-acute. 13
๐ points
Case 2:
Sum of the three angles at the center is ๐๐๐.
at least two of these angles have to be > 90
at least 2 of the four triangles is non-acute. 14
๐ points ๐ points
Lemma1: A triangle formed by selecting 3 points randomly uniformly
from 4 points is acute triangle with probability at most ๐. ๐๐.
Lemma2: A triangle formed by selecting 3 points randomly uniformly
from 5 points is acute triangle with probability at most ๐. ๐.
(Do it as a simple exercise using Lemma 1.)
15
Extension to 100 points ?
Two stage sampling
๐ท: a set of ๐ elements.
๐ โค ๐ โค ๐
Let ๐บ be a uniformly random sample of ๐ elements from ๐ท.
Let ๐น be a uniformly random sample of ๐ elements from ๐บ.
Question: What can we say about (probability distribution of) ๐น ?
Answer: ๐น is a uniformly random sample of ๐ elements from ๐ท.
(Do it as a simple exercise. It uses elementary probability)
Can you use this answer to calculate ๐ ?
16
Number of acute triangles
๐ท: set of ๐ points.
๐ : probability that a triangle formed by 3 random points from ๐ท is acute.
๐ = ?
๐บ : a uniformly random sample of ๐ points from ๐ท.
๐น : a uniformly random sample of ๐ points from ๐บ.
๐ = ?
๐ โค ๐. ๐๐
17
P(a random triangle from ๐บ is acute)
Large cut in a graph
Problem Definition:
Let ๐ฎ be an undirected graph on ๐ vertices and ๐ edges.
We wish to split its vertices into two nonempty sets ๐จ and ๐จ
so that there are maximum number of edges in the cut(๐จ , ๐จ ).
What can be the maximum size cut we can get in this manner ?
Answer:
At least ๐/๐
Spend some time to find out a proof for this bound.
Hopefully, after the problems we solved today,
you would have realized the way probabilistic method works.
19
Large cut in a graph
A randomized algorithm:
๐จโ ;
Add each vertex from ๐ฝ to ๐จ randomly independently with probability ๐
๐.
Return the cut defined by ๐จ.
20
Large cut in a graph
๐ฟ: size of cut (๐จ, ๐จ ) returned by the randomized algorithm.
E[๐ฟ] = ??
๐ฟ๐: ๐ if ๐ is present in the cut๐ otherwise
๐ฟ = ๐ฟ๐๐
E[๐ฟ] = ๐[๐๐]๐
= ๐(๐๐ = ๐)๐
= ๐
๐๐
=๐
๐
21
Large cut in a graph
Now use the following result which is simple but very useful.
Let ๐ฟ is a random variable defined over a probability space (๐, ๐).
If ๐ ๐ฟ = ๐ถ, then there exists an elementary event ๐ โ ๐, such that ๐ฟ ๐ โฅ ๐ถ.
Use it to conclude that there is a cut of size at least ๐
๐.
22
Large subset that is sum-free
Problem Definition:
There is a set ๐จ of ๐ positive integers.
Aim is to compute a large subset ๐บ โ ๐จ such that
there do not exist three elements ๐, ๐,๐ โ ๐บ such that
๐ + ๐ = ๐
How large can ๐บ be for any arbitrary ๐จ?
Answer:
At least ๐/๐
24
Large subset that is sum-free
Let ๐ > ๐๐๐(๐จ) be a prime number.
Let ๐ = ๐๐ + ๐. //The other choice ๐๐ + ๐ is also fine here.
A randomized algorithm:
Select a random number ๐ from {1, ๐ โ ๐}.
Map each element ๐ โ ๐จ to ๐๐ mod ๐.
๐บ all those elements of ๐จ that get mapped to {๐ + ๐,โฆ , ๐๐ + ๐} ?
Return ๐บ;
Question: What is the expected number of elements from ๐จ that are mapped to {๐ + ๐,โฆ , ๐๐ + ๐} ?
Answer: > ๐/๐
25
To prove it, use โข the fact that mapping is 1-1 and uniform. โข and Linearity of expectation.
Large subset that is sum-free
Let ๐ > ๐๐๐(๐จ) be a prime number.
Let ๐ = ๐๐ + ๐.
A randomized algorithm:
Select a random number ๐ from {1, ๐ โ ๐}.
Map each element ๐ โ ๐จ to ๐๐ mod ๐.
๐บ all those elements of ๐จ that get mapped to {๐ + ๐,โฆ , ๐๐ + ๐} ?
Return ๐บ;
Claim: ๐บ is sum-free.
26
Showing that ๐บ is sum-free.
Let ๐ and ๐ be any two elements in ๐บ.
Let ๐ gets mapped to ๐ถ and ๐ gets mapped to ๐ท and ๐ถ, ๐ท โ [๐ + ๐, 2๐ + ๐]
Hence ๐ถ = ๐๐ ๐ฆ๐จ๐ ๐ and ๐ท = ๐๐ ๐ฆ๐จ๐ ๐
we just need to show that ๐ + ๐ , if present in ๐จ, must not be mapped in [๐ + ๐, 2๐ + ๐].
๐ + ๐ will be mapped to ??
Give suitable arguments to conclude that
โข (๐ถ + ๐ท) must be greater than 2๐ + ๐.
โข If (๐ถ + ๐ท) > ๐, then (๐ถ + ๐ท) ๐ฆ๐จ๐ ๐ would be strictly less than ๐.
27
1 2 โฆ ๐ ๐ + ๐ โฆ โฆ โฆ ๐๐ + ๐ โฆ 3๐ + ๐ ๐ถ ๐ท
(๐ถ + ๐ท) ๐ฆ๐จ๐ ๐
โข Try to ponder over the entire solution given for the Large sum-free subset problem.
โข Try to realize the importance of each part of the solution (primality of ๐, the choice of middle third, โฆ)
โข This solution is inspired by our discussion on โhashing with constant search timeโ.
โข Can you see it ?
28