Transcript
Page 1: Efficient Dynamic Approximate Distance Oracles for Vertex

The Interdisciplinary Center, Herzlia Efi Arazi School of Computer Science

M.Sc. program - Research Track

Efficient Dynamic Approximate

Distance Oracles for Vertex-

Labeled Planar Graphs

Submitted by Itay Laish

Under the supervision of Dr. Shay Mozes.

M.Sc. dissertation, submitted in partial fulfillment of the requirements

for the M.Sc. degree, research track, School of Computer Science

The Interdisciplinary Center, Herzliya

July 2017

Page 2: Efficient Dynamic Approximate Distance Oracles for Vertex

Acknowledgements

First of all, I would like to thank my advisor Dr. Shay Mozes, for providing me much

needed directions, especially, when I was sure I'm facing a dead end, and for introducing

me to the world of research, and investing exponential amount of time, teaching and

tutoring me. His way of thinking and passion to find efficient, yet elegant solutions inspired

me, and gave me the drive to look deeper and wider, and to seek for ideas in different

places.

Second, I would like to thank Paweł Gawrychowski and Oren Weimann for fruitful

discussions, and for well appreciated tips, that found their way into this research.

Page 3: Efficient Dynamic Approximate Distance Oracles for Vertex

Abstract

Let šŗ be a graph where each vertex is associated with a label. An Approximate Vertex-

Labeled Distance Oracle is a data structure that, given a vertex š‘£ and a label šœ†, returns a

(1 + šœ€)-approximation of the distance from š‘£ to the closest vertex with label šœ† in šŗ. Such

an oracle is dynamic if it also supports label changes. In this thesis we present three

different dynamic approximate vertex-labeled distance oracles for planar graphs, all with

polylogarithmic query and update times, and nearly linear space requirements. No

previously known approximate vertex-labeled distance oracle supported both queries and

updates in sublinear time.

Page 4: Efficient Dynamic Approximate Distance Oracles for Vertex

Contents

1 Introduction 5

1.1 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . 61.2 Our Results and Techniques . . . . . . . . . . . . . . . . . . 7

2 Preliminaries 10

2.1 Existing techniques . . . . . . . . . . . . . . . . . . . . . . . 12

3 Undirected Graphs With Faster Query 16

3.1 Warm Up: The Static Case . . . . . . . . . . . . . . . . . . 173.2 The Dynamic Case . . . . . . . . . . . . . . . . . . . . . . . 20

4 Directed Graphs 23

4.1 Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264.2 Update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

5 Undirected Graphs With Faster Update 32

6 Concluding remarks 38

Bibliography 40

Appendix 43

4

Page 5: Efficient Dynamic Approximate Distance Oracles for Vertex

1 Introduction

Consider the following scenario. A 911 dispatcher receives a call about are and needs to dispatch the closest re truck. There are two dicultieswith locating the appropriate vehicle to dispatch. First, the vehicles areon a constant move. Second, there are dierent types of emergency vehi-cles, whereas the dispatcher specically needs a re truck. Locating theclosest unit of certain type under these assumptions is the dynamic vertex-labeled distance query problem on the road network graph. Each vertex inthis graph can be annotated with a label that represents the type of theemergency vehicle currently located at that vertex. An alternative scenariowhere this problem is relevant is when one wishes to nd a service provider(e.g., gas station, coee shop), but dierent locations are open at dierenttimes of the day.

A data structure that answers distance queries between a vertex and alabel, and supports label updates is called a dynamic vertex-labeled distanceoracle. We model the road map as a planar graph, and extend previousresults for the static case (where labels are xed). We present oracles withpolylogarithmic update and query times (in the number of vertices) thatrequire nearly linear space.

We focus on approximate vertex-labeled distance oracles for xed pa-rameter Īµ ā‰„ 0. When queried, such an oracle returns at least the truedistance, but not more than (1 + Īµ) times the true distance. These are alsoknown as stretch-(1 + Īµ) distance oracles. Note that, in our context, thegraph is xed, and only the vertex labels change.

5

Page 6: Efficient Dynamic Approximate Distance Oracles for Vertex

1. INTRODUCTION 6

1.1 Related Work

Approximate vertex-to-vertex distance oracles

We outline related results, and refer the reader to an extensive survey dueto Sommer [Som14]. For general graphs, Thorup and Zwick [TZ01] pre-sented for every k ā‰„ 2 a stretch-(2k āˆ’ 1) vertex-to-vertex distance oracle

for undirected graphs with O(kn1+ 1k ) space, and O(k) query time. Their

oracle can be constructed in O(kmn1+ 1k ) time. Wul-Nilsen [Wul12] gave

an oracle with similar space and query time, and O(kn1+ ck ) construction

time. Here c is some universal constant.For planar graphs, Thorup [Tho04] presented a stretch-(1 + Īµ) distance

oracle for directed planar graphs, for any 0 < Īµ < 1. His oracle requiresO(Īµāˆ’1n log n log(nN)) space and answers queries in O(log log (nN) + Īµāˆ’1)time. Here N denotes the ratio of the largest to smallest arc length. Forundirected planar graphs Thorup presented an oracle that can be stored us-ingO(Īµāˆ’1n log n) space, and can answer queries inO(Īµāˆ’1) time. Klein [Kle02,Kle05] independently described a stretch-(1 + Īµ) distance oracle for undi-rected graphs with the same bounds, but faster preprocessing time. Kawarabayashi,Klein and Sommer [KKS11], extended Thorup's result to other families ofrestricted graphs (e.g. minor free, bounded genus) and improved its spacerequirements to O(n) in the cost of increasing the query time by a factorof Īµāˆ’1 log2 n. Kawarabayashi, Sommer and Thorup [KST13] reduced thespace dependency by a factor of Īµāˆ’1 log n, while keeping the query time ofO(Īµāˆ’1). They also show an oracle for unweighted graphs that can be storedusing O(n) space, and has O(Īµāˆ’1) query time. Abraham, Chechik andGavoille [ACG12] presented a stretch-(1 + Īµ) distance oracle that supportsboth query and edge length updates in O(n1/2) time worst case. Abra-ham et al. [ACD+16] later provided an oracle with polylogarithmic updateand query time for planar graphs, when the edge lengths can only changewithin a predetermined ratio. In this work, we consider a dierent setting ofupdates, where the edge lengths are xed, and only the vertex label change.

Approximate vertex-to-label distance oracles

The vertex-to-label query problem was introduced at ICALP'11 by Her-melin, Levy, Weimann and Yuster [HLWY11]. For any k ā‰„ 2, They pre-sented a stretch-(4k āˆ’ 5) distance oracle for undirected general (i.e. not

Page 7: Efficient Dynamic Approximate Distance Oracles for Vertex

1. INTRODUCTION 7

necessarily planar) graphs with O(kn1+ 1k ) space and query time O(k). In

a second result, they gave a dynamic label-to-vertex distance oracle thatcan handle label changes in sub-linear time, but with exponential stretch interms of k, (2 Ā· 3kāˆ’1 + 1). Chechik [Che12] later improved their results,

and presented a stretch-(4k āˆ’ 5) distance oracle that requires O(n1+ 1k )

expected space, and supports queries in O(k) time, and label changes in

O(n1k log1āˆ’ 1

k n log log n) time. Her oracle can be constructed usingO(kmn1k )

time.The rst result for the static vertex-to-label query problem for undirected

planar graphs is due to Li, Ma and Ning [LMN13]. They described a stretch-(1 + Īµ) distance oracle that is based on Klein's results [Kle02]. Their oraclerequires O(Īµāˆ’1n log n) space, and answers queries in O(Īµāˆ’1 log n log āˆ†) time.Here āˆ† is the hop-diameter of the graph, which can be Ī˜(n). Mozes andSkop [MS15], building on Thorup's oracle, described a stretch-(1 + Īµ) dis-tance oracle for directed planar graphs that can be stored usingO(Īµāˆ’1n log n log(nN))space, and has O(log log n log log nN + Īµāˆ’1) query time.

Li Ma and Ning [LMN13] considered the dynamic case, but their updatemethod was trivial and takes Ī˜(n log n) time in the worst case. Ā”cki etal. [aOP+15] presented a dierent dynamic vertex-to-label oracle for undi-rected planar graphs, in the context of computing Steiner trees. Theirorcale requires O(

āˆšn log2 n logDĪµāˆ’1) amortized time per update or query

(in expectation), where D is the stretch of the metric of the graph (could benN). Their oracle however does not support changing the label of a specicvertex. Instead, they represent the labels in a forest, and support mergingtwo labels by connecting two trees in the forest. Likewise, they supportsplitting labels by removing an edge from the forest, dividing a single treeinto two trees.

To the best of our knowledge, our distance oracles are the rst stretch(1 + Īµ) vertex-to-label distance oracles with polylogarithmic query and up-date times, and the rst that support directed planar graphs.

1.2 Our Results and Techniques

We present three approximate vertex-labeled distance oracles with polylog-arithmic query and update times and nearly linear space and preprocessingtimes. Our update and construction times are expected amortized due to

Page 8: Efficient Dynamic Approximate Distance Oracles for Vertex

1. INTRODUCTION 8

the use of dynamic hashing.1 Our solutions dier in the tradeo betweenquery and update times. One solution works for directed planar graphs,whereas the other two only work for undirected planar graphs.

We obtain our results by building on and combining existing techniquesfor the static case. All of our oracles rely on recursively decomposing thegraph using shortest paths separators. Our rst oracle for undirected graphs(Section 3) uses uniformly spaced connections, and eciently handles themusing fast predecessor data structures. The upshot of this approach is thatthere are relatively few connections. The caveat is that this approach onlyworks when working with bounded distances, so a scaling technique [Tho04]is required.

Our second oracle for undirected graphs (Section 5) uses the approachtaken by Li, Ma and Ning [LMN13] in the static case. Each vertex has adierent set of connections, which are handled eciently using a dynamicprex minimum query data structure. Such a data structure can be ob-tained using a data structure for reporting points in a rectangular region ofthe plane [Wil14].

Our oracle for directed planar graphs (Section 4) is based on the staticvertex-labeled distance oracle of [MS15], which uses connections for sets ofvertices (i.e., a label) rather than connections for individual vertices. Weshow how to eciently maintain the connections for a dynamically changingset of vertices using a bottom-up approach along the decomposition of thegraph.

Our data structures support both queries and updates in polylogarith-mic time. No previously known data structure supported both queries andupdates in sublinear time. The following table summarizes the comparisonbetween our oracles and the relevant previously known ones.

1We assume that a single comparison or addition of two numbers takes constant

time.

Page 9: Efficient Dynamic Approximate Distance Oracles for Vertex

1. INTRODUCTION 9

Table 1.1: Vertex-to-Label Distance Oracles Time Bound Comparison

D/U Query time Update time

Li, Ma and Ning [LMN13] U O(Īµāˆ’1 log n log āˆ†) O(n log n)

Ā”cki at el. [aOP+15] U O(Īµāˆ’1āˆšn log2 n logD) O(Īµāˆ’1

āˆšn log2 n logD)

Section 3 (faster query) U O(Īµāˆ’1 log n log log nN) O(Īµāˆ’1 log n log log Īµāˆ’1 log nN)

Section 5 (faster update) U O(Īµāˆ’1 log2 (Īµāˆ’1n)log log (Īµāˆ’1n)

) O(Īµāˆ’1 log1.51(Īµāˆ’1n))

