Better Distance Labeling for Unweighted Planar Graphs

A distance labeling scheme is an assignment of labels, that is, binary strings, to all nodes of a graph, so that the distance between any two nodes can be computed from their labels without any additional information about the graph. The goal is to minimize the maximum length of a label as a function of the number of nodes. A major open problem in this area is to determine the complexity of distance labeling in unweighted planar (undirected) graphs. It is known that, in such a graph on n nodes, some labels must consist of Ω(n1/3)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\varOmega (n^{1/3})$$\end{document} bits, but the best known labeling scheme constructs labels of length O(nlogn)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$O(\sqrt{n}\log n)$$\end{document} (Gavoille, Peleg, Pérennes, and Raz in J Algorithms 53:85–112, 2004). For weighted planar graphs with edges of length polynomial in n, we know that labels of length Ω(nlogn)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\varOmega (\sqrt{n}\log n)$$\end{document} are necessary (Abboud and Dahlgaard in FOCS, 2016). Surprisingly, we do not know if distance labeling for weighted planar graphs with edges of length polynomial in n is harder than distance labeling for unweighted planar graphs. We prove that this is indeed the case by designing a distance labeling scheme for unweighted planar graphs on n nodes with labels consisting of O(n)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$O(\sqrt{n})$$\end{document} bits with a simple and (in our opinion) elegant method. We also show how to extend this to graphs with small weight and (unweighted) graphs with bounded genus. We augment the construction for unweighted planar graphs with a mechanism (based on Voronoi diagrams) that allows us to compute the distance between two nodes in only polylogarithmic time while increasing the length to O(nlogn)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$O(\sqrt{n\log n})$$\end{document}. The previous scheme required Ω(n)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\varOmega (\sqrt{n})$$\end{document} time to answer a query in this model.


