alphaFeedback

WorksComputer Science

Faster Planar Diameter using Pseudoline Envelopes

AI contributions
Not recorded for this paper
View details

Abstract

We give an improved algorithm for weighted directed planar diameter that runs in O~(n3/2)\widetilde{O}(n^{3/2}) time. This improves upon the O~(n5/3)\widetilde{O}(n^{5/3}) time algorithm for weighted directed planar diameter of Gawrychowski, Kaplan, Mozes, Sharir, and Weimann [SIAM J. Comput. 2021] and the recent O~(n8/5)\widetilde{O}(n^{8/5}) time algorithm for unweighted undirected planar diameter of Fredslund-Hansen, Mozes, and Weimann [SOSA 2027]. The main new result is an improved data structure for computing the farthest vertex when given feasible planar distances to the vertices on the outer face. The critical insight is the fact that normalized distances to the vertices of a face behave like pseudolines, for which we can leverage range searching and upper envelope data structures. Using the farthest vertex data structure, we are able to compute all vertex eccentricities and diameter in O~(n3/2)\widetilde{O}(n^{3/2}).

Introduction

Let GG be a directed graph with nn vertices, real edge weights w:E→Rw : E \to\mathbb{R}, and no negative weight cycles. Write V(G)V(G) and E(G)E(G) for the vertex and edge sets of GG, and dG(u,v)d_G(u,v) for the length of a shortest directed uu-to-vv path. We set dG(u,v)=+∞d_G(u,v) = +\infty when vv is unreachable from uu, and dG(u,u)=0d_G(u,u) = 0. In particular, dG(u,v)d_G(u,v) need not equal dG(v,u)d_G(v,u) in a directed graph. The outgoing eccentricity of uu and the diameter of GG are

ecc⁡G+(u)=max⁡v∈V(G)dG(u,v),diam⁡(G)=max⁡u∈V(G)ecc⁡G+(u).\operatorname{ecc}^{+}_{G}(u) = \max_{v\in V(G)} d_G(u,v), \qquad\operatorname{diam}(G) = \max_{u\in V(G)} \operatorname{ecc}^{+}_{G}(u).

Throughout the paper, eccentricity means outgoing eccentricity.

Computing the diameter of the graph is a fundamental problem in graph algorithms. For sparse graphs with nn vertices, m=O(n)m = O(n) edges, and no negative weight edges, the simple algorithm of performing single source shortest path (SSSP) computation from every vertex runs in O~(n2)\widetilde{O}(n^2) total time1 using Dijkstra’s algorithm. Roditty and Vassilevska Williams [34] showed that assuming the strong exponential time hypothesis (SETH) and the orthogonal vectors (OV) hypothesis, there is no O(n2−ε)O(n^{2-\varepsilon}) time algorithm for any ε>0\varepsilon> 0. Since obtaining a truly subquadratic time is unlikely for general graphs, significant attention has turned to computing exact diameter in more structured families of graphs, such as bounded treewidth graphs [13, 3, 20, 4], planar graphs [6 GKM^{+}21, 17], minor-free graphs [15, 29, 25 CCG^{+}25, 35], and geometric intersection graphs [BKK^{+}22, DKP24, CGL24, CCG^{+}25, CCG^{+}26a, CCG^{+}26b].

In a celebrated 2017 breakthrough, Cabello [6] showed that diameter in weighted directed planar graphs can be computed in O~(n11/6)\widetilde{O}(n^{11/6}) running time. Gawrychowski, Kaplan, Mozes, Sharir and Weimann [GKM+21] subsequently improved the running time to O~(n5/3)\widetilde{O}(n^{5/3}). Central to both results is the understanding of additively weighted Voronoi diagrams for planar distances.

Voronoi diagram techniques crucially exploited planarity and thus did not readily extend to other graph classes. Progress in broader graph classes instead came from exploiting the combinatorial structure of distances through bounded VC-dimension. Ducoffe, Habib, and Viennot [15] first showed that subquadratic time diameter computation was possible in unweighted undirected minor-free graphs with a different structural technique involving distance VC-dimension. In a different approach, using the distance profile set systems that were shown to have bounded VC-dimension in planar graphs by Li and Parter [26], Le and Wulff-Nilsen [29] developed normalized distance profiles to obtain subquadratic diameter algorithms in unweighted minor-free digraphs. Zheng [35] recently extended the VC-dimension approach to handle minor-free digraphs with real edge weights.

Distance profile techniques have led to renewed progress on planar graphs. Recently, Fredslund-Hansen, Mozes, and Weimann [17] improved the running time for unweighted undirected planar graphs to O~(n8/5)\widetilde{O}(n^{8/5}) time by strengthening the Li and Parter [26] bound for planar distance profiles. This leaves a gap between O~(n5/3)\widetilde{O}(n^{5/3}) time for weighted directed planar graphs and O~(n8/5)\widetilde{O}(n^{8/5}) time in unweighted undirected planar graphs. Neither exponent seems to be optimal, raising the question of how far either bound can be improved.

Abboud, Mozes, and Weimann explicitly asked whether planar diameter admits an n1+o(1)n^{1+o(1)}-time algorithm or whether a superlinear lower bound can be proved [1]. At the 2016 Dagstuhl seminar Structure and Hardness in P, Søren Dahlgaard suggested as an open problem that n3/2−o(1)n^{3/2-o(1)} conditional hardness was a possible target for planar diameter [27 Section 4.9]. The exponent 3/23/2 also has a natural algorithmic motivation: the planar separator theorem of Lipton and Tarjan [28] guarantees a balanced separator with O(n)O(\sqrt{n}) vertices, and it is natural to need to consider all O(n3/2)O(n^{3/2}) vertex–separator pairs in an algorithm to compute diameter. This makes n3/2n^{3/2} time a natural milestone for planar diameter upper and lower bounds.

Results

We reach this natural n3/2n^{3/2} milestone for weighted planar diameter.

Theorem 1. There is an O~(n3/2)\widetilde{O}(n^{3/2}) time algorithm for computing the diameter and all vertex eccentricities of a real-weighted directed nn-vertex planar graph with no negative weight cycles.

The algorithm rests on a new structural theorem about planar shortest-path distances: normalized distance profiles form a family of pseudolines. Fix a face of a plane graph HH with vertices s1,s2,…,sbs_1,s_2,\ldots,s_b ordered around the face. For every vertex x∈V(H)x \in V(H), the normalized distance profile is the sequence {dH(si,x)−dH(s1,x)}1≤i≤b\{d_H(s_i,x)-d_H(s_1,x)\}_{1\le i\le b}. We prove that any two such profiles change relative order at most once as ii increases, meaning that this is a collection of pseudolines. See Figure 1 for an illustration. The most notable and surprising aspect of the new structural result is that xx is allowed to be anywhere in the graph. The standard Monge property of planar graphs applies only to pairs of vertices on a single face. This new structural result enables the usage of upper envelope and range searching techniques for planar distances.

An unweighted planar graph and distance profiles

Figure 1. Left: an unweighted planar graph. Top right: distance profiles from four selected vertices, normalized by distance to s1s_1. Bottom right: Every pseudoline defined by distance profiles crosses every other pseudoline at most once.

A basic obstacle to applying range searching to graph distances is the size of the separator. The framework of Cabello and Knauer [13] organizes distances across a separator using orthogonal range searching, with dimension depending on the number of separator vertices. This dependence is effective for bounded-treewidth graphs that have constant sized balanced separators, but planar graphs can require balanced separators of size Θ(n)\Theta(\sqrt{n}). We show how to exploit planarity to avoid this. Instead we use Voronoi cells and the CCW-first ordering of [GKM+21] to organize the vertices into intervals, within each of which cell membership is determined by a single profile comparison. The pseudoline property allows us to build efficient data structures for performing this operation.

The resulting data structure removes a costly preprocessing step in the planar Voronoi approach to diameter. The construction of Gawrychowski et al. [GKM+21] uses O~(Nb2)\widetilde{O}(Nb^2) preprocessing to compute the Voronoi diagram of an NN-vertex graph with bb sites. This data structure supports farthest-vertex queries in a Voronoi cell. We present a new data structure that allows these farthest-vertex queries to be restricted to a prescribed subset X⊆V(H)X \subseteq V(H), fixed during preprocessing: for each site ss, we seek the farthest vertex from ss among the vertices of XX in its Voronoi cell. We call XX the target set. Writing k=∣X∣k = |X|, our preprocessing takes only O~(N+bk)\widetilde{O}(N+bk) time. This saves a factor of bb when all vertices are targets, while its dependence on kk allows us to preserve distances in a large graph and optimize over a much smaller region. Combining this structure with the fast Voronoi construction of Mozes and Prigan [31] and a recursive planar decomposition gives the O~(n3/2)\widetilde{O}(n^{3/2}) running time.

Geometry of distances between boundaries and interiors Monge inequalities have long been useful in computing distances in planar graphs, as in FR-Dijkstra [18]. The connection between Monge matrices and pseudolines have been exploited previously [21, 23, 12] for matrix searching. However, the standard Monge argument only applies to distance matrices of vertices that lie on a single face. Our new theorem can be viewed as a proof that the normalized distance matrix between vertices on a single face and vertices anywhere else (after sorting rows and columns appropriately) is a totally monotone, a condition that is weaker than Monge.

Technical Overview

We give an overview of our techniques to compute all vertex eccentricities, and hence diameter of a directed plane graph GG. A key step is to do local computation on a strongly connected subgraph HH of GG with NN vertices and a set B={s1,…,sb}B = \{s_1, \ldots, s_b\} of bb vertices on a face that separates HH from some subset of vertices Y⊆V(G)Y \subseteq V(G). To compute the farthest vertex in HH from a vertex y∈Yy \in Y, we define a function ω:B→R\omega: B \to\mathbb{R} where ω(s)=dG(y,s)\omega(s) = d_G(y,s) for s∈Bs \in B, and find a vertex x∈V(H)x \in V(H) that maximizes dG(y,x)d_G(y,x). In notation this is:

max⁡x∈V(H)min⁡s∈B{ω(s)+dH(s,x)}.\max_{x \in V(H)} \min_{s \in B} \{\omega(s) + d_H(s,x)\}.

To do so, we utilize Voronoi diagrams.

Voronoi Diagrams For additive weights ω:B→R\omega: B \to\mathbb{R}, we say that the weights are admissible, if for every u,v∈Bu,v \in B, it holds that ω(u)+dH(u,v)≥ω(v)\omega(u) + d_H(u,v) \geq\omega(v) so the triangle inequality is respected. Note that shortest path distances in any graph satisfy triangle inequality and are thus admissible. Define the Voronoi cell of a boundary vertex s∈Bs \in B as

