lecture 17-cs648

50
Randomized Algorithms CS648 Lecture 17 Miscellaneous applications of Backward analysis 1

Upload: anshul-yadav

Post on 26-Jun-2015

68 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Lecture 17-cs648

Randomized AlgorithmsCS648

Lecture 17Miscellaneous applications of Backward analysis

1

Page 2: Lecture 17-cs648

MINIMUM SPANNING TREE

2

Page 3: Lecture 17-cs648

Minimum spanning tree

3

b

ac

d

h x

y

u

v

18

7

1

19

22

10

312

3

15

11

5

16

17

13

4 2

9

6

Page 4: Lecture 17-cs648

Minimum spanning tree

Algorithms: โ€ข Primโ€™s algorithmโ€ข Kruskalโ€™s algorithmโ€ข Boruvkaโ€™s algorithm

4

b

ac

d

h x

y

u

v

18

7

1

19

22

10

312

3

15

11

5

16

17

13

4 2

9

6

Less known but it is the first algorithm for MST

Page 5: Lecture 17-cs648

Minimum spanning tree

: undirected graph with weights on edges, .

Deterministic algorithms:Primโ€™s algorithm 1. O(( + ) log ) using Binary heap2. O( + log ) using Fibonacci heapBest deterministic algorithm: O( + ) bound

โ€“ Too complicated to design and analyzeโ€“ Fails to beat Primโ€™s algorithm using Binary heap

5

Page 6: Lecture 17-cs648

Minimum spanning tree

When finding an efficient solution of a problem appears hard, one should strive to design an efficient verification algorithm.

MST verification algorithm: [King, 1990]Given a graph and a spanning tree , it takes O( + ) time todetermine if is MST of .

Interestingly, no deterministic algorithm for MST could use this algorithm to achieve O( + ) time.

6

Page 7: Lecture 17-cs648

Minimum spanning tree

: undirected graph with weights on edges, .

Randomized algorithm:Karger-Klein-Tarjanโ€™s algorithm [1995]1. Las Vegas algorithm2. O( + ) expected timeThis algorithm uses โ€ข Random samplingโ€ข MST verification algorithmโ€ข Boruvkaโ€™s algorithmโ€ข Elementary data structure

7

Page 8: Lecture 17-cs648

Minimum spanning tree

: undirected graph with weights on edges, .

Randomized algorithm:Karger-Klein-Tarjanโ€™s algorithm [1994]1. Las Vegas algorithm2. O( + ) expected time

โ€ข Random sampling :How close is MST of a random sample of edges to MST of original graph ?

The notion of closeness is formalized in the following slide.

8

Page 9: Lecture 17-cs648

Light Edge

Definition: Let . An edge is said to be light with respect to if

Question: If and ||= , how many edges from are light with respect to on expectation ?Answer: ??

9

b

ac

d

h x

y

u

v

18

7

1

19

22

10

312

3

15

11

5

16

17

13

4 2

9

6 31

MST() MST()

ยฟ๐’๐’Œ

(๐’Žโˆ’๐’Œ)

Page 10: Lecture 17-cs648

USING BACKWARD ANALYSIS FORMISCELLANEOUS APPLICATIONS

10

Page 11: Lecture 17-cs648

PROBLEM 1SMALLEST ENCLOSING CIRCLE

11

Page 12: Lecture 17-cs648

Smallest Enclosing Circle

12

Page 13: Lecture 17-cs648

Smallest Enclosing Circle

Question: Suppose we sample points randomly uniformly from a set of points, what is the expected number of points that remain outside the smallest circle enclosing the sample?

13

For = , the answer is

Page 14: Lecture 17-cs648

PROBLEM 2SMALLEST LENGTH INTERVAL

14

Page 15: Lecture 17-cs648

0 1

Sampling points from a unit interval

Question: Suppose we select points from interval [0,1], what is expected length of the smallest sub-interval ?โ€ข for , it is ?? โ€ข for , it is ??

โ€ข General solution : ??

This bound can be derived using two methods.โ€ข One method is based on establishing a relationship between uniform

distribution and exponential distribution.โ€ข Second method (for nearly same asymptotic bound) using Backward

analysis.

๐Ÿ

(๐’Œ+๐Ÿ )๐Ÿ

Page 16: Lecture 17-cs648

PROBLEM 3MINIMUM SPANNING TREE

16

Page 17: Lecture 17-cs648

Light Edge

Definition: Let . An edge is said to be light with respect to if

Question: If and ||= , how many edges from are light with respect to on expectation ?

17

b

ac

d

h x

y

u

v

18

7

1

19

22

10

312

3

15

11

5

16

17

13

4 2

9

6 31

MST() MST()

Page 18: Lecture 17-cs648

USING BACKWARD ANALYSIS FORTHE 3 PROBLEMS :

A GENERAL FRAMEWORK

18

