Presentation is loading. Please wait.

Presentation is loading. Please wait.

Randomized Algorithms CS648

Similar presentations


Presentation on theme: "Randomized Algorithms CS648"โ€” Presentation transcript:

1 Randomized Algorithms CS648
Lecture 18 Approximate Distance Oracles Algorithm for Min-cut : part 1

2 Approximate Distance oracles

3 All-Pairs Shortest Paths
Notations and Terminologies : A graph ๐‘ฎ=(๐‘ฝ,๐‘ฌ) on ๐’=|๐‘ฝ| vertices ๐’Ž=|๐‘ฌ| edges ๐Ž:๐‘ฌโ†’ ๐‘น + A path from ๐’– to ๐’—: a sequence (๐’–=)๐’™ ๐ŸŽ , ๐’™ ๐Ÿ ,โ€ฆ, ๐’™ ๐’Œ (=๐’—) where ( ๐’™ ๐’Š , ๐’™ ๐’Š+๐Ÿ ) โˆˆ๐‘ฌ Length of a path ๐‘ท : sum of the weights on the edges of path ๐‘ท. Shortest path from ๐’– to ๐’— : the path of smallest length from ๐’– to ๐’—. Distance from ๐’– to ๐’— : the length of the shortest path from ๐’– to ๐’—. ๐œน(๐’–,๐’—) : Distance from ๐’– to ๐’—

4 All-Pairs Shortest Paths
Problem Definition: Given a graph ๐‘ฎ=(๐‘ฝ,๐‘ฌ), build a compact data structure so that for any ๐’–,๐’—โˆˆ๐‘ฝ, ๐œน(๐’–,๐’—) can be reported in ๐‘ถ(๐Ÿ) time Shortest path from ๐’– to ๐’— can be reported in optimal time. Results known: ๐‘ถ( ๐’ ๐Ÿ ) size data structure (Distance matrix and Witness matrix) ๐‘ถ(๐’Ž๐’+ ๐’ ๐Ÿ ๐ฅ๐จ๐  ๐’) preprocessing time (Dijkstraโ€™s algorithm from each vertex) Current-state-of-the-art RAM size: 8 GBs ๏ƒจCanโ€™t handle graphs with even ๐Ÿ๐ŸŽ ๐Ÿ“ vertices (with RAM size) ๏Œ

5 All-Pairs Approximate Shortest Paths
Problem Definition: Given a graph ๐‘ฎ=(๐‘ฝ,๐‘ฌ), build a compact data structure so that for any ๐’–,๐’—โˆˆ๐‘ฝ, it reports ๐œน (๐’–,๐’—) in ๐‘ถ(๐Ÿ) time satisfying ๐œน ๐’–,๐’— โ‰ค ๐œน (๐’–,๐’—)โ‰ค๐’• ๐œน(๐’–,๐’—) ๐’•: stretch. Aim: To achieve Sub-quadratic space. Sub-cubic preprocessing time. With ๐‘ถ(๐Ÿ) query time. Many elegant results have been invented for undirected graphs ๏Š

6 Approximate Distance Oracles
A truly magical result Approximate Distance Oracles ๐’•:Stretch Space Query time Preprocessing time ๐‘ถ( ๐’ ๐Ÿ+ ๐Ÿ ๐Ÿ ) ๐‘ถ(๐Ÿ) ๐‘ถ( ๐’Ž๐’ ๐Ÿ ๐Ÿ ) ๐Ÿ‘ ๐‘ถ( ๐’ ๐Ÿ+ ๐Ÿ ๐Ÿ‘ ) ๐‘ถ(๐Ÿ) ๐‘ถ( ๐’Ž๐’ ๐Ÿ ๐Ÿ‘ ) ๐Ÿ“ ๐‘ถ( ๐’ ๐Ÿ+ ๐Ÿ ๐’Œ ) ๐‘ถ(๐’Œ) ๐‘ถ( ๐’Œ ๐’Ž๐’ ๐Ÿ ๐’Œ ) ๐Ÿ๐’Œโˆ’๐Ÿ Mikkel Thorup and Uri Zwick: Approximate Distance Oracles for graphs, Journal of ACM (4), 2005

7 Inspiration from our daily life

