Abstract 1 Introduction 2 Preliminaries 3 Deterministic (𝟐𝟏/𝟐𝒌𝟏)-Diameter Approximation 4 Deterministic Small Clusters 5 New Diameter Approximation Algorithms 6 Deterministic (𝟐𝟏𝟐𝒌𝟏)-Radius Approximation and (𝟑𝟒𝟐𝒌+𝟏)-All Nodes Eccentricity Approximation References

New Diameter Approximations via Distance Oracle Techniques

Yael Kirkpatrick ORCID Massachusetts Institute of Technology, Cambridge, MA, USA    Liam Roditty ORCID Bar Ilan University, Ramat Gan, Israel    Richard Qi Massachusetts Institute of Technology, Cambridge, MA, USA    Virginia Vassilevska Williams ORCID Massachusetts Institute of Technology, Cambridge, MA, USA
Abstract

Computing the diameter of a graph is a problem of great interest both in general algorithms research and specifically within fine-grained complexity, where it is a cornerstone hard problem. As computing the exact diameter in m-edge graphs requires m2o(1) time under the Strong Exponential Time Hypothesis, much work has gone into approximating this parameter. Recent work has achieved a full conditional lower bound tradeoff curve for both directed and undirected graphs [Dalirrooyfard, Li and Vassilevska W., FOCS’21]. However, the best known upper bounds do not match the lower bounds. In particular, the best known approximation scheme for undirected graph diameter [Cairo-Grossi-Rizzi, SODA 2016] has not been improved. Moreover, this scheme is randomized and no similar deterministic scheme is known.

Another fundamental field of research in shortest paths computation is the construction of approximate distance oracles. Thorup and Zwick [JACM’05] provided the first such distance oracle with constant query time and (conditionally) optimal space, and in the years since many advances have led to a vast toolbox of techniques and data structures.

These two areas of research seem natural to combine since they both concern approximating shortest paths. However, the known diameter approximation algorithms only use a small subset of the techniques used in distance oracles research. In this work we show that in fact approximate diameter and distance oracles are intricately connected.

We first demonstrate a strong connection between the current best known diameter approximation scheme of Cairo, Grossi and Rizzi (“CGR”) and the (2k1)-approximate distance oracle of Thorup and Zwick. This allows us to derandomize the CGR algorithm and obtain the first deterministic diameter approximation tradeoff.

We further derandomize other central techniques in the field of distance oracles and use them to achieve new deterministic diameter approximation algorithms, including a simpler 3/2-approximation with no additive error and a new 5/3-approximation, the first new step in the diameter approximation tradeoff in almost a decade. Finally, we show how these new techniques can be used to derandomize many current best known results in various fields of shortest paths approximations.

Keywords and phrases:
Graph Algorithms, Diameter, Distance Oracle, Approximation Algorithm
Category:
Track A: Algorithms, Complexity and Games
Funding:
Yael Kirkpatrick: Supported by NSF Grant No 2141064.
Liam Roditty: Supported by BSF Grant 2024233.
Virginia Vassilevska Williams: Supported by NSF Grant CCF-2330048, BSF Grant 2024233 and a Simons Investigator Award.
Copyright and License:
[Uncaptioned image] © Yael Kirkpatrick, Liam Roditty, Richard Qi, and Virginia Vassilevska Williams; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Graph algorithms analysis
Related Version:
Full Version: https://arxiv.org/abs/2604.27142
Editors:
Sayan Bhattacharya, Danupon Nanongkai, Michael Benedikt, and Gabriele Puppis

1 Introduction

One of the most fascinating problems in shortest paths algorithms is estimating the diameter of a given graph. The diameter is the largest shortest path distance and is a natural parameter that measures how fast information can spread in a network. Computing the diameter can be accomplished by first computing All-Pairs Shortest Paths (APSP), going through all computed distances and returning the largest. This approach is largely unsatisfying because the output size of APSP in n-node graphs is n2 and hence even in very sparse graphs, one cannot hope to obtain sub-n2 time algorithms for the diameter if one first computes APSP. The situation is even worse in dense weighted graphs, where the fastest exact algorithm for APSP runs in n3/exp(logn) time [41]. The fastest approximation algorithms use fast matrix multiplication: Zwick [43] provided an O~(nω/ε) time 111O~ subsumes polylogarithmic factors. (1+ε)-approximation algorithm where ω<2.372 is the exponent of square matrix multiplication [7]. (Boolean) matrix multiplication is also known [25] to be necessary for any finite directed (or factor <2 undirected) approximation algorithm for APSP.

It remains a big open problem whether computing the diameter of a graph exactly requires computing APSP. Roditty and Vassilevska W. [37] showed that the Strong Exponential Time Hypothesis (SETH) ([28, 13]) implies that computing the exact diameter requires m2o(1) time in sparse graphs. Because of this, a lot of research has focused on obtaining fast, subquadratic time approximation algorithms.

Aingworth, Chekuri, Indyk and Motwani [5] gave an O~(n2+mn) time deterministic algorithm that achieves an “almost” 3/2 approximation222Here “almost” means that there is extra small additive error, in addition to the multiplicative approximation factor.: an estimate D~ of the diameter D such that 2D/3M/3D~D in any directed or undirected graph with nonnegative integer edge weights bounded by M. Roditty and Vassilevska W. [37] obtained the same guarantees as [5] but with improved (expected) running time O~(mn) at the cost of randomization.

Cairo, Grossi and Rizzi [12] extended the techniques of [37, 5] to obtain a runtime/approximation tradeoff for undirected graphs. For every k1, they construct an algorithm with expected running time O~(mn1/k) achieving 2k1D/(2k1)(2k11)M/(2k1)D~D, an almost (21/2k1)-approximation. We call this approximation scheme “CGR”. Abboud et al. [3] obtain a weaker scheme for directed graphs.