Mozes and Skop [MS15] D O(Īµāˆ’1 + log log n log log nN) N/A

Section 4 D O(Īµāˆ’1 log n log log nN) O(Īµāˆ’1 log3 n log nN)In the table above, D/U stands for Directed and Undirected graphs.

Page 10: Efficient Dynamic Approximate Distance Oracles for Vertex

2 Preliminaries

An undirected (respectively directed) graph G is a tuple consisting of anite set of objects named vertices, denoted by V (G), and a set of edges(resp, arcs) denoted by E(G). An undirected (resp. directed) edge (resp.arc), is an unordered (resp. ordered) pair of vertices. Given an edge e = uv,we say that u and v are the endpoints of e. If e is an arc (in a directedgraph), we say that the orientation of e is from u to v. An undirected (resp.directed) u-to-v path P is a sequence of vertices in V (G), that starts withu, ends with v, and for every pair (x, y) āˆˆ P there exists an edge (resp. anarc) xy āˆˆ E(G). A path P is called a simple path if every vertex in V (G)appears at most once in P . A cycle C is a path that begins and ends in thesame vertex. Analogously, a simple cycle is a cycle such that every vertexin C appears at most once, except from the rst vertex, that is also thelast.

For a directed graph G, we let Gā€² be the underlying undirected graphwhose vertices V (Gā€²) = V (G), and for every u, v āˆˆ V (G), E(Gā€²) containsan edge uv if and only if E(G) contains the arc uv or the arc vu. We saythat the graph G is connected if for every u, v āˆˆ V (G) there exists an u-to-vpath in Gā€².

An undirected tree T is an undirected connected graph that contains nocycles. I.e. for every pair of vertices u, v there exists a unique path fromu to v. A vertex v āˆˆ V (T ) is called a leaf of T if it is adjacent to atmost one other vertex. A rooted undirected tree is a tree T equipped witha vertex r āˆˆ V (T ) referred to as root. A spanning tree T of a graph Gis a subgraph of G (respectively, if G is directed, T is a subgraph of theunderlying undirected graph Gā€²) consisting of |V (G)āˆ’ 1| edges from E(G)(resp. E(Gā€²)), that forms a tree, such that for every v āˆˆ V (G) there existsa r-to-v path in T .

Let T be an undirected rooted tree. Let A(Ā·) be a boolean property that

10

Page 11: Efficient Dynamic Approximate Distance Oracles for Vertex

2. PRELIMINARIES 11

is dened over the vertices of T . For every v āˆˆ V (T ), we say that a vertexu is the root-most vertex on the v-to-root path P in T that fullls A, if uis the closest vertex to the root of T on the v-to-root path that fullls A.

Given an undirected graph G with a spanning tree T rooted at r andan edge uv not in T , the fundamental cycle of uv (with respect to T ) is thecycle composed of the r-to-u and r-to-v paths in T , and the edge uv.