8 Air/Road Network ๐‘ณ๐’–๐’„๐’Œ๐’๐’๐’˜ ๐‘ซ๐’†๐’๐’‰๐’Š ๐‘ฒ๐’‚๐’๐’‘๐’–๐’“ ๐‘ฉ๐’‚๐’๐’ˆ๐’‚๐’๐’๐’“๐’†

9 The Idea Given a graph ๐‘ฎ=(๐‘ฝ,๐‘ฌ),
Compute a small set ๐‘ณ of Landmark vertices. From each vertex ๐’–โˆˆ๐‘ฝ\๐‘ณ, store distance to vertices present in its locality. From each vertex ๐’—โˆˆ๐‘ณ, store distance to all vertices in the graph. Questions: What is the formal notion of locality ? How to retrieve distance from ๐’– to a far away vertex ? What is the guarantee of stretch ? How to compute the desired set ๐‘ณ efficiently ?

10 Formal notion of locality
๐’–

11 Formal notion of locality
๐‘ฉ๐’‚๐’๐’(๐’–,๐‘ฝ,๐‘ณ)= {๐’™โˆˆ๐‘ฝ| ๐œน ๐’–,๐’™ <๐œน ๐’–,๐‘ณ(๐’–) } ๐‘ณ(๐’–) ๐’– ๐‘ฉ๐’‚๐’๐’(๐’–,๐‘ฝ,๐‘ณ)

12 Reporting distance from ๐’–
๐œน ๐’–,๐‘ณ(๐’–) โ‰ค๐œน ๐’–,๐’— ๐’— ๐’— ๐‘ณ(๐’–) ๐’– ๐‘ฉ๐’‚๐’๐’(๐’–,๐‘ฝ,๐‘ณ)

13 stretch โ‰ค๐Ÿ‘ What is the stretch ? ๐œน ๐’–,๐‘ณ(๐’–) โ‰ค๐œน ๐’–,๐’— ?? โ‰ค๐œน ๐’–,๐’— +๐œน ๐’–,๐‘ณ(๐’–)
โ‰ค๐Ÿ๐œน ๐’–,๐’— ๐’— ๐‘ณ(๐’–) ๐’– ๐‘ฉ๐’‚๐’๐’(๐’–,๐‘ฝ,๐‘ณ)