Vor⁡(s):={v∈V(H):s=arg min⁡si∈B{ω(si)+dH(si,v)}}\operatorname{Vor}(s) := \left\{v \in V(H) : s = \underset{s_i \in B}{\operatorname{arg\,min}}\{\omega(s_i) + d_H(s_i,v)\}\right\}

For simplicity we assume that no ties occur so these cells partition V(H)V(H) and form the additively weighted Voronoi diagram VD⁡(H,B,ω)\operatorname{VD}(H,B,\omega). A Voronoi cell is represented in the dual graph, and for any s∈Bs \in B, the boundary of the Voronoi cell Vor⁡(s)\operatorname{Vor}(s) is a collection of dual edges and faces and is denoted by ∂Vor⁡(s)\partial\operatorname{Vor}(s). The diagram has a compact reduced dual representation of total complexity O(b)O(b), and a represented edge may stand for a long path of underlying dual edges. The complexity of the Voronoi cell ∣∂Vor⁡(s)∣|\partial\operatorname{Vor}(s)| is measured by the number of faces that contain a vertex of Vor⁡(s)\operatorname{Vor}(s) and vertices of at least two other Voronoi cells. A standard fact (see [6] or [GKM+21, Corollary 2.3]) is that a Voronoi diagram of bb sites has total complexity ∑s∈B∣∂Vor⁡(s)∣=O(b)\sum_{s\in B}|\partial\operatorname{Vor}(s)| = O(b).

Farthest vertex in Voronoi cells The Voronoi diagram gives us a way to compute the distances:

max⁡x∈V(H)min⁡s∈B{ω(s)+dH(s,x)}=max⁡s∈B{ω(s)+max⁡x∈Vor⁡(s)dH(s,x)}.\max_{x\in V(H)}\min_{s\in B}\{\omega(s)+d_H(s,x)\}=\max_{s\in B}\left\{\omega(s)+\max_{x\in\operatorname{Vor}(s)}d_H(s,x)\right\}.

Gawrychowski, Kaplan, Mozes, Sharir, and Weimann [GKM+21, Theorem 1.1] provide such a data structure for NN-vertex planar graphs with no negative weight cycles and bb vertices lying on O(1)O(1) faces. After O~(Nb2)\widetilde{O}(Nb^2) preprocessing time, their data structure constructs the diagram for any admissible additive weight ω\omega in O~(b)\widetilde{O}(b) time. It then computes the maximum distance from each active site ss to a vertex in Vor⁡(s)\operatorname{Vor}(s) in O~(∣∂Vor⁡(s)∣)\widetilde{O}(|\partial\operatorname{Vor}(s)|) time. Thus, both constructing the diagram and computing all cell maxima take O~(b)\widetilde{O}(b) total time.

The most expensive part is preprocessing, not query time. For each pair of boundary vertices, their construction preprocesses all possible bisectors as the difference between the two additive weights varies. A fixed pair of boundary vertices requires O~(N)\widetilde{O}(N) time and space to handle. Processing all Θ(b2)\Theta(b^2) pairs therefore incurs O~(Nb2)\widetilde{O}(Nb^2) preprocessing time [GKM+21]. We avoid this pairwise preprocessing by using distance profiles that we will define shortly. When the sites lie on a single face, our data structure supports searching for the maximum among a fixed target subset of vertices XX with preprocessing time sensitive to its size. The following is our main data structure contribution.

Theorem 2 (Farthest Vertex Data Structure). Let HH be an NN-vertex directed plane graph with real edge lengths and no negative-length cycles. Fix a set B={s1,…,sb}⊆V(H)B=\{s_1,\ldots,s_b\}\subseteq V(H) of b=∣B∣b=|B| vertices on a single face of HH and a subset X⊆V(H)X\subseteq V(H) with k=∣X∣k=|X| vertices. After O~(N+bk)\widetilde{O}(N+bk)-time preprocessing, a query of admissible weights ω:B→R\omega:B\to\mathbb{R} admits the computation of an implicit representation of VD⁡(H,B,ω)\operatorname{VD}(H,B,\omega) in O~(b)\widetilde{O}(b) time. This representation supports querying for max⁡v∈Vor⁡(s)∩XdH(s,v)\max_{v\in\operatorname{Vor}(s)\cap X}d_H(s,v) for any s∈Bs\in B and a vertex (if any exist) witnessing the max in O~(∣∂Vor⁡(s)∣)\widetilde{O}(|\partial\operatorname{Vor}(s)|) time.

The target vertex set XX is fixed during preprocessing, while the additive weights ω\omega are supplied with each query. In the diameter algorithm, the graph we are building the data structure on may be much larger than ∣X∣|X|, making this refined preprocessing time essential.

Distance profiles and pseudolines Fix an arbitrary vertex, say s1∈Bs_1\in B, where the vertices B={s1,s2,…,sb}B=\{s_1,s_2,\ldots,s_b\} are ordered counterclockwise around a single face. Define the normalized distance profile of a target x∈Xx\in X as

fxs1(sj):=dH(sj,x)−dH(s1,x),sj∈B.f_x^{s_1}(s_j) := d_H(s_j,x)-d_H(s_1,x), \qquad s_j\in B.

These were examined by Le and Wulff-Nilsen [29] which were inspired by the patterns of Li and Parter [26]. The crucial observation is that viewing the distance profile as a (discrete) curve going through the points (1,fxs1(s1)),(2,fxs1(s2)),…,(b,fxs1(sb))(1, f^{s_1}_{x}(s_1)), (2, f^{s_1}_{x}(s_2)), \ldots, (b, f^{s_1}_{x}(s_b)), these curves satisfy a pseudoline property: two curves change relative order at most once along the boundary. See Figure 1 for an illustration of this. The proof of this follows from a variation of the result of Li and Parter [26], who show that unweighted graphs avoid alternating patterns. The pseudoline property indicates that these profiles behave similarly to abstract lines in the plane. In particular, this implies upper envelopes of kk pseudolines have complexity O(k)O(k).

Handling a query For each query, we construct the additively weighted Voronoi diagram with the recent fast construction algorithm of Mozes and Prigan [31] in O~(b)\widetilde{O}(b) time. We then use the fact that the Voronoi edges of Vor⁡(s1)\operatorname{Vor}(s_1) partition the CCWCCW-first ordering of the shortest-path tree Ts1T_{s_1} rooted at s1s_1 into one circular interval per Voronoi edge, as observed in [GKM+21]. The cell Vor⁡(s1)\operatorname{Vor}(s_1) induces a connected subtree of Ts1T_{s_1}, and each excursion of the tree traversal outside the cell visits an entire attached subtree before returning. The outward edges of the cell occur in the order of its dual boundary, so all excursions through the same reduced Voronoi edge lie in its corresponding interval. See § 5.1 for details and Figure 3 for an illustration. On the interval corresponding to an edge separating the Voronoi cells of s1s_1 and sis_i, membership in the Voronoi cell of s1s_1 is determined by the single comparison fxs1(si)>ω(s1)−ω(si)f^{s_1}_{x}(s_i) > \omega(s_1) - \omega(s_i). For an xx outside Vor⁡(s1)\operatorname{Vor}(s_1) in the interval, the shortest path from s1s_1 to xx first leaves Vor⁡(s1)\operatorname{Vor}(s_1) at a vertex v∈Vor⁡(si)v \in\operatorname{Vor}(s_i). Replacing the s1s_1-to-vv prefix by a shortest path from sis_i to vv yields fxs1(si)<ω(s1)−ω(si)f^{s_1}_{x}(s_i) < \omega(s_1) - \omega(s_i), so the comparison with sis_i alone excludes every vertex outside Vor⁡(s1)\operatorname{Vor}(s_1) in the interval.

Voronoi edges give CCW-first intervals

Figure 3. Voronoi edges give CCW-first intervals. The pink cell Vor⁡(s)\operatorname{Vor}(s) has dual boundary Γ\Gamma, with the reduced Voronoi edge EℓE_\ell highlighted in orange. Paired arcs show the two traversal directions of each primal edge. The labels ρi(a)\rho_i(a) are the CCW-first preorder indices of the artificial leaves associated with the directed arcs aa. Numbering starts at ss with index 0, using the leftward ray in the outer face as reference. Every original vertex and every artificial leaf contributes one index, including leaves for reverse and non-tree arcs. The red tree edge ee enters the component CeC_e of T−V(Vor⁡(s))T - V(\operatorname{Vor}(s)), where TT is the shortest path tree rooted at ss. On the bottom line, the orange bracket marks [ρi(eℓ),ρi(eℓ+1))=[58,205)[\rho_i(e_\ell),\rho_i(e_{\ell+1})) = [58, 205). The red segment marks the complete excursion into CeC_e, from ρi(e)=106\rho_i(e) = 106 to the reverse arc at index 152; gray segments mark the other excursions through EℓE_\ell. The augmented subtree of CeC_e contains seven original vertices and 39 artificial leaves, accounting for the difference 152−106=7+39152 - 106 = 7 + 39. Thus V(Ce)⊆JℓV(C_e) \subseteq J_\ell. The dashed arc closes Γ\Gamma through the outer face.

We find the farthest vertex of Vor⁡(s1)∩X\operatorname{Vor}(s_1) \cap X within a CCWCCW-first interval II by binary searching the sorted distances dH(s1,x)d_H(s_1,x) for x∈Xx \in X. For a candidate distance DD, we consider targets whose CCWCCW-first positions lie in II and whose distances from s1s_1 are at least DD. A data structure on CCWCCW-first positions and distances decomposes the candidate set into polylogarithmically many canonical subsets, whose upper envelopes are stored during preprocessing. If the largest envelope value at sis_i exceeds ω(s1)−ω(si)\omega(s_1) - \omega(s_i), the vertex xx corresponding to a maximizing profile fxs1f^{s_1}_{x} belongs to Vor⁡(s1)\operatorname{Vor}(s_1) and satisfies dH(s1,x)≥Dd_H(s_1,x) \ge D; otherwise, no candidate belongs to Vor⁡(s1)\operatorname{Vor}(s_1). The pseudoline property of normalized distance profiles shows that these upper envelopes have linear complexity. Standard range searching then achieves O~(bk)\widetilde{O}(bk) preprocessing for the kk target vertices, in addition to O~(N)\widetilde{O}(N) shared global preprocessing. The reduced Voronoi diagram has O(b)O(b) Voronoi edges, each representing a bisector between two sites and defining one interval in the CCWCCW-first ordering rooted at each of the two sites. Thus, processing the resulting O(b)O(b) intervals in O~(1)\widetilde{O}(1) time per interval gives O~(b)\widetilde{O}(b) total query time.

From data structure queries to diameter. We apply the data structure within a recursive rr-division with few holes [24]. The important insight is that it suffices to handle distances between vertices on successive levels of the rr-division. This way, we can separately consider the holes of each piece of the division in every level of the hierarchy as a single face to apply Theorem 2. Pairs of vertices between these successive levels and the remaining pairs at the leaves account for every pair of vertices in the graph. Each vertex maintains the greatest distance found, yielding eccentricities and hence the diameter.

