Approximating Distances in Graphs Uri Zwick Tel Aviv University Otwarte wykłady dla doktorantów informatyki Instytut Informatyki Uniwersytetu Warszawskiego.

Slides:



Advertisements
Similar presentations
Lower Bounds for Additive Spanners, Emulators, and More David P. Woodruff MIT and Tsinghua University To appear in FOCS, 2006.
Advertisements

all-pairs shortest paths in undirected graphs
Approximate Distance Oracles and Spanners with sublinear surplus Mikkel Thorup AT&T Research Uri Zwick Tel Aviv University.
Theory of Computing Lecture 6 MAS 714 Hartmut Klauck.
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
3.3 Spanning Trees Tucker, Applied Combinatorics, Section 3.3, by Patti Bodkin and Tamsen Hunter.
Everything you always wanted to know about spanners * *But were afraid to ask Seth Pettie University of Michigan, Ann Arbor.
A Randomized Linear-Time Algorithm to Find Minimum Spanning Trees David R. Karger David R. Karger Philip N. Klein Philip N. Klein Robert E. Tarjan.
1 Discrete Structures & Algorithms Graphs and Trees: II EECE 320.
All Pairs Shortest Paths and Floyd-Warshall Algorithm CLRS 25.2
1 Sadna in Algorithms Haim Kaplan and Svetlana Olonetsky Tel Aviv University, fall 07/08.
Testing the Diameter of Graphs Michal Parnas Dana Ron.
1 Algorithms for Large Data Sets Ziv Bar-Yossef Lecture 8 May 4, 2005
Randomized Algorithms and Randomized Rounding Lecture 21: April 13 G n 2 leaves
1 On Dynamic Shortest Paths Problems Liam Roditty Uri Zwick Tel Aviv University ESA 2004.
1 Finding cycles using rectangular matrix multiplication and dynamic programming Raphael Yuster Haifa Univ. - Oranim Uri Zwick Tel Aviv University Uri.
Greedy Algorithms Reading Material: Chapter 8 (Except Section 8.5)
1 Approximate Distance Oracles Mikkel Thorup AT&T Research Uri Zwick Tel Aviv University.
Compact Routing Schemes Mikkel Thorup Uri Zwick AT&T Labs – Research Tel Aviv University.
1 On the Benefits of Adaptivity in Property Testing of Dense Graphs Joint work with Mira Gonen Dana Ron Tel-Aviv University.
1 Separator Theorems for Planar Graphs Presented by Shira Zucker.
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
Randomness in Computation and Communication Part 1: Randomized algorithms Lap Chi Lau CSE CUHK.
1 Exact and Approximate Distances in Graphs – A Survey Uri Zwick Tel Aviv University.
Introduction Outline The Problem Domain Network Design Spanning Trees Steiner Trees Triangulation Technique Spanners Spanners Application Simple Greedy.
Tirgul 13 Today we’ll solve two questions from last year’s exams.
TECH Computer Science Graph Optimization Problems and Greedy Algorithms Greedy Algorithms  // Make the best choice now! Optimization Problems  Minimizing.
Randomized Algorithms Morteza ZadiMoghaddam Amin Sayedi.
Theory of Computing Lecture 10 MAS 714 Hartmut Klauck.
Algorithms: Design and Analysis Summer School 2013 at VIASM: Random Structures and Algorithms Lecture 3: Greedy algorithms Phan Th ị Hà D ươ ng 1.
Fixed Parameter Complexity Algorithms and Networks.
Design Techniques for Approximation Algorithms and Approximation Classes.
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
Spring 2015 Lecture 11: Minimum Spanning Trees
GRAPH SPANNERS by S.Nithya. Spanner Definition- Informal A geometric spanner network for a set of points is a graph G in which each pair of vertices is.
Near Optimal Streaming algorithms for Graph Spanners Surender Baswana IIT Kanpur.
Distance sensitivity oracles in weighted directed graphs Raphael Yuster University of Haifa Joint work with Oren Weimann Weizmann inst.
 2004 SDU Lecture 7- Minimum Spanning Tree-- Extension 1.Properties of Minimum Spanning Tree 2.Secondary Minimum Spanning Tree 3.Bottleneck.