14 3-approximate distance oracle
Preprocessing-algorithm(๐‘ฎ) { Compute set ๐‘ณ suitably; For each ๐’—โˆˆ๐‘ณ store distance to all vertices; For each ๐’—โˆˆ๐‘ฝ\๐‘ณ compute ๐‘ฉ๐’‚๐’๐’(๐’–,๐‘ฝ,๐‘ณ); Build a hash table storing distances from ๐’– to ๐‘ฉ๐’‚๐’๐’(๐’–,๐‘ฝ,๐‘ณ); } Query(๐’–, ๐’—) { If ๐’—โˆˆ๐‘ฉ๐’‚๐’๐’(๐’–,๐‘ฝ,๐‘ณ) return ๐œน ๐’–,๐’— ; else return ๐œน ๐’–,๐‘ณ(๐’–) +๐œน ๐‘ณ(๐’–),๐’— ; Global distance info. Local distance info.

15 The real challenge left
How to compute set ๐‘ณ such that ๐‘ณ is small. ๐‘ฉ๐’‚๐’๐’(๐’–,๐‘ฝ,๐‘ณ) is small for each ๐’–โˆˆ๐‘ฝ\๐‘ณ. Fact1: It is difficult, if not impossible, to compute such a set deterministically. Fact2: The structure of graph (the edges and weights) can be arbitrary and more complex than planar road/air networkk.

16 The real challenge left
๐‘ณ(๐’–) ๐’– ๐‘ฉ๐’‚๐’๐’(๐’–,๐‘ฝ,๐‘ณ)

17 Conquering the challenge
Let ๐’‘>๐ŸŽ be a fraction to be fixed later on. Computing ๐‘ณ : { ๐‘ณ๏ƒŸโˆ…; For each ๐’—โˆˆ๐‘ฝ Add ๐’— to ๐‘ณ independently with probability ๐’‘; return ๐‘ณ; } Expected size of ๐‘ณ : ๐‘ถ ๐’๐’‘ ๐‘ฟ: random variable for |๐‘ฉ๐’‚๐’๐’(๐’–,๐‘ฝ,๐‘ณ)|

18 Expected size of ๐‘ฉ๐’‚๐’๐’(๐’–,๐‘ฝ,๐‘ณ)
๐‘ฟ ๐’Š = ๐Ÿ if ๐’— ๐’Š is present in ๐‘ฉ๐’‚๐’๐’(๐’–,๐‘ฝ,๐‘ณ) ๐ŸŽ otherwise ๏ƒจ๐‘ฟ= ๐ŸŽโ‰ค๐’Š<๐’ ๐‘ฟ ๐’Š ๐„[๐‘ฟ]= ๐ŸŽโ‰ค๐’Š<๐’ ๐„[ ๐‘ฟ ๐’Š ] = ๐ŸŽโ‰ค๐’Š<๐’ ๐( ๐‘ฟ ๐’Š =๐Ÿ) = ๐ŸŽโ‰ค๐’Š<๐’ ๐( ๐’— ๐’Š is present in ๐‘ฉ๐’‚๐’๐’(๐’–,๐‘ฝ,๐‘ณ)) = ๐ŸŽโ‰ค๐’Š<๐’ ๐Ÿโˆ’๐’‘ ๐’Š+๐Ÿ < ๐Ÿโˆ’๐’‘ ๐’‘ = ๐‘ถ ๐Ÿ ๐’‘ ๐’— ๐Ÿ ๐’— ๐Ÿ โ€ฆ ๐’— ๐’Š โ€ฆ ๐’— ๐’โˆ’๐Ÿ ๐’– Increasing order of distance from ๐’– None of ๐’— ๐ŸŽ , โ€ฆ, ๐’— ๐’Š is present in ๐‘ณ

19 Expected space of 3-approximate distance oracle
Space for Global distance information: = ๐‘ถ ๐’|๐‘ณ| = ๐‘ถ ๐’ โˆ™๐’๐’‘ = ๐‘ถ ๐’ ๐Ÿ ๐’‘ Space for Local distance information: = ๐‘ถ ๐‘ฝ\๐‘ณ ๐Ÿ ๐’‘ = ๐‘ถ ๐’ ๐’‘ To minimize the total space: (Balance the two terms) ๐’‘= ๐Ÿ โˆš๐’ Expected space: ๐‘ถ( ๐’ ๐Ÿ+ ๐Ÿ ๐Ÿ ) Each vertex in ๐‘ฝ\๐‘ณ keeps a Ball)

20 Theorem: An undirected weighted graph can be processed to build a data structure of expected size ๐‘ถ( ๐’ ๐Ÿ+ ๐Ÿ ๐Ÿ ) that can report 3-approximate distance between any pair of vertices in ๐‘ถ ๐Ÿ time. Homework: Convert to a Las Vegas algorithm with high probability bound on space. Show that expected preprocessing time is ๐‘ถ ๐’Ž ๐’ + ๐’ ๐Ÿ

21 5-approximate distance oracle
Meant for only those (hopefully nonzero no. of) students whose aim is more than just a good grade in this course.

22 3-approximate distance oracle
๐‘ณ ๐‘ฝ

23 5-approximate distance oracle
๐‘ณ ๐Ÿ ๐‘ณ ๐Ÿ ๐‘ฝ

24 5-approximate distance oracle
๐‘ณ ๐Ÿ (๐’–) ๐‘ณ ๐Ÿ (๐’–) ๐’– ๐‘ฉ๐’‚๐’๐’(๐’–,๐‘ฝ, ๐‘ณ ๐Ÿ ) ๐‘ฉ๐’‚๐’๐’(๐’–, ๐‘ณ ๐Ÿ , ๐‘ณ ๐Ÿ )

25 problem 2 Min-cut

26 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.

27 Min-Cut Deterministic Algorithms: ๐‘ถ ๐’Ž๐’ ๐ฉ๐จ๐ฅ๐ฒ๐ฅ๐จ๐  ๐’ time
- Designed in 1997, - Quite complex to analyze and implement Randomized Algorithms: ๐‘ถ( ๐’ ๐Ÿ ๐ฉ๐จ๐ฅ๐ฒ๐ฅ๐จ๐  ๐’) time Monte Carlo [1993] ๐‘ถ(๐’Ž ๐ฉ๐จ๐ฅ๐ฒ๐ฅ๐จ๐  ๐’) time Monte Carlo [1996] - Both are much simpler and easier to implement.