Organization

We begin with preliminaries in § 2, before presenting the full algorithm for diameter and eccentricities using our data structure of Theorem 2 in § 3. Next, we analyze the structural connection between distance profiles and pseudolines in § 4 before proving Theorem 2 in § 5.

Preliminaries

Unless stated otherwise, GG is a directed planar graph with n=∣V∣n = |V| vertices and O(n)O(n) edges with a weight function w(e)=w(u,v)w(e) = w(u,v) for each edge (u,v)(u,v). We assume GG has no negative weight cycles. For a subgraph H⊆GH \subseteq G with NN vertices, we use V(H)V(H) to denote the vertices of HH, and E(H)E(H) to denote the edges of HH. We designate a face of HH as the outer face and let BB be the set of vertices on the boundary. A plane graph is a planar graph with a fixed embedding. Connectivity, faces, and planar duality refer to the underlying undirected embedded graph. We write e∗e^* and f∗f^* for the dual edge of a primal edge ee and the dual vertex of a face ff.

Simplifying assumptions. For the weighted algorithm for computing eccentricities, we will assume that the undirected version of the input planar graph is simple and maximal (thus triangulated), and we have weighted directed edges going in both directions (so the graph is strongly connected). We justify these assumptions as follows. We can remove self-loops and for each ordered pair of adjacent vertices, retain only a shortest directed edge. Define M=∑e∈E(G)∣w(e)∣M = \sum_{e \in E(G)} |w(e)|. Every reachable pair has a shortest simple path of absolute value at most MM. Add edges to any embedding of the graph to make it maximal, giving length 2M+12M + 1 to both directions of every added edge and to each missing reverse directed edge. Note that for any two vertices u,v∈V(G)u,v \in V(G) where uu can reach vv, the shortest path distance did not change by the transformation. On the other hand if uu cannot reach vv, the shortest path distance will be at least 2M+1−M=M+12M + 1 - M = M + 1, as the sum of all original edges is at least −M-M. Thus if a shortest path from uu to vv is larger than MM in the augmented graph, then uu does not reach vv in the original graph. Furthermore, we can assume that the lengths of all shortest paths are unique. This can be done by standard symbolic perturbation of the edges.

Recursive subdivisions A region of a planar graph is an edge-induced embedded subgraph where we ignore edge orientations. A division covers the edges of the graph by regions, which may overlap on their boundaries. A vertex shared by multiple regions is a boundary vertex. The boundary vertices of a region RR are denoted by ∂R\partial R. A hole of RR is a face of RR that is not a face of the original embedded graph. An rr-division is a division with O(n/r)O(n/r) regions, each with at most rr vertices and O(r)O(\sqrt{r}) boundary vertices. It has few holes if each region has O(1)O(1) holes and every edge shared by two regions lies on a hole boundary in each of them [citep][KMS13].

A decomposition tree is a rooted hierarchy of regions whose root is the entire graph and whose children cover their parent. For a geometrically decreasing sequence r=(rm,…,r1)\mathbf{r} = (r_m,\ldots,r_1), a recursive rr-division with few holes is such a hierarchy where each level is a rir_i-division with few holes.

Theorem 3 (Recursive divisions [citep][KMS13], Theorems 2 and 3). For any geometrically decreasing sequence r=(rm,…,r1)\mathbf{r} = (r_m,\ldots,r_1) with r1r_1 larger than some absolute constant, a recursive rr-division with few holes can be computed in O(n)O(n) time.

We use the connected regions produced by this construction [citep][KMS13], Section 2.5). At scale rr, there are O(n/r)O(n/r) regions, each of size O(r)O(r), with O(r)O(\sqrt{r}) boundary vertices and O(1)O(1) holes.

Multiple-source shortest paths (MSSP). For a strongly connected planar graph HH, let TsT_s denote the shortest-path tree rooted at ss, with tree edges directed away from ss.

We use the multiple-source shortest-path (MSSP) algorithm of Klein [citep][Kle05]. For a fixed face BB of an NN-vertex planar graph HH, the algorithm moves the root of the shortest-path tree around the boundary of BB. Over the entire execution, the shortest-path tree undergoes only O(N)O(N) changes, and a persistent representation gives access to the tree rooted at each boundary vertex.

Theorem 4 (MSSP [citep][Kle05], [citep][MWN10]). Let HH be an NN-vertex directed plane graph no negative weight cycles, and let BB be a distinguished face. In O~(N)\tilde{O}(N) time and space, one can construct a data structure that, given s∈Bs \in B and v∈V(H)v \in V(H), returns dH(s,v)d_H(s,v) in O(log⁡N)O(\log N) time.

Note that the original algorithm of [22] could only handle nonnegative edge weights. Mozes and Wulff-Nilsen [32] show that by vertex reweighting, this can be extended to any graph with no negative weight cycle with O(Nlog⁡2N/log⁡log⁡N)O(N \log^{2} N / \log\log N) additional preprocessing time.

Distance oracle. We will need exact distances between arbitrary ordered pairs of vertices. We use the distance oracle of Charalampopoulos et al. [10], with the improved construction of Mozes and Prigan [31].

Theorem 5 (Distance oracle [31 Theorem 1.1]). Let GG be an nn-vertex directed planar graph with real edge weights and no negative weight cycles. In n1+o(1)n^{1+o(1)} time and space, one can construct a data structure that, given any ordered pair (u,v)∈V(G)×V(G)(u,v) \in V(G) \times V(G), returns dG(u,v)d_G(u,v) in log⁡2+o(1)n\log^{2+o(1)} n time.

Weighted Eccentricities and Diameter Algorithm

We prove Theorem 1 by applying the Voronoi farthest vertex data structure of Theorem 2 separately within each hole of a recursive division. The high level strategy is to construct a recursive rr-division with few holes and consider each parent-child pair of regions (P,Q)(P,Q). For each hole hh of QQ, we query distances from vertices of QQ to vertices of PP lying in hh or on its boundary.

Recall that the input is an nn-vertex planar graph GG that is strongly connected and triangulated. We present the entire algorithm here for computing the eccentricities of all vertices.

  1. Construct a global distance oracle. Construct a single distance oracle on the entire graph GG using Theorem 5. This oracle is used in steps 4(b) and 4(c) of the algorithm.

  1. Construct a recursive rr-division. Construct a recursive rr-division with few holes of Theorem 3, with geometrically decreasing scales r=(rm,…,r1)r=(r_m,\ldots,r_1) and r1=Lr_1=L for a parameter LL we will specify later.

  1. Initialize the answers. For every vertex u∈V(G)u \in V(G), let A[u]A[u] denote its tentative eccentricity and W[u]W[u] denote a vertex witnessing this value. Initialize A[u]=0A[u]=0 and W[u]=uW[u]=u.

  1. Process distances. For every parent-child pair (P,Q)(P,Q) in the hierarchy, perform Steps 4(a) and 4(b) separately for each hole hh of QQ, separating QQ from P∖QP \setminus Q, including the exterior hole when present. Let BhB_h be the boundary walk around the hole hh. (If the hole hh is not simple, e.g. because of pendant vertices or bridges, perform the standard transformation of adding an additional copy of each vertex for each occurrence in a facial walk and add zero weight edges to make the boundary simple.) Note that Step 4(c) is performed only when QQ is a leaf.

    (a) Build the local data structures. Define HP,hH_{P,h} by retaining the part of GG drawn in hh, together with its boundary BhB_h. Thus V(HP,h)∩V(Q)=V(Bh)V(H_{P,h}) \cap V(Q)=V(B_h). (Note that HP,hH_{P,h} does not contain QQ.) Using Theorem 2, choosing X=V(P)∩V(HP,h)X=V(P)\cap V(H_{P,h}), construct the implicit data structure for querying VD⁡(HP,h,Bh,ω)\operatorname{VD}(H_{P,h},B_h,\omega) for ω\omega defined by vertices within QQ.

    (b) Handle child to parent distances. For every vertex u∈V(Q)u \in V(Q), query the global distance oracle of Step 1 to obtain the additive boundary weights ωu(s)=dG(u,s)\omega_u(s)=d_G(u,s) for s∈Bhs \in B_h. Using the implicit data structure for VD⁡(HP,h,Bh,ωu)\operatorname{VD}(H_{P,h},B_h,\omega_u), query with the additive weights ωu\omega_u to compute the farthest vertex from uu in Vor⁡(s)∩V(P)\operatorname{Vor}(s)\cap V(P) for all s∈Bhs \in B_h, updating A[u]A[u] and W[u]W[u] if a farther vertex is found. The distances used within the Voronoi data structure remain dHP,hd_{H_{P,h}}.

    (c) Handle distances within leaves. If QQ is a leaf, query the global distance oracle for dG(u,v)d_G(u,v) for every ordered pair (u,v)∈V(Q)×V(Q)(u,v)\in V(Q)\times V(Q). Update A[u]A[u] and W[u]W[u] if a farther vertex is found. These distances are computed in the full graph GG using the distance oracles of Step 1.

At the end of the algorithm, we will have computed the eccentricity of every vertex u∈V(G)u \in V(G) as A[u]A[u] and a witness to the eccentricity W[u]W[u]. The diameter can be computed as the maximum eccentricity.

Correctness

Fix a vertex u∈V(G)u \in V(G) with u∈V(Qu)u \in V(Q_u) for a leaf region QuQ_u. Suppose the eccentricity of uu is witnessed by a vertex t∈V(G)t \in V(G). We divide into two cases depending on whether t∈Qut \in Q_u. In either case, we show that we have considered the distance from uu to tt as a candidate for eccentricity. We also show that every candidate considered in Steps 4(b) and 4(c) is an exact distance in GG, and hence cannot exceed the eccentricity of uu; together with coverage, this proves correctness.

Coverage of leaf distances Suppose t∈Qut \in Q_u. Step 4(c) queries the global distance oracle for every ordered pair of vertices in V(Qu)V(Q_u). In particular, the oracle returns the exact distance dG(u,t)d_G(u,t), even if a shortest path leaves and reenters QuQ_u. This distance is considered as a candidate for the eccentricity of uu.

Coverage of non-leaf distances Suppose that t∉Qut \notin Q_u. Then there must be some parent and child region PP and QQ with u∈Qu \in Q, and t∈P∖Qt \in P \setminus Q where hh is the hole of QQ containing tt, with boundary BhB_h. The piece QQ can be found by walking up the hierarchy from QuQ_u until we find that t∈Pt \in P. Step 4(b) queries the global distance oracle to obtain ωu(s)=dG(u,s)\omega_u(s) = d_G(u,s) for every s∈Bhs \in B_h, and constructs an implicit representation of VD⁡(HP,h,Bh,ωu)\operatorname{VD}(H_{P,h}, B_h, \omega_u).