Introduction
An informative labeling scheme is an elegant formalization of the idea that identifiers of nodes in a network can be chosen to carry some additional information. Peleg [33] defined such a scheme for a function f defined on subsets of nodes to consist of two components: an encoder and a decoder. First, the encoder is given a description of the whole graph G and assigns a binary string to each of its nodes. The string assigned to a node is called its label. Second, the decoder is given the labels assigned to a subset of nodes W and needs to calculate f (W ). This must be done without any information about the graph except for the given labels and the fact that G belongs to a specific family G . The main goal is to make the labels as short as possible, that is, to minimize the maximum length of a label assigned to a node in G. A particularly clean example of a function f that one might want to consider in this model is adjacency. Kannan et al. [25] observed that an adjacency labeling scheme is related (in fact, equivalent) to a so-called vertex-induced universal graph, a purely combinatorial object that has been considered already in the 60s [32]. By now, we have a rich body of work concerning not only adjacency labeling [3, 4, 8-10, 13, 34], but also flow and connectivity labeling [22,26,28], Steiner tree labeling [33] and, most relevant to this paper, distance labeling.
Distance labeling. A distance labeling scheme is an assignment of labels, that is, binary strings, to all nodes of a graph G, so that the distance δ G (u, v) between any two nodes u, v can be computed from their labels. Unless specified otherwise, we consider unweighted graphs, so δ G (u, v) is the smallest number of edges on a path between u and v. The main goal is to make the labels as short as possible, that is, to minimize the maximum length of a label. The secondary goal is to optimize the query time, that is, the time necessary to compute δ G (u, v) given the labels of u and v. Distance labeling for general unweighted undirected graphs on n nodes was first considered by Graham and Pollak [21], who obtained labels consisting of O(n) bits. The decoding time was subsequently improved to O(log log n) by Gavoille et al. [17], then to O(log * n) by Weimann and Peleg [35], and finally Alstrup et al. [6] obtained O(1) decoding time with labels of length log 3 2 n + o(n). 1 It is known that, for every labeling scheme, some labels must consist of at least n 2 bits [25,32], so achieving sublinear bounds is not possible in the general case.
Better schemes for distance labeling are known for restricted classes of graphs. As a prime example, trees admit a distance labeling scheme with labels of length 1 4 log 2 n + o(log 2 n) bits [16], and this is known to be tight up to lower-order terms [7]. In fact, any sparse graph admits a sublinear distance labeling scheme [5] (see also [18] for a somewhat simpler construction). However, the best known upper bound is still rather far away from the best known lower bound of Ω( √ n) [17], and recently Kosowski et al. [29] showed that, for a natural class of schemes based on storing the distances to a carefully chosen set of hubs, the best achievable hub-label size and distance-label size in sparse graphs may be Θ(n/2 (log n) c ) for some 0 < c < 1.
Planar graphs. An important subclass of sparse graphs are planar graphs, for which Gavoille et al. [17] constructed a scheme with labels of length O( √ n log n). They also proved that in any such scheme some label must consist of Ω(n 1/3 ) bits. In fact, their upper bound of O( √ n log n) bits is also valid for weighted planar graphs, under a natural assumption that the weights are bounded by a polynomial in n. The lower bound is based on designing a family of grid-like graphs on k × k nodes and each edge being of length O(k). The family consists of 2 Θ(k 2 ) graphs and admits the following property: the pairwise distances of O(k) nodes on the boundaries uniquely determine the graph. This construction immediately implies that, for weighted planar graphs, there must be a node with label consisting of Ω( √ n) bits. However, for unweighted planar graphs, this only implies a lower bound of Ω(n 1/3 ), as one needs to replace an edge of length with edges, thus increasing the size of the graph to k 3 . Abboud and Dahlgaard [1] extended this construction to show that, in fact, for graphs with the length of each edge bounded by a polynomial in n, there must be a node with label consisting of Ω( √ n log n) bits. Interestingly, they were able to use essentially the same construction to establish a strong conditional lower bound for dynamic planar graph algorithms. Unfortunately, there has been no progress in improving the construction for unweighted planar graphs.
Abboud et al. [2] provided a reasonable explanation for the lack of progress on improving the unweighted grid-like construction. They showed that for any unweighted planar graph G with k distinguished nodes, there is an encoding consisting ofÕ(min{k 2 , √ k · n}) bits that allows calculating the distance between any pair of distinguished nodes. This implies that the approach based on fixing a family G of unweighted planar graphs, with each graph containing k distinguished nodes such that their pairwise distance uniquely determine G ∈ G , cannot result in a higher lower bound thanÕ(min{k 2 , √ k · n})/k =Õ(n 1/3 ). This indicates that we should seek a significantly different proof technique or a better upper bound. Determining the complexity of distance labeling in unweighted planar graphs remains to be a major open problem in this area.
Our contribution. We present an improved upper bound for distance labeling of unweighted planar graphs on n nodes. We design a distance labeling scheme with labels consisting of O( √ n) bits. While this might be seen as "only" a logarithmic improvement, it provides a separation for distance labeling between unweighted and weighted planar graphs. Furthermore, we believe that lack of any progress on resolving the complexity of distance labeling in unweighted planar graphs in the last 16 years makes any asymptotic decrease desirable. Our method easily extends to undirected planar graphs with edges of length from [1, W ], allowing us to decrease the label length from O( √ n log(nW )) to O( √ n log W ), and (unweighted) undirected graphs with genus g, decreasing the label length from O( √ ng log n) to O( √ ng log g) for graphs of genus at most g. Decoding time in our construction for planar unweighted graphs is O( √ n) (as in the previously known scheme of Gavoille et al. [17]), but we augment it with a mechanism that computes the distance in polylogarithmic time, however at the expense of increasing the label length to O( √ n log n). Table 1 summarizes the current state of knowledge concerning this problem.
Techniques and roadmap. As in the previous scheme of Gavoille et al. [17], we apply a recursive separator decomposition. This scheme is presented in detail in Sect. 2. Our Planar, lengths polynomial in n Ω( √ n log n) [1] O( √ n log n) [17] Planar, unweighted improvement is based on the following observation: if each separator is, in fact, a cycle, then we can shave off a factor of log n by appropriately encoding the stored distances. For a triangulated graph, one can indeed always find a balanced cycle separator, but our graph does not have to be triangulated. In some applications, the solution to this problem is to simply triangulate with edges of sufficiently large length (as to not change the distance), but we need to keep the graph unweighted. In Sect. 3, we overcome this difficulty by designing a novel method of replacing each face of the original graph G with an appropriately chosen gadget to obtain a new unweighted graph G with every face of length at most 4. The crucial property is that, for any two nodes that exist in both G and G , their distance in G is at least the logarithm of their distance in G. So, while inserting the gadgets may decrease the distances, we are able to control this decrease. We believe that this might be of independent interest. To facilitate efficient decoding, in Sect. 5 we build on the distance oracle of Gawrychowski et al. [19]. This requires some tweaks in their point location structure to make it smaller at the expense of increasing the query time (but still keeping it polylogarithmic) and adjusting our scheme to balance the lengths of different parts of the label.
Computational model. When discussing the decoding time we assume the Word RAM model with words of length log n. A label of length is packed in / log n words, and the decoder computing the distance between u and v can access in constant time any word from their labels. Standard arithmetic and Boolean operations on words are assumed to take constant time.

Previous Scheme
We briefly recap the scheme of Gavoille et al. [17]. Their construction is based on the notion of separators, that is, sets of nodes which can be removed from the graph so that every remaining connected component consists of at most 2 3 n nodes. By the classical result of Lipton and Tarjan [30] any planar graph on n nodes has such a separator consisting of O( √ n) nodes. Now the whole construction for a connected graph G proceeds as follows: find a separator S of G, and let G 1 , G 2 , . . . be the connected components of G \ S. The label of v ∈ G i in G, denoted G (v), is composed of i, recursively constructed G i (v), and the distances from v to every u ∈ S in G, denoted δ G (v, u), written down in the same order for every v ∈ G. A label of v ∈ S consists of only the distances δ G (v, u) for all u ∈ S (also written down in the same order).
The space complexity of the whole scheme is dominated by the space required to store |S| distances, each consisting of log n bits, resulting in O( √ n log n) bits in total. The bound of O( √ n) on the size of a separator is asymptotically tight. However, the total length of the label of v ∈ G (in bits) depends not on the size of the separator, but on the number of bits necessary to encode the distances from v to the nodes of the separator. If one can write S = (u 1 , u 2 , . . . , u |S| ), where every u i and u i+1 are adjacent (we implicitly assume u |S|+1 = u + 1), then |δ G (v, u i ) − δ G (v, u i+1 )| ≤ 1, for every i = 1, 2, . . . , |S| − 1, and consequently writing down δ G (v, u 1 ) explicitly and then storing all the differences It is known that if the graph is triangulated, there always exists a simple cycle separator [31], so for such graphs labels of length O( √ n) are enough. We show that, in fact, for any planar graph it is possible to select a separator so that the obtained sequence of differences is compressible. This is done by inserting some gadgets into every face of the graph.