Let ` : E(G) ā†’ R+ be a non-negative length function. Let N be theratio of the maximum and minimum values of `(Ā·). Let P be a path from u-to-v. The length of P is Ī£eāˆˆP `(e). The shortest u-to-v path is a path thatminimizes that distance. We dene the distance form u-to-v denoted byĪ“G(u, v), as the length of a shortest u-to-v path. We assume, only for easeof presentation, that shortest paths are unique. This assumption is onlyused when we present our algorithms and refer the shortest path betweentwo vertices. Our data structures do not require this assumption. For asimple path Q and a vertex set U āŠ† V (Q) with |U | ā‰„ 2, we dene QU , thereduction of Q to U as a path whose vertices are U . Consider the verticesof U in the order in which they appear in Q. For every two consecutivevertices u1, u2 of U in this order, there is an arc u1u2 in QU whose lengthis the length of the u1-to-u2 sub-path of Q.

Let L be a set of labels. We say that a graph G is vertex-labeled if everyvertex is assigned a single label from L. For a label Ī» āˆˆ L, let SĪ»G denotethe set of vertices in G with label Ī». We dene the distance from a vertexu āˆˆ V (G) to the label Ī» by Ī“G(u, Ī») = minvāˆˆSĪ»G Ī“G(u, v). If G does not

contain the label Ī», or Ī» is unreachable from u, we say that Ī“G(u, Ī») =āˆž.

Denition 1. For a xed parameter Īµ ā‰„ 0, a stretch-(1 + Īµ) vertex-labeleddistance oracle is a data structure that, given a vertex u āˆˆ V (G) and a labelĪ» āˆˆ L, returns a distance d satisfying Ī“G(u, Ī») ā‰¤ d ā‰¤ (1 + Īµ)Ī“G(u, Ī»).

Denition 2. For xed parameters Ī±, Īµ ā‰„ 0, a scale-(Ī±, Īµ) vertex-labeleddistance oracle is a data structure that, given a vertex u āˆˆ V (G) and a labelĪ» āˆˆ L, such that Ī“G(u, Ī») ā‰¤ Ī±, returns a distance d satisfying Ī“G(u, Ī») ā‰¤d ā‰¤ Ī“G(u, Ī») + ĪµĪ±. If Ī“G(u, Ī») > Ī±, the oracle returns āˆž.

The only properties of planar graphs that we use in this paper are theexistence of shortest path separators (see below), and the fact that singlesource shortest paths can be computed in O(n) time in a planar graph withn vertices [HKRS97].

Page 12: Efficient Dynamic Approximate Distance Oracles for Vertex

2. PRELIMINARIES 12

Denition 3. Let G be a directed graph. Let Gā€² be the undirected graphinduced by G. Let P be a path in Gā€². Let S be a set of vertex disjoint directedshortest paths in G. We say that P is composed of S if (the undirected pathcorresponding to) each shortest path in S is a subpath of P and each vertexof P is in some shortest path in S.

Denition 4. Let G be a directed embedded planar graph. An undirectedcycle C is a balanced cycle separator of G if each of the strict interior andthe strict exterior of C contains at most 2|V (G)|/3 vertices. If, additionally,C is composed of a constant number of directed shortest paths, then C iscalled a shortest path separator.

Let G be a planar graph. We assume that G is triangulated since we cantriangulate G with innite length edges, so that distances are not aected.It is well known [LT79, Tho04] that for any spanning tree of G, there existsa fundamental cycle C that is a balanced cycle separator. The cycle C canbe found in linear time. Note that, if T is chosen to be a shortest pathtree, or if any root-to-leaf path of T is composed of a constant number ofshortest paths, then the fundamental cycle C is a shortest path separator.

2.1 Existing Techniques for Approximate

Distance Oracles for Planar Graphs

Thorup shows that to obtain a stretch-(1 + Īµ) distance oracle, it suces toshow scale-(Ī±, Īµ) oracles for so-called Ī±-layered graphs. An Ī±-layered graphis one equipped with a spanning tree T such that each root-to-leaf path inT is composed of O(1) shortest paths, each of length at most Ī±. This issummarized in the following lemma:

Lemma 1. [Tho04, Lemma 3.9] For any planar graph G and xed param-eter Īµ, a stretch-(1 + Īµ) distance oracle can be constructed using O(log nN)scale-(Ī±, Īµā€²) distance oracles for Ī±-layered graphs, where Ī± = 2i, i = 0, ...dlog nNeand Īµā€² āˆˆ 1/2, Īµ/4. If the scale-(Ī±, Īµā€²) has query time t(Īµā€²) independent ofĪ±, the stretch-(1 + Īµ) distance oracle can answer queries in O(t(1/2)Īµāˆ’1 +t(Īµ/4) log log (nN)).

All of our distance oracles are based on a recursive decomposition of Gusing shortest path separators. If G is undirected (but not necessarily Ī±-layered), we can use any shortest path tree to nd a shortest path separator

Page 13: Efficient Dynamic Approximate Distance Oracles for Vertex

2. PRELIMINARIES 13

in linear time. Similarly, if G is Ī±-layered, we can use the spanning tree Gis equipped with to nd a shortest path separator in linear time.

We recursively decompose G into subgraphs using shortest path separa-tors until each subgraph has a constant number of vertices. We representthis decomposition by a binary tree TG. To distinguish the vertices of TGfrom the vertices of G we refer the former as nodes.

Each node r of TG is associated with a subgraph Gr. The root of TGis associated with the entire graph G. We sometimes abuse notation andequate nodes of TG with their associated subgraphs. For each non-leaf noder āˆˆ TG, let Cr be the shortest path separator of Gr. Let Sepr be the set ofshortest paths Cr is composed of. The subgraphs Gr1 and Gr2 associatedwith the two children of r in TG are the interior and exterior of Cr (w.r.t.Gr), respectively. Note that Cr belongs to both Gr1 and Gr2 . For a vertexv āˆˆ V (G), we denote by rv the leaf node of TG that contains v. See Fig. 2.1for an illustration.

We now describe the basic building block used in our (and in manyprevious) distance oracle. Let u, v be vertices in G. Let Q be a path onthe root-most separator (i.e., the separator in the node of TG closest to itsroot) that is intersected by the shortest u-to-v path P . Let t be a vertex inQāˆ©P . Note that Ī“G(u, v) = Ī“G(u, t)+Ī“G(t, v). Therefore, if we stored for uthe distance to every vertex on Q, and for v the distance from every vertexon Q, we would be able to nd Ī“G(u, v) by iterating over the vertices of Q,and nding the one minimizing the distance above. This, however, is notecient since the number of vertices on Q might be Īø(|V (G)|). Instead, westore the distances for a subset of Q. This set is called an (Ī±, Īµ)-coveringconnections set.

Denition 5 ((Ī±, Īµ)-covering connections set). [Tho04, Section 3.2.1] LetĪµ, Ī± ā‰„ 0 be xed constants. Let G be a directed graph. Let Q be a shortestpath in G of length at most Ī±. For u āˆˆ V (G) we say that CG(u,Q) āŠ† V (Q)is an (Ī±, Īµ)-covering connections set from u to Q if and only if for everyvertex t on Q s.t. Ī“G(u, t) ā‰¤ Ī±, there exists a vertex q āˆˆ CG(u,Q) such thatĪ“G(u, q) + Ī“G(q, t) ā‰¤ Ī“G(u, t) + ĪµĪ±.

One denes (Ī±, Īµ)-covering connections sets CG(Q, u) from Q to u sym-metrically. Thorup proves that there always exists an (Ī±, Īµ)-covering con-nections set of size O(Īµāˆ’1):

Page 14: Efficient Dynamic Approximate Distance Oracles for Vertex

2. PRELIMINARIES 14

š‘¢

š‘®

šŗ0 šŗ1

šŗ10

šŗ11

š‘Ÿ1

š’“

š‘Ÿ0

š‘Ÿ11 š‘Ÿ10

š‘Ÿš‘¢

ā€¦

š“£š‘®

šŗ111

šŗ110 š‘Ÿ111 š‘Ÿ110

š‘£

š‘Ÿš‘£

ā€¦

Figure 2.1: An illustration of (part of) the recursive decomposition of agraph G using cycle separators, and the corresponding decomposition treeTG. The graph G is decomposed using a cycle separator into G0, and G1.Similarly, G1 is decomposed into G10 and G11, and G11 is decomposed intoG110 and G111. The node r is the root of TG and is associated with Gr = G.Similarly, r1 is associated with G1, etc. The nodes ru and rv are the leafnodes that contain u and v, respectively. The node r1 is the root-most nodewhose separator is intersected by the shortest u-to-v path in G (indicatedin blue). Hence, this path is fully contained in Gr1 = G1.

Lemma 2. [Tho04, Lemma 3.4] Let G,Q, Īµ, Ī± and u be as in denition 5.There exists an (Ī±, Īµ)-covering connections set CG(u,Q) of size at mostd2Īµāˆ’1e. This set can be found in O(|Q|) if the distances from u to everyvertex on Q are given.

We will use the term Īµ-covering connections set whenever Ī± is obviousfrom the context. Thorup shows that (Ī±, Īµ)-covering connections sets canbe computed eciently.

Lemma 3. [Tho04, Lemma 3.15] Let H be an Ī±-layered graph. In O(Īµāˆ’2n log3 n)time and O(Īµāˆ’1n log n) space one can compute and store a decomposition THof H using shortest path separators, along with (Ī±, Īµ)-covering connections

Page 15: Efficient Dynamic Approximate Distance Oracles for Vertex

2. PRELIMINARIES 15

sets CH(u,Q) and CH(Q, u) for every vertex u āˆˆ V (H), every ancestor noder of ru in TH , and every Q āˆˆ Sepr.

Page 16: Efficient Dynamic Approximate Distance Oracles for Vertex

3 An Oracle for Undirected

Graphs With Faster Query

Let H be an undirected Ī±-layered graph,1 and let T be the associated span-ning tree of H. For any xed parameter Īµā€² we set Īµ = Īµā€²

3. We decompose

H using shortest path separators w.r.t. T . Let TH be the resulting decom-position tree. For every node r āˆˆ TH and every shortest path Q āˆˆ Sepr,we select a set CQ āŠ† V (Q) of Īµāˆ’1 connections evenly spread intervals alongQ.2 Thus, for every vertex t āˆˆ V (Q) there is a vertex q āˆˆ CQ such thatĪ“H(t, q) ā‰¤ ĪµĪ±.

For each r āˆˆ TH , for each shortest path Q āˆˆ Sepr, for each q āˆˆ CQ,we compute in O(|Hr|) time a shortest path tree in Hr rooted at q us-ing [HKRS97]. This computes the connection lengths Ī“Hr(u, q), for allu āˆˆ V (Hr).

Lemma 4. Let u āˆˆ V (H). For every ancestor node r āˆˆ TH of ru, andevery Q āˆˆ Sepr, CQ is a 2Īµ-covering connections set from u to Q.

Proof. Let t āˆˆ Q. We need to show that there exist q āˆˆ CQ such thatĪ“Hr(u, t) ā‰¤ Ī“Hr(u, q) + Ī“Hr(q, t) ā‰¤ Ī“Hr(u, t) + Īµā€²Ī±. Since t āˆˆ Q, there exists avertex q āˆˆ CQ such that Ī“H(q, t) ā‰¤ ĪµĪ±. Since H is undirected, the triangleinequality for shortest path lengths holds for any three vertices in V (H).

1 The discussion of Ī±-layered graphs in Section 2 refers to directed graphs, and hence

also applies to undirected graphs.2We assume that the endpoints of the intervals are vertices on Q, since otherwise

once can add articial vertices on Q without asymptotically changing the size of the

graph.

16

Page 17: Efficient Dynamic Approximate Distance Oracles for Vertex

3. UNDIRECTED GRAPHS WITH FASTER QUERY 17

We start with the triangle inequality between u, t and q in H as follows.

Ī“Hr(u, q) ā‰¤ Ī“Hr(u, t) + Ī“Hr(t, q) (3.1)

Ī“Hr(u, q) + Ī“Hr(t, q) ā‰¤ Ī“Hr(u, t) + Ī“Hr(t, q) + Ī“Hr(t, q) (3.2)

Ī“Hr(u, q) + Ī“Hr(t, q) ā‰¤ Ī“Hr(u, t) + 2ĪµĪ± (3.3)

From the triangle inequality, Ī“Hr(u, t) ā‰¤ Ī“Hr(u, q) + Ī“Hr(q, t), and thelemma follows.

šœ€š›¼ šœ€š›¼

šœ€š›¼ šœ€š›¼

šœ€š›¼

š’’

š‘„

š‘£

š‘”

Figure 3.1: Illustration of Lemma 4. Q is a shortest path in some separator,the connections of CQ are marked by triangles. The solid v-to-q path reectsthe shortest path from v to the connection q, and the dashed v-to-t pathreects the shortest path from v to t.

3.1 Warm Up: The Static Case

We start by describing our data structure for the static case with a singlexed label Ī» (i.e., each vertex either has label Ī» or no label at all). Forevery node r āˆˆ TH , let SĪ»r be the set of Ī»-labeled vertices in Hr. For everyseparator Q āˆˆ Sepr, every vertex q āˆˆ CQ, and every vertex v āˆˆ SĪ»r let

Page 18: Efficient Dynamic Approximate Distance Oracles for Vertex

3. UNDIRECTED GRAPHS WITH FASTER QUERY 18

Ī“Hr(q, v) = kĪµĪ± where k is the smallest value such that Ī“Hr(q, v) ā‰¤ kĪµĪ±.Thus, Ī“Hr(q, v) ā‰¤ Ī“Hr(q, v) ā‰¤ Ī“Hr(q, v) + ĪµĪ±. Let Lr(q, Ī») be the list of thedistances Ī“Hr(q, v) for all v āˆˆ SĪ»r . We sort each list in ascending order.Thus, the rst element of Lr(q, Ī») denoted by first(Lr(q, Ī»)) is at most ĪµĪ±more than the distance from q to the closest Ī»-labeled vertex inHr. We notethat each vertex u āˆˆ V (H) may contribute its distance to O(Īµāˆ’1 log n) lists.Hence, we have O(Īµāˆ’1n log n) elements in total. Since H is an Ī±-layeredgraph, the length of each Q is bounded by Ī±. Hence, the universe of theselists can be regarded as non-negative integers bounded by Ī±

ĪµĪ±= Īµāˆ’1. Thus,

these lists can be sorted in total O(Īµāˆ’1n log n) time.

Query(u,Ī»)

Given u āˆˆ H. We wish to nd the closest Ī»-labeled vertex v to u in H. Foreach ancestor r of ru, for each Q āˆˆ Sepr, we perform the following search.We inspect for every q āˆˆ CQ, the distance Ī“Hr(u, q) + first(Lr(q, Ī»)). Wealso inspect the Ī»-labeled vertices inHru explicitly. We return the minimumdistance inspected. See Fig. 3.2 for an illustration.

Lemma 5. The query algorithm runs in O(Īµāˆ’1 log n) time, and returns adistance d such that Ī“H(u, Ī») ā‰¤ d ā‰¤ Ī“H(u, Ī») + 3ĪµĪ±.

Proof. Let v be the closest Ī»-labeled to u in H. It is trivial that if theshortest path P form u-to-v does not leave ru = rv the query algorithm iscorrect, since the distances in ru are computed explicitly. Otherwise, let rbe the root-most node in TH such that P intersects some Q āˆˆ Sepr. Thus,P is fully contained in Hr. Let t be a vertex in Qāˆ©P . Since v is the closestĪ»-labeled vertex to u, it follows that it is also the closest Ī»-labeled vertexto t.

Since t āˆˆ Q, there exists q āˆˆ CQ such that Ī“Hr(v, q) + Ī“Hr(q, t) ā‰¤Ī“Hr(v, t) + Īµā€²Ī±. By the triangle, Ī“Hr(v, q) ā‰¤ Ī“Hr(q, t) + Ī“Hr(v, t). Hence,first(Lr(q, Ī»)) ā‰¤ Ī“Hr(q, t) + Ī“Hr(v, t) ā‰¤ Ī“Hr(q, v) + ĪµĪ±.

first(Lr(q, Ī») ā‰¤ Ī“Hr(q, v) ā‰¤ Ī“Hr(q, v) + ĪµĪ± (3.4)

ā‰¤ Ī“Hr(q, t) + Ī“Hr(t, v) + ĪµĪ± (3.5)

ā‰¤ Ī“Hr(t, v) + 2ĪµĪ± (3.6)

Where inequality (3.4) follows from the denition of Lr(q, Ī»), (3.5) followsfrom the triangle inequality, and (3.6) follows from the fact that Ī“Hr(q, t) ā‰¤

Page 19: Efficient Dynamic Approximate Distance Oracles for Vertex

3. UNDIRECTED GRAPHS WITH FASTER QUERY 19

š‘„

š’’

š‘¢

š‘„

š‘£

š‘¦

š‘”

Figure 3.2: Illustration of the query algorithm. The solid quarter-circlesare shortest paths of separators in G. The vertices x, y and v have labelĪ», and v is the closest Ī»-labeled vertex to u. The path Q belongs to theroot-most node r whose separator is intersected by the shortest u-to-Ī» path(solid blue). The vertices q and t on Q are as in the proof of Lemma 5.The connection q minimizes Ī“H(u, q) + first(Lr(q, Ī»)). The distances inLr(q, Ī») are the lengths of the dashed paths.

ĪµĪ±.

Query(u, Ī») ā‰¤Ī“Hr(u, q) + first(Lr(q, Ī»)) (3.7)

ā‰¤Ī“Hr(u, q) + Ī“Hr(t, v) + 2ĪµĪ± (3.8)

ā‰¤Ī“Hr(u, t) + Ī“Hr(t, q) + Ī“Hr(t, v) + 2ĪµĪ± (3.9)

ā‰¤Ī“Hr(u, v) + 3ĪµĪ± (3.10)

ā‰¤Ī“H(u, Ī») + 3ĪµĪ± (3.11)

Here, inequality (3.9) follows from the triangle ineqaulity, and (3.11) followsfrom the fact that P is fully contained in Hr, and our assumption that v isthe closest Ī»-labeled vertex to v.

Since Ī“Hr(u, q) + first(Lr(q, Ī»)) underlines a real path in the Hr, fromour assumption that v is the closest Ī»-labeled vertex to u, it follows thatQuery(u, Ī») ā‰„ Ī“Hr(u, v), and the lemma follows.

Page 20: Efficient Dynamic Approximate Distance Oracles for Vertex

3. UNDIRECTED GRAPHS WITH FASTER QUERY 20

To prove the query time, observe that the height of TH is O(log n). Atany level of the decomposition we inspect the rst element in O(Īµāˆ’1) lists,that is O(Īµāˆ’1 log n) time. We also inspect constant number of distances inru in constant time.

We now generalize to multiple labels. Let L be the set of labels in H.For r āˆˆ TH , let Lr be the restriction of L to labels that appear in Hr. Forevery label Ī» āˆˆ Lr, every Q āˆˆ Sepr and every q āˆˆ CQ, we store the listLr(q, Ī»). This does not aect the total size of our structure, since eachvertex has one label, so it still contributes its distances to O(Īµāˆ’1 log n) lists.The proof of Lemma 5 remains the same since each list contains distancesto a single label.

Naively, we could store for every node r, every vertex q, and every labelĪ» āˆˆ L the list Lr(q, Ī») in a xed array of size |L|. This allows O(1)-timeaccess to each list, but increases the space by a factor of |L| w.r.t. thesingle label case. Instead, we use hashing. Each vertex q holds a hash tableof the labels that contributed distances to q. For the static case, one canuse perfect hashing [FKS84] with expected construction time and constantquery time. In the dynamic case, we will use a dynamic hashing scheme,e.g., [PR01], which provides query and deletions in O(1) worst case, andinsertions in O(1) expected amortized time.

3.2 The Dynamic Case

We now turn our attention to the dynamic case. We wish to use the follow-ing method for updating our structure. When a node v changes its labelfrom Ī»1 to Ī»2, we would like to iterate over all ancestors r of rv in TH .For every Q āˆˆ Sepr and every q āˆˆ CQ, we wish to remove the value con-tributed by v from Lr(q, Ī»1), and insert it to Lr(q, Ī»2). We must maintainthe lists sorted, but do not wish to pay O(log n) time per insertion to doso. We will be able to pay O(log log Īµāˆ’1) per insertion/deletion by using asuccessor/predecessor data structure as follows.

For every r āˆˆ TH , Q āˆˆ Sepr, and q āˆˆ CQ, let Lr(q) be the list containingall distances from all vertices in V (Hr) to q sorted in ascending order. Wenote that since the distance for each specic vertex to q does not depend onits label, the list Lr(q, Ī») is a restriction of Lr(q) to the Ī»-labeled verticesin Hr.

Page 21: Efficient Dynamic Approximate Distance Oracles for Vertex

3. UNDIRECTED GRAPHS WITH FASTER QUERY 21

During the construction of our structure we build Lr(q), and, for everyvertex v in Hr, we store for v its corresponding index in Lr(q). We denotethis index as IDq(v). We also store for q a single lookup table from theIDs to the corresponding distances. We note that v has O(Īµāˆ’1 log n) suchidentiers, and in total we need O(Īµāˆ’1n log n) space to store them.

Now, instead of using linked list as before, we implement Lr(q, Ī») using asuccessor/predecessor structure over the universe [1, ..., |V (Hr)|] of the IDs.For example, we can use y-fast tries [Wil83] that support operations inO(log log Īµāˆ’1) expected amortized time and minimum query in O(1) worstcase.

Query(u, Ī»)

The query algorithm remains the same as in the static case. For everyancestor r of ru in TH , every Q āˆˆ Sepr, and every connection q āˆˆ CQ, weretrieve the minimal ID from Lr(q, Ī») , and use the lookup table to get theactual distance between q and the vertex with that ID.

Update

Assume that the vertex v changes its label from Ī»1 to Ī»2. For every ancestorr of rv in TH , every Q āˆˆ Sepr, and every q āˆˆ CQ, we remove IDq(v) fromLr(q, Ī»1) and insert it to Lr(q, Ī»2).

Lemma 6. The update time is O(Īµāˆ’1 log n Ā· log log Īµāˆ’1) expected amortized.

Proof. In each one of the O(log n) levels in TH , we perform O(Īµāˆ’1) inser-tions and deletions from successor/predecessor structures in O(log log Īµāˆ’1)expected amortized time per operation. Therefore the total update timeis O(Īµāˆ’1 log n log log n). If the set Lr changes for some r āˆˆ TH as a resultof the update, we must also update the hash table that handles the labels.This might cost an additional O(1) expected amortized time per node, andis bounded by O(log n) expected amortized time in total.

Lemma 7. The data structure can be constructed in O(Īµāˆ’1n log nĀ·log log Īµāˆ’1)expected amortized time, and stored using O(Īµāˆ’1n log n) space.

Proof. We decompose H into TH , and compute the connection length inO(Īµāˆ’1n log n) time. We than build the lists Lr(q) for every node r āˆˆ TH

Page 22: Efficient Dynamic Approximate Distance Oracles for Vertex

3. UNDIRECTED GRAPHS WITH FASTER QUERY 22

and q on any q āˆˆ Sepr. These lists contains O(Īµāˆ’1n log n) elements in therange [1, ..., Īµāˆ’1] that is independent of both n and Ī±. Hence we sort the listsin O(Īµāˆ’1n log n) time. We than use our update process on each v āˆˆ V (H)and each ancestor r of rv in O(Īµāˆ’1 log n Ā· log log Īµāˆ’1) expected amortizedtime for v. Hence, our construction time is O(Īµāˆ’1n lg n log log Īµāˆ’1) expectedamortized. To see our space bound, we note that every v contributes a dis-tance O(Īµāˆ’1) lists at every ancestor r of rv. Hence, there are O(Īµāˆ’1n log n)elements in total. Our successor/predecessor structures, and the hash ta-bles has linear space in the number of elements stored. Thus, O(Īµāˆ’1n log n)space.

We plug in this structure to Lemma 1 and obtain the following theorem:3

Theorem 1. Let G be an undirected planar graph. There exists a stretch-(1 + Īµ) Approximate Dynamic Vertex-Labeled Distance Oracle that supportsquery in O(Īµāˆ’1 log n log log nN) worst case and updates in O(Īµāˆ’1 log n Ā·log log Īµāˆ’1 log nN) expected amortized. The construction time of that or-acle isO(Īµāˆ’1n log nĀ·log log Īµāˆ’1 log nN) and it can be stored in O(Īµāˆ’1n log n log nN)space.

3Formally, one needs to show that Lemma 1 holds for vertex-labeled oracles as well.

See Appendix A

Page 23: Efficient Dynamic Approximate Distance Oracles for Vertex

4 Oracle for Directed Graphs

For simplicity we only describe an oracle that supports queries from a givenlabel to a vertex. Vertex to label queries can be handled symmetrically. Todescribe our data structure for directed graphs, we rst need to introducethe concept of Īµ-covering set from a set of vertices to a directed shortestpath.

Denition 6. Let S be a set of vertices in a directed graph H. Let Q bea shortest path in H of length at most Ī±. CH(S,Q) āŠ† V (Q) Ɨ R+ is anĪµ-covering set from S to Q in H if for every t āˆˆ Q s.t. Ī“H(S, t) ā‰¤ Ī±, thereexists (q, `) āˆˆ CH(S,Q) s.t. `+ Ī“(q, t) ā‰¤ Ī“H(S, t) + ĪµĪ±, and ` ā‰„ Ī“H(S, q).