The following argument applies to every processed parent-child pair (P,Q)(P,Q), every hole hh of QQ, and every source u∈V(Q)u \in V(Q). For every v∈V(HP,h)v \in V(H_{P,h}), splitting a shortest uu-to-vv path at its last vertex of BhB_h gives dG(u,v)=min⁡b∈Bh{ωu(b)+dHP,h(b,v)}d_G(u,v) = \min_{b \in B_h}\{\omega_u(b) + d_{H_{P,h}}(b,v)\}, since the remaining suffix lies in HP,hH_{P,h}. Thus, for every v∈Vor⁡(s)v \in\operatorname{Vor}(s), the value ωu(s)+dHP,h(s,v)\omega_u(s) + d_{H_{P,h}}(s,v) equals dG(u,v)d_G(u,v), so we have considered correct shortest paths for all candidates considered.

Suppose t∈Vor⁡(s)∩V(P)t \in\operatorname{Vor}(s) \cap V(P) for s∈Bhs \in B_h. The data structure of Theorem 2 returns the farthest vertex in Vor⁡(s)∩V(P)\operatorname{Vor}(s) \cap V(P), suppose it returned some vertex v′v'. Thus v′v' satisfies the expression as follows.

v′=arg⁡max⁡v∈Vor⁡(s)∩V(P) ωu(s)+dHP,h(s,v)=arg⁡max⁡v∈Vor⁡(s)∩V(P) dG(u,s)+dHP,h(s,v)=arg⁡max⁡v∈Vor⁡(s)∩V(P) dG(u,v)v' = \underset{v \in\operatorname{Vor}(s) \cap V(P)}{\arg\max}\ \omega_u(s) + d_{H_{P,h}}(s,v) = \underset{v \in\operatorname{Vor}(s) \cap V(P)}{\arg\max}\ d_G(u,s) + d_{H_{P,h}}(s,v) = \underset{v \in\operatorname{Vor}(s) \cap V(P)}{\arg\max}\ d_G(u,v)

