Download presentation
Presentation is loading. Please wait.
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 : ๐โ ๐ ๐ ๐ ๐ ๐ ๐ ๐ฅ๐จ๐ ๐ < ๐ ๐ ๐
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.