Page 19: Lecture 17-cs648

A General framework

Let be the desired random variable in any of these problems/random experiment.

โ€ข Step 1: Define an event related to the random variable .

โ€ข Step 2: Calculate probability of event using standard method based on definition. (This establishes a relationship between )

โ€ข Step 3: Express the underlying random experiment as a Randomized incremental construction and calculate the probability of the event using Backward analysis.

โ€ข Step 4: Equate the expressions from Steps 1 and 2 to calculate E[].

19

Page 20: Lecture 17-cs648

PROBLEM 3MINIMUM SPANNING TREE

20

Page 21: Lecture 17-cs648

A BETTER UNDERSTANDING OF LIGHT EDGES

21

Page 22: Lecture 17-cs648

Minimum spanning tree

22

b

ac

d

h x

y

u

v

18

7

1

19

22

10

342

3

15

11

5

16

17

13

4 2

19

6

x

b

ac

d

h

y

u

v

181

19

22

10 15

11

5

16

4

31

31

Random sampling

(๐‘ฝ ,๐‘ฌ )

(๐‘ฝ ,๐‘น)

Page 23: Lecture 17-cs648

Minimum spanning tree

23

b

ac

d

h x

y

u

v

18

7

1

19

22

10

342

3

15

11

5

16

17

13

4 2

19

6

x

b

ac

d

h

y

u

v

1

19

10 15

11

5

16

4

31

18

2231

MST()

(๐‘ฝ ,๐‘ฌ )

(๐‘ฝ ,๐‘น)

Page 24: Lecture 17-cs648

Minimum spanning tree

24

b

ac

d

h x

y

u

v

18

7

1

19

22

10

342

3

15

11

5

16

17

23

4 2

19

6

b

ac

d

h x

y

u

v

1

19

10 15

11

5

16

4

7

342

3

17

23

2

19

6

31

MST()

(๐‘ฝ ,๐‘ฌ )

(๐‘ฝ ,๐‘น)๐‘ฌ ยฟ

Page 25: Lecture 17-cs648

Minimum spanning tree

25

b

ac

d

h x

y

u

v

18

7

1

19

22

10

342

3

15

11

5

16

17

23

4 2

19

6

b

ac

d

h x

y

u

v

7

1

19

10

342

3

15

11

5

16

17

23

4 2

19

6

31

MST()

(๐‘ฝ ,๐‘ฌ )

(๐‘ฝ ,๐‘น)๐‘ฌ ยฟ

Light

Page 26: Lecture 17-cs648

First useful insight

Lemma1: An edge is light with respect to if and only if belongs to MST().

26

Page 27: Lecture 17-cs648

Minimum spanning tree

27

b

ac

d

h x

y

u

v

18

7

1

19

22

10

342

3

15

11

5

16

17

23

4 2

19

6

b

ac

d

h x

y

u

v

7

1

19

10

342

3

15

11

5

16

17

23

4 2

19

6

31

MST()

(๐‘ฝ ,๐‘ฌ )

(๐‘ฝ ,๐‘น)๐‘ฌ ยฟ

Light heavy

Page 28: Lecture 17-cs648

Minimum spanning tree

28

b

ac

d

h x

y

u

v

7

1

3 3

54 2

6

b

ac

d

h x

y

u

v

7

1

19

10

3 3

15

11

5

16

17

4 2

42

23

19

6

MST()

(๐‘ฝ ,๐‘ฌ )

(๐‘ฝ ,๐‘น)๐‘ฌ ยฟ

Light heavy

MST()

Is there any relationship among MST(), MST()

and Light edges from ?

Page 29: Lecture 17-cs648

Second useful insight

Lemma2: Let โ€ข and โ€ข be the set of all edges from that are light with respect to . Then

MST() = MST()

This lemma is used in the design of randomized algorithm for MST as follows (just a sketch):โ€ข Compute MST of a sample of edges (recursively). Let it be Tโ€™.โ€ข There will be expected edges light edges among all unsampled edges.โ€ข Recursively compute MST of Tโ€™ edges which are less than on expectation.

29

Page 30: Lecture 17-cs648

Light Edge

Definition: Let . An edge is said to be light with respect to if

Question: If and ||= , how many edges from are light with respect to on expectation ?

30

b

ac

d

h x

y

u

v

18

7

1

19

22

10

312

3

15

11

5

16

17

13

4 2

9

6 31

MST() MST()

We shall answer the above question using the Generic framework. But before that, we need to get a better understanding of the

corresponding random variable.

Page 31: Lecture 17-cs648

31

๐’Œ

๐‘น

๐‘ฌ ยฟMST()

Page 32: Lecture 17-cs648

32

๐’Œ

๐‘น

๐‘ฌ ยฟMST()

Light

Page 33: Lecture 17-cs648

33

๐’Œ

๐‘น

๐‘ฌ ยฟLight heavy