Thus we have considered a distance dG(u,v′)≥dG(u,t)d_G(u,v') \ge d_G(u,t) as a candidate for the eccentricity of uu. Since tt witnesses the eccentricity of uu, equality follows, and v′v' is therefore globally farthest from uu.

Running time

The global distance oracle of Step 1 is constructed once in n1+o(1)n^{1+o(1)} time using Theorem 5. Step 2 takes O(n)O(n) time using Theorem 3.

To analyze Step 4, consider a child region QQ at scale rir_i of the recursive rr-division, its parent PP, and a hole hh of QQ. In particular, this means that both PP and QQ have size O(ri)O(r_i), and the boundary hole BhB_h has size b=O(ri)b = O(\sqrt{r_i}). Step 4(a) applies Theorem 2 to HP,hH_{P,h} of size O(n)O(n), with ∣Bh∣=O(ri)|B_h| = O(\sqrt{r_i}) and ∣X∣=O(ri)|X| = O(r_i). This takes O~(n+ri3/2)\widetilde{O}(n + r_i^{3/2}) preprocessing time.

Step 4(b) makes O(∣V(Q)∣∣Bh∣)=O(ri3/2)O(|V(Q)||B_h|) = O(r_i^{3/2}) oracle queries to obtain the additive weights, taking O(ri3/2log⁡2+o(1)n)=O~(ri3/2)O(r_i^{3/2}\log^{2+o(1)} n) = \widetilde{O}(r_i^{3/2}) time. For each of the O(ri)O(r_i) vertices of QQ, constructing VD⁡(HP,h,Bh,ωu)\operatorname{VD}(H_{P,h}, B_h, \omega_u) takes O~(b)\widetilde{O}(b) time by Theorem 2. Querying all Voronoi cells takes O~(∑s∈Bh∣∂Vor⁡(s)∣)=O~(ri)\widetilde{O}(\sum_{s \in B_h} |\partial\operatorname{Vor}(s)|) = \widetilde{O}(\sqrt{r_i}) time for each ωu\omega_u, taking O~(ri3/2)\widetilde{O}(r_i^{3/2}) time in total. Step 4(c) makes O(∣V(Q)∣2)=O(L2)O(|V(Q)|^2) = O(L^2) oracle queries per leaf, taking O~(L2)\widetilde{O}(L^2) time per leaf and O~(nL)\widetilde{O}(nL) time over all leaves, since all leaves have size at most LL. Using the fact that there are O(n/ri)O(n/r_i) many regions at scale rir_i, and that each child region has O(1)O(1) holes, so processing all its holes changes the bounds for Steps 4(a) and 4(b) by only a constant factor. Therefore, the total running time is:

n1+o(1)+O~(nL⋅L2+∑i=1mnri(n+ri3/2))=n1+o(1)+O~(nL+n2∑i=1m1ri+n∑i=1mri)=O~(nL+n2L+n3/2).\begin{aligned} n^{1+o(1)}+\widetilde{O}\left(\frac{n}{L}\cdot L^2+\sum_{i=1}^{m}\frac{n}{r_i}\left(n+r_i^{3/2}\right)\right)=n^{1+o(1)}+\widetilde{O}\left(nL+n^2\sum_{i=1}^{m}\frac{1}{r_i}+n\sum_{i=1}^{m}\sqrt{r_i}\right) \\ &=\widetilde{O}\left(nL+\frac{n^2}{L}+n^{3/2}\right). \end{aligned}

The last equality uses that the scales are geometric, with minimum LL and maximum O(n)O(n). Setting L=nL=\sqrt{n} balances the terms nLnL and n2/Ln^2/L and gives O~(n3/2)\widetilde{O}(n^{3/2}) time.

Pseudoline Families

Here we give a careful definition of weak pseudoline families that allow for stretches of equality between the pseudolines, before showing that normalized distance profiles form a pseudoline family. Subsequently, we describe efficient data structures for constructing upper envelopes of distance profile pseudolines.

Characterizing Pseudolines

In this section we define what it means for a family of discrete functions to be pseudolines. We say that the collection of functions f1,…,fk:[b]→Rf_1,\ldots,f_k:[b]\to\mathbb{R} is a weak pseudoline family, if the ordered list of differences {fi(x)−fj(x)}x∈[b]\{f_i(x)-f_j(x)\}_{x\in[b]} switches signs at most once after omitting all zero entries. This induces a geometric belowness relationship: we can say fif_i is weakly below fjf_j at xx, or in notation fi(x)≺fj(x)f_i(x)\prec f_j(x). These functions are called pseudolines because if fif_i is initially below fjf_j, then there is at most one point where fif_i transitions to being weakly above fjf_j, and fif_i will never be below fjf_j afterwards. We formally characterize this relation as it will be useful in our later algorithms.

Definition 6. Let bb be a positive integer and consider kk discrete functions f1,…,fk:[b]→Rf_1,\ldots,f_k:[b]\to\mathbb{R}. For i,j∈[k]i,j\in[k] and x∈[b]x\in[b], we can say that fi(x)≺fj(x)f_i(x)\prec f_j(x) if the function fif_i lies weakly below fjf_j at xx, meaning that one of the following holds:

  1. Strictly below. fi(x)<fj(x)f_i(x)<f_j(x).

  1. Weakly below. fi(x)=fj(x)f_i(x)=f_j(x) and either:

    (a) fi(y)=fj(y)f_i(y)=f_j(y) for all z<y≤xz<y\le x and fi(z)<fj(z)f_i(z)<f_j(z) for some 1≤z<x1\le z<x.

    (b) fi(y)=fj(y)f_i(y)=f_j(y) for all 1≤y<z1\le y<z and fi(z)<fj(z)f_i(z)<f_j(z) for some x<z≤bx<z\le b.

    (c) fi(y)=fj(y)f_i(y)=f_j(y) for all 1≤y≤b1\le y\le b and i<ji<j.

This definition of a weak pseudoline family allows for stretches of equality and thus is slightly different from the standard definition of pseudolines in [2], but remark that they can be handled in essentially the same way (e.g. if you first make infinitesimal perturbations). We justify why we need this more cumbersome definition to handle these stretches of equality in an example in next section.

Normalized Distance Profiles form a Pseudoline Family

Recall that we consider a planar graph HH, with a specific identified face B={s1,…,sb}B=\{s_1,\ldots,s_b\}. Without loss of generality, we may assume that BB is the outer face. Recall also the definition of the normalized distance profiles:

fxs1(si):=dH(si,x)−dH(s1,x),si∈B.f_x^{s_1}(s_i):=d_H(s_i,x)-d_H(s_1,x),\qquad s_i\in B.

Data Structures for Upper Envelope of Distance Profile Pseudolines

These distance profiles have stretches of equality for technical reasons: there can be stretches of equality between two distance profiles that arise naturally from the shortest path topology. As an example consider two vertices x,y∈V(H)x,y \in V(H), where yy lies on the shortest path between s1s_1 and xx as well as on the shortest path between s2s_2 and xx. In this case

fxs1(s2)=dH(s2,x)−dH(s1,x)=dH(s2,y)+dH(y,x)−(dH(s1,y)+dH(y,x))=dH(s2,y)−dH(s1,y)=fys1(s2).f_x^{s_1}(s_2)=d_H(s_2,x)-d_H(s_1,x) = d_H(s_2,y)+d_H(y,x)-(d_H(s_1,y)+d_H(y,x)) = d_H(s_2,y)-d_H(s_1,y)=f_y^{s_1}(s_2).

We prove here that normalized distance profiles {fxs1}x∈V(H)\{f_x^{s_1}\}_{x\in V(H)} form a weak pseudoline family by adapting the argument of Li and Parter [26]. Their argument was only for unweighted profiles, where they instead analyzed the discrete derivative of the distance profile {fxs1(si)−fxs1(si−1)}i=2,…,b\{f_x^{s_1}(s_i)-f_x^{s_1}(s_{i-1})\}_{i=2,\ldots,b}. We generalize the argument to weighted profiles.

Lemma 7. The set of normalized distance profiles {fxs1}x∈V(H)\{f_x^{s_1}\}_{x\in V(H)} forms a (weak) pseudoline family.

Proof. Suppose for sake of contradiction that there were two vertices x,y∈V(H)x,y \in V(H) where their normalized distance profiles fxs1f_x^{s_1} and fys1f_y^{s_1} crossed twice. Interchanging xx and yy if necessary, there are indices 1<i<j<k1<i<j<k such that

fxs1(s1)=fys1(s1)=0,fxs1(si)<fys1(si),fxs1(sj)>fys1(sj),fxs1(sk)<fys1(sk).(1)f_x^{s_1}(s_1)=f_y^{s_1}(s_1)=0,\qquad f_x^{s_1}(s_i)<f_y^{s_1}(s_i),\qquad f_x^{s_1}(s_j)>f_y^{s_1}(s_j),\qquad f_x^{s_1}(s_k)<f_y^{s_1}(s_k). \tag*{(1)}
Example of a planar graph with paths between boundary vertices and interior vertices

Figure 2. Example of a planar graph with s1,si,sj,sks_1,s_i,s_j,s_k in counterclockwise order around the boundary. There is no way for the undirected path from s1s_1 to sjs_j through yy to avoid crossing the undirected path from sis_i to sks_k through xx without meeting at some vertex zz. In notation of the proof of Lemma 7 we would have a=ska=s_k and b=s1b=s_1.

Observe that the shortest path from aa to xx, with a∈{si,sk}a\in\{s_i,s_k\}, must intersect some shortest path from bb to yy, with b∈{s1,sj}b\in\{s_1,s_j\}. This follows because s1,si,sj,sks_1,s_i,s_j,s_k appear in order on the boundary of BB, and thus in the undirected graph, there cannot be an undirected path from sis_i to xx to sks_k that does not intersect the undirected path from s1s_1 to yy to sjs_j since both lie on the same side of the outer face BB (see Figure 2). Suppose that these two paths intersected at a vertex zz.

dH(a,y)+dH(b,x)≤dH(a,z)+dH(z,y)+dH(b,z)+dH(z,x)=dH(a,x)+dH(b,y).d_H(a,y)+d_H(b,x)\le d_H(a,z)+d_H(z,y)+d_H(b,z)+d_H(z,x)=d_H(a,x)+d_H(b,y).

Subtracting dH(s1,x)+dH(s1,y)d_H(s_1,x)+d_H(s_1,y) from both sides yields

fys1(a)+fxs1(b)≤fxs1(a)+fys1(b).(2)f_y^{s_1}(a)+f_x^{s_1}(b)\le f_x^{s_1}(a)+f_y^{s_1}(b). \tag*{(2)}

On the other hand, (1) combined with the definition of aa and bb gives fxs1(a)<fys1(a)f_x^{s_1}(a)<f_y^{s_1}(a) and fys1(b)≤fxs1(b)f_y^{s_1}(b)\le f_x^{s_1}(b). Adding these comparisons gives

fys1(a)+fxs1(b)>fxs1(a)+fys1(b)f_y^{s_1}(a)+f_x^{s_1}(b)>f_x^{s_1}(a)+f_y^{s_1}(b)

This is a contradiction, so we conclude that {fxs1}x∈V(H)\{f_x^{s_1}\}_{x\in V(H)} is a pseudoline family.

Data Structures for Upper Envelope of Distance Profile Pseudolines

In this section we discuss basic computation of upper envelopes, and describe a data structure to quickly compute upper envelopes of distance profiles around different boundary vertices.

Constructing upper envelopes We begin by considering two basic geometric primitives to manipulate pseudoline families.

  1. Point comparison. Given two x,y∈Xx,y \in X and a point sis_i, decide if fxs(si)≺fys(si)f_x^s(s_i) \prec f_y^s(s_i).

  1. Locating a crossing. Given two x,y∈Xx,y \in X, find the smallest ii such that fxs(si)≻fys(si)f_x^s(s_i) \succ f_y^s(s_i) or report that none exist.

If these geometric primitives can be implemented in O~(1)\widetilde{O}(1) time, we can compute the upper envelope with any algorithm, e.g. Graham’s scan [33]. Graham’s scan sorts the vertices of X={x1,…,xk}X = \{x_1,\ldots,x_k\} such that fx1s(s1)≻fx2s(s1)≻⋯≻fxks(s1)f_{x_1}^s(s_1) \succ f_{x_2}^s(s_1) \succ\cdots\succ f_{x_k}^s(s_1), and then processes each pseudoline in this order from first to last, building the upper envelopes using a stack.

Theorem 8 (Graham’s Scan [33]). There is an algorithm that takes as input kk pseudolines and computes the upper envelope of the pseudolines with O(klog⁡k)O(k \log k) many calls to point comparisons and locating crossings.

Geometric primitives for distance profiles Here we show that point comparisons and locating a crossing can be performed in O~(1)\widetilde{O}(1) time for any collection of kk distance profiles {fxs}x∈X\{f_x^s\}_{x\in X} for any of the bb choices of s∈Bs \in B (when we choose a different ss we rotate the labels on all the sites so ss appears first on the boundary ordering) on the boundary after O~(bk)\widetilde{O}(bk) preprocessing. This is notable because to specify a single distance profile requires O(b)O(b) space, and there are bkbk many pseudolines of the form fxsf_x^s, so a naive implementation could require O(b2k)O(b^2k) preprocessing. Conveniently, any fixed x∈Xx \in X and any si,sj∈Bs_i,s_j \in B, the distance profiles fxsif_x^{s_i} can be obtained from fxsjf_x^{s_j} by shifting all coordinates by an additive constant dH(sj,x)−dH(si,x)d_H(s_j,x)-d_H(s_i,x). Our following data structure is able to leverage this fact by exploiting the fact that this transformation preserves differences between adjacent points.

Lemma 9 (Geometric Primitive Data Structure). Let HH be a planar graph with a specified face BB and a set X⊆V(H)X \subseteq V(H) of kk target vertices, and let bb denote the number of boundary vertices of BB. Suppose all distances from boundary vertices of BB to vertices in XX are given. After O~(bk)\widetilde{O}(bk) preprocessing, point comparisons and crossing-location queries for the family {fxs}x∈X\{f_x^s\}_{x\in X} for any fixed boundary vertex s∈Bs \in B can be answered in O~(1)\widetilde{O}(1) time each.

Proof. The explicit distance matrix gives the bkbk values of fxs(si)f_x^s(s_i) for all si∈Bs_i \in B and x∈Xx \in X. It will be convenient for us to consider the discrete differences of adjacent values Dx[si]=fxs(si−1(modb))−fxs(si)D_x[s_i] = f_x^s(s_{i-1}\pmod b)-f_x^s(s_i), where we define s0=sbs_0=s_b. Observe that this does not depend on the choice of basepoint ss, so there are at most bkbk such values. After sorting these bkbk values, we can translate the entries into rank space so all values are integers between 1 and bkbk, without changing the answer to any comparison between them.

Point Comparison To handle point comparisons between fxs(si)f_x^s(s_i) and fys(si)f_y^s(s_i), we can directly compute both values. If they are not equal, we are done. Otherwise fxs(si)=fys(si)f_x^s(s_i)=f_y^s(s_i), we will lexicographically compare the following discrete difference strings:

Kxs(i)=(Dx[si],Dx[si−1],…,Dx[s2])andKys(i)=(Dy[si],Dy[si−1],…,Dy[s2])K_x^s(i)=(D_x[s_i],D_x[s_{i-1}],\ldots,D_x[s_2]) \qquad\text{and} \qquad K_y^s(i)=(D_y[s_i],D_y[s_{i-1}],\ldots,D_y[s_2])

Suppose Kxs(i)≠Kys(i)K_x^s(i) \ne K_y^s(i). Let jj be the largest value where Dx[sj]≠Dy[sj]D_x[s_j] \ne D_y[s_j]. Interchanging xx and yy if necessary, assume that Dx[sj]<Dy[sj]D_x[s_j] < D_y[s_j]. As fxs(si)=fys(si)f_x^s(s_i)=f_y^s(s_i), we have that

fxs(sj)=fxs(si)+Dx[si]+Dx[si−1]+⋯+Dx[sj+1]=fys(si)+Dy[si]+Dy[si−1]+⋯+Dy[sj+1]=fys(sj),(3)f_x^s(s_j)=f_x^s(s_i)+D_x[s_i]+D_x[s_{i-1}]+\cdots+D_x[s_{j+1}]=f_y^s(s_i)+D_y[s_i]+D_y[s_{i-1}]+\cdots+D_y[s_{j+1}]=f_y^s(s_j), \tag*{(3)}

and that fxs(sj−1)<fys(sj−1)f_x^s(s_{j-1}) < f_y^s(s_{j-1}). Thus we can safely conclude that fxs(si)<fys(si)f_x^s(s_i) < f_y^s(s_i).

Otherwise K‾xs(i)=K‾ys(i)\overline{K}_x^s(i) = \overline{K}_y^s(i) and all values of fxs(sℓ)=fys(sℓ)f_x^s(s_\ell) = f_y^s(s_\ell) for all 1≤ℓ≤i1 \le\ell\le i. Then we must look ahead for a crossing:

K‾xs(i)=(Dx[si+1],Dx[si+2],…,Dx[sb])andK‾ys(i)=(Dy[si+1],Dy[si+2],…,Dy[sb])\overline{K}_x^s(i) = (D_x[s_{i+1}],D_x[s_{i+2}],\ldots,D_x[s_b]) \qquad\text{and} \qquad\overline{K}_y^s(i) = (D_y[s_{i+1}],D_y[s_{i+2}],\ldots,D_y[s_b])

A similar argument allows us to decide if fxs(si)<fys(si)f_x^s(s_i) < f_y^s(s_i).

To handle these comparisons between strings, we consider the suffix array data structure [30] that allows for lexicographical comparisons of arbitrary substrings (contiguous subsets) in O~(1)\widetilde{O}(1) time. Furthermore, we remark that for different base vertices s∈Bs \in B, all strings of the form K‾xs(i)\overline{K}_x^s(i) (and K‾ys(i)\overline{K}_y^s(i)) are substrings of the (reversed) doubled discrete distance string:

D~x=(Dx[sb],…,Dx[s1],Dx[sb],…,Dx[s1])\widetilde{D}_x = (D_x[s_b],\ldots,D_x[s_1],D_x[s_b],\ldots,D_x[s_1])

Thus we can build two single suffix array in O~(bk)\widetilde{O}(bk) time over the strings D~x\widetilde{D}_x and their reverse for all x∈Xx \in X to handle these queries for all boundary vertices s∈Bs \in B in O~(1)\widetilde{O}(1) time.

Locating a Crossing. There can be at most one crossing between any two pseudolines. If initially we have fxs(s1)≺fys(s1)f_x^s(s_1) \prec f_y^s(s_1), and for some later ii we have fxs(si)≻fys(si)f_x^s(s_i) \succ f_y^s(s_i), then fxs(sj)≻fys(sj)f_x^s(s_j) \succ f_y^s(s_j) for all j>ij > i. Thus we can binary search for the smallest ii with O(log⁡b)O(\log b) calls to point comparison.

Combining Lemma 9 with Theorem 8 yields the following theorem.

Lemma 10 (Upper envelope data structure). Consider an NN-vertex planar graph HH with a specified face BB and a set X⊆V(H)X \subseteq V(H) of k=∣X∣k = |X| target vertices. Suppose all distances from boundary vertices BB to target vertices of XX are given. After O~(bk)\widetilde{O}(bk) preprocessing, given any boundary vertex s∈Bs \in B and a subset X′⊆XX' \subseteq X, the upper envelope of {fxs}x∈X′\{f_x^s\}_{x\in X'} can be constructed in O~(∣X′∣)\widetilde{O}(|X'|) total time. The upper envelope can return max⁡x∈X′fxs(si)\max_{x\in X'} f_x^s(s_i) and a witness to the maximum in O(log⁡∣X′∣)O(\log|X'|) time.

Farthest Vertex Data Structure

The main objective of this section is to prove the existence of the farthest vertex data structure of Theorem 2. To do so, we will first describe a way to order the edges in § 5.1. We then show in § 5.2 that it suffices to make a single data structure query with a contiguous interval in this ordering for each Voronoi edge of a Voronoi cell to find the farthest vertex. § 5.3 shows that we can compute such intervals efficiently. § 5.4 shows how the interval query can be handled by a reduction to computing pseudoline upper envelopes. Finally, we conclude by putting everything together to prove Theorem 2 in § 5.5.

Recall that HH is an NN-vertex planar graph with bidirected edges (possibly with different weights in each direction) and a collection of sites B=(s1,…,sb)B = (s_1,\ldots,s_b) that lie in this order on the outer face of HH. Let TiT_i denote the shortest path tree rooted at sis_i.

CCW-First Ordering

We use the CCW-first ordering of [GKM+21] to assign distinct indices to the vertices and directed edges of HH. For every directed edge e=(u,v)e = (u,v), add an artificial leaf xex_e adjacent to uu, placing its edge immediately before ee in the counterclockwise order around uu. For a boundary root sis_i, let Ti+T_i^+ consist of the shortest path tree TiT_i and all artificial leaf edges.

Perform a depth-first traversal of Ti+T_i^+, visiting the children of each vertex in counterclockwise order, starting immediately after the edge to its parent. At sis_i, start from a fixed imaginary incoming edge embedded in the outer face. Let pre⁡i(z)\operatorname{pre}_i(z) be the preorder index of a vertex zz in this traversal, starting with pre⁡i(si)=0\operatorname{pre}_i(s_i)=0. Define the CCW-first index of a directed edge ee by ρi(e)=pre⁡i(xe)\rho_i(e)=\operatorname{pre}_i(x_e). Every original vertex and every directed edge has a distinct index, including both directions of tree and non-tree edges.

We next show how to compute these indices for trees rooted at each boundary vertex si∈Bs_i \in B with only O~(N)\widetilde{O}(N) total preprocessing.

Lemma 11 (CCW-first indices). After O~(N)\widetilde{O}(N) preprocessing time, the CCW-first index ρi(e)\rho_i(e) and the preorder index pre⁡i(v)\operatorname{pre}_i(v) can be reported in O~(1)\widetilde{O}(1) time for any boundary si∈Bs_i \in B, directed edge ee, and vertex v∈V(H)v \in V(H).

Proof. We use MSSP to maintain the shortest path tree as the source moves around the outer face. Following [10 Appendix A.2], we use a fixed auxiliary root rr embedded in that face. Add to TiT_i an additional edge (r,si)(r,s_i), placed at the prescribed imaginary incoming edge of sis_i. MSSP performs O(N)O(N) parent changes of the form T←T−{(p,v)}+{(q,v)}T \leftarrow T - \{(p,v)\} + \{(q,v)\}, where qq lies outside the subtree rooted at vv.

We maintain the Euler tour of the augmented tree, traversing each tree edge in both directions and following the counterclockwise edge order at each vertex. Store the Euler tour in a balanced binary tree supporting splits, concatenations, and prefix sums. Give value 1 to edges moving away from rr, and value 0 otherwise. These edges mark the first time a vertex v∈V(H)v \in V(H) or an artificial leaf xex_e is visited. To compute pre⁡i(v)\operatorname{pre}_i(v), we take the prefix sum of the Euler tour before the traversal from its parent. The same query for the artificial leaf xex_e gives ρi(e)\rho_i(e).

An MSSP parent change detaches the subtree rooted at vv and inserts it at the position of (q,v)(q,v) in the counterclockwise edge order at qq. Since the incoming edge at vv also changes, we cyclically rotate the detached subtree tour to start immediately after the new parent edge. This requires only O(1)O(1) splits and concatenations, together with replacing the two occurrences of the old parent edge. We also update the pointer to the first arrival at vv. Thus each change takes O(log⁡N)O(\log N) time.

Finally, we make the binary tree storing the Euler tour persistent across the MSSP changes, and keep a version for every tree TiT_i rooted at a boundary vertex si∈Bs_i \in B. Since MSSP makes O(N)O(N) tree changes, maintaining the Euler tours takes O(Nlog⁡N)O(N \log N) time since each split and concatenation takes O(log⁡N)O(\log N) time. Persistence costs an extra O(log⁡N)O(\log N) factor in preprocessing time and query time. Thus the total preprocessing time and space are O~(N)\widetilde{O}(N), and each query takes O~(1)\widetilde{O}(1) time.

Remark. The artificial leaves allow us to query ρi(e)\rho_i(e) directly even when ee does not belong to TiT_i. For a fixed target vertex set XX of size kk, we can also compute pre⁡i(x)\operatorname{pre}_i(x) for all si∈Bs_i \in B and x∈Xx \in X, and sort XX in each ordering, in O~(bk)\widetilde{O}(bk) additional time. Thus representing the orderings and extracting their restrictions to XX takes O~(N+bk)\widetilde{O}(N+bk) total preprocessing time and space.

Voronoi Cells and Shortest Path Trees

We will discuss the interaction between the Voronoi cell Vor⁡(s)\operatorname{Vor}(s) for some s=si∈Bs=s_i \in B in the Voronoi diagram VD⁡(H,B,ω)\operatorname{VD}(H,B,\omega) with respect to arbitrary admissible weights ω\omega, the shortest path tree TiT_i, and a CCW-first index of the edges. Let E1,…,EdE_1,\ldots,E_d be the edges of the reduced dual Voronoi diagram of Vor⁡(s)\operatorname{Vor}(s) in counterclockwise order around the Voronoi cell. Each reduced Voronoi edge consists of a set of dual edges that separate Vor⁡(s)\operatorname{Vor}(s) from another Voronoi cell Vor⁡(sjℓ)\operatorname{Vor}(s_{j_\ell}). Let eℓ=(uℓ,vℓ)e_\ell=(u_\ell,v_\ell) be the directed primal edge whose dual is the first edge of EℓE_\ell encountered in a counterclockwise walk around the boundary of Vor⁡(s)\operatorname{Vor}(s), oriented so that uℓ∈Vor⁡(s)u_\ell\in\operatorname{Vor}(s) and vℓ∈Vor⁡(sjℓ)v_\ell\in\operatorname{Vor}(s_{j_\ell}). Let JℓJ_\ell consist of the original vertices xx whose positions pre⁡i(x)\operatorname{pre}_i(x) lie in the cyclic interval [ρi(eℓ),ρi(eℓ+1))[\rho_i(e_\ell),\rho_i(e_{\ell+1})), where the interval for the last reduced edge EdE_d ends at ρi(e1)\rho_i(e_1). If d=1d=1, this interval comprises one complete traversal. The following lemma relates these intervals to the structure of Vor⁡(s)\operatorname{Vor}(s) in TiT_i and shows that, within each JℓJ_\ell, membership in Vor⁡(s)\operatorname{Vor}(s) is determined by a single comparison with the neighboring site sjℓs_{j_\ell}.

Lemma 12. Fix a site s=sis=s_i, and let TT be a shortest path tree rooted at ss. Then the following is true.

(a) Connected Voronoi subtree. [GKM+21, Lemma 2.1] The vertices of Vor⁡(s)\operatorname{Vor}(s) form a connected induced subtree of TT.

(b) Voronoi edges give CCW-first intervals. Let CeC_e be a connected subtree of T−V⁡(Vor⁡(s))T-\operatorname{V}(\operatorname{Vor}(s)), with parent edge ee directed from Vor⁡(s)\operatorname{Vor}(s) into CeC_e, whose dual belongs to EℓE_\ell. The entire CCW-first traversal into CeC_e is a cyclic interval contained in the cyclic interval [ρi(eℓ),ρi(eℓ+1))[\rho_i(e_\ell),\rho_i(e_{\ell+1})) with vertices JℓJ_\ell. In particular, V⁡(Ce)⊆Jℓ\operatorname{V}(C_e)\subseteq J_\ell.

(c) One comparison per interval. For every x∈Jℓx\in J_\ell, x∈Vor⁡(s)x\in\operatorname{Vor}(s) if and only if fxs(sjℓ)≥ω(s)−ω(sjℓ)f_x^s(s_{j_\ell})\geq\omega(s)-\omega(s_{j_\ell}).

Proof. We begin by showing that normalized distance profiles are monotone non-increasing as we walk down the shortest path tree. Consider a vertex vv with parent pp in TT. As the edge e=pve=pv lies on the shortest path from ss to vv, we have that dH(s,v)=dH(s,p)+w(e)d_H(s,v)=d_H(s,p)+w(e). For any other site tt, triangle inequality gives dH(t,v)≤dH(t,p)+w(e)d_H(t,v)\leq d_H(t,p)+w(e). Subtracting this yields:

fvs(t)=dH(t,v)−dH(s,v)≤dH(t,p)−dH(s,p)=fps(t).(4)f_v^s(t)=d_H(t,v)-d_H(s,v)\leq d_H(t,p)-d_H(s,p)=f_p^s(t). \tag*{(4)}

Proof of (a) connected Voronoi subtrees. A vertex x∈V(H)x\in V(H) is in Vor⁡(s)\operatorname{Vor}(s) if xx is closer to ss than any other site. This means that fxs(t)≥ω(s)−ω(t)f_x^s(t)\geq\omega(s)-\omega(t) for every other t∈Bt\in B. Thus if xx has parent pp in TT, then for every t∈Bt\in B we must have fps(t)≥fxs(t)≥ω(s)−ω(t)f_p^s(t)\geq f_x^s(t)\geq\omega(s)-\omega(t). By induction, the entire shortest path from ss to xx is in Vor⁡(s)\operatorname{Vor}(s). Thus we conclude that Vor⁡(s)\operatorname{Vor}(s) is a connected subtree.

Proof of (b) Voronoi edges give CCW-first intervals. Let Γ\Gamma be the boundary walk of Vor⁡(s)\operatorname{Vor}(s) in the dual. By part (a), the paths in TT from ss to the tails of the edges leaving Vor⁡(s)\operatorname{Vor}(s) lie entirely in Vor⁡(s)\operatorname{Vor}(s). These paths are non-crossing, and the CCW-first search explores their branches in counterclockwise order. Thus, contracting the subtree of TT induced by Vor⁡(s)\operatorname{Vor}(s) to ss preserves the cyclic order in which the search encounters the outward boundary edges. After contraction, these edges occur counterclockwise around ss in the order of their duals along Γ\Gamma, so the cyclic order of the reduced Voronoi edges agrees with the CCW-first order.

Each reduced Voronoi edge EℓE_\ell is a contiguous subpath of Γ\Gamma. Thus the outward directed primal edges whose duals belong to EℓE_\ell occur consecutively among the outward boundary edges encountered by the CCW-first search. Say e∗∈Eℓe^*\in E_\ell is an edge dual to the primal edge ee of TT and CeC_e is the connected component of T−Vor⁡(s)T-\operatorname{Vor}(s). Once the tour enters CeC_e through the edge ee, it visits the entire rooted subtree CeC_e before returning to Vor⁡(s)\operatorname{Vor}(s). Every interval endpoint is the index of an artificial leaf attached to a vertex of Vor⁡(s)\operatorname{Vor}(s), so no endpoint is encountered during this excursion. Since ρi(e)\rho_i(e) lies in [ρi(eℓ),ρi(eℓ+1))[\rho_i(e_\ell),\rho_i(e_{\ell+1})) and is visited immediately before entering CeC_e, the entire CCW-first traversal of CeC_e lies in this cyclic interval. See Figure 3 for an illustration of this.

Proof of (c) one comparison per interval. Write t=sjℓt=s_{j_\ell}, and consider a vertex x∈Jℓx\in J_\ell. Suppose x∈Vor⁡(s)x\in\operatorname{Vor}(s), then clearly fxs(t)≥ω(s)−ω(t)f_x^s(t)\geq\omega(s)-\omega(t). On the other hand if x∉Vor⁡(s)x\notin\operatorname{Vor}(s), then by (a) xx belongs to a rooted subtree CeC_e of T−V⁡(Vor⁡(s))T-\operatorname{V}(\operatorname{Vor}(s)) with parent edge ee. Let vv be the endpoint of ee that is the root of CeC_e. By part (b), the dual of ee belongs to EℓE_\ell. Since ee separates Vor⁡(s)\operatorname{Vor}(s) from Vor⁡(t)\operatorname{Vor}(t), we must have v∈Vor⁡(t)v\in\operatorname{Vor}(t). This means that fvs(t)<ω(s)−ω(t)f_v^s(t)<\omega(s)-\omega(t). By Equation (4), it follows that:

fxs(t)≤fvs(t)<ω(s)−ω(t).f_x^s(t)\leq f_v^s(t)<\omega(s)-\omega(t).

This means x∉Vor⁡(s)x\notin\operatorname{Vor}(s) fails the comparison, proving (c). □

Computing Voronoi Edge Intervals

We use a theorem of Mozes and Prigan [31] that efficiently computes a Voronoi diagram of a set BB of sites lying on one face. We can assume all other faces have exactly three sides without changing the underlying graph metric by adding long edges (see simplifying assumptions of § 2). The key idea is to find trichromatic triangles which are faces with three vertices belonging to different Voronoi cells. These are the dual vertices of the Voronoi diagram of degree three. The theorem is as follows.

Theorem 13 (Lemma 3.1 of [31]). Let HH be an NN-vertex directed planar graph with real weights and no negative weight cycles, and BB be a collection of bb sites on one face. Assume that all other faces of HH have degree 3. After O~(N)\widetilde{O}(N)-time preprocessing, for any admissible weight function ω\omega, an implicit representation of VD⁡(H,B,ω)\operatorname{VD}(H,B,\omega) along with all trichromatic triangles can be computed in O~(b)\widetilde{O}(b) time.

To recover the intervals according to the CCW-first indices of the shortest path trees, we can use Lemma 11 to get the index ρ(e)\rho(e) for trichromatic edges.

Together with the compressed Voronoi diagram and Lemma 11, we can compute the indices of the interval corresponding to each Voronoi edge.

Corollary 14. After O~(N)\widetilde{O}(N) preprocessing, for every admissible weight function ω\omega on a set of bb boundary sites B′⊆BB' \subseteq B, after computing the implicit Voronoi diagram in O~(b)\widetilde{O}(b) time and trichromatic triangles with Theorem 13, we can recover the induced CCW interval of a Voronoi edge in O~(1)\widetilde{O}(1) time.

Data Structures via Range Searching

In this section we describe standard range searching data structures to show that finding the farthest vertex can be performed using upper envelopes of distance profile pseudolines.

Lemma 12(c) says that we can decompose the Euler tour into intervals where we need to only compare distance profiles with a single competitor boundary site to determine if vertices are in Vor⁡(s)\operatorname{Vor}(s). This means that for interval JℓJ_\ell, it suffices to query ∣Vor⁡(s)∣\lvert\operatorname{Vor}(s)\rvert many intervals for the vertex xx that maximizes dH(s,x)d_H(s,x) while satisfying fx(sjℓ)≥ω(s)−ω(sjℓ)f_x(s_{j_\ell}) \geq\omega(s) - \omega(s_{j_\ell}). This can be encapsulated in the following problem.

Problem 1 (Interval Threshold Maximization Problem). Consider a sequence of kk pseudolines f1,f2,…,fkf_1, f_2, \ldots, f_k that take on values on bb unique coordinates where each pseudoline has an associated distance d1,d2,…,dkd_1, d_2, \ldots, d_k. Construct a data structure to support queries of an interval II, a pseudoline coordinate tt, and a threshold τ\tau to output the index ii that maximizes did_i subject to i∈Ii \in I such that fi(t)≥τf_i(t) \ge\tau.

This problem can be solved using standard multilevel orthogonal range searching technique where we store the upper envelope data structures. We give here the full proof of this via reduction to a problem that can be solved using upper envelopes (in our case with Lemma 10). For this reduction, it helps to define the following intermediate problem.

Problem 2 (Interval Threshold Decision Problem). Consider a sequence of kk pseudolines f1,f2,…,fkf_1, f_2, \ldots, f_k that takes on values on bb unique coordinates. Construct a data structure to support queries of an interval II, a pseudoline coordinate tt, and a threshold τ\tau to an index i∈Ii \in I where fi(t)≥τf_i(t) \ge\tau.

We also define the following problem that can be solved using upper envelopes.

Problem 3 (Global Threshold Decision Problem). Consider a sequence of kk pseudolines f1,f2,…,fkf_1, f_2, \ldots, f_k that takes on values on bb unique coordinates. Construct a data structure to support queries for a pseudoline coordinate tt and a threshold τ\tau to output any index ii where fi(t)≥τf_i(t) \ge\tau.

The reductions are standard. We present a full proof here for completeness.

Lemma 15 (Data structure reductions). Suppose a data structure for Problem 3 can be constructed in T3(k)T_3(k) time and could handle queries in Q3(k)Q_3(k) time. Assuming that T3(k)=Ω(k)T_3(k) = \Omega(k), a data structure for Problem 1 can be constructed in O~(T3(k))\widetilde{O}(T_3(k)) time with O~(Q3(k))\widetilde{O}(Q_3(k)) query time.

Proof. As an intermediate step, we first reduce Problem 1 to Problem 2.

Reducing from Problem 1 to Problem 2 We proceed by standard divide and conquer. Sort all values of did_i, and split the pseudolines into two sets FHIGHF_{\mathrm{HIGH}} and FLOWF_{\mathrm{LOW}} for which all values in FHIGHF_{\mathrm{HIGH}} are greater than those in FLOWF_{\mathrm{LOW}}. Build the data structure for Problem 2 on FHIGHF_{\mathrm{HIGH}}, then recursively build a data structure for Problem 1 on both FLOWF_{\mathrm{LOW}} and FHIGHF_{\mathrm{HIGH}}. Queries can be handled by binary search, use the data structure for FHIGHF_{\mathrm{HIGH}} to determine if any pseudoline with did_i value larger than mm satisfies the interval and threshold condition. If there is, then recurse on FHIGHF_{\mathrm{HIGH}}, otherwise recurse on FLOWF_{\mathrm{LOW}}. In the recursion, binary search for new endpoints of the query interval, since FLOWF_{\mathrm{LOW}} and FHIGHF_{\mathrm{HIGH}} only contain subsets of the original indices.

Suppose we had a data structure for Problem 2 with T2(k)T_2(k) preprocessing time with Q2(k)Q_2(k) query time. The construction time for the data structure for Problem 1 has the recurrence T1(k)=T2(k/2)+2T1(k/2)+O(klog⁡k)T_1(k) = T_2(k/2) + 2T_1(k/2) + O(k\log k). This solves to T1(k)=O~(T2(k))T_1(k) = \widetilde{O}(T_2(k)) as any data structure for T2(k)T_2(k) takes at least Ω(k)\Omega(k) time. The query time has the recurrence Q1(k)=Q2(k/2)+Q1(k)+O(log⁡k)Q_1(k) = Q_2(k/2) + Q_1(k) + O(\log k), which solves to Q1(k)=O~(Q2(k))Q_1(k) = \widetilde{O}(Q_2(k)).

:::

Reducing from Problem 2 to Problem 3 This follows by standard segment trees [14], that decompose an interval into O(log⁡k)O(\log k) dyadic intervals. Suppose we had a data structure for Problem 3 with T3(k)T_3(k) preprocessing time with Q3(k)=O~(1)Q_3(k)=\widetilde{O}(1) query time. Then the preprocessing time satisfies T2(k)=2T2(k/2)+T3(k)T_2(k)=2T_2(k/2)+T_3(k) which solves to T2(k)=O~(T3(k))T_2(k)=\widetilde{O}(T_3(k)) by building a solution to Problem 3, and ignoring the global preprocessing time. To perform a query, it takes Q2(k)=O(log⁡k)⋅Q3(k)Q_2(k)=O(\log k)\cdot Q_3(k) time. Thus we have shown that T1(k)=O~(T2(k))=O~(T3(k))T_1(k)=\widetilde{O}(T_2(k))=\widetilde{O}(T_3(k)) and that Q1(k)=O~(Q2(k))=O~(Q3(k))Q_1(k)=\widetilde{O}(Q_2(k))=\widetilde{O}(Q_3(k)). so we conclude the lemma.

Proving thm:mainds

Here we prove our main data structure result of Theorem 2 that we restate below for convenience.

Theorem 2 (Farthest Vertex Data Structure). Let HH be an NN-vertex directed plane graph with real edge lengths and no negative-length cycles. Fix a set B={s1,…,sb}⊆V(H)B=\{s_1,\ldots,s_b\}\subseteq V(H) of b=∣B∣b=|B| vertices on a single face of HH and a subset X⊆V(H)X\subseteq V(H) with k=∣X∣k=|X| vertices. After O~(N+bk)\widetilde{O}(N+bk)-time preprocessing, a query of admissible weights ω:B→R\omega:B\to\mathbb{R} admits the computation of an implicit representation of VD⁡(H,B,ω)\operatorname{VD}(H,B,\omega) in O~(b)\widetilde{O}(b) time. This representation supports querying for max⁡v∈Vor⁡(s)∩XdH(s,v)\max_{v\in\operatorname{Vor}(s)\cap X}d_H(s,v) for any s∈Bs\in B and a vertex (if any exist) witnessing the max in O~(∣∂Vor⁡(s)∣)\widetilde{O}(|\partial\operatorname{Vor}(s)|) time.

Proof. We begin by describing the data structure.

Data structure We store the data structure of Corollary 14 for recovering Voronoi edge intervals and a single MSSP data structure from Theorem 4 shared by all boundary vertices. For each si∈Bs_i\in B, we also store the data structure for Problem 1 on the pseudolines {fxsi}x∈X\{f_x^{s_i}\}_{x\in X} in increasing order of pre⁡i(x)\operatorname{pre}_{i}(x), associating each pseudoline fxsif_x^{s_i} with the distance dH(si,x)d_H(s_i,x).

Preprocessing time Constructing the data structures for computing Voronoi edge intervals and MSSP takes O~(N)\widetilde{O}(N) preprocessing time. Using distances obtained by the MSSP, Lemma 10 allows for constructing an upper envelope to solve the decision problem of Problem 3 on any k′k' pseudolines with the same boundary vertex si∈Bs_i\in B in O~(k′)\widetilde{O}(k') time after O~(bk)\widetilde{O}(bk) preprocessing. The reduction of Lemma 15 therefore gives O~(k)\widetilde{O}(k) construction time for the data structure for Problem 1 at each boundary vertex, or O~(bk)\widetilde{O}(bk) over all boundary vertices. The total preprocessing time is thus O~(N+bk)\widetilde{O}(N+bk).