Chechik et al. [15] removed the additive error in the almost 3/2-approximation algorithm of [37] at the cost of higher running time O~(min{mn2/3,m3/2). Backurs et al. [8] provide an O~(n2) almost-3/2 approximation and an O(n2.05) time almost-3/2 approximation with better additive error.

All known diameter approximation algorithms except for the original Aingworth et al. [5] algorithm and the O~(mn2/3) time algorithm of [15] are randomized. This raises our first natural question:

Question 1: Can one obtain deterministic diameter approximation algorithms with the same guarantees as the known randomized algorithms?

Another important area of research in APSP approximation for undirected graphs is the construction of space-efficient approximate distance oracles that answer distance queries in constant time. Thorup and Zwick [40] first provided a randomized construction that for every integer k1 and every undirected n-node m-edge graph with nonnegative weights preprocessed a distance oracle in O~(mn1/k) expected time that could provide a (2k1)-approximation to any distance in O(k) query time. Later, Roditty, Thorup and Zwick [36] derandomized the construction. Chechik [14], following Wulff-Nilsen [42], brought down the query time to a global constant, independent of k.

The space usage of these oracles is known to be optimal under the Erdös Girth Conjecture. Recent work [2, 1, 29] has focused on showing that the preprocessing time of the distance oracles might be optimal. The latest of these results is that under the 3SUM Hypothesis, n1+1/(2k1)o(1) time is needed to compute any (2kδ)-distance oracle of an O(n)-edge graph that can support no(1) time queries.

The literature on distance oracles is vast and there is a huge toolbox of techniques for constructing them. By and large, the known diameter approximation algorithms use a very small subset of the techniques for distance approximation: mainly hitting sets of balls around vertices, combined with Dijkstra’s algorithm. Moreover, there are many different constructions of distance oracles (with different guarantees) besides the original Thorup and Zwick construction: e.g. [6, 34, 33]. Meanwhile, there are only a small handful of diameter approximation algorithms, the main one being the Cairo-Grossi-Rizzi construction (which itself is based on [5, 37]). Here we ask:

Question 2: Can we obtain new diameter algorithms by employing the vast techniques from the distance oracle literature? Can the many known distance oracle constructions lead to new diameter algorithms?

1.1 Our results

In this paper we establish a strong connection between distance oracles and diameter approximations, which allows us to address both Question 1 and Question 2.

We first employ a classic deterministic distance oracle construction to obtain a diameter approximation algorithm matching the tradeoff curve of Cairo, Grossi and Rizzi. Beyond derandomization, this new algorithm is a simpler version of the longstanding state of the art diameter approximation and the first improvement over it in almost a decade.

We further develop tools to derandomize other known diameter approximations, showing that randomization is not needed in most of the current best known diameter approximation algorithms. Additionally, we leverage other existing distance oracles to obtain new diameter approximation algorithms.

While this work takes only a small step towards closing the gap between the best known upper and lower bounds for diameter approximations, we hope the powerful connection we demonstrate between distance oracles and diameter approximations will open the door to new advancements in this field using the extensive range of techniques used in approximate distance oracles.

1.2 Derandomization of Diameter Algorithms

Our first result is a full derandomization of the Cairo-Grossi-Rizzi (CGR) [12] approximation scheme for diameter in undirected graphs. We show how to achieve this best known runtime/approximation tradeoff using the classic (2k1)-approximate distance oracle structure of Thorup and Zwick [40], which in turns allows us to use the subsequent derandomization of this distance oracle to derandomize our diameter approximation scheme.

Theorem 1 (Theorem 11 in the body).

Given an undirected graph with nonnegative edge weights bounded by M and an integer k2, one can compute in deterministic O~(mn1/k) time an estimate D~ of the diameter D satisfying 2k12k1DαD~D where α=2k112k1M.

We note that our deterministic algorithm runs in the exact same time as the original algorithm of [12], without adding any logarithmic factors to the runtime, which is often the cost of derandomizations. Furthermore, our algorithm also derandomizes the radius and eccentricity approximation schemes of [12]. While there is an O~(m) expected time 2-approximation algorithm for all eccentricities [17, 8] which subsumes the CGR eccentricities scheme, it is not known how to derandomize these 2-approximation algorithms. Thus, our derandomization of CGR presents the best known deterministic approximation algorithms for all nodes eccentricities.

Our next contribution is a derandomization of another tool frequently used in distance oracles: the computation of clusters and balls that are simultaneously small, first introduced by Thorup and Zwick [39]. For a vertex v and a set of vertices S, the S-ball of v, BS(v) is the set {xV|d(v,x)<d(v,S)}. The S-cluster CS(v) is {xV|vBS(x)}. If the graph is directed, we can define CSR(v) and BSR(v) to be CS(v) and BS(v) in the graph with edge directions reversed.

Clusters and balls are in a sense inverses of each other. The fast computation of small clusters and balls is at the heart of fast distance oracle preprocessing. Approximate distance oracles often use a random resampling technique to construct a set with worst case guarantees on the size of all of its clusters (this technique originates from [39]). Here, we show that the same can be achieved deterministically in the same time complexity.

Theorem 2.

Given a weighted, directed or undirected graph G and >0, one can compute a set SV of size O(nlogn) deterministically in time O((m+nlogn)) such that for every vV, |CS(v)|,|BS(v)|,|CSR(v)|,|BSR(v)|=O().

1.3 New Diameter Approximation Algorithms from Known Distance Oracles

Using this new deterministic tool, together with ideas from two known distance oracle constructions, we obtain new deterministic diameter approximation algorithms.

The first result we address concerns removing the additive error from the original 3/2-diameter approximation of Aingworth et al. [5]. Chechik et al. [15] gave a O(mn2/3log5/3(n)) time deterministic 3/2-approximation to the diameter of any directed or undirected graph, getting rid of the additive error at the cost of a slower runtime.

Using the tools from a (2,1) distance oracle data structure [34], combined with our deterministic cluster and ball computation tool, we obtain an arguably simpler algorithm that achieves roughly the same result as [15], and even removes a logarithmic factor in the running time.

Theorem 3 (Theorem 18 in the body).

Given a directed graph with nonnegative edge weights and (unknown) diameter D, one can compute in deterministic O(mn2/3log2/3n) time an estimate D~ satisfying 2D3D~D.

We then combine the basis of the (2+ε,5) distance oracle of [6] with our new deterministic tools to obtain a brand new diameter approximation algorithm, the first such algorithm whose multiplicative approximation is not of the form 212k.

Theorem 4 (Theorem 19 in the body).

Given an unweighted, undirected graph with (unknown) diameter D, one can compute in deterministic O(nm3/5log8/5n) time an estimate D~ satisfying 3D5αD~D for α=max(65,53D15)).

This O~(nm3/5) almost-5/3 approximation algorithm is faster than all the known almost-3/2-diameter approximation algorithms (which run in O~(min{n2,mn}) time) for every graph density m in the interval [n5/4,n5/3].

Notice that the approximation guarantee 5/3 is between the 3/2 and 7/4 guarantees of the CGR algorithm [12] for k=2 and k=3 respectively, so that this is a brand new point on the trade-off curve for diameter approximation algorithms.

Over the last decade, there has been significant progress in fine-grained conditional lower bounds for diameter. Starting with the work of [37, 8, 11] and culminating in the results of [32, 23, 20], we now have a full lower bound trade-off curve for diameter even in undirected and unweighted graphs: under the Strong Exponential Time Hypothesis, for every integer k2, any 21/kε approximation algorithm needs mn1/(k1)+o(1) time. Using k=2,3, we get that the 3/2-approximation algorithms of [37, 15] are optimal under SETH, and using k in the limit, we get that the folklore linear time 2-approximation cannot be improved.

If we believe that the known conditional lower bounds are best possible, we should suspect that (for k=3,4 in the trade-off) there should be a 5/3-approximation algorithm running in O~(m4/3) time. Unfortunately, the known O~(m4/3) time approximation algorithm on the CGR curve [12] only achieves a 7/4 approximation. Our new 5/3-approximation algorithm can be seen as a step towards the desired next algorithmic point on the lower bound curve after 3/2.

1.4 Applications and Further Derandomizations

To illustrate the usefulness of our new techniques, we obtain derandomizations of several known results related to various problems in the field of shortest path computations.