All-Pairs Shortest Paths & Essential Subgraph 01/25/2005 Jinil Han.
Greedy Algorithms and Matroids Andreas Klappenecker.
알고리즘 설계 및 분석 Foundations of Algorithm 유관우. Digital Media Lab. 2 Chap4. Greedy Approach Grabs data items in sequence, each time with “best” choice, without.
Approximate Distance Oracles Mikkel Thorup and Uri Zwick Presented By Shiri Chechik.
1 The Floyd-Warshall Algorithm Andreas Klappenecker.
Lower Bound for Sparse Euclidean Spanners Presented by- Deepak Kumar Gupta(Y6154), Nandan Kumar Dubey(Y6279), Vishal Agrawal(Y6541)
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
A randomized linear time algorithm for graph spanners Surender Baswana Postdoctoral Researcher Max Planck Institute for Computer Science Saarbruecken,
Connectivity. Graph Scanning Algorithm Input: A graph G and some vertex s. Output: The set R of vertices reachable from s and a set T ⊆ E(G) such that.
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. Fast.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
Proof of correctness of Dijkstra’s algorithm: Basically, we need to prove two claims. (1)Let S be the set of vertices for which the shortest path from.
Theory of Computational Complexity Yusuke FURUKAWA Iwama Ito lab M1.
On Local Partition Oracles and their Applications
Improved Randomized Algorithms for Path Problems in Graphs
Greedy Algorithms / Minimum Spanning Tree Yin Tat Lee
Spanners and emulators with sublinear distance errors
Autumn 2016 Lecture 11 Minimum Spanning Trees (Part II)
Enumerating Distances Using Spanners of Bounded Degree
Randomized Algorithms CS648
Analysis of Algorithms
Autumn 2015 Lecture 11 Minimum Spanning Trees (Part II)
Algorithms (2IL15) – Lecture 5 SINGLE-SOURCE SHORTEST PATHS
Approximate Distance Oracles and Spanners with sublinear surplus
Discrete Math II Howon Kim
Approximating Distances in Graphs
Raphael Yuster Haifa University Uri Zwick Tel Aviv University
Approximate Distance Oracles
Exact and Approximate Distances in Graphs – A Survey
The Greedy Approach Young CS 530 Adv. Algo. Greedy.
Winter 2019 Lecture 11 Minimum Spanning Trees (Part II)
Autumn 2019 Lecture 11 Minimum Spanning Trees (Part II)
Presentation transcript:

Approximating Distances in Graphs Uri Zwick Tel Aviv University Otwarte wykłady dla doktorantów informatyki Instytut Informatyki Uniwersytetu Warszawskiego Kwietnia 27-28, 2007

APSP algorithm All-Pairs Shortest Paths n by n distance matrix Input: A weighted undirected graph G=(V,E), where |E|=m and |V|=n. Output: An n  n distance matrix. mn time n 2 space

An estimated distance  ’ (u,v) is of stretch t iff  (u,v)   ’ (u,v)  t ·  (u,v) An estimated distance  ’(u,v) is of surplus t iff  (u,v)   ’ (u,v)   (u,v) + t Approximate Shortest Paths Let  (u,v) be the distance from u to v. Multiplicative error Additive error

Multiplicative and additive spanners Let G=(V, E) be a weighted undirected graph on n vertices. A subgraph G’=(V, E’) is a t-spanner of G iff for every u,v  V we have  G’ (u,v) ≤ t  G (u,v). Let G=(V, E) be a unweighted undirected graph on n vertices. A subgraph G’=(V, E’) is an additive t-spanner of G iff for every u,v  V we have  G’ (u,v) ≤  G (u,v) + t.