Handling a query Given an admissible weight function ω\omega, we use Corollary 14 to construct an implicit representation of its Voronoi diagram in O~(b)\widetilde{O}(b) time. For each Voronoi edge on the boundary of a cell Vor⁡(si)\operatorname{Vor}(s_i), we recover the corresponding interval in the CCW-first ordering rooted at sis_i in O~(1)\widetilde{O}(1) time. By Lemma 12(c), processing this interval requires one query (or two for circular intervals) to the data structure for Problem 1 associated with sis_i, also taking O~(1)\widetilde{O}(1) time. Thus, after constructing the diagram, we can process all boundary edges of Vor⁡(si)\operatorname{Vor}(s_i) in O~(∣∂Vor⁡(si)∣)\widetilde{O}(|\partial\operatorname{Vor}(s_i)|) time.

Conclusion

We have reached a milestone for planar diameter and all vertex eccentricities by showing that these quantities can be computed in O~(n3/2)\widetilde{O}(n^{3/2}) time. We conclude with some open problems.

  1. Tighter bounds for exact planar diameter. We reiterate the question asked by Abboud, Mozes, and Weimann [1]. Does planar diameter admit an n1+o(1)n^{1+o(1)}-time algorithm or can a superlinear lower bound be proved? Are other improvements beyond O~(n3/2)\widetilde{O}(n^{3/2}) for planar diameter possible?

  1. Wiener index. The Wiener index computes the sum of shortest path distances between all pairs of vertices. Upper envelopes are only good for maximum queries, so our farthest vertex

