Introduction to Randomized Algorithms Arijit Bishnu ( - - PowerPoint PPT Presentation

introduction to randomized algorithms
SMART_READER_LITE
LIVE PREVIEW

Introduction to Randomized Algorithms Arijit Bishnu ( - - PowerPoint PPT Presentation

Introduction Quick Sort Minimum Enclosing Disk Min Cut Introduction to Randomized Algorithms Arijit Bishnu ( arijit@isical.ac.in ) Advanced Computing and Microelectronics Unit Indian Statistical Institute Kolkata 700108, India. Introduction


slide-1
SLIDE 1

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Introduction to Randomized Algorithms

Arijit Bishnu (arijit@isical.ac.in) Advanced Computing and Microelectronics Unit Indian Statistical Institute Kolkata 700108, India.

slide-2
SLIDE 2

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Organization

1 Introduction 2 Quick Sort 3 Minimum Enclosing Disk 4 Min Cut

slide-3
SLIDE 3

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Introduction

INPUT OUTPUT ALGORITHM

Goal of a Deterministic Algorithm

The solution produced by the algorithm is correct, and the number of computational steps is same for different runs of the algorithm with the same input.

slide-4
SLIDE 4

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Problems in Deterministic Algorithm

Given a computational problem, it may be difficult to design an algorithm with good running time, or the running time of an algorithm may be quite high.

Remedies Efficient heuristics, Approximation algorithms, Randomized algorithms

slide-5
SLIDE 5

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Randomized Algorithm

INPUT OUTPUT ALGORITHM Random Number

Randomized Algorithm In addition to the input, the algorithm uses a source of pseudo random numbers. During execution, it takes random choices depending on those random numbers. The behavior (output) can vary if the algorithm is run multiple times on the same input.

slide-6
SLIDE 6

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Advantage of Randomized Algorithm

The Paradigm Instead of making a guaranteed good choice, make a random choice and hope that it is good. This helps because guaranteeing a good choice becomes difficult sometimes.

slide-7
SLIDE 7

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Advantage of Randomized Algorithm

The Paradigm Instead of making a guaranteed good choice, make a random choice and hope that it is good. This helps because guaranteeing a good choice becomes difficult sometimes. Randomized Algorithms make random choices. The expected running time depends

  • n the random choices, not on

any input distribution.

slide-8
SLIDE 8

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Advantage of Randomized Algorithm

The Paradigm Instead of making a guaranteed good choice, make a random choice and hope that it is good. This helps because guaranteeing a good choice becomes difficult sometimes. Randomized Algorithms make random choices. The expected running time depends

  • n the random choices, not on

any input distribution. Average Case Analysis analyzes the expected running time of deterministic algorithms assuming a suitable random distribution on the input.

slide-9
SLIDE 9

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Pros and Cons of Randomized Algorithms

Pros

slide-10
SLIDE 10

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Pros and Cons of Randomized Algorithms

Pros Making a random choice is fast.

slide-11
SLIDE 11

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Pros and Cons of Randomized Algorithms

Pros Making a random choice is fast. An adversary is powerless; randomized algorithms have no worst case inputs.

slide-12
SLIDE 12

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Pros and Cons of Randomized Algorithms

Pros Making a random choice is fast. An adversary is powerless; randomized algorithms have no worst case inputs. Randomized algorithms are often simpler and faster than their deterministic counterparts.

slide-13
SLIDE 13

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Pros and Cons of Randomized Algorithms

Pros Making a random choice is fast. An adversary is powerless; randomized algorithms have no worst case inputs. Randomized algorithms are often simpler and faster than their deterministic counterparts. Cons

slide-14
SLIDE 14

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Pros and Cons of Randomized Algorithms

Pros Making a random choice is fast. An adversary is powerless; randomized algorithms have no worst case inputs. Randomized algorithms are often simpler and faster than their deterministic counterparts. Cons In the worst case, a randomized algorithm may be very slow.

slide-15
SLIDE 15

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Pros and Cons of Randomized Algorithms

Pros Making a random choice is fast. An adversary is powerless; randomized algorithms have no worst case inputs. Randomized algorithms are often simpler and faster than their deterministic counterparts. Cons In the worst case, a randomized algorithm may be very slow. There is a finite probability of getting incorrect answer. However, the probability of getting a wrong answer can be made arbitrarily small by the repeated employment of randomness.

slide-16
SLIDE 16

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Pros and Cons of Randomized Algorithms

Pros Making a random choice is fast. An adversary is powerless; randomized algorithms have no worst case inputs. Randomized algorithms are often simpler and faster than their deterministic counterparts. Cons In the worst case, a randomized algorithm may be very slow. There is a finite probability of getting incorrect answer. However, the probability of getting a wrong answer can be made arbitrarily small by the repeated employment of randomness. Getting true random numbers is almost impossible.

slide-17
SLIDE 17

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Types of Randomized Algorithms

Definition

Las Vegas: a randomized algorithm that always returns a correct

  • result. But the running time may vary between executions.

Example: Randomized QUICKSORT Algorithm Definition

Monte Carlo: a randomized algorithm that terminates in

polynomial time, but might produce erroneous result. Example: Randomized MINCUT Algorithm

slide-18
SLIDE 18

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Randomized Quick Sort

slide-19
SLIDE 19

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Deterministic Quick Sort

The Problem: Given an array A[1 . . . n] containing n (comparable) elements, sort them in increasing/decreasing order. QSORT(A, p, q) If p ≥ q, EXIT. Compute s ← correct position of A[p] in the sorted order of the elements of A from p-th location to q-th location. Move the pivot A[p] into position A[s]. Move the remaining elements of A[p − q] into appropriate sides. QSORT(A, p, s − 1); QSORT(A, s + 1, q).

slide-20
SLIDE 20

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Complexity Results of QSORT

An INPLACE algorithm The worst case time complexity is O(n2). The average case time complexity is O(n log n).

slide-21
SLIDE 21

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Randomized Quick Sort

An Useful Concept - The Central Splitter It is an index s such that the number of elements less (resp. greater) than A[s] is at least n

4.

The algorithm randomly chooses a key, and checks whether it is a central splitter or not. If it is a central splitter, then the array is split with that key as was done in the QSORT algorithm. It can be shown that the expected number of trials needed to get a central splitter is constant.

slide-22
SLIDE 22

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Randomized Quick Sort

RandQSORT(A, p, q) 1: If p ≥ q, then EXIT. 2: While no central splitter has been found, execute the following steps:

2.1: Choose uniformly at random a number r ∈ {p, p + 1, . . . , q}. 2.2: Compute s = number of elements in A that are less than A[r], and t = number of elements in A that are greater than A[r]. 2.3: If s ≥ q−p

4

and t ≥ q−p

4 , then A[r] is a central splitter.

3: Position A[r] in A[s + 1], put the members in A that are smaller than the central splitter in A[p . . . s] and the members in A that are larger than the central splitter in A[s + 2 . . . q]. 4: RandQSORT(A, p, s); 5: RandQSORT(A, s + 2, q).

slide-23
SLIDE 23

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Analysis of RandQSORT

Fact: One execution of Step 2 needs O(q − p) time. Question: How many times Step 2 is executed for finding a central splitter ? Result: The probability that the randomly chosen element is a central splitter is 1

2.

slide-24
SLIDE 24

Introduction Quick Sort Minimum Enclosing Disk Min Cut

An Useful Result from Probability

Let p be the probability of success and 1 − p be the probability of failure of a random experiment.

slide-25
SLIDE 25

Introduction Quick Sort Minimum Enclosing Disk Min Cut

An Useful Result from Probability

Let p be the probability of success and 1 − p be the probability of failure of a random experiment. If we continue the random experiment till we get success, what is the expected number of experiments we need to perform?

slide-26
SLIDE 26

Introduction Quick Sort Minimum Enclosing Disk Min Cut

An Useful Result from Probability

Let p be the probability of success and 1 − p be the probability of failure of a random experiment. If we continue the random experiment till we get success, what is the expected number of experiments we need to perform? Let X: random variable that equals the number of experiments performed.

slide-27
SLIDE 27

Introduction Quick Sort Minimum Enclosing Disk Min Cut

An Useful Result from Probability

Let p be the probability of success and 1 − p be the probability of failure of a random experiment. If we continue the random experiment till we get success, what is the expected number of experiments we need to perform? Let X: random variable that equals the number of experiments performed. For the process to perform exactly j experiments, the first j − 1 experiments should be failures and the j-th one should be a success. So, we have Pr[X = j] = (1 − p)(j−1) · p.

slide-28
SLIDE 28

Introduction Quick Sort Minimum Enclosing Disk Min Cut

An Useful Result from Probability

Let p be the probability of success and 1 − p be the probability of failure of a random experiment. If we continue the random experiment till we get success, what is the expected number of experiments we need to perform? Let X: random variable that equals the number of experiments performed. For the process to perform exactly j experiments, the first j − 1 experiments should be failures and the j-th one should be a success. So, we have Pr[X = j] = (1 − p)(j−1) · p. So, the expectation of X, E[X] = ∞

j=0 j · Pr[X = j] = 1 p.

slide-29
SLIDE 29

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Implication in Our Case The expected number of times Step 2 needs to be repeated to get a central splitter (success) is 2 as the corresponding success probability is 1

2.

Thus, the expected time complexity of Step 2 is O(n)

slide-30
SLIDE 30

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Analysis of RandQSORT

Time Complexity The expected running time for the algorithm on a set A, excluding the time spent on recursive calls, is O(|A|).

slide-31
SLIDE 31

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Analysis of RandQSORT

Time Complexity The expected running time for the algorithm on a set A, excluding the time spent on recursive calls, is O(|A|). Worst case size of each partition in j-th level of recursion is n · (3

4)j, So, the expected time spent excluding recursive calls

is O(n · (3

4)j) for each partition.

slide-32
SLIDE 32

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Analysis of RandQSORT

Time Complexity The expected running time for the algorithm on a set A, excluding the time spent on recursive calls, is O(|A|). Worst case size of each partition in j-th level of recursion is n · (3

4)j, So, the expected time spent excluding recursive calls

is O(n · (3

4)j) for each partition.

The number of partitions of size n · (3

4)j is O((4 3)j).

slide-33
SLIDE 33

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Analysis of RandQSORT

Time Complexity The expected running time for the algorithm on a set A, excluding the time spent on recursive calls, is O(|A|). Worst case size of each partition in j-th level of recursion is n · (3

4)j, So, the expected time spent excluding recursive calls

is O(n · (3

4)j) for each partition.

The number of partitions of size n · (3

4)j is O((4 3)j).

By linearity of expectations, the expected time for all partitions of size n · (3

4)j is O(n).

slide-34
SLIDE 34

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Analysis of RandQSORT

Time Complexity The expected running time for the algorithm on a set A, excluding the time spent on recursive calls, is O(|A|). Worst case size of each partition in j-th level of recursion is n · (3

4)j, So, the expected time spent excluding recursive calls

is O(n · (3

4)j) for each partition.

The number of partitions of size n · (3

4)j is O((4 3)j).

By linearity of expectations, the expected time for all partitions of size n · (3

4)j is O(n).

Number of levels of recursion = log 4

3 n = O(log n).

slide-35
SLIDE 35

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Analysis of RandQSORT

Time Complexity The expected running time for the algorithm on a set A, excluding the time spent on recursive calls, is O(|A|). Worst case size of each partition in j-th level of recursion is n · (3

4)j, So, the expected time spent excluding recursive calls

is O(n · (3

4)j) for each partition.

The number of partitions of size n · (3

4)j is O((4 3)j).

By linearity of expectations, the expected time for all partitions of size n · (3

4)j is O(n).

Number of levels of recursion = log 4

3 n = O(log n).

Thus, the expected running time is O(n log n).

slide-36
SLIDE 36

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Minimum Enclosing Disk Problem (MED)

slide-37
SLIDE 37

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Minimum Enclosing Disk

The Problem: Given a set of points P = {p1, p2, . . . , pn} in 2D, compute a disk

  • f minimum radius that contains all the points in P.

Trivial Solution: Consider each triple of points pi, pj, pk ∈ P, and check whether every other point in P lies inside the circle defined by pi, pj, pk. Time complexity: O(n4) An Easy Implementable Efficient Solution: Consider furthest point Voronoi diagram. Its each vertex represents a circle containing all the points in P. Choose the one with minimum radius. Time complexity: O(n log n) Best Known Result: A complicated O(n) time algorithm (using linear programming).

slide-38
SLIDE 38

Introduction Quick Sort Minimum Enclosing Disk Min Cut

A Simple Randomized Algorithm

We generate a random permutation of the points in P. Notations:

  • Pi = {p1, p2, . . . , pi}. • Di = the MED of Pi.
slide-39
SLIDE 39

Introduction Quick Sort Minimum Enclosing Disk Min Cut

A Simple Randomized Algorithm

We generate a random permutation of the points in P. Notations:

  • Pi = {p1, p2, . . . , pi}. • Di = the MED of Pi.

Result (Believe this for now) If pi ∈ Di−1 then Di = Di−1. If pi ∈ Di−1 then pi lies on the boundary of Di.

pi Di−1 Di

slide-40
SLIDE 40

Introduction Quick Sort Minimum Enclosing Disk Min Cut

A Simple Randomized Algorithm

We generate a random permutation of the points in P. Notations:

  • Pi = {p1, p2, . . . , pi}. • Di = the MED of Pi.

Result (Believe this for now) If pi ∈ Di−1 then Di = Di−1. If pi ∈ Di−1 then pi lies on the boundary of Di.

pi Di−1 Di

An Implication The above result implies an incremental algorithm.

slide-41
SLIDE 41

Introduction Quick Sort Minimum Enclosing Disk Min Cut

The Idea

A Different Recursive Idea When we encounter a point pi ∈ Di−1, we know that pi is constrained to lie on Di,

slide-42
SLIDE 42

Introduction Quick Sort Minimum Enclosing Disk Min Cut

The Idea

A Different Recursive Idea When we encounter a point pi ∈ Di−1, we know that pi is constrained to lie on Di, This leads to a different version of the original problem where we need to find a MED of a set of points with pi constrained to lie on the boundary.

slide-43
SLIDE 43

Introduction Quick Sort Minimum Enclosing Disk Min Cut

The Idea

A Different Recursive Idea When we encounter a point pi ∈ Di−1, we know that pi is constrained to lie on Di, This leads to a different version of the original problem where we need to find a MED of a set of points with pi constrained to lie on the boundary. In this recursion, if we encounter a point that lies outside the current disk, we recurse on a subproblem where two points are constrained to lie on the boundary.

slide-44
SLIDE 44

Introduction Quick Sort Minimum Enclosing Disk Min Cut

The Idea

A Different Recursive Idea When we encounter a point pi ∈ Di−1, we know that pi is constrained to lie on Di, This leads to a different version of the original problem where we need to find a MED of a set of points with pi constrained to lie on the boundary. In this recursion, if we encounter a point that lies outside the current disk, we recurse on a subproblem where two points are constrained to lie on the boundary. How long can this go on?

slide-45
SLIDE 45

Introduction Quick Sort Minimum Enclosing Disk Min Cut

The Idea

A Different Recursive Idea When we encounter a point pi ∈ Di−1, we know that pi is constrained to lie on Di, This leads to a different version of the original problem where we need to find a MED of a set of points with pi constrained to lie on the boundary. In this recursion, if we encounter a point that lies outside the current disk, we recurse on a subproblem where two points are constrained to lie on the boundary. How long can this go on? In the next level, we have three points constrained to lie on the boundary and that defines a unique disk.

slide-46
SLIDE 46

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Algorithm MINIDISC(P)

Input: A set P of n points in the plane. Output: The minimum enclosing disk MED for P. 1. Compute a random permutation of P = {p1, p2, . . . , pn}. 2. Let D2 be the MED for {p1, p2}. 3. for i = 3 to n do 4. if pi ∈ Di−1 5. then Di = Di−1 6. else Di = MINIDISKWITH1POINT({p1, p2, . . . , pi}, pi) 7. return Dn. Critical Step: If pi ∈ Di−1.

slide-47
SLIDE 47

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Algorithm MINIDISCWITH1POINT(P, q)

Idea: Incrementally add points from P one by one and compute the MED under the assumption that the point q (the 2nd parameter) is on the boundary. Input: A set of points P, and another point q. Output: MED for P with q on the boundary. 1. Compute a random permutation of P = {p1, p2, . . . , pn}. 2. Let D1 be the MED for {p1, q}. 3. for j = 2 to n do 4. if pj ∈ Dj−1 5. then Dj = Dj−1 6. else Dj = MINIDISKWITH2POINTS({p1, p2, . . . , pj}, pj, q) 7. return Dn.

slide-48
SLIDE 48

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Algorithm MINIDISCWITH2POINTS(P, q1, q2)

Idea: Thus we have two fixed points; so we need to choose another point among P \ {q1, q2} to have the MED containing P. 1. Let D0 be the smallest disk with q1 and q2 on its boundary. 3. for k = 1 to n do 4. if pk ∈ Dk−1 5. then Dk = Dk−1 6. else Dk = the disk with q1, q2 and pk on its boundary 7. return Dn.

slide-49
SLIDE 49

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Time Complexity

Worst Case Time Complexity With the nested recursion that we have, the worst case time complexity is O(n3).

slide-50
SLIDE 50

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Time Complexity

Worst Case Time Complexity With the nested recursion that we have, the worst case time complexity is O(n3). Expected case:

slide-51
SLIDE 51

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Time Complexity

Worst Case Time Complexity With the nested recursion that we have, the worst case time complexity is O(n3). Expected case: MINIDISKWITH2POINTS needs O(n) time.

slide-52
SLIDE 52

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Time Complexity

Worst Case Time Complexity With the nested recursion that we have, the worst case time complexity is O(n3). Expected case: MINIDISKWITH2POINTS needs O(n) time. MINIDISKWITH1POINT needs O(n) time if

slide-53
SLIDE 53

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Time Complexity

Worst Case Time Complexity With the nested recursion that we have, the worst case time complexity is O(n3). Expected case: MINIDISKWITH2POINTS needs O(n) time. MINIDISKWITH1POINT needs O(n) time if

we do not consider the time taken in the call of the routine MINIDISKWITH2POINTS.

slide-54
SLIDE 54

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Time Complexity

Worst Case Time Complexity With the nested recursion that we have, the worst case time complexity is O(n3). Expected case: MINIDISKWITH2POINTS needs O(n) time. MINIDISKWITH1POINT needs O(n) time if

we do not consider the time taken in the call of the routine MINIDISKWITH2POINTS.

Question How many times the routine MINIDISKWITH2POINTS is called ?

slide-55
SLIDE 55

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Expected Case Time Complexity

Backward Analysis Fix a subset Pi = {p1, p2, . . . , pi}, and Di is the MED of Pi. If a point p ∈ Pi is removed, and if p is in the proper interior

  • f Di, then the enclosing disk does not change.

However, if p is on the boundary of Di, then the circle gets changed. One of the boundary points is q. So, only for 2 other points, MINIDISKWITH2POINTS will be called from MINIDISKWITH1POINT.

slide-56
SLIDE 56

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Expected Case Time Complexity

Observation: The probability of calling MINIDISKWITH2POINTS is 2

i .

Expected Running time of MINIDISKWITH1POINT O(n) +

n

  • i=2

O(i) × 2 i = O(n) Similarly, we have Expected Running time of MINIDISK O(n)

slide-57
SLIDE 57

Introduction Quick Sort Minimum Enclosing Disk Min Cut

The Pending Proof

Result (We are going to prove this now) If pi ∈ Di−1 then Di = Di−1. If pi ∈ Di−1 then pi lies on the boundary of Di.

slide-58
SLIDE 58

Introduction Quick Sort Minimum Enclosing Disk Min Cut

The Pending Proof

Result (We are going to prove this now) If pi ∈ Di−1 then Di = Di−1. If pi ∈ Di−1 then pi lies on the boundary of Di. Claim 1 For a set of points P in general position, the MED has at least three points on its boundary or it has two points forming the diameter of the disk. If there are three points, then they subdivide the circle bounding the disk into arcs of angle at most π.

slide-59
SLIDE 59

Introduction Quick Sort Minimum Enclosing Disk Min Cut

The Proof Continued

slide-60
SLIDE 60

Introduction Quick Sort Minimum Enclosing Disk Min Cut

The Proof Continued

Claim 2 Given a disk of radius r1 and a circle of radius r2, with r1 < r2, the intersection of the disk with the circle is an arc of angle less than π.

slide-61
SLIDE 61

Introduction Quick Sort Minimum Enclosing Disk Min Cut

The Proof Continued

Suppose, for a contradiction, pi is not on the boundary of Di.

slide-62
SLIDE 62

Introduction Quick Sort Minimum Enclosing Disk Min Cut

The Proof Continued

Suppose, for a contradiction, pi is not on the boundary of Di. Let r1 = radius of Di−1 and r2 = radius

  • f Di.
slide-63
SLIDE 63

Introduction Quick Sort Minimum Enclosing Disk Min Cut

The Proof Continued

Suppose, for a contradiction, pi is not on the boundary of Di. Let r1 = radius of Di−1 and r2 = radius

  • f Di.

Using Claim 2, Di intersects Di−1 in an arc of angle less than π.

slide-64
SLIDE 64

Introduction Quick Sort Minimum Enclosing Disk Min Cut

The Proof Continued

Suppose, for a contradiction, pi is not on the boundary of Di. Let r1 = radius of Di−1 and r2 = radius

  • f Di.

Using Claim 2, Di intersects Di−1 in an arc of angle less than π. Since pi ∈ Di, points defining Di should lie in the said arc implying an angle more than π. We get a contradiction.

slide-65
SLIDE 65

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Global Mincut Problem for an Undirected Graph

slide-66
SLIDE 66

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Global Mincut Problem

Problem Statement Given a connected undirected graph G = (V , E), find a cut (A, B)

  • f minimum cardinality.

Applications: Partitioning items in a database, Identify clusters of related documents, Network reliability, Network design, Circuit design, etc.

slide-67
SLIDE 67

Introduction Quick Sort Minimum Enclosing Disk Min Cut

A Simple Randomized Algorithm

Contraction of an Edge Contraction of an edge e = (x, y) implies merging the two vertices x, y ∈ V into a single vertex, and remove the self loop. The contracted graph is denoted by G/xy.

x y xy xy 2 2 2 G = (V, E) ContractedGraph Contractedsimpleweightedgraph

slide-68
SLIDE 68

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Results on Contraction of Edges

Result - 1 As long as G/xy has at least one edge, The size of the minimum cut in the (weighted) graph G/xy is at least as large as the size of the minimum cut in G . Result - 2 Let e1, e2, . . . , en−2 be a sequence of edges in G, such that none of them is in the minimum cut of G, and G ′ = G/{e1, e2, . . . , en−2} is a single multiedge. Then this multiedge corresponds to the minimum cut in G. Problem: Which edge sequence is to be chosen for contraction?

slide-69
SLIDE 69

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Analysis

Algorithm MINCUT(G) G0 ← G; i = 0 while Gi has more than two vertices do Pick randomly an edge ei from the edges in Gi Gi+1 ← Gi/ei i ← i + 1 (S, V − S) is the cut in the original graph corresponding to the single edge in Gi. Theorem Time Complexity: O(n2) A Trivial Observation: The algorithm outputs a cut whose size is no smaller than the mincut.

slide-70
SLIDE 70

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Demonstration of the Algorithm

The given graph: Stages of Contraction:

2 2 2 2 2 2 2 2 3 2 3 2 4 4 5 9

The corresponding output:

slide-71
SLIDE 71

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Quality Analysis: How good is the solution?

Result 3: Lower bounding |E| If a graph G = (V , E) has a minimum cut F of size k, and it has n vertices, then |E| ≥ kn

2 .

slide-72
SLIDE 72

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Quality Analysis: How good is the solution?

Result 3: Lower bounding |E| If a graph G = (V , E) has a minimum cut F of size k, and it has n vertices, then |E| ≥ kn

2 .

Proof

slide-73
SLIDE 73

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Quality Analysis: How good is the solution?

Result 3: Lower bounding |E| If a graph G = (V , E) has a minimum cut F of size k, and it has n vertices, then |E| ≥ kn

2 .

Proof If any node v has degree less than k, then the cut({v}, V − {v}) will have size less than k.

slide-74
SLIDE 74

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Quality Analysis: How good is the solution?

Result 3: Lower bounding |E| If a graph G = (V , E) has a minimum cut F of size k, and it has n vertices, then |E| ≥ kn

2 .

Proof If any node v has degree less than k, then the cut({v}, V − {v}) will have size less than k. This contradicts the fact that (A, B) is a global min-cut.

slide-75
SLIDE 75

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Quality Analysis: How good is the solution?

Result 3: Lower bounding |E| If a graph G = (V , E) has a minimum cut F of size k, and it has n vertices, then |E| ≥ kn

2 .

Proof If any node v has degree less than k, then the cut({v}, V − {v}) will have size less than k. This contradicts the fact that (A, B) is a global min-cut. Thus, every node in G has degree at least k. So, |E| ≥ 1

2kn.

slide-76
SLIDE 76

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Quality Analysis: How good is the solution?

Result 3: Lower bounding |E| If a graph G = (V , E) has a minimum cut F of size k, and it has n vertices, then |E| ≥ kn

2 .

Proof If any node v has degree less than k, then the cut({v}, V − {v}) will have size less than k. This contradicts the fact that (A, B) is a global min-cut. Thus, every node in G has degree at least k. So, |E| ≥ 1

2kn.

So, the probability that an edge in F is contracted is at most

k (kn)/2 = 2 n

But, we don’t know the min cut.

slide-77
SLIDE 77

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Summing up: Result 4 If we pick a random edge e from the graph G, then the probability

  • f e belonging in the mincut is at most 2

n.

slide-78
SLIDE 78

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Summing up: Result 4 If we pick a random edge e from the graph G, then the probability

  • f e belonging in the mincut is at most 2

n.

Continuing Contraction

slide-79
SLIDE 79

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Summing up: Result 4 If we pick a random edge e from the graph G, then the probability

  • f e belonging in the mincut is at most 2

n.

Continuing Contraction After i iterations, there are n − i supernodes in the current graph G ′ and suppose no edge in the cut F has been contracted.

slide-80
SLIDE 80

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Summing up: Result 4 If we pick a random edge e from the graph G, then the probability

  • f e belonging in the mincut is at most 2

n.

Continuing Contraction After i iterations, there are n − i supernodes in the current graph G ′ and suppose no edge in the cut F has been contracted. Every cut of G ′ is a cut of G. So, there are at least k edges incident on every supernode of G ′.

slide-81
SLIDE 81

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Summing up: Result 4 If we pick a random edge e from the graph G, then the probability

  • f e belonging in the mincut is at most 2

n.

Continuing Contraction After i iterations, there are n − i supernodes in the current graph G ′ and suppose no edge in the cut F has been contracted. Every cut of G ′ is a cut of G. So, there are at least k edges incident on every supernode of G ′. Thus, G ′ has at least 1

2k(n − i) edges.

slide-82
SLIDE 82

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Summing up: Result 4 If we pick a random edge e from the graph G, then the probability

  • f e belonging in the mincut is at most 2

n.

Continuing Contraction After i iterations, there are n − i supernodes in the current graph G ′ and suppose no edge in the cut F has been contracted. Every cut of G ′ is a cut of G. So, there are at least k edges incident on every supernode of G ′. Thus, G ′ has at least 1

2k(n − i) edges.

So, the probability that an edge in F is contracted in iteration i + 1 is at most

k

1 2 k(n−i) =

2 n−i .

slide-83
SLIDE 83

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Digression into Probability

Conditional Probability The conditional probability of X given Y is Pr[X = x | Y = y] = Pr[(X = x) ∩ (Y = y)] Pr[Y = y]

slide-84
SLIDE 84

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Digression into Probability

Conditional Probability The conditional probability of X given Y is Pr[X = x | Y = y] = Pr[(X = x) ∩ (Y = y)] Pr[Y = y] An Equivalent Statement Pr[(X = x) ∩ (Y = y)] = Pr[X = x | Y = y] · Pr[Y = y]

slide-85
SLIDE 85

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Digression into Probability

Conditional Probability The conditional probability of X given Y is Pr[X = x | Y = y] = Pr[(X = x) ∩ (Y = y)] Pr[Y = y] An Equivalent Statement Pr[(X = x) ∩ (Y = y)] = Pr[X = x | Y = y] · Pr[Y = y] Independent Events 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]

slide-86
SLIDE 86

Introduction Quick Sort Minimum Enclosing Disk Min Cut

A Result that we need on Intersection of events

Let η1, η2, . . . , ηn be n events not necessarily independent. Then, Pr[∩n

i=1ηi] = Pr[η1]·Pr[η2 | η1]·Pr[η3 | η1∩η2] · · · Pr[ηn | η1∩. . .∩ηn−1].

The proof is by induction on n.

slide-87
SLIDE 87

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Correctness

Theorem The procedure MINCUT outputs the mincut with probability ≥

2 n(n−1).

Proof: The correct cut(A, B) will be returned by MINCUT if no edge of F is contracted in any of the iterations 1, 2, . . . , n − 2. Let ηi ⇒ the event that an edge of F is not contracted in the ith iteration. We have already shown that Pr[η1] ≥ 1 − 2

n.

Pr[ηi+1 | η1 ∩ η2 ∩ · · · ∩ ηi] ≥ 1 −

2 n−i

slide-88
SLIDE 88

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Lower Bounding the Intersection of Events

We want to lower bound Pr[η1 ∩ · · · ∩ ηn−2]. We use the earlier result Pr[∩n

i=1ηi] = Pr[η1]·Pr[η2 | η1]·Pr[η3 | η1∩η2] · · · Pr[ηn | η1∩. . .∩ηn−1].

So, we have Pr[η1] · Pr[η1 | η2] · · · Pr[ηn−2 | η1 ∩ η2 · · · ∩ ηn−3] ≥

  • 1 − 2

n

1 −

2 n−1

  • · · ·
  • 1 −

2 n−i

  • · · ·
  • 1 − 2

3

  • =

n

2

−1

slide-89
SLIDE 89

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Bounding the Error Probability

We know that a single run of the contraction algorithm fails to find a global min-cut with probability at most 1 −

1

(n

2) ≈ 1.

slide-90
SLIDE 90

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Bounding the Error Probability

We know that a single run of the contraction algorithm fails to find a global min-cut with probability at most 1 −

1

(n

2) ≈ 1.

We can amplify our success probability by repeatedly running the algorithm with independent random choices and taking the best cut.

slide-91
SLIDE 91

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Bounding the Error Probability

We know that a single run of the contraction algorithm fails to find a global min-cut with probability at most 1 −

1

(n

2) ≈ 1.

We can amplify our success probability by repeatedly running the algorithm with independent random choices and taking the best cut. If we run the algorithm n

2

  • times, then the probability that we

fail to find a global min-cut in any run is at most

  • 1 − 1

n

2

  • (n

2)

≤ 1 e .

slide-92
SLIDE 92

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Bounding the Error Probability

We know that a single run of the contraction algorithm fails to find a global min-cut with probability at most 1 −

1

(n

2) ≈ 1.

We can amplify our success probability by repeatedly running the algorithm with independent random choices and taking the best cut. If we run the algorithm n

2

  • times, then the probability that we

fail to find a global min-cut in any run is at most

  • 1 − 1

n

2

  • (n

2)

≤ 1 e . Result By spending O(n4) time, we can reduce the failure probability from 1 − 2

n2 to a reasonably small constant value 1 e .

slide-93
SLIDE 93

Introduction Quick Sort Minimum Enclosing Disk Min Cut

Conclusions

Employing randomness leads to improved simplicity and improved efficiency in solving the problem. It assumes the availability of a perfect source of independent and unbiased random bits. Access to truly unbiased and independent sequence of random bits is expensive. So, it should be considered as an expensive resource like time and space. There are ways to reduce the randomness from several algorithms while maintaining the efficiency nearly the same.