randomized algorithms randomized algorithms cs648 1

30
Randomized Algorithms CS648 Lecture 19 โ€ข algorithm for Min-cut in a graph 1

Upload: khalid-bowlsby

Post on 30-Mar-2015

314 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Randomized Algorithms Randomized Algorithms CS648 1

Randomized AlgorithmsCS648

Lecture 19โ€ข algorithm for Min-cut in a graph

1

Page 2: Randomized Algorithms Randomized Algorithms CS648 1

Overview

1. Recap of the previous lecture time Monte Carlo algorithm for min-cut

2. Knowledge of recurrence

3. time Monte Carlo algorithm for min-cut

4. An important bi-product:

2

To design efficient algorithm

A new tool to design an efficient algorithm

Page 3: Randomized Algorithms Randomized Algorithms CS648 1

RECAP OF THE PREVIOUS LECTURE

3

Page 4: Randomized Algorithms Randomized Algorithms CS648 1

Graph and Multi-graph

A multi-graph may have:โ€ข More than one edge between a pair of verticesโ€ข No self loop

4

๐’™

๐’–

๐’—

๐’˜

๐’‚

๐’ƒ ๐’‰

๐’

Page 5: Randomized Algorithms Randomized Algorithms CS648 1

Min-Cut

: undirected connected graph Definition (cut):A subset whose removal disconnects the graph.

Definition (min-cut): A cut of smallest size.Problem Definition: Design algorithm to compute min-cut of a given graph.

5

Page 6: Randomized Algorithms Randomized Algorithms CS648 1

SOME BASIC FACTS

6

Page 7: Randomized Algorithms Randomized Algorithms CS648 1

Min-Cut

Question: How many cuts ?Answer: Question : what is relation between degree() and size of min-cut ?Answer: size of min-cut degree() Question : If size of min-cut is , what can be minimum value of ?Answer:

7

๐’–

How about cuts in multi-graph ?

Page 8: Randomized Algorithms Randomized Algorithms CS648 1

Contract()

8

๐’–

๐’—

๐’˜๐’š

๐’™ ๐’‚

๐’ƒ ๐’‰

๐’

๐’™๐’š

๐’–

๐’—

๐’˜

๐’‚

๐’ƒ ๐’‰

๐’

