Docsity

Introduction to Probabilistic Algorithms - Advanced Algorithms - Lecture Notes, Study notes of Advanced Algorithms

Toggle sidebar
bg1
Lecture 3: Introduction to Probabilistic Algorithms
(MIS))1
1 Review of Basic Probability
Definition 1.0.1 (Random Variable) A random variable Xis a real num-
ber that is the outcome of a random event.
For example, X= number of spots when a six-sided die is rolled.
Definition 1.0.2 (Expected Value) Expectation of X, denoted E[X]is
E[X] = X
i
i·(P r[X=i])
That is, if someone promises to pay you a dollar per spot that comes up
on a die, the expected value is the amount you expect to be paid on average.
With the example above of random variable X,
E[X] =
6
X
i=1
i·(P r[X=i]) = 7
2
Note that E[X] is not necessarily a possible value of X.P r[X=7
2] = 0.
Also note that expected value is not the only way to judge a probabilistic
decision. Increasing the payout on an incredibly unlikely event will raise
expected value, but not necessarily make, say the lottery, a good bet.
1These notes were partially based on past lectures scribed by Adam Lewis and Jeremy
Freeman
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download Introduction to Probabilistic Algorithms - Advanced Algorithms - Lecture Notes and more Study notes Advanced Algorithms in PDF only on Docsity!

Lecture 3: Introduction to Probabilistic Algorithms

(MIS))^1

1 Review of Basic Probability

Definition 1.0.1 (Random Variable) A random variable X is a real num- ber that is the outcome of a random event.

For example, X = number of spots when a six-sided die is rolled.

Definition 1.0.2 (Expected Value) Expectation of X, denoted E[X] is

E[X] =

i

i· (P r[X = i])

That is, if someone promises to pay you a dollar per spot that comes up on a die, the expected value is the amount you expect to be paid on average. With the example above of random variable X,

E[X] =

∑^6

i=

i· (P r[X = i]) =

Note that E[X] is not necessarily a possible value of X. P r[X = 72 ] = 0. Also note that expected value is not the only way to judge a probabilistic decision. Increasing the payout on an incredibly unlikely event will raise expected value, but not necessarily make, say the lottery, a good bet.

(^1) These notes were partially based on past lectures scribed by Adam Lewis and Jeremy Freeman

Theorem 1.0.3 (Linearity of Expectation) If X and Y are any two ran- dom variables then E[X + Y ] = E[X] + E[Y ]. Generally: E[

∑ Xi] = E[Xi].

If c is a real number then E[c · X] = cE[X]. E[XY ] 6 = E[X]E[Y ] unless X & Y are independent.

Definition 1.0.4 (Indicator Random Variable) Let w be some event (e.g. a six sided die was rolled and turned up a 6), then the indicator random vari- able for w is

Iw =

1 if w happens 0 otherwise

The probability of an event is the expectation of its indicator random variable.

Theorem 1.0.5 (Markov’s Inequality) P r[|X| ≥ a] ≤ E[ ax]

This bounds the probability of having a variable express a value far from the expected value.

Proof 1.0.

Let I|x|≥a =

1 if |x| ≥ a 0 if 0 < |x| < a

It is always the case that xa ≥ I|x|≥a Therefore: E[xa ] ≥ E[I|x|≥a].

and by 1.0.3 E a[x ]≥ P r[|x| ≥ a]

Definition 1.0.7 (Variance)