Improved Scheme
We use the notion of weighted separators, as introduced in [31]. Consider a planar graph, where every node has a non-negative weight and all these weights sum up to 1. Then a set of nodes is a weighted separator if after removing these nodes the total weight of every remaining connected component is at most 2 3 . We have the following well-known theorem (the result is in fact more general and allows assigning weights also to edges and faces, but this is not needed in our application):

Lemma 1 ([31])
For every planar graph on n nodes having assigned non-negative weights summing up to 1, either there exists a node that is a weighted separator or there exists a simple cycle of length at most 2 √ 2 d/2 n which is a weighted separator, where d is the maximum face size.
We will use the above tool to show our main technical lemma.

Lemma 2 Any planar graph G has a separator S, such that
for some ordering u 1 , u 2 . . . , u |S| of all nodes of S.
Before proving the lemma, we first describe a family of subdivided cycles. A subdivided cycle on s ≥ 3 nodes, denoted D s , consists of a cycle C s = (v 1 , . . . , v s ) and possibly some auxiliary nodes. D 3 and D 4 are simply C 3 and C 4 , respectively. For s > 4, we add s 2 auxiliary nodes u 1 , . . . , u s 2 , and connect every v i with u i 2 . To complete the construction, we recursively build D s 2 and identify its cycle with Proof We apply induction on s. It is easy to check that the lemma holds when s ≤ 4, so we assume s ≥ 5. Let us denote δ D s (u, v) = d and δ C s (u, v) = d. We proceed with another induction on d . When d = 1 then u and v must be neighbors on C s , so d = 1 and the claim holds. When d = 1 then d = 1 (because we always have d ≤ d) and the claim also holds. Now assume d , d ≥ 2 and consider a shortest path connecting u and v in D s . If it consists of only auxiliary nodes except for the endpoints u and v, then we consider the immediate neighbors of u and v on the path, denoted u and v , respectively. As u and v are auxiliary nodes, they both must belong to the cycle C s 2 of D s 2 , as no other auxiliary nodes are neighbours of non-auxiliary nodes. Next, we analyze the distance between u and v on C s 2 . Every node of C s 2 is connected to at most two nodes of C s . Consequently, if there are t nodes strictly between u and v on C s 2 , then there are at most 2t + 2 nodes strictly between u and v on C s . Thus, the distance between u and v on C s 2 must be at least d 2 , as otherwise the distance between u and v on C s would be at most 2( d 2 − 2) + 3 < d. This allows us to apply the inductive assumption applied with smaller s 2 < s (and using d ≥ 2): Otherwise, let w be an intermediate node of the path that belongs to the cycle C s .
Because w is an intermediate node, we can apply the inductive assumption with the same s but smaller d 0 , d 1 < d to obtain d 0 ≥ 1 + log d 0 and d 1 ≥ 1 + log d 1 . Then: by the triangle inequality as required.
of Lemma 2 Let G be the graph constructed from G by replacing every face (including the external face) with a subdivided cycle of appropriate size. More precisely, let (v 1 , v 2 , . . . , v s ) be a boundary walk of a face of G. Note that nodes v i are not necessarily distinct. We create a subdivided cycle D s and identify its cycle C s with Clearly G is also planar and each of its faces is either a triangle or a square. Since any subdivided cycle has at most twice as many auxiliary nodes as cycle nodes and the lengths of all boundary walks sum up to twice the number of edges, which is at most 3n − 6 (as G is planar, and without losing the generality simple), G contains at most n = n + 4 · (3n − 6) < 13n nodes.
We assign weights to nodes of G so that every node also appearing in G has weight 1 and every new node has weight 0. By Lemma 1 either there exists a single node s that is a weighted separator or there exists a weighted simple cycle separator S in G of size at most 2 √ 52n. In the former case, s is also a weighted separator in G and there is nothing to prove. In the latter case, let S = S ∩ G be a separator in G. Because S is a simple cycle separator, S = (u 1 , u 2 , . . . , u c ), and u i and u i+1 are incident to the same face f of G. The boundary walk of f , consisting of s i nodes, has been identified with the cycle C s i of a copy of the subdivided cycle D s i such that S connects u i and u i+1 either directly or by visiting some auxiliary nodes of the copy of D s i , for every i = 1, 2, . . . , c (we assume u c+1 = u 1 ). In either case, S connects u i and u i+1 with a path from v i to v i in the copy of D s i , thus: as required.
While not relevant in this section, later we will need to verify that G obtained from G in the proof of Lemma 2 is biconnected.