28 some basic facts

29 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: ๐’๐’Œ ๐Ÿ

30 Contract(๐‘ฎ,๐’†) ๐’– ๐’— ๐’˜ ๐’š ๐’™ ๐’‚ ๐’ƒ ๐’‰ ๐’ Contract(๐‘ฎ,(๐’™,๐’š)) ๐’– ๐’— ๐’˜ ๐’‚ ๐’ƒ ๐’‰ ๐’ ๐’™๐’š

31 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(๐‘ฎ,๐’†): ๐‘ถ(๐’)

32 Contract(๐‘ฎ,๐’†) Let ๐’Œ be the size of min-cut of ๐‘ฎ. Let ๐‘ช be any min-cut of ๐‘ฎ. Let ๐‘ฎโ€ฒ be the graph after Contract(๐‘ฎ,๐’†). Observation: Every cut of ๐‘ฎโ€ฒ is also a cut of ๐‘ฎ. Question: Under what circumstance ๐‘ช is a cut of ๐‘ฎโ€ฒ ? Answer: if ๐’†โˆ‰๐‘ช. Question: If ๐’† is selected randomly uniformly, what is the probability that ๐‘ช is preserved in ๐‘ฎโ€ฒ ? Answer: ๐’Œ ๐’Ž โ‰ค ๐’Œ ๐’๐’Œ/๐Ÿ โ‰ค ๐Ÿ ๐’

33 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 1โˆ’ ๐Ÿ ๐’ . Let ๐’† โˆˆ ๐’“ ๐‘ฎ; ๐‘ฎโ€ฒ ๏ƒŸ Contract(๐‘ฎ,๐’†). Let ๐’†โ€ฒ โˆˆ ๐’“ ๐‘ฎโ€ฒ; ๐‘ฎโ€ฒโ€ฒ ๏ƒŸ Contract(๐‘ฎโ€ฒ,๐’†). Question: What is probability that ๐‘ช is preserved in ๐‘ฎโ€ฒโ€ฒ ? Answer: 1โˆ’ ๐Ÿ ๐’ . 1โˆ’ ๐Ÿ ๐’โˆ’๐Ÿ

34 Algorithm for min-cut Min-cut(๐‘ฎ): { Repeat ?? times { Let ๐’† โˆˆ ๐’“ ๐‘ฎ;
๐‘ฎ ๏ƒŸ Contract(๐‘ฎ,๐’†). } return the edges of multi-graph ๐‘ฎ; Running time: ๐‘ถ( ๐’ ๐Ÿ ) ๐’โˆ’๐Ÿ

35 Algorithm for min-cut Question: What is probability that ๐‘ช is preserved during the algorithm ? Answer: 1โˆ’ ๐Ÿ ๐’ . 1โˆ’ ๐Ÿ ๐’โˆ’๐Ÿ . 1โˆ’ ๐Ÿ ๐’โˆ’๐Ÿ โ€ฆ = ๐’โˆ’๐Ÿ ๐’ . ๐’โˆ’๐Ÿ‘ ๐’โˆ’๐Ÿ . ๐’โˆ’๐Ÿ’ ๐’โˆ’๐Ÿ โ€ฆ = ๐Ÿ ๐’ . ๐Ÿ ๐’โˆ’๐Ÿ > ๐Ÿ ๐’ ๐Ÿ

36 Algorithm for min-cut Min-cut-high-probability(๐‘ฎ):
{ Repeat Min-cut(๐‘ฎ) algorithm ๐’„ ๐’ ๐Ÿ log ๐’ times and report the smallest cut computed; } Running time: ๐‘ถ( ๐’ ๐Ÿ’ ๐ฅ๐จ๐  ๐’) Error Probability : ๐Ÿโˆ’ ๐Ÿ ๐’ ๐Ÿ ๐’„ ๐’ ๐Ÿ ๐ฅ๐จ๐  ๐’ < ๐Ÿ ๐’ ๐’„


Download ppt "Randomized Algorithms CS648"

Similar presentations


Ads by Google