Compact data structure APSP algorithm mn 1/k time n 1+1/k space Approximate Distance Oracles O(1) query time stretch 2k  1 Stretch-Space tradeoff is essentially optimal! n by n distance matrix mn time n 2 space Weighted undirected graph u,v δ’(u,v(

1.All-pairs almost shortest paths (unweighted) a.An O(n 5/2 )-time surplus-2 algorithm (ACIM’96) b.Additive 2-spanners with O(n 3/2 ) edges. c.An O(n 3/2 m 1/2 )-time surplus-2 algorithm (DHZ’96) 2.Multiplicative spanners (weighted graphs) a.(2k  1)-spanners with n 1+1/k edges (ADDJS’93) b.Linear time construction (BS’03) 3.Approximate distance oracles (weighted graphs) a.Stretch=2k  1 query time=O(1) space=O(kn 1+1/k ) (TZ’01) 4.Spanners with sublinear distance errors (unweighted) a.Additive error O(d 1/(k  1) ) with O(kn 1+1/k ) edges (TZ’05)

All-Pairs Almost Shortest Paths unweighted, undirected graphs AuthorsTimeSurplus folklore mn0 ” n 2 (m/n) 1/k 2(k  1) ” n 2+1/(3k  4) 2(k  1) Aingworth-Chekuri- Indyk-Motwani ’96 n 5/2 2 Dor-Halperin-Zwick ’96 n 3/2 m 1/2 2 ” n 7/3 2

1)Add each vertex v to A, independently, with probability n  1/2. (Elements of A are “centers”.) 2)From every center v  A, find a tree of shortest paths from v and add its edges to E’. 3)For every non-center  v  A: a)If v has a neighbor u  A, then add the single edge (u,v) to E’. b)Otherwise, add all the edges incident to v to E’. 4)Solve the APSP problem on the subgraph G’=(V, E’). O(n 5/2 )-time surplus-2 algorithm unweighted, undirected graphs O(n) O(m|A|) = O(n 5/2 ) O(m) O(n|E’|) = O(n 5/2 )

Number of edges in E’ The expected # of edges added to E’ in 2) is O(n 3/2 ). The expected # of edges added to E’ in 3) is also O(n 3/2 ). Consider a vertex v of degree d Hence, the expected number of edges incident to v added to E’ is at most d(1  n  1/2 ) d + 1 ≤ n 1/2 If one of the neighbors of v is placed in A, then E’ will contain only one edge incident on v. v Exercise 0: Check it!

The surplus-2 algorithm Correctness – Case 1 Case 1: No vertex on a shortest path from u to v has a neighboring center. All the edges on the path are in E’. We find a shortest path from u to v. uv

The surplus-2 algorithm Correctness – Case 2 Case 2: At least one vertex on a shortest path from u to v has a neighboring center. We find a path from u to v of surplus at most 2 uv w  (u,w)+1  (w,v)+1 w’

Additive 2-spanners [ACIM’96] [DHZ’96] Every unweighted undirected graph G=(V, E) on n vertices has a subgraph G’=(V, E’) with O(n 3/2 ) edges such that for every u,v  V we have  G’ (u,v) ≤  G (u,v) + 2. Additive 6-spanners [BKMP ’04] Every unweighted undirected graph G=(V, E) on n vertices has a subgraph G’=(V, E’) with O(n 4/3 ) edges such that for every u,v  V we have  G’ (u,v) ≤  G (u,v) + 6. Major open problem: Are there additive spanners with o(n 4/3 ) edges?

Exercise 1: Show that with high probability, all distances larger than 2n 1/2 ln n are correctly computed by the O(n 5/2 ) time surplus 2 algorithm.

1)Add each vertex v to A, independently, with probability (n/m) 1/2. (Elements of A are “centers”.) 2)From every center v  A, find distances to all other vertices in the graph. (Do not add edges to E’.) 3)For every non-center  v  A: a)If v has a neighbor u  A, then add the single edge (u,v) to E’. b)Otherwise, add all the edges incident to v to E’. 4)For every non-center vertex v  A: a)Construct a set F(v)={ (v,w) | w  A } of weighted edges. The weight of an edge (v,w) is  (w,v). b)Find distances from v to all other vertices in the weighted graph G’(v)=(V, E’  F(v)). O(n 3/2 m 1/2 )-time surplus-2 algorithm unweighted, undirected graphs

O(n 3/2 m 1/2 )-time surplus-2 algorithm Correctness – Case 2 Case 2: At least one vertex on a shortest path from u to v has a neighboring center. Consider the last vertex with a neighboring center. We find a path from u to v of surplus at most 2 uvw  (u,w)+1 w’