In the denition above we use ` instead of Ī“(S, q) (compare to Deni-tion 5) because we cannot aord to recompute exact distances as S changes.Instead, we store and use approximate distances `.

Lemma 8. Let H be a directed planar graph. Let Q be a shortest path inH of length at most Ī±. For every set of vertices S āŠ† V (H) there is anĪµ-covering set CH(S,Q) of size O(Īµāˆ’1).

Proof. We introduce a new apex vertex in H denoted by x. For every vertexv in S, we add an arc xv with length 0. Since the indegree of x is 0, Qremains a shortest path, with length bounded by Ī±. We apply Lemma 2 onx w.r.t Q, to get an Īµ-cover set CH(x,Q) of size O(Īµāˆ’1). Clearly, CH(x,Q)is an Īµ-covering set from S to Q, and the Lemma follows.

Our construction relies on the following lemma.

Lemma 9 (Thinning Lemma). Let H, S and Q be as in Lemma 8. LetSiki=1 be sets such that S =

ā‹ƒki=1 Si. For 1 ā‰¤ i ā‰¤ k, let DH(Si, Q) be

an Īµā€²-covering set from Si to Q, ordered by the order of the vertices on Q.

23

Page 24: Efficient Dynamic Approximate Distance Oracles for Vertex

4. DIRECTED GRAPHS 24

Then for every Īµ > 0, an (Īµ+ Īµā€²)-covering set CH(S,Q) from S to Q of sized2Īµāˆ’1e can be found in O(Īµāˆ’1 + |

ā‹ƒki=1DH(Si, Q)|) time.

Proof. Let q0 be the rst vertex on Q. Let Q be the reduction of Q to thevertices in

ā‹ƒki=1DQ(Si) and q0. Let H be the auxiliary graph consisting

of Q and an apex vertex x connected to every q āˆˆ Q with an arc xq oflength Ī“H(Si, q), where Si is the set originally containing q. Note thatĪ“H(Si, q) ā‰„ Ī“H(S, q). Also note that H is planar, with diameter boundedby Ī±, and since the indegree of x is 0, Q is a shortest path in H. Letm = |

ā‹ƒki=1DH(Si, Q)|. We compute the shortest distance from x to every

other q in H explicitly by relaxing all arcs adjacent to x, and than relaxingthe arcs of Q by order. Constructing H and computing these distances canbe done in O(m) time, since |V (H)| = |E(H)| = O(m).

We apply Lemma 2 to x with Īµ and get an Īµ-covering set CH(x,Q) of size

d2Īµāˆ’1e from x to Q. It remains to prove that CH(x,Q) is an (Īµ+Īµā€²)-coveringset CH(S,Q) set from S to Q in H.