Contract(

Page 9: Randomized Algorithms Randomized Algorithms CS648 1

Contract()

Contract(){ Let ; Merge the two vertices and into one vertex; Preserve multi-edges; Remove the edge ; Let be the modified graph; return ;}

Time complexity of Contract():

9

Relation between and ?

Page 10: Randomized Algorithms Randomized Algorithms CS648 1

Relation between and ?

10

๐’–

๐’—

๐’˜๐’š

๐’™ ๐’‚

๐’ƒ ๐’‰

๐’

๐‘ฎ

๐’™๐’š

๐’–

๐’—

๐’˜

๐’‚

๐’ƒ ๐’‰

๐’

๐‘ฎ โ€ฒ

Contract(

Page 11: Randomized Algorithms Randomized Algorithms CS648 1

Observations about Contract()

Let be the size of min-cut of . Let be any min-cut of . Let be the graph after Contract().Observation 1: may be a multi-graph.Observation 2: Every cut of is also a cut of .Observation 3: remains a cut of if .

Question: If is selected randomly uniformly, what is the probability that is preserved in ?Answer:

11

โ‰ค๐’Œ

๐’๐’Œ /๐Ÿโ‰ค๐Ÿ๐’

Recall that

Page 12: Randomized Algorithms Randomized Algorithms CS648 1

Contract()

Let be the size of min-cut of . Let be any min-cut of . Lemma: If edge to be contracted is selected randomly uniformly, is preserved with probability at least .

Let ; Contract().Let ; Contract().

Question: What is probability that is preserved in ?Answer:

12

(1โˆ’ ๐Ÿ๐’โˆ’๐Ÿ )

Page 13: Randomized Algorithms Randomized Algorithms CS648 1

Algorithm for min-cut

Min-cut():{ Repeat ?? times {

Let ; Contract().

} return the edges of multi-graph ;}

Running time:

13

๐’โˆ’๐Ÿ

Page 14: Randomized Algorithms Randomized Algorithms CS648 1

Algorithm for min-cut

Question: What is probability that is preserved during the algorithm ?Answer:

= = >

14

Page 15: Randomized Algorithms Randomized Algorithms CS648 1

Algorithm for min-cut

Min-cut-high-probability():{ Repeat Min-cut() algorithm log times and report the smallest cut computed;} Running time: Error Probability : <

15

Page 16: Randomized Algorithms Randomized Algorithms CS648 1

REVISITING RECURRENCES

In the following slides, we shall revisit common recurrences. Try to solve these recurrences in a simple manner instead of using Masterโ€™s theorem. This will help you develop a useful insight into recurrences. This insight will help you fine-tune

the previous inefficient algorithm and eventually lead to design (and analysis) of a more efficient algorithm for min-cut.

16

Page 17: Randomized Algorithms Randomized Algorithms CS648 1

Common recurrencesโ€ข

โ€ข

โ€ข

โ€ข

17

๐‘ถ (๐’๐Ÿ)

๐‘ถ (๐’)

๐‘ถ (๐’๐ฅ๐จ๐ ๐’)

๐‘ถ (๐’)

Page 18: Randomized Algorithms Randomized Algorithms CS648 1

Common recurrencesโ€ข

โ€ข

โ€ข

Question: What is the largest value of for which the solution of the following recurrence ?โ€ข

18

๐‘ถ (๐’๐Ÿ)

๐‘ถ (๐’๐Ÿ)

๐‘ถ (๐’๐Ÿ‘)

๐’‚=โˆš๐Ÿ

Page 19: Randomized Algorithms Randomized Algorithms CS648 1

FASTER MIN-CUT ALGORITHM

19

Page 20: Randomized Algorithms Randomized Algorithms CS648 1

Revisiting algorithm for min-cut

Min-cut():{ Repeat ?? times {

Let ; Contract().

} return the edges of multi-graph ;}

Running time:

20

๐’โˆ’๐Ÿ

We shall modify this algorithm to improve its success probability. But we shall not allow any significant blow up in the running time.

Page 21: Randomized Algorithms Randomized Algorithms CS648 1

Algorithm for min-cut

Probability that min-cut is preserved during the algorithm : =

Question: What is probability that min-cut is preserved in first iteration ? Answer: Try to make careful observations based on the above answer to improve the

success probability of the min-cut algorithm.

21

โ‰ˆ (๐’โˆ’๐’Š๐’ )๐Ÿ

Page 22: Randomized Algorithms Randomized Algorithms CS648 1

Key observations about Min-Cut algorithm

Algorithm performs contractions :

After contractions:โ€ข Min-cut is preserved with probability ยผ .โ€ข There are only vertices left. (the graph size is significantly reduced).

IDEA: Invoke two calls of Min-cut algorithm after contractions and return the smaller of the two cuts computed. Since the graph size is reduced significantly, we can afford to do it.

22

๐’ /๐Ÿ

recursively

Page 23: Randomized Algorithms Randomized Algorithms CS648 1

Revised algorithm for min-cutFast-Min-cut(): If has at most 10 vertices compute exact min-cut else { ; Repeat times { Let ; Contract(). } Fast-Min-cut(); Fast-Min-cut(); Let be smaller of the cuts , ; } return ;

โ€ข for

Question: Prob. min-cut is preserved at the end of the Repeat loop = ?

Question: How to increase this prob. ?

Answer: reduce .

Question: What is the smallest value of to ensure ?

23

1/4

Page 24: Randomized Algorithms Randomized Algorithms CS648 1

Faster algorithm for min-cutFast-Min-cut(): If has at most 10 vertices compute exact min-cut else { ; Repeat times { Let ; Contract(). } Fast-Min-cut(); Fast-Min-cut(); Let be smaller of the cuts , ; } return ;

Running time of the algorithm :

Question: Prob. min-cut is preserved at the end of the Repeat loop = ?

: the probability that algorithm returns the min-cut.

For , For , ??

24

1/2

Page 25: Randomized Algorithms Randomized Algorithms CS648 1

Success probability of Fast-Min-cut()

For , For , = We shall now show that recurrence has a solution: If we repeat Fast-Min-cut total times and report the smallest of all the output, probability of error= ??

25

(1โˆ’ ๐Ÿlog๐’ )

๐Ÿ’ log๐Ÿ๐’<

Page 26: Randomized Algorithms Randomized Algorithms CS648 1

Solving the recurrence

For , For , = Substituting , we get the recurrenceFor , For ,

26

Page 27: Randomized Algorithms Randomized Algorithms CS648 1

Solving the recurrence

For , For , = It suffices to consider the above recurrence only for those which are powers of .

For the sake of neatness, let us use to denote . Thus the above recurrence can be expressed as

27

Page 28: Randomized Algorithms Randomized Algorithms CS648 1

Solving the recurrence

It suffices to solve the following recurrence., For ,

The recurrence still looks difficult since it does not belong to the pool of recurrences you are familiar with.

However, it has a very short and elementary solution. In fact the solution is very inspiring.

First try on your own before proceeding to the following slides.

28

Page 29: Randomized Algorithms Randomized Algorithms CS648 1

Solving the recurrence

,For ,

Observation 1: Observation 2:

Hence,

// by unfolding and using the fact that // and we are done.

29

//since

proof

Page 30: Randomized Algorithms Randomized Algorithms CS648 1

This lecture introduced many concepts which can be used for design and analysis of efficient randomized algorithms. Try to

reflect upon these conceptโ€ฆ

30