All-Pairs Almost Shortest Paths weighted undirected graphs ReferenceTimeStretch Dijkstra ’59 mn 1 Cohen-Zwick ’97 n 3/2 m 1/2 2 ” n 7/3 7/3 ” n2n2 3 Some log factors ignores

Spanners Given an arbitrary dense graph, can we always find a relatively sparse subgraph that approximates all distances fairly well?

Spanners [PU’89,PS’89] Let G=(V,E) be a weighted undirected graph. A subgraph G’=(V,E’) of G is said to be a t-spanner of G iff δ G’ (u,v) ≤ t δ G (u,v) for every u,v  V. Theorem: Every weighted undirected graph has a (2k  1) -spanner of size O(n 1+1/k ). [ADDJS’93] Furthermore, such spanners can be constructed deterministically in linear time. [BS’03] [RTZ’05] The size-stretch trade-off is optimal if there are graphs with  (n 1+1/k ) edges and girth 2k+2, as conjectured by Erdös and others.

Exercise 2: Show that the following simple algorithm constructs, in O(m) time, a (2k  1)-spanner with at most n 1+1/k edges of any undirected unweighted graph. While the graph is not empty, choose a vertex v  V. Let N i (v) be the set of vertices of distance at most i from v. Let j be the smallest integer for which |N j (v)| ≤ n 1/k |N j  1 (v)|. Add to the spanner a tree of shortest path from v to all vertices of N j (v) and delete the vertices of N j  1 (v) and all the edges adjacent to them from the graph.

Exercise 3: The girth of a graph is the size of the shortest cycle in the graph. Use the construction of the previous exercise to show that the girth of any graph with at least n 1+1/k edges is at most 2k. Girth Conjecture (Erdös and others): There are n-vertex graphs with Ω(n 1+1/k ) edges that have girth > 2k. Known for k=1,2,3,5.

A simple spanner construction algorithm [Althöfer, Das, Dobkin, Joseph, Soares ’93] Consider the edges of the graph in non-decreasing order of weight. Add each edge to the spanner if it does not close a cycle of size at most 2k. The resulting graph is a (2k  1)-spanner. The resulting graph has girth  > 2k. Hence, number of edges in it is at most n 1+1/k.

If |cycle|  2k, then red edge can be removed.

Exercise 4: Let m g (n) be the maximum number of edges in an n-vertex graph of girth  g. Show that every n-vertex graph has a t-spanner with at most m t+2 (n) edges and that this result is best possible.

Linear time spanner construction [Baswana-Sen ’03] The algorithm is composed of k iterations. At each iteration some edges are added to the spanner and some edges and vertices are removed from the graph. At the end of the i-th iteration we have a collection of about n 1  i/k trees of depth at most i that contain all the surviving vertices of the graph.

Tree properties The edges of the trees are spanner edges. The weights of the edges along every leaf-root path are non-increasing. For every surviving edge (u,v) we have w(u,v)  w(u,p(u)), where p(u) is the parent of u. i w1w1 w3w3 w2w2 w4w4 w 1  w 2  w 3 w 4  w 2

Notation A i – roots of trees of the i-th iteration T(v) – the tree rooted at v T(v)T(v) u v E(u,T(v)) – the edges connecting u and T(v). e(u,T(v)) – the lightest edge from E(u,T(v)). w(u,T(v)) – the weight of e(u,T(v)) (or  ).

The i-th iteration Each vertex v  A i-1 is added to A i with probability n  1/k. In the last iteration A k . u v1v1 Let v 1,v 2,… be the vertices of A i-1 such that w(u,T(v 1 )) ≤ w(u,T(v 2 )) ≤ … v2v2 vrAivrAi Let r=r(u) be the minimal index for which v r  A i. If there is no such index, let r(u)=  |A i  1 |.

The i-th iteration (cont.) u v1v1 For every vertex u that belongs to a tree whose root is in A i-1  A i : v2v2 For every 1 ≤ j ≤ r : Add e(u,T(v i )) to the spanner. Remove E(u,T(v i )) from the graph Remove edges that connect vertices in the same tree. Remove vertices that have no remaining edges. vrAivrAi