V ar[X] = E[X − E[X]]^2 = E[X^2 − 2 XE[X] + (E[X])^2 + 2E[X^2 ] = E[X^2 ] − E[X]^2

Theorem 1.0.8 (Chebyshev’s inequality) P r[X − E[X] ≥ a] ≤ V ar a 2 [X]

Chebyshev’s inequality can be shown from Markov’s inequality and the definition of variance.

2.4 Algorithm 3

  1. Pick a container at random and start drawing balls
  2. If a yellow ball is found, stop and report “found the mixed container”
  3. Else continue until the container is empty and report “found the blue container”

This algorithm is always correct, but with probability 12 it is slow.

2.5 Types of Probabilistic Algorithms

There are two classes of probabilistic algorithms we will discuss. Monte Carlo algorithms are always fast though not always correct, but correct with high probability. Las Vegas algorithms are always correct though not always fast, but fast with high probability. Formal definitions follow.

Definition 2.5.1 (Monte Carlo Algorithm) A Monte Carlo algorithm is a probabilistic algorithm M for which ∃ a polynomial P such that ∀x, M ter- minates within P (x) steps on input x.

Furthermore, P [M (x) is correct] > 23 where probability is taken over all coin tosses in algorithm M.

Note that it is easy transform any such Monte Carlo Algorithm into a Monte Carlo Algorithm that is correct with probability 1 −  by simply run- ning M multiple times and taking a vote. In fact, this strategy works when- ever the probability that the probability the algorithm is correct is greater than 12 by at least a fixed constant value.

Definition 2.5.2 (Las Vegas Algorithm) A Las Vegas algorithm is a prob- abilistic algorithm M for which ∃ a polynomial P such that ∀x

E[running time] =

∑^ ∞

t=

(t)P r[M (x) takes exactlly t steps] < P (x)

Furthermore, the output of M is always correct.

You can think of randomized algorithms as deterministic via the trick of considering an algorithm that tries each possible sequence of random choices assuming discrete random variables. Early primality checking algorithms were often Monte Carlo. If a given number was factorable, the algorithm could say so, otherwise the number was probably prime. There have since been Las Vegas and eventually deterministic algorithms.

It is still not known whether having a Monte Carlo algorithm implies there is a Las Vegas algorithm, but the converse is true. It is also still an open question whether or not there exist problems whose only polynomial time algorithms require randomness.

3 The Max-Cut Problem

Given a graph, G = (V, E), we wish to partition V into two sets, A and B, such that the number of edges crossing the cut is maximized. This problem is NP-Hard.

3.1 The Erd˝os and Spencer Probabilistic Method

We now use the probabilistic method to show that for any graph, there is guaranteed to exist a cut that contains at least half the edges of the graph. Notice that such a cut is always a 12 approximation to max cut, since no cut can contain more than all the edges of a graph. It turns out this probabilistic method belies a deterministic algorithm for 12 approximation of max-cut.

To perform the probabilistic algorithm, for each vertex i, flip a coin and let the variable Xi be a random variable:

Xi =

− 1 if coin i flipped tails 1 if coin i flipped heads

Then if Xi = −1, put i in A. If Xi = 1, put i in B. E[Xi] = 0.

Define a varible that represents whether or not an edge crosses the cut ( or 0 resp.)

Eij = 1 −

xixj 2

∀i, j ∈ V

A Digression on Pairwise Independence

xi xj xk = xi ⊕ xj 1 1 0 1 0 1 0 1 1 0 0 0

In the table above, any one variable (column) can be removed, leaving the remaining two pairwise independent. Notice that in the proof above, we only needed pairwise independence. In the context of a randomized algorithm we just want a way to reduce the possibilities of random strings of coin flips while maintaining pairwise independence, that is:

E[Xs = a|xt = b] = E[xs = a] where s 6 = t ∈ {i, j, k}

We can take advantage of that notion of pairwise independence in con- structing a deterministic algorithm for the above problem that interates over a sample space of coin flips that is polynomial (rather than exponential) size, and thus runs in polynomial time. Suppose we have N variables and assume N = 2k^ for some natural number k (if not just pad the set). Take a sequence of length N over the set {− 1 , 1 }. Let W = w 1 w 2 w 3 ...wlog 2 N be a random log N -bit sequence of 0’s and 1’s. Let Xi = (−1)bin(i)^ w, where bin(i) is the binary expansion of i and x y is the count of bits set in the bit-wise exclusive-or of x and y. Each Xi ∈ {− 1 , 1 } and Xi, Xj are pairwise independent. Notice Xi will be 1 if bin(i) w is even and −1 if it is odd. As an example, 1101 0010 0001 1011 = 4. Vertex 36 would be written as log N bits, say as 00100100 and then XORed with the bits of W.

If two numbers have two different bit values then they will have different XOR values against W , giving us 2logN^ = N strings to try. The algorithm is to enumerate all the log N bit strings, XOR with each vertex, and check all possible strings from each to pick the best. Clearly with only N strings to try, this is a polynomial time algorithm, and since the analysis shows the expectation over this smaller sample space is also good, the partition of the best string will give us the cut that we need in polynomial time.

3.2 A Much Simpler Deterministic Algorithm

We now show, in fact, that there’s a much simpler deterministic procedure that would yield the same bound.

A vertex can be labeled as “happy” or “unhappy”. Vertices are unhappy if they have more direct neighbors on their side of the cut than on the other side, and are happy otherwise. Any unhappy vertex can be made happy by flipping it to the other side of the cut.

The greedy algorithm is to simply flip the side of unhappy vertices. That is, while there exists an unhappy vertex, pick an unhappy vertex and flip it across the cut. While a flip may cause some neighbors to become unhappy, each flip is guaranteed to increase the number of edges that cross the cut, thus forward progress is made with each step and the algorithm will terminate. In other words, at each step the number of edges with an endpoint in each set decreases.

Furthermore, when the algorithm terminates, since all vertices are happy, locally, the number of edges that cross the cut is greater than the number of edges that stay on the same side of the cut and therefore, the number of edges globally that cross the cut is greater than the number of edges that stay on the same side of the cut, and thus, it terminates with at least half the edges crossing the cut.

That solution has a running time of O(|E|) and it is still an open question whether or not there is an algorithm with O(|V |) running time.

Both these methods can get a 12 optimal solution, but we will see Gomez and Williamson later in the class which will give us a 0.878 optimal solution to the MaxCut problem.

4 Maximal Independent Set (MIS)

Definition 4.0.1 A Maximal Independent Set (MIS) of a graph G = (V, E) is a set of vertices I ⊆ V such that

  • Independent: x ∈ I ⇒ y /∈ I ∀y such that (x, y) ∈ E

4.1 Parallel Computing Application

To solve MIS with each node represented by its own processor, we approach the problem in rounds. We begin with an empty set of vertices I and a graph G = (V, E), and then in each round each of the vertices in {V − I} flips a coin that goes towards determining if it can enter I.

Let D be the maximum degree in G.

Call a vertex “unsatisfied” if neither it nor any of its neighbors has been put in the MIS.

  1. If vertex j is unsatisfied, it flips a coin to assign

Xj =

1 with probability p = (^41) D 0 otherwise

  1. If Xj = 1 and Xk 6 = 1 for all neighbors k of i then vertex j enters the MIS
  2. Update the list of which vertices are satisfied. If not all vertices, go to next round.

The calculation for how long this is likely to take is a bit more compli- cated. First define an indicator variable

Yi = Xi ×

(i,j)∈E

(1 − Xj )

Random variable Yi shows whether or not vertex i enters the MIS this round. It is zero unless Xi is 1 and Xj is 0 for all j, the neighbors of i. To represent whether or not vertex i is satisfied, define:

Zi =

1 iff (Yi +

(i,j)∈E Yj^ )^ ≥^1 0 otherwise

Next we can sort the vertices into groups by degree. We can make log D buckets:

1 − 2 , 2 − 4 , 4 − 8 , 8 − 16 ,... ,

D

− D

The last group is called “big degree nodes” and we put all vertices in it that satisfy 2 dlog(D−1)e^ ≤ degree(i) ≤ 2 dlogDe

Now we claim that in round i, we satisfy a constant fraction of the big degree nodes. If that is true, we have shown O(log^2 n) rounds will be enough to have an MIS.

Figure 2: i becomes satisfied by j flipping a 1 and all the other neighbors’ not flipping 1

Proof 4.1.1 Let T be the number of big degree nodes that get satisfied in round i: T =

j∈{big degree nodes}

Zj

We want to show that

E[T ] ≥

|big degree nodes| constant

but we will actually bound based on something smaller.

Consider the probability that i becomes satisfied by j flipping 1 and none of the other neighbors flipping 1 (i.e. the picture is Figure 2). Then we define

Rij = Xj

(j,k)∈E

(1 − Xk)

(i,l)∈E,l 6 =j

(1 − Xl)

Fact: any planar graph has average degree less than 6.

Corollary: in any planar graph, there is always some vertex of degree 5 or less.

Theorem 5.0.4 Any planar graph can be colored with 6 colors

Proof 5.0.5 Using the above facts: take a vertex with fewer than 6 neighbors and remove it. Color the remaining graph then add it back in. Since you maintain planarity, you maintain the average degree across steps.

Distributed ∆ + 1 coloring can be done by applying MIS iteratively, as- signing a color to each MIS:

  1. Each uncolored vertex chooses a color at random from δi + 1 colors where δi is the degree of vertex i
  2. For every edge, if both endpoints have the same color, arbitrarily un- color one endpoint
  3. Update the graph by removing all colored vertices and updating list of allowed colors for remaining vertices