data structure of Theorem 2 does not naturally support computation of Wiener index. Typically, supporting the Wiener index requires computation of sums and counts of vertices in a Voronoi cell. Since queries can be processed offline, it may be possible to use point-pseudoline range searching data structures to handle qq queries on kk pseudolines in O~(q2/3k2/3)\widetilde{O}(q^{2/3}k^{2/3}) time. Unfortunately this does not directly lead to any improvement on the O~(n5/3)\widetilde{O}(n^{5/3}) time algorithm in [GKM+21].

3. Dynamic exact diameter and distance oracles. Can the structural observations relating to pseudolines made in this paper help for dynamic exact distance problems?

AI Methodology

The results presented in this paper were developed through multiple interactions with GPT-6 Astra. The idea to use range searching and pseudolines was suggested by the first author. The manuscript itself was written by the authors with editing assistance by the LLM.

References

  1. [1]Amir Abboud, Shay Mozes, and Oren Weimann. What else can Voronoi diagrams do for diameter in planar graphs? In 31st Annual European Symposium on Algorithms, ESA 2023, volume 274 of LIPIcs, pages 4:1–4:20. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2023.arxiv.org/abs/2305.02946
  2. [2]Pankaj K. Agarwal and Micha Sharir. Pseudo-line arrangements: Duality, algorithms, and applications. SIAM J. Comput., 34(3):526–552, 2005.DOI
  3. [3]Amir Abboud, Virginia Vassilevska Williams, and Joshua R. Wang. Approximation and fixed parameter subquadratic algorithms for radius and diameter in sparse graphs. In SODA, pages 377–391, 2016.
  4. [4]Karl Bringmann, Thore Husfeldt, and Måns Magnusson. Multivariate analysis of orthogonal range searching and graph distances. Algorithmica, 82(8):2292–2315, 2020.
  5. [6]Sergio Cabello. Subquadratic algorithms for the diameter and the sum of pairwise distances in planar graphs. ACM Trans. Algorithms, 15(2):21:1–21:38, 2019.
  6. [10]Panagiotis Charalampopoulos, Pawel Gawrychowski, Yaowei Long, Shay Mozes, Seth Pettie, Oren Weimann, and Christian Wulff-Nilsen. Almost optimal exact distance oracles for planar graphs. J. ACM, 70(2):12:1–12:50, 2023.DOI
  7. [12]Timothy M. Chan. Near-optimal randomized algorithms for selection in totally monotone matrices. In Dániel Marx, editor, Proceedings of the 2021 ACM-SIAM Symposium on Discrete Algorithms, SODA 2021, Virtual Conference, January 10 - 13, 2021, pages 1483–1495. SIAM, 2021.DOI
  8. [13]Sergio Cabello and Christian Knauer. Algorithms for graphs of bounded treewidth via orthogonal range searching. Comput. Geom., 42(9):815–824, 2009.DOI
  9. [14]Mark de Berg, Otfried Cheong, Marc J. van Kreveld, and Mark H. Overmars. Computational Geometry: Algorithms and Applications. Springer, Berlin, Heidelberg, 3rd edition, 2008.
  10. [15]Guillaume Ducoffe, Michel Habib, and Laurent Viennot. Diameter, eccentricities and distance oracle computations on H-minor free graphs and graphs of bounded (distance) Vapnik-Chervonenkis dimension. SIAM J. Comput., 51(5):1506–1534, 2022.DOI
  11. [17]Viktor Fredslund-Hansen, Shay Mozes, and Oren Weimann. A tight bound for facial distance patterns in planar graphs. CoRR, abs/2608.07187, 2026.
  12. [18]Jittat Fakcharoenphol and Satish Rao. Planar graphs, negative weight edges, shortest paths, and near linear time. J. Comput. Syst. Sci., 72(5):868–889, 2006.
  13. [20]Thore Husfeldt. Computing graph distances parameterized by treewidth and diameter. In IPEC, volume 63 of LIPics, pages 16:1–16:11, 2016.DOI
  14. [21]Maria M. Klawe. Superlinear bounds for matrix searching problems. J. Algorithms, 13(1):55–78, 1992.DOI
  15. [22]Philip N. Klein. Multiple-source shortest paths in planar graphs. In Proceedings of the Sixteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2005, pages 146–155. SIAM, 2005.
  16. [23]Haim Kaplan, Shay Mozes, Yahav Nussbaum, and Micha Sharir. Submatrix maximum queries in Monge matrices and partial Monge matrices, and their applications. ACM Trans. Algorithms, 13(2):26:1–26:42, 2017.
  17. [24]Philip N. Klein, Shay Mozes, and Christian Sommer. Structured recursive separator decompositions for planar graphs in linear time. In Symposium on Theory of Computing Conference, STOC 2013, pages 505–514. ACM, 2013.arxiv.org/abs/1208.2223
  18. [25]Adam Karczmarz and Da Wei Zheng. Subquadratic algorithms in minor-free digraphs: (weighted) distance oracles, decremental reachability, and more. In SODA, pages 4338–4351. SIAM, 2025.arxiv.org/abs/2410.12003
  19. [26]Jason Li and Merav Parter. Planar diameter via metric compression. In Moses Charikar and Edith Cohen, editors, Proceedings of the 51st Annual ACM SIGACT Symposium on Theory of Computing, STOC 2019, Phoenix, AZ, USA, June 23-26, 2019, pages 152–163. ACM, 2019.arxiv.org/abs/1912.11491
  20. [27]Moshe Lewenstein, Seth Pettie, and Virginia Vassilevska Williams. Structure and hardness in P (Dagstuhl seminar 16451). Dagstuhl Reports, 6(11):1–34, 2017.DOI
  21. [28]Richard J. Lipton and Robert Endre Tarjan. A separator theorem for planar graphs. SIAM Journal on Applied Mathematics, 36(2):177–189, 1979.DOI
  22. [29]Hung Le and Christian Wulff-Nilsen. VC set systems in minor-free (di)graphs and applications. In SODA, pages 5332–5360. SIAM, 2024.arxiv.org/abs/2304.01790
  23. [30]Udi Manber and Gene Myers. Suffix arrays: A new method for on-line string searches. SIAM Journal on Computing, 22(5):935–948, 1993.
  24. [31]Shay Mozes and Daniel Prigan. Distances in planar graphs are almost for free! CoRR, abs/2603.26313, 2026.arxiv.org/abs/2603.26313
  25. [32]Shay Mozes and Christian Wulff-Nilsen. Shortest paths in planar graphs with real lengths in O(n log² n / log log n) time. In Algorithms – ESA 2010, Part II, volume 6347 of Lecture Notes in Computer Science, pages 206–217. Springer, 2010.arxiv.org/abs/0911.4963
  26. [33]Franco P. Preparata and Michael Ian Shamos. Computational Geometry - An Introduction. Texts and Monographs in Computer Science. Springer, 1985.
  27. [34]Liam Roditty and Virginia Vassilevska Williams. Fast approximation algorithms for the diameter and radius of sparse graphs. In Dan Boneh, Tim Roughgarden, and Joan Feigenbaum, editors, Symposium on Theory of Computing Conference, STOC’13, Palo Alto, CA, USA, June 1-4, 2013, pages 515–524. ACM, 2013.
  28. [35]Da Wei Zheng. Real-weighted diameter and eccentricities of minor-free and bounded VC-dimension graphs in truly subquadratic time. In ESA, volume 388 of LIPIcs, pages 61:1–61:12, 2026.arxiv.org/abs/2607.01926

Paper details

vlnc:W_vske2asg
v1 · latestHistory (1)

published · Fresh — added to the Hub within the last 30 days

added ·

Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

CC BY 4.0

Original source

  • Computer Science

Not recorded for this paper · View statement →

Looking for related papers…
Contents