How many edges are added to the spanner? u v1v1 v2v2 vrAivrAi E[r(u)] ≤ n 1/k Hence, the expected number of edges added to the spanner in each iteration is at most n 1+1/k.

What is the stretch? i1i1 Let e be an edge deleted in the i-th iteration. The spanner contains a path of at most 2(i  1)+1 edges between the endpoints of e. e The edges of the path are not heavier than e Hence, stretch ≤ 2k  1

Exercise 4: Complete the proof that the algorithm of Baswana-Sen algorithm produces a (2k  1)-spanner with at most O(kn 1+1/k ) edges. Show that it can be implemented to run in O(km) time. Exercise 5: Prove the correctness of the following variant of the Baswana-Sen algorithm: Perform only the first (k  1)/2 iterations of the original algorithm. (Assume that k is odd.) For every pair of trees produced in the last iteration, find the lightest surviving edge that connects them and add it to the spanner. Note that a factor of k is lost in the number of edges.

1.All-pairs almost shortest paths (unweighted) a.An O(n 5/2 )-time surplus-2 algorithm (ACIM’96) b.Additive 2-spanners with O(n 3/2 ) edges. c.An O(n 3/2 m 1/2 )-time surplus-2 algorithm (DHZ’96) 2.Multiplicative spanners (weighted graphs) a.(2k  1)-spanners with n 1+1/k edges (ADDJS’93) b.Linear time construction (BS’03) 3.Approximate distance oracles (weighted graphs) a.Stretch=2k  1 query time=O(1) space=O(kn 1+1/k ) (TZ’01) 4.Spanners with sublinear distance errors (unweighted) a.Additive error O(d 1/(k  1) ) with O(kn 1+1/k ) edges (TZ’05)