Let t āˆˆ Q. We show that there exists (q, `) āˆˆ CH(x,Q) such that` + Ī“H(q, t) ā‰¤ Ī“H(S, t) + (Īµā€² + Īµ)Ī±. We assume without loss of generality,that Ī“H(S, t) = Ī“H(S1, t). Since DQ(S1) is an Īµ

ā€²-covering set from S1 to Qin H, there exists (qā€², `ā€²) āˆˆ DQ(S1) such that:

`ā€² + Ī“H(qā€², t) ā‰¤ Ī“H(S1, t) + Īµā€²Ī± (4.1)

Also, since qā€² āˆˆ DQ(S1), it is also on Q. Therefore there exists (q, `) āˆˆCH(x,Q) such that:

`+ Ī“H(q, qā€²) ā‰¤ Ī“H(x, qā€²) + ĪµĪ± ā‰¤ `ā€² + ĪµĪ± (4.2)

Where the last inequality follows the fact that for every (qāˆ—, `āˆ—) āˆˆ DQ(S1),Ī“H(x, qāˆ—) ā‰¤ `āˆ—, and hence, Ī“H(x, qā€²) is at most `ā€².

Ī“H(S1 āˆŖ S2, t) + Īµā€²Ī± + ĪµĪ± = Ī“H(S1, t) + Īµā€²Ī± + ĪµĪ± (4.3)

ā‰„ `ā€² + Ī“H(qā€², t) + ĪµĪ± (4.4)

ā‰„ `+ Ī“H(q, qā€²) + Ī“H(qā€², t) (4.5)

= `+ Ī“H(q, qā€²) + Ī“H(qā€², t) (4.6)

= `+ Ī“H(q, t) (4.7)

Here, (4.4) follows from inequality (4.1), (4.5) follows from inequality (4.2).

Page 25: Efficient Dynamic Approximate Distance Oracles for Vertex

4. DIRECTED GRAPHS 25

š’’

š‘„

š’’ā€²

š‘„

š‘”

Figure 4.1: Illustration of he auxiliary graph H in the proof of Lemma 9,when applied to the sets S1 = u and S2 = v (I.e. k = 2). The connectionsets of S1 and S2 are indicated by the triangles and squares, respectively.The connections in the output set are indicated by a solid ll. The vertex tis a vertex on Q (not on Q) that is closer to v than it is to u. Although t iscovered by both q and qā€², its distance from x is better approximated via qā€².The vertex q Īµ-covers qā€² w.r.t. the distances in H hence qā€² is not includedin the output set. Since q Īµ-covers qā€², and qā€² Īµā€²-covers t, it follows that t is(Īµ+ Īµā€²)-covered by q.

Let H be a directed planar Ī±-layered graph, equipped with a spanningtree T . For every xed parameter Īµ, let Īµ = Īµ

8 logn, and Īµāˆ— = Īµ

2. We apply

Lemma 3 with Īµ to H and obtain a decomposition tree TH , and Īµ-coveringsets CHr(v,Q) and CHr(Q, v) for every v āˆˆ V (H), every ancestor r of rv inTH and every Q āˆˆ Sepr. For every 1 ā‰¤ i ā‰¤ log n, let Īµi = Īµ lognāˆ’i+1

4 logn.

For every r āˆˆ TH , for every Ī» āˆˆ Lr, and for every Q āˆˆ Sepr, we applyLemma 9 to the Īµ-covering connections sets CHr(v,Q) for all v āˆˆ SĪ»r , withĪµā€² = Īµ and Īµ set to Īµ

4. Thus, we obtain an Īµāˆ—-covering set Cāˆ—Hr(S

Ī»r , Q). Let

i be the level of r in TH , we also store for r a set of Īµi-covering sets asfollows. For every ancestor node t of r in TH and every Q āˆˆ Sept, we storeCHt(S

Ī»r , Q). We assume for the moment that these sets are given. We defer

Page 26: Efficient Dynamic Approximate Distance Oracles for Vertex

4. DIRECTED GRAPHS 26

š‘Ÿ1

š’“

š‘Ÿš‘¢ š‘Ÿš‘£

Update connections šœŗš’Š-covering sets

Query connections šœŗāˆ—-covering sets

Vertex connections š -covering sets

From š‘†šŗšœ† to š‘„ āˆˆ š‘†š‘’š‘š‘Ÿ

From š‘†šŗšœ† to

š‘„ āˆˆ š‘†š‘’š‘š‘Ÿ š‘/š“ š«

From š‘†š‘Ÿ1šœ† = š‘†š‘Ÿš‘¢ āˆŖ š‘†š‘Ÿš‘£ to

š‘„ āˆˆ š‘†š‘’š‘š‘Ÿ1, š‘†š‘’š‘š‘Ÿ From š‘†š‘Ÿ1

šœ† = š‘†š‘Ÿš‘¢āˆŖ š‘†š‘Ÿš‘£ to š‘„ āˆˆ š‘†š‘’š‘š‘Ÿ1

š‘/š“ š«šŸ

From š‘†š‘Ÿš‘¢šœ† = š‘¢ to

š‘„ āˆˆ š‘†š‘’š‘š‘Ÿš‘¢, š‘†š‘’š‘š‘Ÿ1, š‘†š‘’š‘š‘Ÿ From š‘†š‘Ÿš‘¢

šœ† = š‘¢ to š‘„ āˆˆ š‘†š‘’š‘š‘Ÿš‘¢

š‘/š“ š«š®

From š‘†š‘Ÿš‘£šœ† = š‘£ to

š‘„ āˆˆ š‘†š‘’š‘š‘Ÿš‘£, š‘†š‘’š‘š‘Ÿ1, š‘†š‘’š‘š‘Ÿ From š‘†š‘Ÿš‘£

šœ† = š‘£ to š‘„ āˆˆ š‘†š‘’š‘š‘Ÿš‘£

š‘/š“ š«šÆ

š‘/š“ š‘/š“ From u to every

š‘„ āˆˆ š‘†š‘’š‘š‘Ÿš‘¢, š‘†š‘’š‘š‘Ÿ1, š‘†š‘’š‘š‘Ÿ , and from every such Q to u.

u

š‘/š“ š‘/š“ From v to every

š‘„ āˆˆ š‘†š‘’š‘š‘Ÿš‘£, š‘†š‘’š‘š‘Ÿ1, š‘†š‘’š‘š‘Ÿ , and from every such Q to v.

v

š‘¢ š‘£

Figure 4.2: A summary of the connections-sets stored by the directedoracle. On the left, part of a decomposition tree of a graph is shown. Thevertices u and v are the only Ī» labeled vertices. On the right, a table listingall the covering sets that are stored for the label Ī».

the description of their construction (see the update procedure and the proofof Lemma 12). We will use the Īµāˆ—-covering sets for ecient queries, and themore accurate Īµi-covering sets to be able to perform ecient updates. SeeFig. 4.2.

4.1 Query(Ī», u)

The query algorithm is straightforward. For every ancestor r of ru wend (q, `) āˆˆ Cāˆ—Hr(S

Ī»r , Q) and t āˆˆ CHr(Q, u) that minimize the distance

`+Ī“Hr(q, t)+Ī“Hr(t, u). We also inspect the distance to the Ī»-labeled verticesin ru explicitly. We return the minimum distance inspected. To see that thequery time is O(Īµāˆ’1 log n), we note that for every one of the O(log n) an-cestors of ru we inspect O(Īµāˆ’1) distances on constant number of separators.Inspecting the distances in ru itself takes constant time.

Page 27: Efficient Dynamic Approximate Distance Oracles for Vertex

4. DIRECTED GRAPHS 27

š‘„

š’’

š’•

š‘£ š‘¢

Figure 4.3: The solid quarter-circles are shortest paths of separators in G.The vertex v is the closest Ī»-labeled vertex to u. The path Q belongs to theroot-most node r whose separator is intersected by the shortest Ī»-to-u path(solid blue). The connections of SĪ»r on Q are indicated by black triangles,the connections of u are indicated by black squares. The vertices q and ton Q are as in the proof of Lemma 10. The blue and black dashed lines arethe shortest paths from v to q, and from t to u, respectively. These pathsare used to generate the distance reported by the query algorithm.

Lemma 10. Query(Ī», u) ā‰¤ Ī“H(Ī», u) + ĪµĪ±.

Proof. Let r be the root-most node in TH such that the shortest Ī»-to-u pathP in H intersects some Q āˆˆ Sepr. Let k be a vertex in Q āˆ© P . By thedenition of the connection set Cāˆ—Hr(S

Ī»r , Q), there exists (q, `) such that

l + Ī“Hr(q, k) ā‰¤ Ī“Hr(SĪ»r , k) + Īµāˆ—Ī± (4.8)

Also there exists t āˆˆ CHr(Q, u) such that

Ī“Hr(k, t) + Ī“Hr(t, u) ā‰¤ Ī“Hr(k, u) + ĪµĪ± ā‰¤ Ī“Hr(k, u) + Īµāˆ—Ī± (4.9)

Page 28: Efficient Dynamic Approximate Distance Oracles for Vertex

4. DIRECTED GRAPHS 28

We add the two to get

l + Ī“Hr(q, k)Ī“H(k, t) + Ī“Hr(t, u) ā‰¤ Ī“Hr(SĪ»r , k) + Ī“Hr(k, u) + Īµāˆ—Ī± + Īµāˆ—Ī±

(4.10)

l + Ī“Hr(q, t) + Ī“H(t, u) ā‰¤ Ī“Hr(SĪ»r , k) + Ī“Hr(k, u) + 2Īµāˆ—Ī± (4.11)

l + Ī“Hr(q, t) + Ī“Hr(t, u) ā‰¤ Ī“Hr(SĪ»r , u) + ĪµĪ± (4.12)

Clearly, l + Ī“H(q, t) + Ī“H(t, u) ā‰„ Ī“H(SĪ»r , u). And since P is fully containedin Hr, Ī“Hr(S

Ī»r , u) = Ī“H(SĪ»r , u), and the Lemma follows.

4.2 Update

Assume that some vertex u changes its label from Ī»1 to Ī»2. For everyancestor r of ru and everyQ āˆˆ Sepr, we would like to remove CHr(u,Q) fromCHr(S

Ī»1r , Q), and combine CHr(u,Q) into CHr(S

Ī»2r , Q). While the latter is

straightforward using Lemma 9, removing CHr(u,Q) from CHr(SĪ»1r , Q) is

more dicult. For example, if u was the closest Ī»1 labeled vertex to everyvertex on Q, it is possible that CHr(u,Q) = CHr(S

Ī»1r , Q). In that case,

we will have to rebuild CHr(SĪ»1r , Q) from the other O(|V (Hr)|) vertices of

SĪ»1r . Instead of removing the connections of u, we will rebuild CHr(SĪ»1r , Q)

bottom-up starting from the leaf node ru.We therefore start by describing how to update ru. There is a constant

number of vertices in ru, and hence |SĪ»1ru | = O(1). Let v1, v2,...vk be thevertices in SĪ»1ru . We stress that for every 1 ā‰¤ j ā‰¤ k, vj has an Īµ-covering setCHt(vj, Q) of size O(Īµāˆ’1) from vj to Q, for every ancestor t of ru in TH , andfor every Q āˆˆ Sept. We apply the Thinning Lemma (Lemma 9) for eachsuch t and Q on CHt(vj, Q)kj=1 with Īµ

ā€² = Īµ and Īµ set to Īµ. Lemma 9 yieldsa 2Īµ-covering set CHt(S

Ī»ru , Q).

We next handle the ancestors r of ru in TH in bottom up order. Let xand y be the children of r āˆˆ TH . We rst note that Hr = HxāˆŖHy and hence,SĪ»1r = SĪ»1x āˆŖSĪ»1y . Therefore, by Lemma 9, for every ancestor t of r, and everyQ āˆˆ Sept, CHt(SĪ»1r , Q) can be obtained from CHt(S

Ī»1x , Q)āˆŖCHt(SĪ»1y , Q). Let

i by the level of r in TH , and hence the level of x and y is i+1. Since t is anancestor of r, it is also an ancestor of x and y. Hence, x (y) stores an Īµi+1-covering set CHt(S

Ī»1x , Q) (CHt(S

Ī»1y , Q)). We apply Lemma 9 on CHt(S

Ī»1x , Q)

and CHt(SĪ»1y , Q) with Īµā€² = Īµi+1 and Īµ = 2Īµ to get an (Īµi+1 + 2Īµ)-covering set

CHt(SĪ»1r , Q). The following lemma shows that CHt(S

Ī»1r , Q) is an Īµi-covering

set.

Page 29: Efficient Dynamic Approximate Distance Oracles for Vertex

4. DIRECTED GRAPHS 29

Lemma 11. Let r be a node in level i in TH . For every ancestor t of r,and every Q āˆˆ Sept, CHt(SĪ»1r , Q) is an Īµi-covering set from SĪ»1r to Q.

Proof. We rst recall that Īµi = Īµ lognāˆ’i+14 logn

for every 1 ā‰¤ i ā‰¤ log n. We provethe lemma by induction on the level of r in TH . The base case is i = log n,so r is a leaf. The connection sets of the leaf nodes are computed explicitlyusing Lemma 9, with Īµ and Īµā€² set to Īµ. Hence the product of the lemma is2Īµ-covering sets.

2Īµ = 2Īµ

8 log n=

Īµ

4 log n= Īµlogn (4.13)

For the inductive step, if r is a leaf, then the arguments from the basecase applies. Otherwise, let x and y be the children of r. By the inductionhypothesis, both x and y have Īµi+1-covering set from SĪ»1x and SĪ»1y to Q,respectively. The update procedure applies Lemma 9 on CHx(S

Ī»1x , Q) and

CHy(SĪ»1y , Q) with Īµā€² = Īµi+1 and Īµ = 2Īµ, so we get an (Īµi+1 + 2Īµ)-covering set

CHt(SĪ»1r , Q).

Īµi+1 + 2Īµ = Īµlog nāˆ’ (i+ 1) + 1

4 log n+ Īµ

2

8 log n= Īµ

log nāˆ’ i+ 1

4 log n= Īµi (4.14)

To nish the update process, we need to update the Īµāˆ—-covering setsthat we use for queries. Let r be an ancestor node of ru in level i on TH .By Lemma 11, for every Q āˆˆ Sepr, we have an Īµi-covering set CHr(SĪ»1r , Q).Since Īµi < Īµāˆ— , CHr(S

Ī»1r , Q) is also an Īµāˆ—-covering set. However, it is too

large. We apply Lemma 9 on CHr(SĪ»1r , Q) with Īµā€² = Īµi, and Īµ set to

Īµ4to

get (Īµi + Īµ4)-covering set. We note that since Īµi ā‰¤ Īµ

4for every 1 ā‰¤ i ā‰¤ log n,

we get that Īµi + Īµ4ā‰¤ 2 Īµ

4ā‰¤ Īµ

2= Īµāˆ—. Hence the output of Lemma 9 is the

desired Īµāˆ—-covering set Cāˆ—Hr(SĪ»1r , Q). We repeat the entire process for Ī»2.

Lemma 12. There exists a scale-(Ī±, Īµ) distance oracle for directed Ī±-layeredplanar graph, with query time O(Īµāˆ’1 log n) worst case, and update time ofO(Īµāˆ’1 log3 n) expected amortized. The oracle can be constructed in O(Īµāˆ’2n log5 n)time and stored using O(Īµāˆ’1n log3 n) space.

Proof. Since our update process only uses Lemma 9, we bound the up-date time by the running time of that Lemma. Since the running time ofLemma 9 is linear in sizes of the input connection sets we get the bound

Page 30: Efficient Dynamic Approximate Distance Oracles for Vertex

4. DIRECTED GRAPHS 30

by the number of connection stored for ru and its ancestors. We store forru

Īµ4 logn

-connection set for constant number of separators for every one of

the O(log n) ancestors of ru. Hence, the number of connections stores forru is O(log n( Īµ

4 logn)āˆ’1) = O(Īµāˆ’1 log2 n). Since the number of connections

stored for ru dominates the number of connection stored for any other strictancestor of ru, we get the total number of connections stored of O(log3 n).

We note that the connections of the vertices in ru are only used whenupdating ru, and for any other non-leaf node r, we only use the connection ofits children. Thus, any connection is used at most twice. Once for updatinga connection set of its parent, and the second time, is when updating theĪµāˆ—-covering sets of r (ru). Hence the total input size of Lemma 9 is at mosttwice the number of the connections stored for the ancestors of ru, that isO(log3 n), and the update time follows.

Since we store for every r āˆˆ TH and every Q āˆˆ Sepr a connection set forevery Ī» āˆˆ Lr, we use dynamic hashing as in Section 3. Hence, our updatetime is expected amortized.

Our query time is trivial and follows from the fact that we processO(log n) levels in TH , and in each we inspect O(Īµāˆ—āˆ’1) connections. That isO(Īµāˆ’1 log n) time worst case.

By Lemma 3 with Īµ set to Īµ, all connection sets for all leaves of THcan be computed in O(Īµāˆ’2n log5 n) and it requires O(Īµāˆ’1n log2 n) space.We construct the connection sets CHr(S

Ī»r , Q) for all r āˆˆ TH , Q āˆˆ Sepr and

Ī» āˆˆ Hr by applying the update process for each vertex v āˆˆ V (H). This takesO(Īµāˆ’1 log3 n) expected amortized time per operation, and O(Īµāˆ’1n log3 n)expected amortized time in total. This is dominated by the construction ofThorup's oracle.

To get the space requirements of our data structure, we need to countthe number of connections stored. If every vertex u āˆˆ V (H) has uniquelabel, it follows that the connection sets stored for u are not useful forany other vertex. We therefore count the number of u's connections andmultiple by O(n). Let Ī» be the label of u. To support queries and updatesfor Ī», we store for every ancestor r of ru connection sets from SĪ»r to O(log n)separators for the ancestors of r. Since the size of these connection sets isonly bounded by O(Īµāˆ’1), we get that r requires O(Īµāˆ’1 log2 n) connections.Since ru has O(log n) ancestors, we store for u (and by that for Ī») O(log3 n)connections. Thus, the total space required is O(n log3 n).

We can now apply Lemma 1 to get the following theorem:

Page 31: Efficient Dynamic Approximate Distance Oracles for Vertex

4. DIRECTED GRAPHS 31

Theorem 2. For any directed planar graph and xed parameter Īµ, there ex-ists a (1+Īµ) approximate vertex-labeled distance oracle that support queriesin O(Īµāˆ’1 log n log log nN) worst case and updates in O(Īµāˆ’1 log3 n log nN) ex-pected amortized time. This oracle can be constructed in O(Īµāˆ’2n log5 n log nN)expected amortized time, and stored using O(Īµāˆ’1n log3 n log nN) space.

Page 32: Efficient Dynamic Approximate Distance Oracles for Vertex

5 Oracle for Undirected Graphs

with Faster Update

Both Thorup [Tho04, Lemma 3.19] and Klein [Kle02] independently pre-sented ecient vertex-vertex distance oracles for undirected planar graphthat use connections sets. Klein later improved the construction time [Kle05].They show that, in undirected planar graph, one can avoid the scaling ap-proach that uses Ī±-layered graphs. Instead, there exist connections setsthat approximate distance with (1 + Īµ) multiplicative factor rather than ĪµĪ±additive factor. We use the term portals [Kle05] to distinguish this type ofconnections from the previous one.

Denition 7. Let G be an undirected planar graph, and let Q be a shortestpath in G. For every vertex v āˆˆ V (G) we say that a set CG(v,Q) is anĪµ-covering set of portals if and only if, for every vertex t on Q there exista vertex q on Q such that: Ī“G(v, q) + Ī“G(q, t) ā‰¤ (1 + Īµ)Ī“G(v, t)

We use a recursive decomposition TG with shortest path separators, anduse Klein's algorithm [Kle05] to select all the portal sets CGr(u,Q) e-ciently.We cannot use the lists of Section 3 because there may be too manyportals, and we cannot use the thinning lemma (Lemma 9) of Section 4 be-cause its proof uses a directed construction, and hence, cannot be appliedin undirected graphs. Instead, we take the approach used by Li, Ma andNing for the static vertex-labeled case [LMN13]. We work with all portals ofvertices with the appropriate label, and nd the closest one using dynamicPrex/Sux Minimum Queries.

Denition 8 (Dynamic Prex Minimum Data Structure). A Dynamic Pre-x Minimum Data Structure is a data structure that maintains a set A of npairs in [1, n]ƗR, under insertions, deletions, and Prex Minimum Queries

32

Page 33: Efficient Dynamic Approximate Distance Oracles for Vertex

5. UNDIRECTED GRAPHS WITH FASTER UPDATE 33

š‘¤ š‘„ š‘¦

š‘£0 š‘£2

š‘£1

š‘¤ š‘„š‘£0 š‘¦

š‘£0 š‘£2

š‘£1

š‘„š‘£2 š‘„š‘£1 0 0 š›¾ š›½

š‘„

š‘„ š›¾ š›½

Figure 5.1: Illustration of the reduction to unique portals. Above, the pathQ with the portal x that is used by v0, v1, and v2. Below, x was replaced byxv0, xv1, and xv2, inner connected with zero length edges. Here, xv0, xv1,xv2 are the portals of v0, v1, and v2 respectively. Note that this reductiondoes not introduce new paths in the graph, nor changes the distance alongQ.

(PMQ) of the following form: given l āˆˆ [1, n] return a pair (x, y) āˆˆ A s.t.x āˆˆ [1, l], and for every other pair (xā€², yā€²) with xā€² āˆˆ [1, l], y ā‰¤ yā€².

Sux minimum queries (SMQ) are dened analogously. Let PMQ(A, l)and SMQ(A, l) denote the result of the corresponding queries on the set Aand l.

We assume that for every u, v āˆˆ V (Gr), CGr(u,Q) āˆ© CGr(v,Q) = āˆ….This is without loss of generality, since if x is a portal of a set of verticesv0, ..., vk, we can split x to k copies. This does not increase |G| by morethan a factor of Īµāˆ’1. See Fig. 5.1. (see gure 5.1).

To describe our data structure, we rst need the following denitions.Let Q āˆˆ Sepr for some r āˆˆ TG. Let q0, ..., qk be the vertices on Q bytheir order along Q. G is undirected, hence the direction of Q is chosenarbitrarily. For every 0 ā‰¤ j ā‰¤ k, let h(qj) denote the distance from q0 to qjon Q. We note that since Q is a shortest path in G, h(qi) = Ī“G(q0, qj). For

Page 34: Efficient Dynamic Approximate Distance Oracles for Vertex

5. UNDIRECTED GRAPHS WITH FASTER UPDATE 34

every Ī» āˆˆ Lr we maintain a dynamic prex minimum data structure PreQ,Ī»over (j,āˆ’h(qj) + Ī“Gr(qj, Ī»))kj=0. We similarly maintain a a dynamic suxminimum data structure SufQ,Ī» over (j, h(qj) + Ī“Gr(qj, Ī»))kj=0.

Query(u, Ī»)

For every ancestor r of ru in TG, every Q āˆˆ Sepr, and every qj āˆˆ CGr(u,Q)we wish to nd the index i that minimizes Ī“Gr(u, qj)+Ī“Gr(qj, qi)+Ī“Gr(qi, Ī»).Observe that for i ā‰¤ j, Ī“Gr(qj, qi) = h(j)āˆ’h(i), while for i ā‰„ j, Ī“Gr(qj, qi) =h(i) āˆ’ h(j). We therefore nd the optimal i ā‰¤ j and i ā‰„ j separately.Note that miniā‰¤j(Ī“Gr(u, qj) + Ī“Gr(qj, qi) + Ī“Gr(qi, Ī»)) = Ī“Gr(u, qj) + h(j) +PMQ(PreQ,Ī», j). Similarly, we handle the case where i ā‰„ j using SMQ(SufQ,Ī», j).Thus, we have two queries for each portal of u. We also compute the dis-tance from u to Ī» in ru explicitly. We return the minimum distance com-puted.

Lemma 13. The query algorithm returns a distance d such that Ī“G(u, Ī») ā‰¤d ā‰¤ (1 + Īµ)Ī“G(u, Ī»)

Proof. The proof of correctness of our algorithm is essentially the sameas in [LMN13, Lemma 1]. We adapt it to t our construction. Let vbe the closest Ī»-labeled vertex to u in G. If the shortest u-to-v path Pdoes not leave ru = rv the algorithm is correct, since the distance in ru iscomputed expilicitly. Otherwise, let r be the root-most node in TG suchthat P intersects some Q āˆˆ Sepr. Let t be a vertex on P āˆ©Q. There existsqj āˆˆ CGr(u,Q) and qi āˆˆ CGr(v,Q) such that:

Ī“Gr(u, qj) + Ī“Gr(qj, t) ā‰¤ (1 + Īµ)(Ī“Gr(u, t)) (5.1)

Ī“Gr(v, qi) + Ī“Gr(qi, t) ā‰¤ (1 + Īµ)(Ī“Gr(v, t)) (5.2)

We add the two inequalities to get the following:

Ī“Gr(u, qj) + Ī“Gr(qj, qi) + Ī“Gr(v, qi) ā‰¤ (1 + Īµ)(Ī“Gr(u, v)) (5.3)

If i ā‰¤ j, then PMQ(PrefQ,Ī», j) ā‰¤ Ī“Gr(qi, Ī»)āˆ’ h(qi) ā‰¤ Ī“Gr(v, qi)āˆ’ h(qi).Thus,

Query(u, Ī») ā‰¤ Ī“Gr(v, qi)āˆ’ h(qi) + h(j) + Ī“Gr(u, qj) (5.4)

= Ī“Gr(v, qi) + Ī“Gr(qi, qj) + Ī“Gr(u, qj) (5.5)

ā‰¤ (1 + Īµ)(Ī“Gr(u, v)) (5.6)

ā‰¤ (1 + Īµ)(Ī“G(u, Ī»)) (5.7)

Page 35: Efficient Dynamic Approximate Distance Oracles for Vertex

5. UNDIRECTED GRAPHS WITH FASTER UPDATE 35

Here, inequality (5.6) follows from (5.3), and (5.7) follows from that factthat P is fully contained in r, and our assumption that v is the closestĪ»-labeled vertex to u.

The proof for the case that i ā‰„ j is similar.

Update

Assume that the label of u changes from Ī»1 to Ī»2. For every ancestorr of ru āˆˆ TG, and Q āˆˆ Sepr, and for qi āˆˆ CGr(u, q), we remove fromPreQ,Ī»1 and SufQ,Ī»1 the element (x, y) with x = i, and insert the element(i,āˆ’h(i) + Ī“Gr(u, qi)) into PreQ,Ī»2 , and (i, h(i) + Ī“Gr(u, qi)) into SufQ,Ī»2 .We note that since we assume that every vertex qi is a portal of at mostone vertex, the removals are well dened, and the insertions are safe.

The time and space bounds for the oracle described above are given inthe following lemma.

Lemma 14. Assume there exists a dynamic prex/sux minimum datastructure in the word RAM model, that for a set of sizem, supports PMQ/SMQin O(TQ(m)) time, and updates in O(TU(m)) time, can be constructed inO(TC(m)) time, where TC(m) ā‰„ m, and can be stored in O(S(m)) space.Then there exist a dynamic vertex-labeled stretch-(1 + Īµ) distance oraclefor planar graphs with worst case query time O(Īµāˆ’1 log(n)TQ(Īµāˆ’1n)), andexpected amortized update time O(Īµāˆ’1 log(n)TU(Īµāˆ’1n)). The oracle can beconstructed using O(Īµāˆ’1n log2 n+ log(n)Tc(Īµ

āˆ’1n)) expected amortized time,and stored in O(log(n)S(Īµāˆ’1n)) space.

Proof. Let G be an undirected planar graph. We rst decompose G to ob-tain TG, and compute all the portals and the distances to portals. Klein [Kle05]shows that this can be done using O(n log(n)(Īµāˆ’1 + log n)) time. Then, forevery r āˆˆ TG, for every Q āˆˆ Sepr and every Ī» āˆˆ Lr, we construct a pre-x/sux minimum query data structures for PreQ,Ī» and SufQ,Ī».

Recall that PreQ,Ī» is dened over the set of pairs (j,āˆ’h(qj)+Ī“Gr(qj, Ī»))kj=0,where qj is the j'th portal on Q. For each element (x, y) in PreQ,Ī», the rstcoordinate is specied by the order of the corresponding portal onQ. Hence,x ā‰¤ Īµāˆ’1n is an integer that ts in a single word. The second coordinate canbe treated similarly; We sort the list āˆ’h(qj) + Ī“Gr(qj, Ī»)j for all portalsqj on Q. Then, we can specify y by its ordinal number in the sorted list.The same argument holds for SufQ,Ī».

Page 36: Efficient Dynamic Approximate Distance Oracles for Vertex

5. UNDIRECTED GRAPHS WITH FASTER UPDATE 36

Constructing PreQ,Ī» and SufQ,Ī» takesO(log n(Īµāˆ’1n log(Īµāˆ’1n)+TC(Īµāˆ’1n))time, since at every level of TG the total number of portals is O(Īµāˆ’1n), andsince TC(Ā·) is superlinear. The number of portals we store is O(Īµāˆ’1n log n)since every vertex v has O(Īµāˆ’1) portals for every one of its O(log n) ances-tors in TG. Hence our space is O(log(n)S(Īµāˆ’1n)), and the construction timeis O(Īµāˆ’1n log2 n+ log(n)Tc(Īµ

āˆ’1n)).To analyze the query and update time, we note that we process O(log n)

nodes in TG and in each we perform O(Īµāˆ’1) queries or updates to the pre-x/sux minimum query structures. The size of our prex/sux struc-tures is bounded by the size of V (Q) which is O(Īµāˆ’1n). The Īµāˆ’1 fac-tor is due to the assumption of distinct portals. Thus, the query timeis O(Īµāˆ’1 log(n)TQ(Īµāˆ’1n)) and the update time is O(Īµāˆ’1 log(n)TU(Īµāˆ’1n)).

Since every Q āˆˆ Sepr holds a prex/sux minimum data structure forevery label Ī» āˆˆ Lr, we use dynamic hashing to avoid space dependencyin |L|, as in Section 5. Hence, our construction time and update time areexpected amortized.

It remains to describe a fast prex/sux minimum query structure.We use a result due to Wilkinson [Wil14] for solving the 2-sided reportingproblem in R2 in the word RAM model. In this problem, we maintain a setA of n points in R2 under an online sequence of insertions, deletions andqueries of the following form. Given a rectangle B = [l1, h1] Ɨ [l2, h2] suchthat exactly one of l1, l2 and one of h1, h2 is āˆž or āˆ’āˆž, we report A āˆ© B.Here, [l1, h1] Ɨ [l2, h2] represents the rectangle (x, y) : l1 ā‰¤ x ā‰¤ l2, h1 ā‰¤y ā‰¤ h2. Since Wilkinson assumes the word RAM model, it is assumedthat the coordinates of the points in A are integers that t in a single word.Wilkinson's data structure is captured by the following theorem.

Theorem 3. [Wil14, Theorem 5] For any f āˆˆ [2, log n/ log log n], there ex-ists a data structure for 2-sided reporting with update time O((f log n log log n)1/2),query time O((f log n log log n)1/2 + logf (n) + k) where k is the number ofpoints reported. The structure requires linear space.

In fact, Wilkinson's structure rst nds the point with the minimumy-coordinate in the query region, and then reports the other points. Usingthis fact, and setting f = logĪ³ n for some arbitrary small constant Ī³. Weget the following lemma, in which we also state Wilkinson's constructiontime explicitly.

Page 37: Efficient Dynamic Approximate Distance Oracles for Vertex

5. UNDIRECTED GRAPHS WITH FASTER UPDATE 37

Lemma 15. There exists a linear space data structure for 2-sided reportingon n points, with update time O(log1/2+Ī³ n) and query time O( logn

log logn). This

data structure can be constructed in O(n log1/2+Ī³ n) time. Moreover, uponquery the data structure returns the minimum y-coordinate of a point in thequery region.

The prex/sux queries required by Lemma 16 correspond to one-sidedrange reporting in the plane, which can be solved using 2-sided queries, bysetting the upper limit of the query rectangle to nN .

Lemma 16. For any constant Ī³ > 0, there exists a linear space dynamicprex/sux minimum data structure over n elements with update timeO(log1/2+Ī³ n), and query time O( logn

log logn). This data structure can be con-

structed inO(n log1/2+Ī³ n) time.

Proof. We use Wilkinson's structure. A prex minimum query for i cor-responds to nding the point with minimum y-coordinate in the rectangle(āˆ’āˆž,āˆ’āˆž, i,āˆž). This is 1-sided rectangle. To be able to specify a boundryfor the y-axis, we maintain an upper bound ymax on the y-coordinates ofpoints in A. The bound can be easily updated in constant time when aninsertion occurs. (There is no need to update the bound when a dele-tion occurs). We replace the 1-sided rectangle with the 2-sided rectan-gle (āˆ’āˆž,āˆ’āˆž, i, ymax). Similarly, our sux minimum query is the 1-sidedrectangle (i,āˆ’āˆž,āˆž,āˆž) or the 2-sided (i,āˆ’āˆž,āˆž, ymax). The lemma nowfollows by applying Lemma 15.

We therefore obtain the following theorem.

Theorem 4. For any undirected planar graph and xed parameters Īµ, Ī³,there exists a stretch-(1+Īµ) vertex-labeled distance oracle that approximates

distances in O(Īµāˆ’1 logn log(Īµāˆ’1n)log log (Īµāˆ’1n)

) time worst case, and supports updates in

O(Īµāˆ’1 log n log12+Ī³(Īµāˆ’1n)) expected amortized time. This data structure can

be constructed using O(n log2 n + Īµāˆ’1n log n log12+Ī³ (Īµāˆ’1n)) expected amor-

tized time and stored using O(Īµāˆ’1n log n) space.

Page 38: Efficient Dynamic Approximate Distance Oracles for Vertex

6 Concluding remarks

In this work we presented approximate vertex-labeled distance oracles fordirected and undirected, planar graphs with polylogarithmic query andupdate times and nearly linear space. All of our oracles have Ī©(log n)query and updates, since we handle root-to-leaf paths in the decomposi-tion tree. The logarithmic factor can be avoided in the vertex-to-vertexcase where approximate distance oracles with faster query times exist (seee.g., [Tho04, Wul16, GX15] and references therein). This is also the casefor the static vertex-to-label case. For example, Mozes and Skop [MS15]presented an oracle with constant query time. Their oracle uses label con-nections that store the shortest distance to a labeled vertex in the entiregraph. This is in contrast to our connections that only consider labeledvertices in a subgraph. Hence, their query algorithm only accesses a singlenode in the decomposition tree. The downside of storing distances in theentire graph is that labels changes are less contained (may aect O(n) sep-arators). It would be interesting to study whether an approximate distanceoracle with logarithmic update time and o(log n) query time exists.

Another bottleneck for our directed data structure is the use of O(log n)connection sets in every node of the decomposition tree. Those sets areonly used by our bottom-up update approach, which is mainly needed forremoval of labeled vertices. We tried to avoid storing these sets, with nosuccess. It remains an open question whether this costly update procedurecan be avoided.

For our undirected oracle with the faster update (Section 5), we useWilkinson's 2-sided reporting [Wil14] as a dynamic prex/sux minimumdata structure. During our research, we tried to develop a faster dynamicprex minimum data structure but with no success. Another interestingquestion that arises is whether other approaches may be used to obtain afaster prex/sux minimum data structure, that will lower the time bounds

38

Page 39: Efficient Dynamic Approximate Distance Oracles for Vertex

6. CONCLUDING REMARKS 39

of our oracle.

Page 40: Efficient Dynamic Approximate Distance Oracles for Vertex

Bibliography

[ACD+16] Ittai Abraham, Shiri Chechik, Daniel Delling, Andrew V. Gold-berg, and Renato F. Werneck. On dynamic approximate short-est paths for planar graphs with worst-case costs. In SODA,pages 740753. SIAM, 2016.

[ACG12] Ittai Abraham, Shiri Chechik, and Cyril Gavoille. Fully dynamicapproximate distance oracles for planar graphs via forbidden-setdistance labels. In STOC, pages 11991218. ACM, 2012.

[aOP+15] Jakub acki, Jakub Ocwieja, Marcin Pilipczuk, PiotrSankowski, and Anna Zych. The power of dynamic distanceoracles: Ecient dynamic algorithms for the steiner tree. InSTOC, pages 1120, 2015.

[Che12] Shiri Chechik. Improved distance oracles and spanners forvertex-labeled graphs. In ESA, volume 7501 of Lecture Notesin Computer Science, pages 325336. Springer, 2012.

[FKS84] Michael L. Fredman, JĆ”nos KomlĆ³s, and Endre SzemerĆ©di. Stor-ing a sparse table with O(1) worst case access time. J. ACM,31(3):538544, 1984.

[GX15] Qian-Ping Gu and Gengchun Xu. Constant query time (1 + Īµ)-approximate distance oracle for planar graphs. In ISAAC, pages625636, 2015.

[HKRS97] Monika Rauch Henzinger, Philip N. Klein, Satish Rao, andSairam Subramanian. Faster shortest-path algorithms for pla-nar graphs. J. Comput. Syst. Sci., 55(1):323, 1997.

40

Page 41: Efficient Dynamic Approximate Distance Oracles for Vertex

BIBLIOGRAPHY 41

[HLWY11] Danny Hermelin, Avivit Levy, Oren Weimann, and RaphaelYuster. Distance oracles for vertex-labeled graphs. In ICALP(2), volume 6756 of Lecture Notes in Computer Science, pages490501. Springer, 2011.

[KKS11] Ken-ichi Kawarabayashi, Philip N. Klein, and Christian Som-mer. Linear-space approximate distance oracles for planar,bounded-genus and minor-free graphs. In ICALP (1), volume6755 of Lecture Notes in Computer Science, pages 135146.Springer, 2011.

[Kle02] Philip N. Klein. Preprocessing an undirected planar networkto enable fast approximate distance queries. In SODA, pages820827, 2002.

[Kle05] Philip N. Klein. Multiple-source shortest paths in planar graphs.In SODA, pages 146155, 2005.

[KST13] Ken-ichi Kawarabayashi, Christian Sommer, and Mikkel Tho-rup. More compact oracles for approximate distances in undi-rected planar graphs. In SODA, pages 550563. SIAM, 2013.

[LMN13] Mingfei Li, Chu Chung Christopher Ma, and Li Ning. (1 +Īµ)-distance oracles for vertex-labeled planar graphs. In TAMC,pages 4251, 2013.

[LT79] Richard J Lipton and Robert Endre Tarjan. A separator theo-rem for planar graphs. SIAM Journal on Applied Mathematics,36(2):177189, 1979.

[MS15] Shay Mozes and Eyal E. Skop. Ecient vertex-label distanceoracles for planar graphs. In WAOA, pages 97109, 2015.

[PR01] Rasmus Pagh and Flemming Friche Rodler. Cuckoo hashing.In ESA, pages 121133, 2001.

[Som14] Christian Sommer. Shortest-path queries in static networks.ACM Comput. Surv., 46(4):45:145:31, 2014.

[Tho04] Mikkel Thorup. Compact oracles for reachability and approx-imate distances in planar digraphs. J. ACM, 51(6):9931024,2004.

Page 42: Efficient Dynamic Approximate Distance Oracles for Vertex

BIBLIOGRAPHY 42

[TZ01] Mikkel Thorup and Uri Zwick. Approximate distance oracles.In STOC, pages 183192. ACM, 2001.

[Wil83] Dan E. Willard. Log-logarithmic worst-case range queries arepossible in space theta(n). Inf. Process. Lett., 17(2):8184, 1983.

[Wil14] Bryan T. Wilkinson. Amortized bounds for dynamic orthogonalrange reporting. In ESA, pages 842856, 2014.

[Wul12] Christian Wul-Nilsen. Approximate distance oracles with im-proved preprocessing time. In SODA, pages 202208. SIAM,2012.

[Wul16] Christian Wul-Nilsen. Approximate distance oracles for pla-nar graphs with improved query time-space tradeo. In SODA,pages 351362, 2016.

Page 43: Efficient Dynamic Approximate Distance Oracles for Vertex

Appendix

43

Page 44: Efficient Dynamic Approximate Distance Oracles for Vertex

A Reduction from stretch-(1 + Īµ)vertex-labeled distance oracle to

scale-(Ī±, Īµ) distance oracle.

We now describe how to use a scale-(Īµ, Ī±) vertex-labeled distance oracle toobtain a stretch-(1 + Īµ) distance oracle. For vertex-vertex distance oracles,this reduction was proven by Thorup as captured in Lemma 1.

For the static vertex-labeled case, a similar reduction was presented byMozes and Skop, and is as follows: The proof of Lemma 1 relies on tworeductions [Tho04, Lemmas 3.2,3.8]. The rst shows that from any graphG and for any Ī± > 0, one can construct a family of Ī±-layered graphs GĪ±

i iwhose total size is linear in the size of G, and such that:

1. Ī£|GĪ±i | = O(|G|), where |G| = |V (G)|+ |E(G)|.

2. Each v āˆˆ V (G) has an index j(v) s.t. any w āˆˆ V (G) has d =Ī“G(v, w) ā‰¤ Ī± i d = minĪ“GĪ±

j(v)āˆ’2(v, w), Ī“GĪ±

j(v)āˆ’1(v, w), Ī“GĪ±

j(v)(v, w).

3. EachGĪ±i is a minor ofG. I.e., it can be obtained fromG by contraction

ad deletion of arcs and vertices. In particular, if G is planar, so is GĪ±i .

Item (2.) means that any shortest path of length at most Ī± in G is repre-sented in at least one of three xed graphsGĪ±

i . Thus, one can use scale-(Ī±, Īµ)distance oracles for the Ī±-layered graphs GĪ±

i to implement a scale-(Ī±, Īµ)oracle of G.

The second reduction [Tho04, Lemmas 3.8] is a scaling argument thatshows how to construct a stretch-(1 + Īµ) distance oracle for G using scale-(Ī±, Īµā€²) distance oracles for Ī± āˆˆ 2iiāˆˆ[1,dlog(nNe]. The reduction does notrely on planarity. Now consider the vertex-labeled case. Let Gāˆ— be the

44

Page 45: Efficient Dynamic Approximate Distance Oracles for Vertex

A. REDUCTION FROM STRETCH-(1 + Īµ) TO SCALE-(Ī±, Īµ)DISTANCE ORACLE 45

graph obtained from G by adding apices representing the labels. A vertex-to-vertex distance oracle for Gāˆ— is a vertex-labeled distance oracle for G,and vice versa. By Thorup's second reduction, it suces to show howto construct a scale-(Ī±, Īµ) vertex-vertex distance oracle for Gāˆ— for any Ī±,Īµ, or, equivalently a vertex-labeled scale-(Ī±, Īµ) distance oracle for G andevery Ī±, Īµ. Let Ī± āˆˆ R+. Given u āˆˆ V (G) and Ī» āˆˆ L with Ī“G(u, Ī») ā‰¤ Ī±,let w āˆˆ V (G) be the closest Ī» labeled vertex to u. By the properties ofThorup's rst reduction, there is a graph GĪ±

i in whitch the u-to-w distanceis Ī“G(u,w). Thus, a vertex-labeled distance oracle for GĪ±

i will report adistance of at most Ī“G(u, Ī») + ĪµĪ±. Therefore we have the following Lemma:

Lemma 17. For any planar graph G and xed parameter Īµ, a stretch-(1 + Īµ) vertex-labeled distance oracle can be constructed using O(log nN)scale-(Ī±, Īµā€²) vertex-labeled distance oracles where Ī± = 2i, i = 0, ...dlog nNeand Īµā€² āˆˆ 1/2, Īµ/4. Assume that the scale-(Ī±, Īµ) vertex-labeled distance oraclesupports queries in O(TQ(n, Īµ)) and updates in O(TU(n, Īµ)) time, and it canbe constructed in O(TC(n, Īµ)) time and uses O(S(n, Īµ)) space. There existsa S(n, Īµ) log nN space stretch-(1 + Īµ) vertex-labeled distance oracle that an-swers queries in O(TQ(n, Īµ) log log (nN)) and updated in O(TU(n, Īµ) log nN)time can be constructed in O(TC(n, Īµ) log nN) time.

Proof. Given a planar graph G, we decompose G to O(log nN) Ī±-layeredgraphs, and for each we construct a scale-(Ī±, Īµ) distance oracle. We get thespace requirements, and the construction and query times by using Lemma1. Since we must keep all O(log nN) scale oracles up to date, we performeach update operation O(log nN) times, and the lemma follows.

Page 46: Efficient Dynamic Approximate Distance Oracles for Vertex

×Ŗקצי×Ø

דים, הוא מבנה ודקובעל צביע×Ŗ קלג×Ø×£ אוב מ×Øחקים מקו×Øב. צבעבעל דיו ודקואש×Ø ×›×œ אחד מקג×Ø×£ Gיהי

1), מחזי×Ø Ī»×•×¦×‘×¢ š‘£ דוקדונ×Ŗונים, אש×Ø ×‘×”×™× ×Ŗן ק + šœ€)-קי×Øוב למ×Øחק בין š‘£ ד הק×Øוב ביו×Ŗ×Ø ×”×¦×‘×•×¢ ודקולק

דים.ודקואם בנוהף הוא ×Ŗומך בשינוי צביע×Ŗ הק דינאמיאוב כנ"ל ייק×Øא .G בג×Ø×£ Ī»×‘צבע

דים, כולם בעלי זמן ודקוקדינאמים לג×Ø×£ מישו×Øי בעל צביע×Ŗ מקו×Øבים מ×Øחקים זה נציג שלושה אובי חק×Øבמ

זהו אוב המ×Øחקים המקו×Øב הדינאמי ה×Øאשון מקום ק×Øוב ללינא×Øי.ד×Øישו×Ŗ ל×Ŗה ועדכון פולילוג×Øי×Ŗמים, ושאי

לינא×Øיים.-×Ŗ×Ŗשלו הם השאיל×Ŗהוגם זמן עדכון ה גם זמןאש×Ø

Page 47: Efficient Dynamic Approximate Distance Oracles for Vertex

המ×Øכז הבינ×Ŗחומי בה×Øצליההפ×Ø ××¤×™ א×Øזי למדעי המחשב-בי×Ŗ

מחק×Øימהלול - (.M.Scה×Ŗכני×Ŗ ל×Ŗוא×Ø ×©× ×™ )

דינאמי לג×Ø×£ מקו×Øב אוב מ×Øחקים

דיםודקומישו×Øי בעל צביע×Ŗ ק

.M.Scק מהד×Øישו×Ŗ לשם קבל×Ŗ ×Ŗוא×Ø ×ž×•×”×ž×š כחל זה המוגש×Ŗעבוד×Ŗ ×Ŗ

ה×Øצליה זי למדעי המחשב, המ×Øכז הבינ×Ŗחומיבמהלול המחק×Øי בבי×Ŗ הפ×Ø ××¤×™ א×Ø

אי×Ŗי לישמוגש על ידי

בהנחיי×Ŗ ד"×Ø ×©×™ מוזה.

2017 הטאוגו


Top Related