First we consider the <3 APSP approximations of Baswana and Kavitha [9]. They construct a 2-approximation and a 7/3-approximation algorithm using a hierarchy of randomly sampled sets and a randomized version of Theorem 2. This randomized hierarchy needs to satisfy two conditions. First, that for every set S of size O~(q) the set of edges ES(v) defined as the edges incident to v of weight <d(v,s) satisfies |ES(v)|=O(n/q). This can be achieved deterministically by constructing a greedy hitting set to the n/q highest weight incident edges of every vertex, which can be done in O(n2) time. Second, the hierarchy of sets =AkAk1,A0=V needs to satisfy that for every vertex v, |Bi(v)|=|{xAi:d(v,x)<d(v,Ai+1}|n1/k, which can be achieved using the deterministic distance oracle construction of Roditty, Thorup and Zwick [36]. Taking the sets A0,,Ak obtained the construction of [36], and taking a union of each Ai with a hitting set to the n/|Ai| highest weight incident edges of every vertex guarantees that both conditions hold. Together with Theorem 2, this gives us a deterministic version of the following result:

Theorem 5 (Derandomization of Algorithms 9 and 10 in [9]).

A given weighted undirected graph on n vertices can compute all-pairs 2-approximate distance in deterministic time O~(mn+n2) or all pairs 7/3-approximate distance in deterministic time O~(m2/3n+n2).

Using a similar idea, we can derandomize the O~(n2)-time construction of a (2k1)-approximate distance oracle of Baswana and Kavitha [9]. In this algorithm, they use a similar hierarchy of sets Ak1A0=V of sizes Ai=O~(n1i/k) which satisfy the same properties. To avoid the O~(mn1/k) runtime, they authors construct a 3-spanner on min(m,n3/2) edges and use it to construct a graph on m¯=min(m,n21/k) in expected linear time. They proceed to compute Ak1-balls using only the edges of this graph and compute the sets Bi(v) for every vertex v in quadratic time.

We can derandomize this algorithm by beginning with sets Ski which are deterministic hitting sets to the ni/k highest weight edges adjacent to every vertex. We can then compute the same 3-spanner in deterministic linear time [36] and compute the n1/k closest vertices to each vertex in the corresponding subgraph in time O~(m¯n1/k)=O~(n2). We take Ak1 to be the union of deterministic hitting set to these neighborhoods and Sk1. For subsequent Ai’s, we compute Bi+1(v) for every vertex in the graph (V,ESi). We then take Ai to be the union of Si and a deterministic hitting set of all Bi+1. This approach gives us the following deterministic result:

Theorem 6 (Derandomization of Theorem 6.6 of [9]).

An undirected, weighted graph on n vertices and m edges can be preprocessed in deterministic time O~(min(n2,kmn1/k)) to compute a (2k1)-distance oracle of size O~(kn1+1/k) for any integer k>2.

Because Theorem 2 is a direct derandomization of Corollary 3.3 from [39], we also get a deterministic version of their algorithm for constructing a stretch 3 routing scheme that works in the same time complexity (note that their scheme cites a deterministic construction of a 2-level hash table that supports lookups in worst-case constant time).

Backurs et al. [8]333We note that Theorem 38 of [8] (a randomized O(n2.05) algorithm that yields a slightly better almost-3/2 diameter approximation and almost-5/3 eccentricity approximation for undirected, unweighted graphs) can directly be derandomized using the deterministic distance oracle techniques from [36]. use the randomized small clusters technique from [39] to obtain an almost-3/2 approximation of undirected unweighted diameter in expected O(n2logn) time. The randomness in their algorithm arises from randomly sampling a hitting set A of size |A|=O(nlogn) such that |CA(w)|=O(n) for all w. Then, the algorithm iterates over all pairs of vertices within every cluster, resulting in an O(n×|CA(w)|2)=O(n2) contribution in time complexity. The algorithm also uses a result from Knudsen [31] to obtain an additive 2 spanner H with O(n1.5) edges in deterministic O(n2) time, and computes |A| shortest path threes in H in O(|A|n1.5)=O(n2logn) time.

To derandomize the result, we first compute the nearest =O(n) neighbors to each node, which can been listed out in O(n2) time (see the construction of a k-partial-BFS tree in [25]). Then, we use our Lemma 16 to compute the hitting set A with the same guarantees in deterministic O(nlogn)=O(n1.5logn) time, giving us the following result:

Theorem 7 (Derandomization of Algorithm 32 in [8]).

There is a deterministic O(n2logn) time algorithm that, for an unweighted undirected graph G with diameter D=3h+z where h is a positive integer and z[0,1,2], outputs a value D^ satisfying

{2h1if z[0,1]2hif z=2D^D

1.5 Related work

Besides the typical definition of diameter, there are several other notions of diameter in directed graphs, using different symmetric notions of distance ([4]). Several works [4, 16, 10, 22, 19] provide approximation algorithms for the so-called min-diameter which is defined as maxu,vmin{d(u,v),d(v,u)}. The roundtrip diameter is maxu,vd(u,v)+d(v,u), and approximation algorithms and conditional lower bounds for it were studied by [3, 4]. Other notions such as ST diameter and bichromatic diameter were studied by [8, 21]. Most of the known algorithms are randomized. We suspect that at least some of them can be derandomized using our techniques.

There is a lot of work on APSP approximation. Besides the approximation algorithms mentioned so far, there is work on additive approximations for APSP [25, 24, 27, 38] and multiplicative 2-approximations [5, 25, 18, 9, 30, 24, 27, 35, 26, 38]. We can’t hope to capture all of the vast literature on shortest paths approximation. We invite the reader to look at the references in the above papers for more.

2 Preliminaries

Let G=(V,E) be a directed or undirected graph on n vertices and m edges. When G is a weighted graph denote by w(u,v) the weight of the edge (u,v). Given a pair of vertices u,vV denote by dG(u,v) the length of the shortest path from u to v in G. When G is clear from context we drop the subscript.

Denote by ϵ(u)=maxvVd(u,v) the eccentricity of a vertex u and let D=maxuVϵ(u) be the diameter of the graph and R=minuVϵ(u) be the radius of the graph.

We say that a value D~ is an (α,β)-approximation to a parameter D if αD+βD~D. When β=0 we have a multiplicative approximation and call it an α-approximation. When β>0 is a constant we refer to D~ as an “almost” α-approximation.

Given a vertex v, denote by N(v)={uV:(v,u)E} its neighborhood. Given an additional set S define the S-ball of a vertex v by BS(v)={uV:d(v,u)<d(v,S)}. Define the S-cluster as CS(x)={vV:xBS(v)}. In some case we are interested in the neighborhood of the S-ball of a vertex, we denote this set by BS+(x)=wBS(x)N(w).

If G is a directed graph, we further define the incoming S-balls and clusters BSR(v),CSR(v) to be the S-balls and clusters in the graph with edge direction reversed.

Given a subset UV, and integer q1, for vV the set Uq(v) is defined to be the q closest vertices of U to v, i.e. |Uq(v)|=q and whenever xUq(v),yUUq(v), then d(x,v)d(y,v). When creating Uq(v), ties are broken according to some permutation of the vertices, e.g. the lexicographic order of their names.

We use the following result concerning the fast, deterministic computation of the sets Uq.

Lemma 8 (Theorem 2 of [36]).

For any directed n-node, m-edge G=(V,E) with positive edge weights, any UV, 1q|U|, one can compute Uq(v) for all vV in O((m+nlogn)q) time deterministically by performing q SSSP444Single source shortest paths, either BFS in O(m) time in undirected graphs or Dijkstra’s algorithm in O(m+nlogn) time in directed graphs. We make this distinction since in some cases we wish to be careful about our log factors. computations on graphs with O(n) nodes and O(m) edges.

Another fundamental tool we use is the construction of a deterministic hitting set:

Lemma 9 (Greedy hitting set).

Given S1,,SN[n] such that N=poly(n) and for all i[N], |Si|L, one can compute deterministically in O(NL) time a set H of size O(n/Llogn) such that for all i, SiH.

As mentioned, we derandomize a stronger variant of the balls and clusters construction, one that guarantees that the clusters of all vertices are of bounded size. The proof of this theorem can be found in Section 4.

Theorem 2. [Restated, see original statement.]

Given a weighted, directed or undirected graph G and >0, one can compute a set SV of size O(nlogn) deterministically in time O((m+nlogn)) such that for every vV, |CS(v)|,|BS(v)|,|CSR(v)|,|BSR(v)|=O().

In such a setting, when all vertices have small clusters, we note that in O(C) time we can compute not only BS(v) for all vertices but also BS+(v), where C represents the time it takes to compute a single graph SSSP search. We can do this by scanning the edges out of every BS(v) and using the following claim.

Claim 10.

vV|BS+(v)|=O(m).

Proof.

vV|BS+(v)|vVxBS(v)deg(x)=xVvCS(x)deg(x)xVdeg(x)=O(m).

3 Deterministic (𝟐𝟏/𝟐𝒌𝟏)-Diameter Approximation

In this section we derandomize the longstanding best known diameter approximation tradeoff of Cairo, Grossi and Rizzi [12], achieving a deterministic algorithm that matches the multiplicative and additive approximation guarantees of [12] without incurring any additional cost on the runtime (as our algorithm matches the runtime of [12] down to the logarithmic dependency). To do so, we avoid randomized sampling techniques and reduce the problem of approximating the graph diameter to a series of queries to the classic approximate distance oracle of Thorup and Zwick [40]. Using the deterministic construction of this distance oracle of Roditty, Thorup and Zwick [36], we obtain the first deterministic diameter approximation tradeoff for undirected graphs.

Just as the algorithm of Cairo, Grossi and Rizzi also provides a (212k1)-approximation to the graph radius and a (342k1+1)-approximation to all eccentricities, so can our algorithm. We defer the proof of this result to Section 6.

We note that by using Lemma 9 to construct a hitting set of neighborhoods constructed using Lemma 8, we can easily derandomize both the O~(mn) time almost-3/2 approximation of [37] and the O~(m3/2) time genuine-3/2 approximation of [15] which work in directed graphs. Derandomizing the full CGR construction is not as simple since the original randomized construction uses random samples to hit large node neighborhoods that would be expensive to construct explicitly. We get around this by adapting the ideas behind the Thorup-Zwick distance oracles.

Theorem 11.

Given an undirected graph with edges weight bounded by M and an integer k2, one can compute in deterministic O~(mn1/k) time an estimate D~ satisfying 2k12k1DαD~D where α=2k112k1M.

Proof.

We begin by recursively constructing the data structure used in the deterministic (2k1)-approximate distance oracle of [36]. Begin with A0=V. Now, assuming we have the set Ai, let Ni(v) be the q=O~(n1/k) closest vertices to v in Ai, we will set the exact logarithmic dependency of q in our runtime analysis. Using Lemma 8, we can construct these sets in O~(mn1/k) time. Define Ai+1 to be a greedy hitting set of the sets Ni(v) for all v using Lemma 9. Note that the lemma gives the following property:

Claim 12.

|Ai|O~(n1i/k).

For every i, run Dijkstra’s algorithm from the set Ai+1 and let vi be the furthest vertex of V from the set. Define Bi(vi){xAi:d(vi,x)<d(vi,Ai+1)}. By the definition of Ai, |Bi(vi)|=O~(n1/k).

Finally, we run Dijkstra’s algorithm from Ak1 and from every vertex yBi(vi) for 0ik2 and return the largest distance found. See Algorithm 1 for the full pseudo-code.

Algorithm 1 (212k1)-Diameter Approximation.

Correctness.

We want to show that the distance D~ returned by the algorithm satisfies the desired distance approximation. Clearly D~D as it is a true distance in the graph, so we are left to show the lower bound. To do so we define a series of parameters and use them to prove that at every step either we find a pair of vertices of distance 2k12k1Dα or the vertex vi is sufficiently far from Ai+1 and we proceed inductively.

Fix a pair of diameter endpoints, d(s,t)=D and define the values ε,γ1,γk1,α2,,αk1 as follows. Let ε=2k112k1, we want to show that D~(1ε)DεM. For every r=0,,k2 define γk1r=12r(1ε)(12ε). Finally, define for every i=1,,k2,αi+1=γi+1γi.

Note that since the γi’s are increasing we always have that αi>0. Furthermore, γ1=12ε=12k1>0 so all γi>0. Next we note the following property relating our chosen parameters to each other and motivating their definition.

Proposition 13.

1εαi+1+γi=ε.

Proof.

αi+1γi =γi+12γi=12ki2(1ε)(12ε)22ki1(1ε)+2(12ε)
=(12ki222ki1)(1ε)+(12ε)=12ε.

Thus, 1εαi+1+γi=ε.

We wish to show inductively that at every step of the algorithm we either find a pair of point far enough apart or claim a lower bound on the distance between vi and Ai+1. We begin with the base case.

Claim 14.

If there exists a vertex xAk1 such that d(s,x)ε(D+M) then D~d(x,t)(1ε)DεM.

The proof follows from the triangle inequality. Thus, if after running Dijkstra’s from Ak1 we don’t have a good enough approximation then d(vk2,Ak1)>ε(D+M)=γk1(D+M).

Lemma 15.

Suppose d(vi,Ai+1)>γi+1(D+M), then after running Dijkstra’s from Bi(vi) we either have an estimate D~(1ε)DεM, or d(vi1,Ai)>γi(D+M).

Proof.

When we run Dijkstra’s from vi, if we do not get the desired approximation we must have that d(s,vi)<(1ε)DεM. Since d(vi,Ai+1)>γi+1(D+M), the set Bi(vi) contains all vertices of Ai at distance γi+1(D+M) from vi.

Consider the shortest path between s and vi. There must exists a vertex c on this shortest path such that d(vi,c)αi+1(D+M) and

d(s,c)((1ε)DεM)αi+1(D+M)+M=(1εαi+1)(D+M).

Consider the distance d(c,Ai). If this distance is greater than γi(D+M) then we have that d(vi1,Ai)>γi(D+M). Otherwise, there exists qAi such that d(c,q)γi(D+M). So by the triangle inequality,

d(vi,q)αi+1(D+M)+γi(D+M)=γi+1(D+M).

Therefore, qBi(vi) and so we have computed Dijkstra’s from it. Furthermore, by Proposition 13,

d(s,q) d(s,c)+d(c,q)(1εαi+1)(D+M)+γi(D+M)
=(1εαi+1+γi)(D+M)=ε(D+M).

Meaning d(q,t)(1ε)DεM and we have computed the desired approximation. We conclude that after running Dijkstra’s from Bi(vi) either D~ is sufficiently large or d(vi1,Ai)>γi(D+M).

By applying Lemma 15 (k1) times, using Claim 14 as the base case, we either compute an estimate D~(1ε)DεM or have that d(v0,A1)>γ1(D+M)=(12ε)(D+M).

In this case, B0(v0) contains all vertices of V at distance (12ε)(D+M) from V0. Since we run Dijkstra’s from v0 we can assume d(v0,s)<(1ε)DεM or we have already found a sufficiently large distance. Thus, there exists a vertex y on the shortest path between v0 and s such that d(s,y)ε(D+M) and

d(v0,y)((1ε)DεM)ε(D+M)+M=(12ε)(D+M).

Therefore yB0(v0) and d(y,t)(1ε)DεM and so running Dijkstra’s from all vertices in B0(v0) gives us the desired approximation. We conclude that,

D~(1ε)DεM=2k12k1D2k112k1M.

Runtime.

Using Lemma 8, we can compute the sets Ni(v) in total time O(qC) where C=O(m+nlogn) is the time it takes to run a single graph search. Next, using Lemma 9, computing Ai+1 takes O(nq) time and produces a set of size |Ai+1|=O(|Ai|qlogn)=O(nqilogin). Finding vi and computing Bi(vi) can be done in O(C) time and running Dijkstra’s algorithm from every yBi(vi) takes O(qC) as |Bi(vi)||Ni(vi)|=q.

Thus, running lines 5-9 takes O(qC+nq)=O(qC) time, for a total runtime of O(kqC). Finally, running Dijkstra’s algorithm from all vertices of Ak1 takes time O(|Ak1|C)=O(nqk1logk1nC).

Setting q=O(n1/klog(k1)/knk1/k) gives a final runtime of O(Cn1/klog(k1)/knk(k1)/k)=O~(mn1/k).

4 Deterministic Small Clusters

A random hitting set of size Θ(n) results in an expected average cluster size 1nwV|CA(w)| of O(). A deterministic greedy hitting set of size Θ(nlogn) results in an O() on the size of every ball, and furthermore the average cluster size is small as a result:

v:|BA(v)|1nwV|CA(w)|=1nvV|BA(w)|

However, sometimes we want the size of all clusters to be bounded by . Theorem 3.1 from [39] gave a Las Vegas algorithm for doing so that worked in O(nllogn) expected time. Here, we present a deterministic algorithm that works in the same running time.

Lemma 16.

There exists a deterministic algorithm running in O(nlogn) time that, when given an n× matrix M consisting of the closest vertices to every node (in a directed or undirected graph), constructs a set A of size |A|=O(nlogn) such that all clusters and balls with respect to A are of size at most .

To prove lemma 16, we make use of the following “early hitting set” lemma from [36].

Lemma 17 (Definition 2, Theorem 3 from [36]).

Let M be an n× matrix whose elements are taken from a finite set S of size |S|=s, let A be a set, and let P0 be a penalty. Let hit(Mi,A) be the index of the first element of Mi, the i-th row of M, that belongs to A, or +P, if no element of Mi belongs to A. Let hit(M,A)=i=1nhit(Mi,A) be the hitting sum of A with respect to M.

Then, for every 0<p<1 there is an O(n) time algorithm which finds a set AS for which np2s|A|+hit(M,A)3n/p+(1p)Pn.

Proof of Lemma 16..

The idea is that early hitting sets satisfy the same property that random sets do in the proof of Theorem 3.1 from [39].

Algorithm.

Construct a greedy hitting set (Lemma 9) of size O(nlogn) that hits every row of this matrix. Initialize A to be this greedy hitting set.

For i[logn], we repeat the following:

Compute the balls BA(v) for every vertex v by iterating through each row of M and finding the first element in each row which is in A, and compute the clusters CA(w) as the inverse of the balls. Let Wi={wV||CA(w)|>}, i.e. all clusters that are still “too big”. Now, we construct a new matrix M, where for each row in M, consider only the elements before the first occurrence of A that are also members of Wi. Pad all rows of M with a dummy element to make them the same length.

In Lemma 17, plug in p=8n|Wi|,s=|Wi|,k=,P=0.

Lemma 17 returns a set A. If the dummy element is not included in A, we add it in. We set AAA.

Correctness.

Consider the set A returned by Lemma 17 after iteration i, and the set A after A is merged in.

Lemma 17 guarantees np2s|A|+hit(M,A)3n/p+(1p)Pn. Because P=0 and all terms are non-negative, we have np2s|A|3n/p and hit(M,A)3n/p. The first inequality yields |A|ps=24n. From the second inequality, we have hit(M,A)3|Wi|8.

For a row corresponding to vertex v, the set of elements that occur before the first hit (which is the entire row, if no hit occurs), is precisely BA(v)Wi, and so hit(M,A)=vV|BA(v)Wi|.

We have wWi|CA(w)|=v|BA(w)Wi|3|Wi|8. Recall that Wi+1Wi are the clusters still satisfying |CA(w)|> at the end of the ith iteration. So, we have
3|Wi|8hit(M,A)=v|BA(w)Wi|=wWi|CA(w)|wWi+1|CA(w)|>|Wi+1| |Wi+1|<|Wi|2

W0V|W0|n, so in logn iterations, Wi becomes the empty set, at which point all clusters satisfy |CA(w)|.

We add at most 24n+1 elements into A at every iteration, so the total number of added elements is |A|O(nlogn).

Runtime.

In each iteration, the size of the matrix M is bounded by n. Lemma 17 constructs the hitting set in linear time in the size of the matrix. The greedy hitting set finds an initial set A satisfying |BA(v)| for every v, so computing all balls and clusters takes time vV|BA(v)|=wV|CA(w)|n.

There are logn total iterations, for an overall time complexity of O(nlogn).

Finally, we prove Theorem 2.

Proof of Theorem 2..

It suffices to prove the claim for a weighted, directed graph. First, we use Lemma 8 to compute Uq(v) for the set U=V and q= in O((m+nlogn)) time. Then, we apply Lemma 16 to compute a set SF of size O(nlogn) such that |CSF(v)|,|BSF(v)| in O(nlogn) time.

Similarly, we compute a set SR of size O(nlogn) such that |CSR(v)|,|BSR(v)| in the same running time.

Finally, we set S=SFSR. Note that balls and clusters are nonincreasing as we add elements to S, so S satisfies |S|=O(nlogn) and |CS(v)|,|BS(v)|,|CSR(v)|,|BSR(v)|=O().

5 New Diameter Approximation Algorithms

5.1 Simplified (𝟑/𝟐,𝟎)-Diameter Approximation

We begin by constructing a simple 3/2-diameter approximation algorithm with no additive error. Our algorithm runs in time O(mn2/3logn2/3), improving by a log factor upon the runtime of the (3/2,0)-approximation algorithm of Chechik et al. [15] with a vastly simpler algorithm. We derive this algorithm from queries to an adaptation of a (2,1) distance oracle data structure [34] using the classic balls and clusters approach, together with the observation (e.g. [9]) that iterating over all the neighbors of a vertex’s ball can be done efficiently, to avoid the original additive error.

Theorem 18.

Given a weighted, directed graph with diameter D, one can compute in O(mn2/3log2/3n) time an estimate D~ satisfying 2D3D~D.

Recall the 3/2 diameter approximation algorithm of Roditty and Vassilevska W. [37]. Take a set S of size O~(n/) such that every vV has |BS(v)|=O(). Run Dijkstra’s algorithm to and from every vertex in S and let w be the vertex maximizing d(w,S). Finally, run Dijkstra’s from w and into every vertex in BS(w) and return the largest distance found. By setting =n the algorithm achieves a runtime of O~(mn).

The approximation guarantee comes from the following argument. Consider a pair of diameter endpoints d(s,t)=D. If d(s,S)D3, then there exists a point xS with d(x,t)2D3, which gives us our desired approximation. Otherwise, d(w,S)>D3 as it maximizes this distance, meaning BS(w) contains all points of distance D3 from w. If w has distance greater than 2D3 to t we are done, otherwise pick a vertex on the shortest path between w and t that is within distance D3 from w - meaning it is contained in BS(w) - and to t - meaning it has distance 2D3 from s. Thus, running Dijsktra’s from all vertices in BS(w) runs a search out of this vertex and thus guarantees finding a large enough distance. However, such a vertex does not necessarily exist, as on the shortest path between w,t there could be an edge xy such that d(w,x),d(y,t)<D3 while d(x,t),d(w,y)>D3. This causes the algorithm to incur an additive error proportional to the weight of the edge xy, which could be arbitrarily large.

To address this additive error, Chechik et al. [15] perform a binary search to have an approximate value of the diameter and introduce various new tools in a relatively involved algorithm running in O(mn2/3log5/3n) time.

We instead propose a simple algorithm, hinging on the observation that for any pair of vertices u,v that have d(u,S),d(S,v)>D/3, if the distance between them is smaller than our target of 2D/3, then there exists an edge connecting their S-balls to each other. We adapt the (2,1)-distance oracle of Pătraşcu and Roditty [34] to compute the distances between such pairs of points.

Proof of Theorem 18..

We are now ready to formally state our algorithm. See Algorithm 2 for the full pseudo-code.

Using Theorem 2, construct a set S of size O(nlogn), using a parameter to be set later, such that all ingoing and outgoing S-balls and clusters are of size O(). Compute BS+(v) for every vV and run Dijsktra’s algorithm to and from all vertices in S.

Next, we compute the distances obtained from paths of the form uxyv where xBS(u),yBSR(v) and (x,y)E. Denote by d^(u,v) the length of the shortest path of this form from u to v and set d^(u,v)= if no such path exists, note that in general d^(u,v)d(u,v). For every vertex u, we compute all d^(u,v) by scanning BS(u). For each xBS(u), each yN(x) and each vCSR(y) we compute d^(u,v)min(d^(u,v),d(u,x)+w(x,y)+d(y,v)). In fact, this is an adaptation to the preprocessing step of the (2,1) distance oracle of Pătraşcu and Roditty [34], which computes the distances between pairs of points whose S-balls intersect in the undirected setting. We can think of this step as the preprocessing of an approximate distance oracle where we later obtain the values d^(u,v) by querying the oracle.

Now, for every vertex w compute the largest value d^(w,v) for a vertex v such that d(w,S)d(S,v). Denote this value by ϵ^(w). Similarly, define ϵ^R(w) to be the largest value d^(v,w) for a vertex v such that d(S,w)d(v,S). We choose the vertex w that maximizes the expression min(3d(w,S),ϵ^(w)) and the vertex wR that maximizes the expression min(3d(S,wR),ϵ^R(w)R). We claim that running Dijkstra’s from w and to wR will result in the desired approximation.

Algorithm 2 (3/2,0)-Diameter Approximation.

Correctness.

Clearly the value D~ returned by the algorithm satisfies D~D, as it is a distance in the graph. We are left to show that D~2D/3.

Fix a pair of diameter endpoints d(s,t)=D. If d(s,S)D3, then there exists a point xS such that d(s,x)D3 and so by the triangle inequality d(x,t)2D3. Thus, the algorithm will have found a sufficiently large distance in line 4. Similarly, if d(S,t)D3 we are done, so we can assume that d(s,S),d(S,t)>D3.

W.l.o.g we can assume d(s,S)d(S,t), as the reverse case is symmetric. Thus we have that ϵ^(s)d^(s,t)d(s,t)=D. Since d(s,S)>D3, we conclude that line 12 selects a w such that,

min(3d(w,S),ϵ^(w))min(3d(s,S),ϵ^(s))D.

Therefore, d(w,S)D3 and ϵ^(w)D, meaning there exists a vertex v with d(S,v)d(w,S)>D3 such that d^(w,v)D. We claim that d(w,v)2D3 and so running Dijkstra’s from w will obtain the desired approximation.

Indeed, if d(w,v)<2D3 then there exists an edge on the shortest path between w and v, (x,y)E such that d(w,x)<D3 and d(y,v)<D3. Since d(v,S)d(w,S)D3 we have that xBS(w) and yBSR(v). Therefore the path wxyv would have been considered in the computation of d^(w,v) and we would have d^(w,v)2D3, contradiction. We conclude that d(w,v)2D3 and the largest distance found from running Dijkstra’s out of w obtains the desired approximation.

Runtime.

Computing the set S, as well as all BS+,BSR balls and the distances within them, takes O(mlogn) time. Running Dijsktra’s to and from every vertex in S takes O(mnlogn) assuming m=Ω(nlogn). If this is not the case and m=o(nlogn) we can compute a (3/2,0)-approximation in O~(m3/2)O(mn2/3) time [15].

Computing the values d^(u,v) takes time:

vVyBS+(v)|CS(y)|vV|BS+(v)|O()O(m2).

The values ϵ^(v),ϵ^R(v) can be computed at the same time as the d^ values by sorting the vertices in order of distance to/from S ahead of time and only considering the d^ values computed. If not all relevant vertices v have a value d^(w,v) or d^(v,w) computed, we assign the value of . Finally, lines 12, 13 and 14 run in near linear time.

The total runtime of the algorithm therefore comes out to O(mlogn+mnlogn+m2). Setting =(nlogn)1/3 we get a runtime of O(mn2/3log2/3n).

5.2 New (𝟓/𝟑,𝟕/𝟑)-Diameter Approximation

In the next section we provide the first diameter approximation algorithm with multiplicative error not of the form 212k. Our algorithm runs in time O~(nm3/5) and obtains a multiplicative error of 5/3. In the worst case, the algorithm has an additive error of +7/3. This algorithm is faster than the current best 3/2-approximation algorithms (with additive errors) in the regime where n5/4mn5/3.

The algorithm uses the structure of Akav and Roditty’s (2+ε,5)-distance oracle [6], together with the balls and clusters techniques of classic diameter approximation algorithms. As we cannot afford to preprocess the entire (2+ε,5)-approximate distance oracle, we construct a partial distance oracle treating only pairs of points with one endpoint in a particular set. While the original work is randomized, we use a deterministic hitting set construction while building the distance oracle to achieve a deterministic diameter approximation algorithm.

Theorem 19.

Given an unweighted, undirected graph with diameter D, one can compute in O(nm3/5log8/5n) time an estimate D~ satisfying 3D5αD~D for α=max(65,53D15)).

The above algorithm gives us a value D~ such that D5D~3+5α3D+5α3, i.e. a (53,max(2,25D9))-approximation to the diameter. If the diameter of the graph is large enough, D7, we have α=65 and obtain a (5/3,2) approximation. In the worst case we have D=4, as D=1 or D=2 can be checked in linear time and if D=3 a single BFS finds a distance of 2=2D3. In this case we get α=75 and obtain a (5/3,7/3)-approximation.

The idea of our algorithm is as follows. We construct sets S1, S2 of size O~(n/) and O~() respectively. We can afford to run BFS from all the points in S1 and from a ball BS2(w) of some vertex w in time O~(mn). Using the previous ideas for diameter approximations, this gives us the desired approximation if a diameter endpoint is within distance 2D5 of S1 or further than D5 away from S2.

For the remaining case, we show that we have a pair of points xS2 and tV such that both d(x,t) and d(x,S1)+d(t,S1) are large. We now construct a restricted, deterministic version of Akav and Roditty’s (2+ε,5)-approximate distance oracle to handle such pairs. The idea of this distance oracle is to construct a spanner H that guarantees an additive 2 approximation to paths that are fully contained within a single S1-ball, and thus a +4 approximations to distances between points whose S1-balls intersect. We now compute all distances out of S2 using the edges of the spanner H, this guarantees that the distance obtained, dH(u,v) is a good approximation for d(u,v) whenever the S1 balls of u and v intersect. If they don’t intersect, we can approximate the distance between u and v with d(u,S1)+d(v,S1). The distance oracle returns the minimum of these two estimates, to guarantee a lower bound to the true distance between u and v. We show for the pair of points x and t mentioned above that this estimate provides the desired approximation.

The construction of the spanner H is also randomized in the original work of [6]. The idea of the spanner is to take a hitting set T of size O~(nL) that hits the neighborhood of all vertices of degree >L. We then compute BS1(v) for every vT and add a shortest path tree spanning BS1(v) to H. We complete H by adding all edges adjacent to vertices of degree L.

We can derandomize this construction by carefully constructing the sets T,S1,S2 in a particular order. We first construct T as a deterministic hitting set to all neighborhoods of vertices of degree >L. We then compute the -nearest neighbors of each vertex in T and construct S1 to be a hitting set for these neighborhoods, to guarantee that all vertices in T have small S1-balls. Finally, for S2 we can afford to use Theorem 2 and construct a set such that all vertices have small S2-balls.

Proof of Theorem 19..

We can now formally state our algorithm. For full pseudo-code, see Algorithm 3.

Let ,L be parameters to be set later. Using Lemma 9, construct a set T of size O(nLlogn) in time O(nL) that hits the neighborhood of every vertex of degree >L. For every uT compute W(u) to be the closest nodes to u. Now, again using Lemma 9, construct a hitting set S1 of size O(nlogn) in time O(n) to hit W(u) for every uT. Note that in this case, for every uT we have that |BS1(u)||W(u)|=O(). Using Theorem 2, construct a set S2 of size O(logn) in time O(mnlogn) such that all vertices have |BS2(v)|=O(n).

Following the approach of previous diameter approximation algorithms, begin by running BFS from all vertices in S1 and from the set S2. Let w be the furthest point from S2 and run BFS from every point in BS2(w).

Fix a pair of diameter endpoints d(s,t)=D. If d(t,S1)2D5+α, then there exists a point xS1 such that d(x,t)2D5+α and so d(x,s)3D5α and running BFS from S1 achieves the desired approximation. Similarly, if d(s,S1)2D5+α we are done.

Continuing along the analysis of previous diameter approximations, if d(s,S2)>D5+12α, then d(w,S2)>D5+12α. If d(w,s)3D5α, then there exists a vertex y on the shortest path between w and s such that d(w,y)D5+12α and d(y,s)2D5+α. Therefore yBS2(w) and d(y,t)3D5α, thus running BFS from all points in BS2(w) obtains the desired approximation.

We are left to handle the case when d(s,S1),d(t,S1)>2D5+α and d(s,S2)D5+12α. In this case, there exists a vertex xS2 such that d(s,x)D5+12α, and so d(x,t)4D51+2α. Furthermore, since d(s,S1)>2D5+α, by the triangle inequality we know that d(x,S1)d(s,S1)d(x,s)>D51+3α.

To handle this final case we construct a restricted, deterministic version of Akav and Roditty’s (2+ε,5)-approximate distance oracle to compute an approximation for distances from S2. We will simply compute an estimate to these distances, but we can think of this step as constructing a distance oracle and querying d~(u,v) for every uS2,vV.

Construct the following spanner H. Initialize the edges of H to contain all edges adjacent to vertices of degree L. For every uT, add a spanning tree of BS1(u) rooted at u to H. As each S1-ball of a vertex in T is of size O() this results in H having O(L+nLlogn) edges. Run BFS from every xS2 in the spanner H to compute dH(x,v) for every xS2,vV. Using a series of claims we will now show that the following distance approximation is a lower bound to the true distance between a pair of points.

Lemma 20.
d~(u,v)min(dH(u,v)4,d(u,S1)+d(v,S1)5)d(u,v).

We prove this lemma by considering two cases. Note that we only use BS1(u),BS1(v) for analysis and don’t have to compute these sets at any point of the algorithm.

Claim 21.

If no shortest path between u,v contains five vertices in BS1(u)BS1(v) then d(u,S1)+d(v,S1)d(u,v)+5.

Proof.

Consider a shortest path between u,v. Label the vertices u=x0,x1,,xk=v. Let xi be the furthest vertex on the path from u that is still in BS1(u) and let xj be the furthest vertex from v that is still in BS1(v). Then since we cannot have five vertices on the path in BS1(u)BS1(v) we have ij<4. Since xi+1BS1(u) we know d(u,S1)=i+1 and similarly d(v,S1)=d(u,v)j+1.

Therefore,

d(u,S1)+d(v,S1)=i+1+d(u,v)j+1=d(u,v)+2+ijd(u,v)+5.

Claim 22.

If a shortest path between u,v contains five vertices in BS1(u)BS1(v) then dH(u,v)d(u,v)+4.

Proof.

Let x0=u,x1,,xr=v be a shortest path between u,v such that xk2,xk1,xk,xk+1,xk+2BS1(u)BS1(v). Consider the path between u and xk. If all vertices on this path are of degree L then the path is contained in H and dH(u,x)=d(u,x).

Otherwise, let xi be the first vertex of degree >L on the path from u to x and let pT be a neighbor of xi. We claim that xkBS1(p). Indeed, by the triangle inequality, d(p,S1)d(u,S1)d(u,p). Since d(u,S1)k+3 and d(u,p)i+1 we have that d(p,S1)k1+2. On the other hand, d(p,xk)d(xi,xk)+1=ki+1, and so xkBS1(p).

Therefore, H contains all edges on the path uxi as they are adjacent to vertices of degree L. H contains the edge xip as it is part of the spanning tree of BS1(p). Finally, H contains a path of length d(p,xk) between p and xk since xkBS1(p). We conclude that,

dH(u,xk)d(u,p)+d(p,xk)=d(u,xk)+2.

Similarly, we can show that dH(xk,v)d(xk,v)+2 and so we can conclude that:

dH(u,v)dH(u,xk)+dH(xk,v)d(u,xk)+2+d(xk,v)+2=d(u,v)+4.

Therefore, the estimate d~(u,v) gives us a lower bound to d(u,v). Now consider d~(x,t) for the vertex xS2 and the diameter endpoint t discussed above. Since α53D15,

dH(x,t)4d(x,t)4D51+2α43D5α.

Furthermore, since α65,

d(x,S1)+d(t,S1)5D51+3α+2D5+α53D5α.

Therefore, d~(x,t)3D5α. So returning the largest d~ distance estimate computed will obtain the desired approximation.

Algorithm 3 (5/3,7/3)-Diameter Approximation.

Correctness.

By Lemma 20, all values d~ computed are smaller than true distances in the graph. Therefore the value D~ returned is bounded above by a true distance and so D~D.

As discussed above, if d(s,S1)2D5+α or d(t,S1)2D5+α, we find a sufficiently large distance in line 7. Furthermore, if d(s,S2)D5+12α we find a sufficiently large distance in line 8. Otherwise, we have a point xS2 and tV such that d~(x,t)3D5α and thus the largest d~ distance computed gives our desired approximation.

Runtime.

Using Lemma 9 to construct T and S1 takes O~(nL+n) time, which will be dominated by O(nm3/5log8/5n) for the ,L we set. Constructing S2 using a greedy hitting set takes O(mnlogn) time.

Computing the -nearest neighbors of all vertices in T takes O(|T|2)=O(n2Llogn) time. Running lines 7 and 8 take O(mnlogn) time.

The spanner H contains O(nL) edges adjacent to low degree vertices. Adding the spanning trees to the spanner adds O(nLlogn) edges for a total of O(nL+nLlogn) edges. Therefore, computing the distances d~ from O(logn) vertices takes O(nLlog2n+n2Llog3n).

This gives us a final runtime of

O(mnlogn+nLlog2n+n2Llog3n).

Setting =m2/5log3/5n,L=m1/5log1/5n we obtain our desired runtime of O(nm3/5log8/5n).

6 Deterministic (𝟐𝟏𝟐𝒌𝟏)-Radius Approximation and (𝟑𝟒𝟐𝒌+𝟏)-All Nodes Eccentricity Approximation

In this section we show that the algorithm introduced in the proof of Theorem 11 can also approximate the radius and all eccentricities of a given graph.

While there is an O~(m) expected time 2-approximation algorithm for all eccentricities [17, 8], it is not known how to derandomize these algorithms. Thus, the deterministic algorithm below presents the best known deterministic approximation algorithms for all nodes eccentricities.

Consider Algorithm 4, which runs the same graph searches as Algorithm 1 and outputs radius and eccentricities approximations.

Algorithm 4 (212k1)-Radius Approximation and (342k1+1)-Eccentricities Approximation.

We claim that Algorithm 4 gives the following result.

Theorem 23.

Given an undirected graph with edges weight bounded by M and an integer k2, one can compute in deterministic O~(mn1/k) time an estimate R~ satisfying RR~2k12k1R+2k112k1M, and estimates ϵ~w for every wV satisfying 2k1+132k11ϵ(w)2k232k11Mϵ~wϵ(w).

We showed the runtime of the algorithm in the proof of Theorem 11, so we are left to show that approximation guarantees, which we do in the subsequent Lemma 24 and Lemma 25. We will follow a very similar proof idea, adjusting the parameters for each problem. To adhere to space constraints, we omit the proofs from this version. See the full version for proofs of the following two lemmas.

Lemma 24.

The value R~ outputted by algorithm 4 satisfies RR~2k12k1R+2k112k1M.

Lemma 25.

For every wV, the value ϵ~w outputted by algorithm 4 satisfies 2k1+132k11ϵ(w)2k232k11Mϵ~wϵ(w).

References

  • [1] Amir Abboud, Karl Bringmann, and Nick Fischer. Stronger 3-sum lower bounds for approximate distance oracles via additive combinatorics. In Proceedings of the 55th Annual ACM Symposium on Theory of Computing, STOC 2023, Orlando, FL, USA, June 20-23, 2023, pages 391–404. ACM, 2023. doi:10.1145/3564246.3585240.
  • [2] Amir Abboud, Karl Bringmann, Seri Khoury, and Or Zamir. Hardness of approximation in p via short cycle removal: cycle detection, distance oracles, and beyond. In STOC ’22: 54th Annual ACM SIGACT Symposium on Theory of Computing, Rome, Italy, June 20 - 24, 2022, pages 1487–1500. ACM, 2022. doi:10.1145/3519935.3520066.
  • [3] Amir Abboud, Mina Dalirrooyfard, Ray Li, and Virginia Vassilevska Williams. On diameter approximation in directed graphs. In Inge Li Gørtz, Martin Farach-Colton, Simon J. Puglisi, and Grzegorz Herman, editors, 31st Annual European Symposium on Algorithms, ESA 2023, September 4-6, 2023, Amsterdam, The Netherlands, volume 274 of LIPIcs, pages 2:1–2:17. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2023. doi:10.4230/LIPIcs.ESA.2023.2.
  • [4] Amir Abboud, Virginia Vassilevska Williams, and Joshua Wang. Approximation and fixed parameter subquadratic algorithms for radius and diameter in sparse graphs. In Proceedings of the Twenty-Seventh Annual ACM-SIAM Symposium on Discrete Algorithms, SODA ’16, pages 377–391, USA, 2016. Society for Industrial and Applied Mathematics. doi:10.1137/1.9781611974331.CH28.
  • [5] D. Aingworth, C. Chekuri, P. Indyk, and R. Motwani. Fast estimation of diameter and shortest paths (without matrix multiplication). SIAM Journal on Computing, 28(4):1167–1181, 1999. doi:10.1137/S0097539796303421.
  • [6] Maor Akav and Liam Roditty. An almost 2-approximation for all-pairs of shortest paths in subquadratic time. In Proceedings of the 2020 ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1–11, 2020. doi:10.1137/1.9781611975994.1.
  • [7] Josh Alman, Ran Duan, Virginia Vassilevska Williams, Yinzhan Xu, Zixuan Xu, and Renfei Zhou. More asymmetry yields faster matrix multiplication. In 36th ACM-SIAM Symposium on Discrete Algorithms (SODA 2025), pages 2005–2039. SIAM, 2025. arXiv:2404.16349.
  • [8] Arturs Backurs, Liam Roditty, Gilad Segal, Virginia Vassilevska Williams, and Nicole Wein. Towards tight approximation bounds for graph diameter and eccentricities. In Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing, pages 267–280, 2018. doi:10.1145/3188745.3188950.
  • [9] Surender Baswana and Telikepalli Kavitha. Faster algorithms for all-pairs approximate shortest paths in undirected graphs. SIAM Journal on Computing, 39(7):2865–2896, 2010. doi:10.1137/080737174.
  • [10] Aaron Berger, Jenny Kaufmann, and Virginia Vassilevska Williams. Approximating Min-Diameter: Standard and Bichromatic. In 31st Annual European Symposium on Algorithms (ESA 2023), volume 274 of Leibniz International Proceedings in Informatics (LIPIcs), pages 17:1–17:14, 2023. doi:10.4230/LIPIcs.ESA.2023.17.
  • [11] Édouard Bonnet. Inapproximability of Diameter in Super-Linear Time: Beyond the 5/3 Ratio. In Markus Bläser and Benjamin Monmege, editors, 38th International Symposium on Theoretical Aspects of Computer Science (STACS 2021), volume 187 of Leibniz International Proceedings in Informatics (LIPIcs), pages 17:1–17:13, Dagstuhl, Germany, 2021. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.STACS.2021.17.
  • [12] Massimo Cairo, Roberto Grossi, and Romeo Rizzi. New bounds for approximating extremal distances in undirected graphs. In Proceedings of the Twenty-seventh Annual ACM-SIAM Symposium on Discrete Algorithms, pages 363–376. SIAM, 2016. doi:10.1137/1.9781611974331.CH27.
  • [13] Chris Calabro, Russell Impagliazzo, and Ramamohan Paturi. On the exact complexity of evaluating quantified k-cnf. In Venkatesh Raman and Saket Saurabh, editors, Parameterized and Exact Computation - 5th International Symposium, IPEC 2010, Chennai, India, December 13-15, 2010. Proceedings, volume 6478 of Lecture Notes in Computer Science, pages 50–59. Springer, 2010. doi:10.1007/978-3-642-17493-3_7.
  • [14] Shiri Chechik. Approximate distance oracles with constant query time. In Proceedings of the forty-sixth annual ACM symposium on Theory of computing, pages 654–663, 2014. doi:10.1145/2591796.2591801.
  • [15] Shiri Chechik, Daniel H. Larkin, Liam Roditty, Grant Schoenebeck, Robert E. Tarjan, and Virginia Vassilevska Williams. Better approximation algorithms for the graph diameter. In Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA ’14, pages 1041–1052, USA, 2014. Society for Industrial and Applied Mathematics.
  • [16] Shiri Chechik and Tianyi Zhang. Constant approximation of min-distances in near-linear time. In 2022 IEEE 63rd Annual Symposium on Foundations of Computer Science (FOCS), pages 896–906. IEEE, 2022. doi:10.1109/FOCS54457.2022.00089.
  • [17] Keerti Choudhary and Omer Gold. Extremal distances in directed graphs: Tight spanners and near-optimal approximation algorithms. In Proceedings of the Fourteenth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 495–514. SIAM, 2020. doi:10.1137/1.9781611975994.30.
  • [18] Edith Cohen and Uri Zwick. All-pairs small-stretch paths. Journal of Algorithms, 38(2):335–353, 2001. Announced at SODA 1997. doi:10.1006/jagm.2000.1117.
  • [19] Mina Dalirrooyfard and Jenny Kaufmann. Approximation Algorithms for Min-Distance Problems in DAGs. In 48th International Colloquium on Automata, Languages, and Programming (ICALP 2021), volume 198 of Leibniz International Proceedings in Informatics (LIPIcs), pages 60:1–60:17, 2021. doi:10.4230/LIPIcs.ICALP.2021.60.
  • [20] Mina Dalirrooyfard, Ray Li, and Virginia Vassilevska Williams. Hardness of approximate diameter: Now for undirected graphs. J. ACM, 72(1), 2025. doi:10.1145/3704631.
  • [21] Mina Dalirrooyfard, Virginia Vassilevska Williams, Nikhil Vyas, and Nicole Wein. Tight approximation algorithms for bichromatic graph diameter and related problems. In Christel Baier, Ioannis Chatzigiannakis, Paola Flocchini, and Stefano Leonardi, editors, 46th International Colloquium on Automata, Languages, and Programming, ICALP 2019, July 9-12, 2019, Patras, Greece, volume 132 of LIPIcs, pages 47:1–47:15. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2019. doi:10.4230/LIPIcs.ICALP.2019.47.
  • [22] Mina Dalirrooyfard, Virginia Vassilevska Williams, Nikhil Vyas, Nicole Wein, Yinzhan Xu, and Yuancheng Yu. Approximation Algorithms for Min-Distance Problems. In 46th International Colloquium on Automata, Languages, and Programming (ICALP 2019), volume 132 of Leibniz International Proceedings in Informatics (LIPIcs), pages 46:1–46:14, 2019. doi:10.4230/LIPIcs.ICALP.2019.46.
  • [23] Mina Dalirrooyfard and Nicole Wein. Tight conditional lower bounds for approximating diameter in directed graphs. In Proceedings of the 53rd Annual ACM SIGACT Symposium on Theory of Computing, STOC 2021, pages 1697–1710, 2021. doi:10.1145/3406325.3451130.
  • [24] Mingyang Deng, Yael Kirkpatrick, Victor Rong, Virginia Vassilevska Williams, and Ziqian Zhong. New additive approximations for shortest paths and cycles. In 49th International Colloquium on Automata, Languages, and Programming (ICALP 2022), pages 50:1–50:10, 2022. doi:10.4230/LIPIcs.ICALP.2022.50.
  • [25] Dorit Dor, Shay Halperin, and Uri Zwick. All-pairs almost shortest paths. SIAM Journal on Computing, 29(5):1740–1759, 2000. doi:10.1137/S0097539797327908.
  • [26] Michal Dory, Sebastian Forster, Yael Kirkpatrick, Yasamin Nazari, Virginia Vassilevska Williams, and Tijn de Vos. Fast 2-approximate all-pairs shortest paths. In Proceedings of the 2024 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 4728–4757. SIAM, 2024. doi:10.1137/1.9781611977912.169.
  • [27] Anita Dürr. Improved bounds for rectangular monotone min-plus product and applications. Information Processing Letters, page 106358, 2023. doi:10.1016/J.IPL.2023.106358.
  • [28] Russell Impagliazzo and Ramamohan Paturi. On the complexity of k-sat. Journal of Computer and System Sciences, 62(2):367–375, 2001. doi:10.1006/jcss.2000.1727.
  • [29] Ce Jin and Yinzhan Xu. Removing additive structure in 3sum-based reductions. In Proceedings of the 55th Annual ACM Symposium on Theory of Computing, STOC 2023, Orlando, FL, USA, June 20-23, 2023, pages 405–418. ACM, 2023. doi:10.1145/3564246.3585157.
  • [30] Telikepalli Kavitha. Faster algorithms for all-pairs small stretch distances in weighted graphs. Algorithmica, 63(1-2):224–245, 2012. Announced at FSTTCS 2007. doi:10.1007/s00453-011-9529-y.
  • [31] Mathias Bæk Tejs Knudsen. Additive spanners and distance oracles in quadratic time, 2017. arXiv:1704.04473.
  • [32] Ray Li. Settling seth vs. approximate sparse directed unweighted diameter (up to (nu)nseth). In Proceedings of the 53rd Annual ACM SIGACT Symposium on Theory of Computing, STOC 2021, pages 1684–1696, New York, NY, USA, 2021. Association for Computing Machinery. doi:10.1145/3406325.3451045.
  • [33] Mihai Patrascu, Liam Roditty, and Mikkel Thorup. A new infinity of distance oracles for sparse graphs. In 2012 IEEE 53rd Annual Symposium on Foundations of Computer Science, pages 738–747. IEEE, 2012. doi:10.1109/FOCS.2012.44.
  • [34] Mihai Pǎtraşcu and Liam Roditty. Distance oracles beyond the thorup–zwick bound. SIAM Journal on Computing, 43(1):300–311, 2014. doi:10.1137/11084128X.
  • [35] Liam Roditty. New algorithms for all pairs approximate shortest paths. In Barna Saha and Rocco A. Servedio, editors, Proceedings of the 55th Annual ACM Symposium on Theory of Computing, STOC 2023, Orlando, FL, USA, June 20-23, 2023, pages 309–320. ACM, 2023. doi:10.1145/3564246.3585197.
  • [36] Liam Roditty, Mikkel Thorup, and Uri Zwick. Deterministic constructions of approximate distance oracles and spanners. In Automata, Languages and Programming, 32nd International Colloquium, ICALP 2005, Lisbon, Portugal, July 11-15, 2005, Proceedings, volume 3580 of Lecture Notes in Computer Science, pages 261–272. Springer, 2005. doi:10.1007/11523468_22.
  • [37] Liam Roditty and Virginia Vassilevska Williams. Fast approximation algorithms for the diameter and radius of sparse graphs. In Proceedings of the Forty-Fifth Annual ACM Symposium on Theory of Computing, STOC ’13, pages 515–524, New York, NY, USA, 2013. Association for Computing Machinery. doi:10.1145/2488608.2488673.
  • [38] Barna Saha and Christopher Ye. Faster approximate all pairs shortest paths. In Proceedings of the 2024 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 4758–4827. SIAM, 2024. doi:10.1137/1.9781611977912.170.
  • [39] Mikkel Thorup and Uri Zwick. Compact routing schemes. In Proceedings of the Thirteenth annual ACM symposium on Parallel algorithms and architectures, pages 1–10, 2001. doi:10.1145/378580.378581.
  • [40] Mikkel Thorup and Uri Zwick. Approximate distance oracles. J. ACM, 52(1):1–24, January 2005. doi:10.1145/1044731.1044732.
  • [41] R. Ryan Williams. Faster all-pairs shortest paths via circuit complexity. SIAM J. Comput., 47(5):1965–1985, 2018. doi:10.1137/15M1024524.
  • [42] Christian Wulff-Nilsen. Approximate distance oracles with improved query time. In Proceedings of the twenty-fourth annual ACM-SIAM symposium on Discrete algorithms, pages 539–549. SIAM, 2013. doi:10.1137/1.9781611973105.39.
  • [43] Uri Zwick. All pairs shortest paths using bridging sets and rectangular matrix multiplication. J. ACM, 49(3):289–317, 2002. doi:10.1145/567112.567114.