MST()

Page 34: Lecture 17-cs648

: random variable for the number of light edges in when is a random sample of edges.

: set of all subsets of of size . : number of light edges in when . = ??

34

๐Ÿยฟ๐‘บโˆจยฟ โˆ‘

๐’‚โˆˆ๐‘บ

๐’‡ (๐’‚ ) ยฟCan you express in terms of

and only ?

Page 35: Lecture 17-cs648

Step 1

Question: Let be a uniformly random sample of edges from .What is the prob. that an edge selected randomly from is a light edge ?

35

Two methods to find

Page 36: Lecture 17-cs648

Step 2

Calculating using definition

36

Page 37: Lecture 17-cs648

Step 2

Calculating using definition

37

๐’Œ

๐’‚

๐‘ฌ ยฟMST()

Light heavy

Light edges=

Page 38: Lecture 17-cs648

Step 2

Calculating using definition

: set of all subsets of of size .The probability is equal to

38

๐’‡ (๐’‚)๐’Žโˆ’๐’Œ

๐Ÿยฟ๐‘บโˆจยฟยฟ

Page 39: Lecture 17-cs648

Step 3

Expressing the entire experiment as Randomized Incremental Construction

A slight difficulty in this process is the following:โ€ข The underlying experiment talks about random sample from a set.โ€ข But RIC involves analyzing a random permutation of a set of elements. Question: What is relation between random sample from a set and a random permutation of the set ?

Spend some time on this question before proceeding further.

39

Page 40: Lecture 17-cs648

random sample and random permutation

Observation: is indeed a uniformly random sample of

40

Random permutation of

๐’“ ๐’Žโˆ’๐’“๐‘จ ๐‘ฌ ยฟ

Page 41: Lecture 17-cs648

Step 3

The underlying random experiment as Randomized Incremental Construction: โ€ข Permute the edges randomly uniformly.โ€ข Find the probability that th edge is light relative to the first edges.

Question: Can you now calculate probability ?

Spend some time on this question before proceeding further.

41

Page 42: Lecture 17-cs648

Step 3

42

Random permutation of

๐’†๐’Š๐’†๐Ÿ๐’†๐Ÿ โ€ฆ

๐‘ฌ ๐’Šโˆ’๐Ÿ

Page 43: Lecture 17-cs648

Step 3

: a random variable taking value 1 if is a light edge with respect to MST().

43

Random permutation of

๐’†๐’Š๐’†๐Ÿ๐’†๐Ÿ โ€ฆ

๐‘ฌ ๐’Šโˆ’๐Ÿ ๐‘ฌ {๐‘ฌ ยฟ๐’Šโˆ’๐Ÿ

Page 44: Lecture 17-cs648

Step 3

: a random variable taking value 1 if is a light edge with respect to MST().

Question: What is relation between and โ€™s?Answer: ??

44

Random permutation of

๐’†๐’Š๐’†๐Ÿ๐’†๐Ÿ โ€ฆ

๐‘ฌ ๐’Šโˆ’๐Ÿ ๐‘ฌ {๐‘ฌ ยฟ๐’Šโˆ’๐Ÿ

๐’‘=๐ยฟยฟ

Page 45: Lecture 17-cs648

Calculating ).

: set of all subsets of of size . ) =

depends upon

45

Forward analysis

๐’†๐’Š๐’†๐Ÿ๐’†๐Ÿ โ€ฆ

๐‘ฌ ๐’Šโˆ’๐Ÿ

MST()

Random permutation of

Page 46: Lecture 17-cs648

Calculating ).

: set of all subsets of of size . )=

46

Backward analysis

๐’†๐’Š๐’†๐Ÿ๐’†๐Ÿ โ€ฆ

๐‘ฌ ๐’Š

Random permutation of

Page 47: Lecture 17-cs648

๐ยฟ ยฟ

= ??

??

47

Backward analysis

๐’†๐’Š๐’†๐Ÿ๐’†๐Ÿ โ€ฆ

๐‘ฌ ๐’Š

MST()

ยฟMST (๐’‚)โˆจยฟ๐’Šยฟ

Random permutation of

Use Lemma 2.

๐ ( ๐’Š thedge๐›๐ž๐ฅ๐จ๐ง๐ ๐ฌ ยฟMST (๐’‚))

Page 48: Lecture 17-cs648

Calculating )

: set of all subsets of of size . )=

48

Backward analysis

๐’†๐’Š๐’†๐Ÿ๐’†๐Ÿ โ€ฆ

๐‘ฌ ๐’Š

Random permutation of

Page 49: Lecture 17-cs648

Combining the two methods for calculating

Using method 1:

Using method 2:

)

Hence:

49

Page 50: Lecture 17-cs648

Theorem: If we sample edges uniformly randomly from an undirected graph on vertices and edges, the number of light edges among the unsampled edges will be less than on expectation.

50