Lemma 4 If n ≥ 4 then G is biconnected.
Proof It is straightforward to verify that removing an auxiliary node cannot disconnect the graph. Consider a node u of G, and let v 0 , v 1 , . . . , v d−1 be its neighbors arranged in a clockwise order. We claim that v i and v (i+1) mod d are still connected in G after removing u from G . Consider the face containing v i , u, v (i+1) mod d as a part of the boundary walk. If the boundary walk is of size at least 5 then the artificial nodes guarantee the connectivity. When the boundary walk contains just one occurrence of u then the non-auxiliary nodes guarantee the connectivity after removing the only occurrence of u. The only remaining case is that the boundary walk is Proof We proceed as in the previously known scheme of size O( √ n log n), except that in every step we apply our Lemma 2. In more detail, to construct the label of every node v ∈ G we proceed as follows. First, we find a separator S = (u 1 , For every v ∈ G we encode its distances to all nodes of the separator as follows. We use the Elias γ code [14], which gives a prefix-free encoding of a number x using 2 log x + 1 bits. Formally, this encoding assigns a bitstring code(x) to every number x. For every x, the length of code(x) is at most 2 log x + 1. Additionally, for every x = y, code(x) is not a prefix of code(y) (nor vice versa). We first encode δ G (v, u 1 ) using the Elias γ code. Then we encode , for all i = 2, . . . , c, also using the Elias γ code and an extra bit to denote the sign. All encodings are concatenated, and by the prefix-free property given the concatenation we can recover all the distances. The total length of the concatenation is: Then, if u and v belong to the same connected component of G \ S, we proceed recursively there and return the minimum of d and the recursively found distance in the connected component. The correctness is clear: either a shortest path between u and v is fully within one of the connected components, or it visits some w ∈ S, and in such case we can recover δ G (u, w) + δ G (w, v) from the stored distances. The final

Simple Extensions
In this section, we describe two simple extensions of Theorem 1. First, consider a planar graph G with edges of length from [1, W ], for some W ≥ 2. Applying the scheme of Gavoille et al. [17] results in labels consisting of Θ( √ n log(nW )) bits for this case, as on the topmost level of the recursion we need to store Θ( √ n) distances bounded by nW . We improve this to O( √ n log W ).
Theorem 2 Any planar graph on n nodes with edges of length from [1, W ], for W ≥ 2, admits a distance labeling scheme of length O( √ n log W ).
Proof We proceed as in proof of Theorem 1. On every level of the recursion, we find the separator S by considering an unweighted planar graph G 1 obtained from G by disregarding the length of every edge. However, the encoded distances are computed in the original G. On the topmost level of the recursion, the total length of all these encoded distances is bounded by which, by the choice of S in G 1 , this is O( √ n log W ). Summing this over all levels of the recursion, we obtain the theorem.
The second extension concerns bounded-genus (unweighted) graphs. For a genus g graph on n nodes, Gavoille et al. [17] showed how to construct labels consisting of O( √ ng log n) bits. We improve this to O( √ ng log g).
Theorem 3 Any genus-g planar graph on n nodes admits a distance labeling scheme of length O( √ ng log g).

Proof
Let G be such a genus-g graph on n nodes, and consider its 2-cell embedding in a surface of genus g. Then, every face of G is homeomorphic to an open disc. We can assume that G is simple, that is, every face is incident to at least three edges, and so the number of edges is O(n + g). We obtain G by inserting a copy of the subdivided cycle inside every face of G as in the proof of Lemma 2 while increasing the number of nodes to O(n + g) (by the bound on the number of faces of G ). Then, we apply the theorem of Hutchinson [23] to find a short non-contractible cycle. A non-contractible cycle is either separating and deleting it divides the graph into two graphs of strictly smaller genus, or non-separating and deleting it decreases the genus by at least one. The theorem states that, for any triangulated graph on n nodes, we can find such a cycle of length O( √ n/g log g). We cannot apply this directly, as our graph might have faces of size four. So, we temporarily triangulate G to obtain G , apply the theorem on G to find a short non-contractible cycle C , and then translate it to a walk C in G by routing along the faces, which increases its length only by a constant factor, so |C | = O( √ (n + g)/g log g). Finally, we consider C = C ∩ G. We can encode the distances from any v ∈ G to all nodes of C as described in the proof of Theorem 1 in O( √ (n + g)/g log g) bits. This encoding becomes part of the label of every node v ∈ G and allows us to compute the distance if there exists a shortest path visiting a node of C. If C was a separating cycle then removing C from G separates it into two graphs G 1 , G 2 with smaller genus. We recursively construct the label of every node of G 1 and G 2 . The label of every node of C consists only of the encoding of the distances to all nodes of C. The label of every node of G \ C additionally contains its label in the corresponding G 1 or G 2 , together with a single bit denoting whether the node belongs to G 1 or G 2 . If C was not separating then removing C from G decreases the genus. We repeat the reasoning on G \ C, and obtain the label of every node of C and G\C similarly as in the previous case, except that now there is no need for the single bit denoting whether the node belongs to G 1 or G 2 . In the recursion, when g = 0 we obtain a planar graph and apply Theorem 1. To bound the overall length of a label obtained through this recursive construction, we notice that every node participates in at most one smaller instance of the same problem until it becomes either a part of the separator (and does not participate further) or a planar graph (when we apply Theorem 1). Each step of this process appends O( √ (n + g)/g log g) bits to the label, and then possibly we add O( √ n) bits in the last step. The overall length of a label is thus O( √ (n + g)g log g). If g ≤ n then this is already O( √ ng log g) as desired, and otherwise we can switch to an O(n)-bit distance labeling scheme for general unweighted graphs [6].

Efficient Decoding
The drawback of the scheme from Theorem 1 is its high decoding time. Computing δ G (u, v) given G (u) and G (v) is done as follows. First, we iterate over w ∈ S and consider δ G (u, w) + δ G (v, w) as a possible distance, extracting δ G (u, w) from G (u) and δ G (v, w) from G (v). Then, we check if u and v belong to the same component G i , and if so recurse on G i (u) and G i (v). Even assuming that extracting any δ G (u, w) takes constant time, it is not clear how to avoid iterating over all w ∈ S, so we cannot hope for anything faster than O( √ n). In this section we show how to overcome this difficulty by applying the machinery of Voronoi diagrams on planar graphs, introduced for computing the diameter of a planar graph in subquadratic time by Cabello [11]. Our method roughly follows the approach of Gawrychowski et al. [19] (also see [12]), but we need to make sure that the information can be distributed among the labels, and carefully adjust the parameters of the whole construction. We start with presenting the necessary definitions and tools. r -divisions. A region R of G is an edge-induced subgraph of G. An r -division of G is a collection of regions such that each edge of G is in at least one region, there are O(n/r ) regions, each region has at most r nodes and O( √ r ) boundary nodes that belong to more than one region. We work with a fixed planar embedding of G, and all of its subgraphs, in particular the regions, inherit this embedding. A hole of a region R is a face that is not a face of G. An r -division with few holes has the additional property that each edge belonging to two regions is on a hole in each of them, and each region has O(1) holes.

Lemma 5 ([27]) For a constant s, there is a linear-time algorithm that, for any biconnected triangulated planar embedded graph G and any r ≥ s, outputs an r -division of G with few holes.
The above theorem additionally guarantees that each region is connected and its boundary nodes are exactly the nodes incident to its holes. Voronoi diagrams. Following the description in [19], let S be the nodes (called sites) incident to the external face h of an internally triangulated planar graph G. Note that while our goal is to consider unweighted graphs, Voronoi diagrams can be defined for weighted graphs, and indeed this is how we are going to use them. This allows us to perturb the weights to ensure that all shortest paths are unique, see e.g. [15]. In our case, we need to additionally verify that the perturbed weights are not too large, but the standard argument based on the Isolation Lemma shows that O(log n) additional bits of accuracy are enough to this end.
Each site u ∈ S has a weight ω(u), defined as the distance from some node v of the larger graph to u, and the distance between a site u ∈ S and a node v, denoted by d (u, v), is defined as ω(u) + δ G (u, v). The (additively) weighted Voronoi diagram of (S, ω) within G, denoted VD(S, ω), is a partition of the nodes of G into pairwise disjoint sets, one set Vor(u) for every u ∈ S. Vor(u) is called the cell of u and contains all nodes of G that are closer to u than any other site u . The standard perturbation as described above allows us to assume that this is well defined, that is, for every node v there is only one site u for which ω(u) + δ G (u, v) achieves the minimum. We work with a dual representation of VD(S, ω), denoted by VD * (S, ω), defined as follows. Let G * be the dual of G, and VD 0 is the subgraph of G * containing the duals of all edges (u, v) of G such that u and v belong to different cells. Then, let VD 1 be obtained from VD 0 by contracting edges incident to vertices of degree 2 one-by-one as long as possible. A vertex of VD 1 is called a Voronoi vertex, and is dual to a face f such that the nodes incident to f belong to at least three Voronoi cells. In particular, h * is a Voronoi vertex. Finally, VD * (S, ω) is obtained from VD 1 by replacing h * by multiple copies, one for each incident edge. See Fig. 2 for an example. The complexity of VD * (S, ω) is O(|S|) and, assuming that every node belongs to its cell is a tree. This assumption is not necessarily true in the general case, as we could have ω(s i ) > ω(s j ) + δ G (s j , s i ) for some different sites s i , s j . However, in our case the weighs ω(s i ) will be actually distances from the same node u in a larger graph, and hence before the perturbation we will necessarily have ω(s i ) ≤ ω(s j ) + δ G (s j , s i ). Therefore, assuming that we perturb the weight of every edge by adding a strictly positive value, we will indeed guarantee that s i ∈ Vor(s i ). We will also assume that the graph is biconnected, so that the boundary walk of the external face is simple. Point location. The main technical contribution of [19] is a point location structure for VD(S, ω) that, given a node v, finds its cell in O(log |S|) time, assuming constanttime access to certain primitives. We briefly describe the required primitives and then the high-level idea of this structure, but the reader is strongly advised to consult the original description.
For any site u, let T u be the shortest path tree rooted at u. Additionally, for each face f other than h we add an artificial node v f whose embedding coincides with the embedding of f * . In T u , v f is a leaf connected with a zero-length edge to the node y f incident to f that is closest to u. For any site u and node v, we might need to have access to the following information: for any face f , is v on the path in in T u from u to v f , or left/right 2 of this path.
If the goal is to build a global structure of size O(n 1.5 ), such queries can be supported by storing, for every site u separately, the pre-and postorder number of every node in T u (in particular, for v and v f ), together with the value of d(u, v) for every node v. In our case this is not possible, and we will explicitly describe which queries are required and how implement them.
Let s 1 , s 2 , . . . , s |S| be the boundary walk of the external face containing every site. Recall that VD * (S, ω) is a tree with no vertices of degree 2. A centroid decomposition of such a tree T on n nodes is recursively defined as follows: we find a centroid u ∈ T such that removing u from T and replacing it with copies, one for each edge incident to u, results in a set of trees, each with at most (n + 1)/2 edges, and repeat the reasoning on each of these trees. The construction terminates when the tree has no nodes of degree 3 or more (i.e. it consists of a single edge by the assumption of no degree-2 vertices). The point location structure consists of a centroid decomposition of VD * (S, ω).
In the query, the centroid decomposition of VD * (S, ω) is traversed starting from the root. In every step, we consider a centroid f * of the current connected subtree T * of VD * (S, ω). Removing f * partitions T * into T * 0 , T * 1 and T * 2 . Assuming that the graph is triangulated, there are three nodes y 0 , y 1 , y 2 incident to f , where y i ∈ Vor(s i j ). Let e * j be the edge of VD * (S, ω) incident to f * that is on the boundary of the cells of s i j and s i j+1 , and let T * j contain e * j . Finally, let p j be the shortest path from site s j to y i . We first need to find site s i j such that v is closer to site s i j than to sites s i j−1 and s i j+1 . Next, we need to determine if v is to the left/right of p i j . The first possibility is that the sought site s such that v ∈ Vor(s) is in fact s i j . Otherwise, depending on whether v is to the left/right of p i j , we recurse on T * j+1 or T * j , respectively. The depth of the recursion is of course O(log |S|).
As explained in [19,Lemma 5], the invariant of the traversal is that all the boundary edges of the sought Vor(s) are contained in the current T * . This implies that the number of remaining possible sites s is bounded by the number of edges of T * . Further, let k be the depth of the current vertex in the centroid decomposition. We claim that all remaining possible sites s constitute O(k) contiguous segments in the natural cyclic order around h. This is proven by induction on k. Assume that the claim holds for the previous vertex at depth k − 1, and consider the next step. As described above, we recurse on either T * j+1 or T * j , for concreteness assume the latter case. We eliminate from further consideration all sites s such that not all boundary edges of Vor(s) are contained in T * j . All such sites are between s i 0 and s i 1 in the natural cyclic order around h (note that some of these sites might have been already eliminated). Thus, at depth k the eliminated sites constitute at most k contiguous segments in the natural cyclic order around h, and the claim follows. Bitvectors. Recall that in the proof of Theorem 1 we stored the differences δ G (v, u i ) − δ G (v, u i−1 ), for i = 2, 3, . . . , c, by concatenating their Elias γ encodings. Now we need to compute any prefix sum δ G (v, u i ) − δ G (v, u 1 ) in constant time. We will augment the concatenation of all Elias γ encodings with some small extra information and a rank structure allowing us to access the appropriate position in constant time. We first recall the interface of a rank/select structure. This allows us to implement the following mechanism.

Lemma 6 ([24]) A bitvector B[1..n] can be augmented with o(n) extra bits so that the following queries can be answered in constant time
Lemma 7 For any > 0, given any sequence of integers Δ 1 , Δ 2 , . . . , Δ s , such that j i=1 Δ i ∈ [−n, n] for every j, we can construct a structure consisting of O(n + s i=1 (1 + log Δ i )) bits that returns j i=1 Δ i , for any j, in constant time.
Proof We start with concatenating the Elias γ encodings of all numbers Δ i to obtain a bitvector E [1.. ] Additionally, we construct a bitvector B [1.. ] in which we mark with a 1 the starting position of the encoding of every Δ i , and apply Lemma 6 on B. We partition the numbers into O( / log n) contiguous subsequences (called groups) with the following property: either the group consists of a single number, or the Elias γ encodings of the numbers in the group consist of at most 2 log n bits in total. To see that such a partition exists, first designate every number with the Elias γ encoding consisting of more than 4 log n bits to be in a separate group, there are no more than O( / log n) such numbers. To partition the remaining numbers, apply the following reasoning: a sequence of numbers Δ x , Δ x+1 , . . . , Δ y such that the Elias γ encoding of each number consists of at most 4 log n bits can be greedily partitioned into a number of groups with the total length of the Elias γ encodings in each group belonging to [ 4 log n, 2 log n], and possibly one group with the total length less than 4 log n.
We create another bitvector C [1.. ] in which we mark with a 1 the starting position of the encoding of the first number in every group, and apply Lemma 6 on C. Additionally, we store a precomputed table for every possible group consisting of numbers with the total length of the Elias γ encodings not exceeding 2 log n. A description of such a group consists of at most 2 log n bits, and can be represented with two numbers: the length and an -bit number. The table is first indexed by ∈ {0, . . . , 2 log n} and then a number from {0, 2 2 log n − 1} corresponding to a possible group. For each such group, the table stores the prefix sums of all its prefixes in an array of at most 2 log n numbers consisting of log n bits each. This allows us to retrieve the prefix sum of any prefix in constant time, assuming that we have and the -bit number corresponding to the concatenated Elias γ encodings. The table is stored in O( 2 log n ·n /2 · 2 log 2 n) = O(n ) bits.
Finally, we store the binary encoding of every j i=1 Δ i such that Δ j is the last number of its group. Each encoding consists of 1 + log n bits, and the encodings are concatenated one after another using O( / log n)(1 + log n) = O( ) bits in total. This finishes the description of the structure.
To compute j i=1 Δ i , we first use rank/select queries on B [1.. ] and C [1.. ] to determine which group contains Δ j , and the offset of Δ j in its group. In more detail, we first use a select query on B [1.. ] to determine the starting position of the encoding of Δ j . Next, we use a rank query on C [1.. ] to determine its group, and with another select query on C [1.. ] we determine the starting position of the encoding of the first number in that group. Finally, a rank query on B [1.. ] allows us to translate the starting position to the index of the first number in the group, and consequently the offset of Δ j in its group. Then, if Δ j is the last number in its group, we return the precomputed partial sum. Otherwise, we retrieve the precomputed prefix sum j i=1 Δ i , where Δ j is the last number in the previous group. This needs to be increased by the appropriate prefix sum of the group of Δ j , which can be retrieved from the precomputed table in constant time.
Having gathered all the technical ingredients, we are now ready to describe a modification of the proof of Theorem 1 that allows us to guarantee polylogarithmic decoding time. We first describe the high-level idea, then highlight two technical difficulties and proceed with a detailed description.
We would like to apply reasoning from the proof of Theorem 1 to find a balanced Jordan curve separator S = (u 1 , u 2 , . . . , u c ) in G with the property that the distances in G from a node u to all nodes in S can be encoded in O( √ n) bits. S partitions G into the external part G ext and the internal part G int , and we want to augment the labels with enough information so that, given G (v) and G (v ), we can compute δ G (v, v ) in polylogarithmic time if there is a shortest path from v to v that visits some node of S (this is always the case when v ∈ G int and v ∈ G ext ). By repeating the reasoning on G ext and G int recursively, this allows us to compute any δ G (v, v ). The natural idea would be to proceed as follows when constructing the label G (v). First, define a Voronoi diagram of G int by setting the weight of each node u i to be δ G (v, u i ). Then, store its point location structure that allows us to efficiently minimize , v )). However, this takes too much space, as the point location structure is a tree on c = Θ( √ n) nodes, and it appears that we need to store in G (v) a constant number of integers consisting of log n bits for each node of this tree. To overcome this, one might try to store only the top part of the centroid decomposition corresponding to subtrees of sufficiently large size, say log n. Then we can afford to store a description of this top part in G (v), and it can be used to either find the nearest site, or narrow down the set of remaining sites to O(log n). However, this still requires some information about v , and in particular we need its position in every T u i (there is no clear way of how to restrict the number of sites u i for which such information needs to be stored, as v is oblivious to v, and different nodes v might need to access different sites when traversing their top parts of the centroid decomposition). Therefore, we need a more complex approach that adds O( √ n log n) bits to every label. The modified construction proceeds as follows. G is biconnected but not necessarily triangulated, as there might be faces of length 4. We triangulate G to obtain G , and then apply Lemma 5 to obtain an r -division, with some r that will be chosen at the end as to optimise the overall size of the labels. By the properties of an r -division, there are O(n/r ) regions. Each region R contains O( √ r ) boundary nodes incident to O(1) holes. The boundary walk (u 1 , u 2 , . . . , u c ) of every hole h of R is a (not necessarily simple) cycle in G , and by the construction of G we can find a walk (u 1 , u 2 , . . . , u c ) in G that contains (u 1 , u 2 , . . . , u c ) as a subsequence, and The r -division of G naturally induces an r -division of G , and we will refer to (u 1 , u 2 , . . . , u c ) as a boundary walk of h. Note that because we have defined the r -division by applying Lemma 5 to G , some nodes u i might not belong to R, and we do not guarantee that all nodes incident to a hole are boundary nodes.
The label of every node v of G consists of two asymmetric parts. Let h be a hole of a region R, and (u 1 , u 2 , . . . , u c ) a boundary walk of h, where c = O( √ r ). Furthermore, let (u 1 , u 2 , . . . , u c ) be a subsequence of (u 1 , u 2 , . . . , u c ) consisting of the nodes of G. By the reasoning from the proof of Theorem 1, we have i (1 + log δ G (u i , u i−1 )) = O( √ r ). The first part of the label of v in G encodes δ G (v, u 1 ) in O(log n) bits, and then the differences δ G (v, u i ) − δ G (v, u i−1 ) using Lemma 7. This takes O(log n+ √ r ) bits for every hole by setting < 1/2, so O(n/ √ r ) bits in total for all R and h. If v is a boundary node of R incident to a hole h then we store the identity of R and h in the label of v (there could be multiple such pairs R and h, we choose any of them), together with the position of any occurrence of v in (u 1 , u 2 , . . . , u c ). This is already enough to determine δ G (v, v ) in constant time for any boundary node v . Otherwise, v belongs to exactly one region R, and either v is not a boundary node and belongs to the same region R or a shortest path from v to v goes through one of the boundary nodes of R. To take the former case into the account, we consider the connected components of the subgraph of G consisting of the non-boundary nodes of R. Each such node stores the identity of its component in O(log n) bits, so that we can verify if v and v belong to the same connected component and recurse there if so (that is, the whole construction is repeated on every connected component, and the resulting label is a concatenation of the labels defined in the subsequent steps of the recursion). To deal with the latter case, we need to show how to find the shortest path in G from v to v that first goes from v to a boundary node u of R and then goes to v without visiting any other boundary node (note that this might happen even when v and v belong to the same connected component). We focus on this in the remaining part of the description. Consider a region R and its hole h. We make h the external face, triangulate the non-external faces, and make the weight of every edge that does not belong to G infinite to obtain a weighted graph R (we also perturb the weights of all edges in R to make the shortest paths unique). Let u 1 , u 2 , . . . be the boundary nodes of R incident to h. We construct the Voronoi diagram of the obtained weighted graph R with sites u 1 , u 2 , . . ., setting the weight of every u i to be its distance from v in G. Storing the centroid decomposition of this Voronoi diagram would take O( √ r ) words, which is too much. Instead, we store its top part obtained by stopping as soon as the size of the current subtree is less than B, for some B = polylog ( n) that will be chosen at the end as to optimise the overall size of the labels (while keeping the query time polylogarithmic). The size of this top part is O( √ r /B) by the following lemma. Proof The decomposition can be naturally interpreted as a tree T , with every node corresponding to a subtree obtained during the process. The leaves of T correspond to single edges of T , and internal nodes of T correspond to larger subtrees. The weight w(u) of u ∈ T is the number of leaves in its subtree (equal to the size of the corresponding subtree of T ), and for each child v we have w(v) ≤ (w(u) + 1)/2. Because the degree of T is bounded by a constant, it is enough to count u ∈ T such that w(u) ≥ b; we call such nodes heavy. There are clearly at most (|T |+1)/b heavy nodes with no heavy children, as their subtrees are disjoint. This also bounds the number of heavy nodes with more than one heavy child. It remains to bound the number of heavy nodes u with exactly one heavy child v. However, such u must have some non-heavy children For each leaf in the top part of the decomposition, we store O(log n) contiguous segments of the sites that might be relevant. 3 This takes O( √ r /B · log 2 n) bits. For every non-leaf, we have a centroid f * used for deciding where to descend. We store the weights ω(s i j ) of the three relevant sites, and the preorder number of every y j in its corresponding shortest path tree T s j . This takes O( √ r /B · log n) bits. Summed over all regions R and holes h, this is O(n/( √ r B) log 2 n) bits per node. To use the centroid decomposition, we need to store enough information in the label of v as to be able to compute any δ R (u i , v ) in constant time. Recall that for a non-boundary node v we have exactly one relevant R and a constant number of Voronoi diagrams corresponding to the holes of R. Therefore, because there are only O( √ r ) sites in every Voronoi diagram, we can afford to store every δ R (u i , v ) in binary using O( √ r log n) bits overall. Additionally, v stores its preorder number in the shortest path tree rooted at every T u i , this also takes O( √ r log n) bits. To compute δ G (v, v ), we consider every hole h of the unique region R containing v . We first navigate through the stored top part of the centroid decomposition. In every step, we need to first determine the closest site s i j . This is possible as we know every weight ω(s i j ) and distance δ R (s i j , v ). Next, we decide where to descend by checking if v is to left/right of the path p s j , this is possible using the stored preorder numbers of v and y j in T s j . After reaching a leaf in the top part of the centroid decomposition, we simply consider the remaining at most B possible sites one-by-one. In this last step, we use the distances in the whole G, that is, δ G (v, s i j ) and δ G (v , s i j ). Overall Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.