Compact data structure APSP algorithm mn 1/k time n 1+1/k space Approximate Distance Oracles (TZ’01) O(1) query time stretch 2k  1 Stretch-Space tradeoff is essentially optimal! n by n distance matrix mn time n 2 space Weighted undirected graph u,v δ’(u,v(

Approximate Distance Oracles [TZ’01] A hierarchy of centers A 0  V ; A k  A i  sample(A i  1,n  1/k )

Bunches A 0 = A 1 = A 2 = v p1(v)p1(v) p2(v)p2(v)

Lemma: E[|B(v)|] ≤ kn 1/k Proof: |B(v)  A i | is stochastically dominated by a geometric random variable with parameter p=n  1/k.

The data structure Keep for every vertex v  V: The centers p 1 (v), p 2 (v),…, p k-1 (v) A hash table holding B(v) For every w  V, we can check, in constant time, whether w  B(v), and if so, what is  (v,w).

Query answering algorithm Algorithm dist k (u,v) w  u, i  0 while w  B(v) { i  i+1 (u,v)  (v,u) w  p i (u) } return  (u,w)+  (w,v)

Query answering algorithm w 0 = u v w1=p1(v)A1w1=p1(v)A1 w2=p2(u)A2w2=p2(u)A2 w3=p3(v)A3w3=p3(v)A3

u v wi1=pi1(v)Ai1wi1=pi1(v)Ai1 wi=pi(u)Aiwi=pi(u)Ai Analysis  (i  1)  ii ii (i+1)  Claim 1: δ(u,w i ) ≤ iΔ, i even δ(v,w i ) ≤ iΔ, i odd Claim 2: δ(u,w i ) + δ(w i,v) ≤ (2i+1)Δ ≤ (2k  1)Δ

Exercise 6: What is the stretch of a query answering algorithm that does not swap u and v in each iteration, i.e., finds the smallest i for which w=p i (u)  B(v) and returns  (u,w)+  (w,v) ?

Where are the spanners? Define clusters, the “duals” of bunches. For every u  V, put in the spanner a tree of shortest paths from u to all the vertices in the cluster of u.

Bunches and Clusters

Clusters A 0 = A 1 = A 2 = w

Computing Clusters Lemma: If v  C(w) and u lies on a shortest path from w to v, then u  C(w). Using this fact, each cluster can be computed by a modified version of Dijkstra’s algorithm that only examines edges that touch vertices of the cluster.

Exercise 7: Show that the subgraph composed of the shortest path trees of the clusters is a (2k  1)-spanner with an expected number of O(kn 1+1/k ) edges.

Approximate distance oracles - summary Preproceesing time = O(kmn 1+1/k ) Space = O(n 1+1/k ) Query time = O(k) Stretch ≤ 2k  1 The space/stretch tradeoff is essentially optimal (modulo the girth conjecture) Can the query time be reduced to O(1)? Manor and Naor (2006) recently gave a solution with space = O(n 1+1/k ), stretch = O(k), query time = O(1)

Exercise 8: Show that the subgraph composed of the shortest path trees of the clusters is a (2k  1)-spanner with an expected number of O(kn 1+1/k ) edges.

Additive Spanners Let G=(V,E) be a unweighted undirected graph. A subgraph G’=(V, E’) of G is said to be an additive t-spanner of G iff δ G’ (u,v) ≤ δ G (u,v) +t for every u,v  V. Theorem: Every unweighted undirected graph has an additive 2-spanner of size O(n 3/2 ). [ACIM ’96] [DHZ ’96] Theorem: Every unweighted undirected graph has an additive 6-spanner of size O(n 4/3 ). [BKMP ’04] Major open problem Do all graphs have additive spanners with only O(n 1+ε ) edges, for every ε>0 ?

Spanners with sublinear surplus Theorem: For every k > 1, every undirected graph G=(V,E) on n vertices has a subgraph G’=(V,E’) with O(n 1+1/k ) edges such that for every u,v  V, if δ G (u,v)=d, then δ G’ (u,v)=d+O(d 1  1/(k  1) ). dd + O(d 1  1/(k  1) ) Extends and simplifies a result of Elkin and Peleg (2001) Improved recently by Pettie (2007)

All sorts of spanners A subgraph G’=(V,E’) of G is said to be a functional f-spanner if G iff δ G’ (u,v) ≤ f(δ G (u,v)) for every u,v  V. sizef(d)reference βn 1+δ (1+ε)d + β(ε,δ) [EP ’01] n 3/2 d + 2 [ACIM ’96] [DHZ ’96] n 4/3 d + 6 [BKMP ’04] n 1+1/k d + O(d 1  1/(k  1) ) [TZ ’05] n 1+1/k (2k  1 )d [ADDJS ’93]

The construction of the approximate distance oracles, when applied to unweighted graphs, produces spanners with sublinear surplus! We present a slightly modified construction with a slightly simpler analysis.

Balls u p1(u)p1(u) p2(u)p2(u) A 0 = A 1 = A 2 =

Spanners with sublinear surplus For every u  V, add to the spanner a shortest paths tree of Ball[u]. Select a hierarchy of centers A 0  A 1  …  A k  1.

The path-finding strategy Let Δ be an integer parameter. Suppose we are at u  A i and want to go to v. If the first x i = Δ i  Δ i  1 edges of a shortest path from u to v are in the spanner, then use them. Otherwise, head for the (i+1)-center u i+1 nearest to u. uAiuAi v u i+1  A i+1 xixi xixi ► The distance to u i+1 is at most x i. (As u’  Ball(u).) u’u’

The path-finding strategy uAiuAi v u i+1  A i+1 xixi xixi u’u’ We either reach v, or at least make x i = Δ i  Δ i  1 steps in the right direction. Or, make at most x i = Δ i  Δ i  1 steps, possibly in a wrong direction, but reach a center of level i+1. If i=k  1, we will be able to reach v.

The path-finding strategy u0u0 v xi1xi1 uiui x1x1 x0x0 xi2xi2 x i = Δ i  Δ i  1 Δi1Δi1 After at most Δ i steps: we reach v distance to v decreased by Δ i  2Δ i  1 u’ or

The path-finding strategy Surplus 2Δ i  1 Stretch The surplus is incurred only once! After at most Δ i steps: we reach v distance to v decreased by Δ i  2Δ i  1

Sublinear surplus This holds for any Δ ! Δ is part of the analysis, not the construction.

Improved spanners with additive error Pettie (2007) has recently obtained improved spanners with additive errors.

Main open problems Additive spanners? Approximate distance oracles with additive errors?