lecture 18-cs648
TRANSCRIPT
![Page 1: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/1.jpg)
Randomized AlgorithmsCS648
Lecture 18• Approximate Distance Oracles• Algorithm for Min-cut : part 1
1
![Page 2: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/2.jpg)
APPROXIMATE DISTANCE ORACLES
2
![Page 3: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/3.jpg)
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
3
![Page 4: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/4.jpg)
All-Pairs Shortest PathsProblem 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)
4
![Page 5: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/5.jpg)
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
5
![Page 6: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/6.jpg)
A truly magical result
:Stretch Space Query time Preprocessing time
6
𝟑
𝟓𝟐𝒌−𝟏
𝑶 (𝒏𝟏+𝟏
𝟐) 𝑶 (𝟏) 𝑶 (𝒎𝒏𝟏𝟐 )
𝑶 (𝒏𝟏+𝟏
𝟑) 𝑶 (𝟏) 𝑶 (𝒎𝒏𝟏𝟑 )
𝑶 (𝒏𝟏+𝟏
𝒌) 𝑶 (𝒌) 𝑶 (𝒌𝒎𝒏𝟏𝒌)
Approximate Distance Oracles
Mikkel Thorup and Uri Zwick:Approximate Distance Oracles for graphs, Journal of ACM (4), 2005
![Page 7: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/7.jpg)
INSPIRATION FROM OUR DAILY LIFE
7
![Page 8: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/8.jpg)
Air/Road Network
8
𝑲𝒂𝒏𝒑𝒖𝒓
𝑳𝒖𝒄𝒌𝒏𝒐𝒘
𝑩𝒂𝒏𝒈𝒂𝒍𝒐𝒓𝒆
𝑫𝒆𝒍𝒉𝒊
![Page 9: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/9.jpg)
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 ?
9
![Page 10: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/10.jpg)
10
Formal notion of locality
𝒖
![Page 11: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/11.jpg)
11
Formal notion of locality
= {}
𝒖 𝑳 (𝒖)
𝑩𝒂𝒍𝒍 (𝒖 ,𝑽 ,𝑳)
![Page 12: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/12.jpg)
12
Reporting distance from
𝒖
𝒗
𝑳 (𝒖)
𝑩𝒂𝒍𝒍 (𝒖 ,𝑽 ,𝑳)
𝒗
𝜹 (𝒖 ,𝑳 (𝒖))≤ 𝜹 (𝒖 ,𝒗 ) Report
![Page 13: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/13.jpg)
13
??
What is the stretch ?
𝒖
𝒗
𝑳 (𝒖)
𝜹 (𝒖 ,𝑳 (𝒖))≤ 𝜹 (𝒖 ,𝒗 )
𝑩𝒂𝒍𝒍 (𝒖 ,𝑽 ,𝑳)
≤ 𝜹 (𝒖 ,𝒗 )+𝜹 (𝒖 ,𝑳(𝒖))
stretch
![Page 14: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/14.jpg)
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 ;}
14
Global distance info.
Local distance info.
![Page 15: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/15.jpg)
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.
15
![Page 16: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/16.jpg)
16
The real challenge left
𝒖 𝑳 (𝒖)
𝑩𝒂𝒍𝒍 (𝒖 ,𝑽 ,𝑳)
![Page 17: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/17.jpg)
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 ||
17
![Page 18: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/18.jpg)
Expected size of
=
18
𝒖Increasing order of distance from
… …
None of is present in
𝑩𝒂𝒍𝒍 (𝒖 ,𝑽 ,𝑳)
![Page 19: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/19.jpg)
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:
19
Each vertex in keeps a Ball)
![Page 20: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/20.jpg)
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
20
![Page 21: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/21.jpg)
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.
21
![Page 22: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/22.jpg)
3-approximate distance oracle
22
𝑽
𝑳
![Page 23: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/23.jpg)
5-approximate distance oracle
23
𝑽
𝑳𝟏
𝑳𝟐
![Page 24: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/24.jpg)
24
5-approximate distance oracle
𝒖 𝑳𝟏(𝒖)
𝑩𝒂𝒍𝒍 (𝒖 ,𝑽 ,𝑳𝟏)
𝑩𝒂𝒍𝒍 (𝒖 ,𝑳𝟏 ,𝑳𝟐)
𝑳𝟐(𝒖)
![Page 25: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/25.jpg)
PROBLEM 2MIN-CUT
25
![Page 26: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/26.jpg)
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.
26
![Page 27: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/27.jpg)
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.
27
![Page 28: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/28.jpg)
SOME BASIC FACTS
28
![Page 29: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/29.jpg)
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:
29
![Page 30: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/30.jpg)
Contract()
30
𝒖
𝒗
𝒘𝒚
𝒙 𝒂
𝒃 𝒉
𝒍
𝒙𝒚
𝒖
𝒗
𝒘
𝒂
𝒃 𝒉
𝒍
Contract(
![Page 31: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/31.jpg)
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():
31
![Page 32: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/32.jpg)
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:
32
≤𝒌
𝒏𝒌 /𝟐≤𝟐𝒏
![Page 33: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/33.jpg)
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:
33
![Page 34: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/34.jpg)
Algorithm for min-cut
Min-cut():{ Repeat ?? times {
Let ; Contract().
} return the edges of multi-graph ;}
Running time:
34
𝒏−𝟐
![Page 35: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/35.jpg)
Algorithm for min-cut
Question: What is probability that is preserved during the algorithm ?Answer:
= = >
35
![Page 36: Lecture 18-cs648](https://reader036.vdocuments.net/reader036/viewer/2022062514/5588e581d8b42a1c148b465f/html5/thumbnails/36.jpg)
Algorithm for min-cut
Min-cut-high-probability():{ Repeat Min-cut() algorithm log times and report the smallest cut computed;} Running time: Error Probability : <
36