Abstract 1 Introduction 2 Preliminaries 3 Low Radius Clustering 4 Processing a Tree Decomposition 5 Handling Apices 6 Conclusion and Open Problems References

Going Beyond Surfaces in Diameter Approximation

Michał Włodarczyk ORCID University of Warsaw, Poland
Abstract

Calculating the diameter of an undirected graph requires quadratic running time under the Strong Exponential Time Hypothesis and this barrier works even against any approximation better than 3/2. For planar graphs with positive edge weights, there are known (1+ε)-approximation algorithms with running time 𝗉𝗈𝗅𝗒(1/ε,logn)n. However, these algorithms rely on shortest path separators and this technique falls short to yield efficient algorithms beyond graphs of bounded genus.

In this work we depart from embedding-based arguments and obtain diameter approximations relying on VC set systems and the local treewidth property. We present two orthogonal extensions of the planar case by giving (1+ε)-approximation algorithms with the following running times:

  • 𝒪h((1/ε)𝒪(h)nlog2n)-time algorithm for graphs excluding an apex graph of size h as a minor,

  • 𝒪d((1/ε)𝒪(d)nlog2n)-time algorithm for the class of d-apex graphs.

As a stepping stone, we obtain efficient (1+ε)-approximate distance oracles for graphs excluding an apex graph of size h as a minor. Our oracle has preprocessing time 𝒪h((1/ε)8nlognlogW) and query time 𝒪h((1/ε)2lognlogW), where W is the metric stretch. Such oracles have been so far only known for bounded genus graphs. All our algorithms are deterministic.

Keywords and phrases:
diameter, approximation, distance oracles, graph minors, treewidth
Copyright and License:
[Uncaptioned image] © Michał Włodarczyk; 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/2507.03447
Funding:
Supported by Polish National Science Centre SONATA-19 grant 2023/51/D/ST6/00155.
Editors:
Anne Benoit, Haim Kaplan, Sebastian Wild, and Grzegorz Herman

1 Introduction

The diameter of a graph G, denoted 𝖽𝗂𝖺𝗆(G), is the largest distance between a pair of its vertices in the shortest path metric. We assume that each edge is assigned some real positive weight, and the length of a path is the sum of its weights. The obvious way to calculate 𝖽𝗂𝖺𝗆(G) is to check the distances for all vertex pairs, but this inevitably requires quadratic time. This trivial approach is essentially optimal because already unweighted graphs of diameter 2 or 3 cannot be distinguished in time 𝒪(m1.99) under the Strong Exponential Time Hypothesis [49] (see [2] for hardness in sparse graphs). On the other hand, truly subquadratic algorithms to compute diameter are available in planar graphs [10, 34] and graph classes excluding a minor [26, 42, 46]. Still, the best algorithm for planar graphs runs in time111The variable n refers to the number of vertices in a graph but all the considered graph classes are sparse so the number of edges is 𝒪(n). The 𝒪~-notation hides factors polylogarithmic in n. We refer to the dependence 𝒪~(n) as almost-linear. 𝒪~(n5/3) [34], which is far from linear.

The absence of fast algorithms calculating the diameter exactly led the researchers to seek fast approximation algorithms. Weimann and Yuster [55] gave the first almost-linear (1+ε)-approximation for planar diameter, running in time 𝒪~(2𝒪(1/ε)n). This was improved to randomized time 𝒪~((1/ε)5n) by Chan and Skrepetos [12] (see also [18]). Li and Parter [47] gave a deterministic algorithm of this type, as well as a distributed algorithm with a small number of rounds. Observe that each of these can be used to recognize unweighted planar graphs of diameter D, simply by setting ε=1/(2D). There are also specialized algorithms for this task by Eppstein [28], with running time 2𝒪(DlogD)n, and by Abboud, Mozes, and Weimann [1], with running time 𝒪~(D2n).

Shortest path separators.

An area that is technique-wise related is the design of approximate distance oracles. After a preprocessing step, we would like to quickly estimate any (u,v)-distance within factor (1+ε). Thorup [53] exploited the fact that planar graphs admit balanced separators consisting of two shortest paths to give an oracle with preprocessing time 𝒪((1/ε)2nlog3n), space 𝒪((1/ε)nlogn), and query time 𝒪(1/ε). The shortest path separators constitute a crucial ingredient of all the three aforementioned algorithms for estimating planar diameter as well.

Abraham and Gavoille [3] presented a generalization of shortest path separators to graph classes excluding a minor and extended Thorup’s oracle to such classes. However, their separators no longer enjoy such a nice structure. The main caveat is that already in a single balanced separator one might need to use paths P1,P2 such that P2 is a shortest path only in GP1. Hence P2 may be much longer than 𝖽𝗂𝖺𝗆(G), which is easily seen to be unavoidable already in the class of apex graphs222G is called an apex graph if G can be made planar by removal of a single vertex., and it is unclear how to exploit such a separator for diameter computation. The second issue is that finding the separator requires highly superlinear time, which burdens the preprocessing time of the oracle. Almost-linear preprocessing time is currently available only for graphs of bounded genus [40] and for unit disk graphs [13]. The lack of well-structured balanced separators beyond surface-embeddable graphs seems to have limited the development of efficient metric-related algorithms so far.

Beyond surface embedding.

There are two directions of generalizing the topological graph classes. First, one can pick 𝒪(1) faces in the surface embedding of a graph and replace them with certain graphs of pathwidth 𝒪(1), which are called the vortices. Second, one can insert a set of 𝒪(1) vertices, called the apices, and connect them possibly to anyone. The structural theorem of Robertson and Seymour [48] states that for any graph H, all the graphs excluding H as a minor can be constructed from graphs embeddable in some fixed surface using these two operations and by taking a clique-sum of them.

When the excluded minor H is an apex graph, this description can be slightly restricted [25]. What is important to us, apex-minor-free graphs enjoy the local treewidth property: their treewidth is bounded in terms of the (unweighted) diameter and this relation is known to be linear [24]. Note that the diameter of an edge-weighted graph cannot be related to treewidth by any means because the diameter can be reduced by scaling the weights, while the topological structure of the graph remains the same. Nevertheless, we will see that the local treewidth property is still useful in the considered setting.

The main message of this work is that the local treewidth property can be used instead of shortest path separators for the sake of approximating diameter and radius, as well as for efficient construction of distance oracles. We first employ it to tackle apex-minor-free graphs but we also show that its usefulness is not limited to such graph classes.

Additive core-sets.

Suppose we have a list of vertices S=(s0,s1,,sk1) in G and we want to (approximately) learn all the distance patterns, between a vertex v and all of S. Chan and Skrepetos [12] employed Cabellos’s technique of abstract Voronoi diagrams [10] to build a data structure to browse such distance patterns in the case when G is planar and S lie on a single face. However, this technique relies heavily on the embedding of the graph.

A more versatile argument was given by Li and Parter [47] in order to approximate planar diameter in a distributed regime. Following their convention, a subset UU is called a δ-additive core-set of U if for every uU there exists uU such that for each i[0,k) we have |d(u,si)d(u,si)|δ. When δ=ε𝖽𝗂𝖺𝗆(G), a trivial rounding argument yields a δ-additive core-set of size (1/ε)k. Remarkably, the dependence on k can be in fact removed from the exponent [47]. This theorem relies on a bound on the VC dimension of a certain set system and this argument carries over to any minor-free graph class [46]. A direct consequence of these theorems reads as follows. (Here Kh stands for the h-vertex clique.)

Lemma 1 (Corollary of [46, Theorem 1.3]).

Let G be an edge-weighted Kh-minor-free graph G, S=(s0,,sk1)V(G)k, UV(G), and ε>0. Then U admits an (ε𝖽𝗂𝖺𝗆(G))-additive core-set (with respect to S) of size 𝒪(kh1(1/ε)h).

For the sake of completeness, we provide a proof in Section 2. The local treewidth property will allow us to apply this lemma for k=𝗉𝗈𝗅𝗒(1/ε) to efficiently compress information about distances in large subgraphs.

1.1 Our contribution

A crucial property of a separator S consisting of 𝒪(1) shortest paths is that S can be covered by 𝒪(1/ε) subgraphs of strong333A subgraph H of G has strong diameter D if every pair of vertices u,vV(H) can be connected by a path in H of length at most D. For comparison, weak diameter refers to distances measured in G. diameter ε𝖽𝗂𝖺𝗆(G). Then the interaction between the two sides of S can be channeled through 𝒪(1/ε) portals on S when small distance distortion is allowed. We show that balanced separators of this kind exist and can be efficiently found in any class excluding an apex minor. Specifically, we construct a clustering of an apex-minor-free graph into pieces of small strong diameter such that the graph obtained by contracting each cluster has bounded treewidth. We use this construction to estimate the eccentricity 𝖾𝖼𝖼G(v) of every vertex v, that is, maxuV(G)dG(v,u).

Theorem 2.

Let H be an apex graph of size h. There is an algorithm that, given an edge-weighted H-minor-free graph G and ε>0, runs in time 𝒪h((1/ε)3h+2nlog2n) and estimates eccentricity of each vertex vertex vV(G) within additive error ε𝖽𝗂𝖺𝗆(G). Moreover, for each vV(G) the algorithm outputs vertex v for which dG(v,v)𝖾𝖼𝖼G(v)ε𝖽𝗂𝖺𝗆(G).

As a corollary, we get (1+ε)-approximation for both diameter and radius, which are respectively the largest and the smallest eccentricity.

To employ the additive core-sets in the proof of Theorem 2, we first need to precompute approximate distances for 𝒪((1/ε)2nlogn) pairs of vertices. To this end, we design a distance oracle with preprocessing and query times tailored to our needs. Similar oracles are available for minor-free graphs [3, 16, 40] but their preprocessing times are far from linear. An oracle with additive error ε𝖽𝗂𝖺𝗆(G) suffices for the proof of Theorem 2 but we can improve it to multiplicative error by taking into account the metric stretch, i.e., the ratio between the largest and smallest positive distances.

Theorem 3.

Let H be an apex graph. Given an edge-weighted H-minor-free graph G of metric stretch W and ε>0, one can build an (1+ε)-approximate distance oracle with preprocessing time 𝒪H((1/ε)8nlognlogW) and query time 𝒪H((1/ε)2lognlogW).

The simplest case not covered by Theorem 2 is of course given by the class of apex graphs. This class no longer enjoys the local treewidth property. Moreover, some problems which are easy on planar graphs become much harder after insertion of a single apex [5, 11]. Note that removing just a single vertex can increase the diameter significantly and so our clustering technique cannot be directly applied to decompose such a graph.

We give a stronger theorem that in particular covers the apex graphs. As a consequence of Robertson and Seymour’s structural theorem, for every graph K there exists an apex graph H and a constant c, such that every K-minor-free graph can be constructed via a clique-sum from graphs G1,,G with the following property: each Gi becomes H-minor-free after deletion of c vertices [23, Theorem VI.1]. We extend Theorem 2 to such graphs, assuming that the deletion set is known.

Theorem 4.

Let h,c and be a graph class excluding an apex graph of size h. There is an algorithm that, given an edge-weighted graph G, ε>0, and a set AV(G) of size c, for which GA, runs in time 𝒪h+c((1/ε)αnlog2n), where α=𝒪((h+1)(c+1)), and estimates 𝖽𝗂𝖺𝗆(G) within factor (1+ε).

Unlike the apex-minor-free case, this time we do not estimate eccentricities because Theorem 4 involves a certain “irrelevant vertex rule” that only preserves the diameter (approximately). The assumption that the set A is given in the input can be dropped for the class of planar graphs, i.e., when the input is a d-apex graph. In this case, one can find the set A in time 2𝒪(dlogd)n [37], which leads to the following unconditional statement.

Corollary 5.

There is an 𝒪d((1/ε)𝒪(d)nlog2n)-time algorithm that estimates the diameter of an edge-weighted d-apex graph within factor (1+ε).

This result can be regarded as a generalization of the planar case in a direction that is orthogonal to Theorem 2. Unfortunately, when the class excludes an arbitrary apex graph H, we do not know whether one can drop the assumption about the set A being provided. Indeed, the fastest parameterized algorithm to find set A for which GA is H-minor-free (where H is some apex graph) requires quadratic time [50]. We discuss the perspective of handling more general graph classes in Section 6.

1.2 Related Work

Apart from the ones used in this work, there are more VC set systems considered in the context of minor-free graph metrics [7, 8, 21, 22, 26, 39]. Some other approaches to such metrics are based on a decomposition into low-diameter subgraphs, including the classic KPR theorem [41]. Our low-diameter clustering scheme bears resemblance to the shortcut partitions [14, 15, 16] which provide even stronger guarantees but it is not known how to construct them in almost-linear time. The related buffered cop decompositions [16] yield cluster graphs of bounded weak coloring numbers [6]. These in turn are connected to sparse covers [4, 9, 29], however there the low-diameter subgraphs need not to be disjoint.

An alternative way to represent a metric by a bounded treewidth graph is a metric embedding. For example, an edge-weighted planar graph G can be embedded into a metric given by a graph of treewidth f(ε) so that the additive distortion is ε𝖽𝗂𝖺𝗆(G) [32]. The function f can be estimated as f(ε)=𝒪(ε4) [14]. For apex-minor-free graphs, the current best treewidth bound is f(ε)=2𝒪(1/ε) [16]. In the latter case, we again do not know if such an embedding can be computed in almost-linear time. See also [23, 30] for metric embeddings of minor-free graphs and a variant with multiplicative distortion.

For more advances in diameter computation, see [13, 17, 27], and for recent developments in planar distance oracles, see [18, 19, 33, 35, 44].

1.3 Organization of the Paper

We begin with Section 2 including preliminaries on VC set systems and additive core-sets. The following three sections contain the main technical lemmas. Sections 3 and 4 culminate with the proof of Theorem 2 while Section 5 contains the crucial lemma for Theorem 4. The formal proofs of Theorems 3 and 4 can be found in the full version of the article. The full version also contains the proofs of the statements marked with ().

2 Preliminaries

All our statements concern undirected graphs with real positive edge weights. In an unweighted graph, each weight is set to one.

Definition 6 (Treewidth).

A tree decomposition of a graph G is a pair (T,χ) where T is a tree, and χ:V(T)2V(G) is a function, such that:

  1. 1.

    for each vV(G) the nodes {tvχ(t)} form a non-empty connected subtree of T,

  2. 2.

    for each edge uvE(G) there is a node tV(T) with {u,v}χ(t).

The width of (T,χ) is defined as maxtV(T)|χ(t)|1. The treewidth of a graph G (denoted 𝗍𝗐(G)) is the minimal width a tree decomposition of G.

VC dimension.

A set system is a collection of subsets of some set U. We say that a subset YA is shattered by if {YS:S}=2Y , that is, every subset of Y is an intersection of Y with some S. The VC dimension of a set system is the size of the largest shattered subset. The notion of VC dimension was introduced by Vapnik and Chervonenkis [54]. What is important to us, a set system of bounded VC dimension cannot be too large.

Lemma 7 (Sauer–Shelah Lemma [51]).

Let be a set system of VC dimension d over a set of size m. Then ||=𝒪(md).

2.1 Additive core-sets

For a vector 𝐱𝐤 its -norm is defined as (𝐱)=maxi=1k|xi|.

Definition 8 ([47]).

For a sequence of vertices S=(s0,,sk1) from G we define the distance tuple of v with respect to S as ΦS(v)=(dG(v,s0),,dG(v,sk1)).

For a vertex set V, a subset VV is called a δ-additive core-set with respect to S if for every vV there exists vV such that (ΦS(v)ΦS(v))δ.

We will take advantage of the bound on VC dimension of certain set systems related to a graph metric. Le and Wulff-Nilsen [46] considered a slight modification of the set systems introduced by Li and Parter [47], and so they denoted them by 𝒫^.

Definition 9 ([46]).

Let G be an edge-weighted graph, S be a k-tuple of vertices from G, and M. For vV(G) we define:

X^v={(i,Δ):i[1,k1],ΔM,dG(v,si)dG(v,s0)Δ}.

Let 𝒫^G,M(S)={X^v:vV(G)} be a collection of subsets of the ground set [k1]×M.

Theorem 10 ([46, Theorem 1.3]).

Let G be an edge-weighted Kh-minor free graph and S,M be as in Definition 9. Then 𝒫^G,M(S) has VC dimension at most h1.

We adapt the construction of additive core-sets from [47] to rely on the set system 𝒫^.

Lemma 1 (Corollary of [46, Theorem 1.3]). [Restated, see original statement.]

Let G be an edge-weighted Kh-minor-free graph G, S=(s0,,sk1)V(G)k, UV(G), and ε>0. Then U admits an (ε𝖽𝗂𝖺𝗆(G))-additive core-set (with respect to S) of size 𝒪(kh1(1/ε)h).

Proof.

Let D=𝖽𝗂𝖺𝗆(G), δ=εD/2, and z=2/ε. Next, we choose M={jδ:j[z,z]}. We will extend Definition 9 slightly. For vertices u,v we define d(u,v) as the largest integer j for which jδdG(u,v). Note that d(u,v) is always bounded by z. For a vertex v let X^v be the pair (d(v,s0),X^v). By Theorem 10 and Lemma 7, the family {X^v:vV(G)} has size 𝒪(((k1)|M|)h1)=𝒪((k/ε)h1). It follows that the family {X^v:vV(G)} has 𝒪(kh1εh) elements.

We construct U by picking for each X{X^v:vV(G)} an arbitrary vertex vU with X^v=X. Then |U|=𝒪(kh1εh). To show that U is an (εD)-additive core-set, pick uU. We need to prove that there exists uU such that (ΦS(u)ΦS(u))εD. By construction, there is uU for which X^u=X^u. Now we need to argue that for each i[0,k1] it holds that |dG(u,si)dG(u,si)|εD.

The simplest case is for i=0. As d(u,s0)=d(u,s0), there is an integer j such that both dG(u,s0),dG(u,s0) belong to the interval [jδ,(j+1)δ). Hence |dG(u,s0)dG(u,s0)|δ=εD/2.

Now consider i1. Let j be the largest integer (possibly negative) for which dG(u,si)dG(u,s0)jδ. We define j analogously with respect to u. Note that j,j[z,z]. Because X^u=X^u it must be j=j. By the same argument as before, the numbers x=dG(u,si)dG(u,s0), y=dG(u,si)dG(u,s0) differ by at most δ. Finally, since |dG(u,s0)dG(u,s0)|δ we obtain that |dG(u,si)dG(u,si)|2δ=εD.

In our setting we will only know approximations of the distances from S. We show that this suffices to construct an additive core-set.

Lemma 11.

Let G be an edge-weighted Kh-minor-free graph G, S=(s0,,sk1)V(G)k, and UV(G). Let δ be given and denote ε=δ/𝖽𝗂𝖺𝗆(G). Next, suppose that for each vU we are given 𝐲vk that satisfies (𝐲vΦS(v))δ. Then in time 𝒪((k/ε)h|U|) we can compute a (5δ)-additive core-set of U of size 𝒪(kh1εh).

Proof.

We first describe the algorithm, which is a simple greedy construction of a 3δ-cover in a metric space. Initialize U^= and iterate over vU in any fixed order. When processing v, check if U^ contains u for which (𝐲v𝐲u)3δ. If there is no such element, add v to U^.

First we show that every vector in {𝐲v:vU} is within distance 3δ in the metric from the set {𝐲v:vU^}. Suppose otherwise and let vU be a vertex whose vector 𝐲v is further than 3δ from this set. In particular, this means that (𝐲v𝐲u)>3δ for each u considered before v. So v must have been added to U^ at this point; a contradiction.

Now we argue that U^ is a (5δ)-additive core-set. For each uU we know that there exists vU^ such that (𝐲v𝐲u)3δ. Next, by assumption (𝐲uΦS(u))δ and likewise for v. Then by the triangle inequality we get (ΦS(v)ΦS(u))5δ, as intended.

Next, we bound the size U^. By construction, for each u,vU^ we have (𝐲v𝐲u)>3δ. We apply the triangle inequality again to get (ΦS(v)ΦS(u))>δ. By applying Lemma 1 for ε=ε/2 we obtain UU so that the (δ/2)-radius balls (in the metric) centered at {ΦS(v):vU} cover the set {ΦS(v):vU}. Each such ball has diameter δ so it can contain at most one element from the set {ΦS(v):vU^}. This implies |U^||U| and so the size bound follows from Lemma 1.

Finally, we analyze the running time. When inspecting a vertex uU we need to compute distances in k between 𝐱u and the vectors of all the vertices already placed in the core-set. This requires at most k|U^| operations and so the running time bound follows from the bound on |U^|.

3 Low Radius Clustering

We begin with summoning the local treewidth property of apex-minor-free graphs.

Lemma 12 ([24]).

For every apex graph H, there exists a constant c such that for every unweighted H-minor-free graph G it holds that 𝗍𝗐(G)c𝖽𝗂𝖺𝗆(G).

Our first tool is a clustering of a graph into induced subgraphs of small strong diameter.

Definition 13.

For an edge-weighted graph G, we define a δ-radius clustering of G as a collection of pairs (Ci,ci)i=1 with the following properties.

  1. 1.

    (Ci)i=1 forms a partition of V(G).

  2. 2.

    For each i[] it holds that G[Ci] is connected, ciCi, and each vCi is within distance δ from ci in G[Ci].

For 𝒞=(Ci,ci)i=1 we denote by G𝒞 the cluster graph obtained from G by contracting each Ci into a single vertex. The vertex ci is called the center of the i-th cluster.

Note that each cluster in a δ-radius clustering has strong diameter at most 2δ. As our first goal, we aim to construct a δ-radius clustering, for δ=ε𝖽𝗂𝖺𝗆(G), whose cluster graph has treewidth 𝒪(1/ε). Secondly, even when δ is chosen to be much smaller 𝖽𝗂𝖺𝗆(G) we would like to put vertices u,v, satisfying dG(u,v)=𝒪(δ), into “nearby” clusters.

For a graph G, a layering is simply a function 𝗅𝖺𝗒𝖾𝗋:V(G). When such a function is clear from the context, for I we denote by GI the subgraph of G induced by the vertices v with 𝗅𝖺𝗒𝖾𝗋(v)I. Given a clustering 𝒞 of G and a layering of G𝒞, we naturally extend it to a layering of G.

Figure 1: Construction of the clustering in Lemma 14. Left: The black edges form a shortest-path tree T rooted at r. The alternating background colors represented the layers. Each connected subgraph of T contained within a single layer forms a cluster. Right: An argument that G𝒞I has bounded treewidth for I={2,3,4}. For simplicity, the edges not originating from T are omitted. After contracting the layers 0 and 1 into a single vertex, we obtain a graph of (unweighted) diameter at most 6. Since this graph is apex-minor-free, we can use the local treewidth property.
Lemma 14 ().

Let H be an apex graph. Given a connected edge-weighted n-vertex H-minor-free graph G and δ>0, we can in time 𝒪(nlogn) find a δ-radius clustering 𝒞 of G and a layering function 𝗅𝖺𝗒𝖾𝗋:V(G𝒞) such that the following hold.

  1. 1.

    For an interval I of size p, the graph G𝒞I has treewidth 𝒪H(p).

  2. 2.

    The treewidth of G𝒞 is bounded by 𝒪H(𝖽𝗂𝖺𝗆(G)/δ).

  3. 3.

    For each u,vV(G) and p satisfying dG(u,v)δp, it holds that |𝗅𝖺𝗒𝖾𝗋(u)𝗅𝖺𝗒𝖾𝗋(v)|p. In this case, there is an interval I depending only on (𝗅𝖺𝗒𝖾𝗋(u),𝗅𝖺𝗒𝖾𝗋(v),p), such that |I|2p+1 and the (u,v)-distance is the same in G and GI.

The proof constructs the layering by analyzing a shortest-path tree T rooted at an arbitrary vertex r. Then the j-th layer corresponds to vertices whose distance from r belongs to [jδ,jδ+δ). The clustering 𝒞 is obtained by contracting all the edges in T connecting vertices sharing the same layer.

Clearly, each root-to-leaf path in T traverses at most 𝖽𝗂𝖺𝗆(G)/δ layers, which bounds the (unweighted) diameter of G𝒞. Since G𝒞 is a contraction of G, it is H-minor-free as well and we can take advantage of the local treewidth property. A similar argument yields Item 1 while Item 3 follows from the triangle inequality.

Lemma 12 only guarantees that 𝗍𝗐(G𝒞) can be bounded in terms of ε, without providing an efficient way to construct a tree decomposition. Moreover, the known algorithms for computing optimal (or 𝒪(1)-approximate) tree decomposition require time exponential in treewidth, whereas we aim at polynomial dependence on ε. Luckily, there is one algorithm available that suits our needs, with a bit worse width guarantee.

While several algorithms rely on dynamic programming over a tree decomposition to compute the diameter exactly [2, 28, 36], we cannot afford such an strategy due to prohibitive error accumulation. Instead, we will turn the decomposition into a balanced one, again by increasing its width slightly, and use it to build our data structures.

Lemma 15.

There is an algorithm that, given a graph G of treewidth at most k, runs in time 𝒪(k7nlogn) and outputs a binary rooted tree decomposition of G of width 𝒪(k2), depth 𝒪(logn), and size 𝒪(n).

Proof.

First, in time 𝒪(k7nlogn) one can compute a tree decomposition (T,χ) of G of width k=𝒪(k2) [31]. By a standard argument, we can modify (T,χ) to have size 𝒪(n). Next, we turn (T,χ) into a binary rooted tree decomposition of depth 𝒪(logn) and width at most 4k+3 in time 𝒪(n) [20]. This also preserves the bound |V(T)|=𝒪(n).

4 Processing a Tree Decomposition

We will need an argument to reroute paths to go through a center ci of some cluster Ci.

Lemma 16.

Let G be an edge-weighted graph, u,v,wV(G), and let C be a vertex set contained in the δ-radius ball around w. Suppose there is a shortest (u,v)-path P in G that intersects C. Then dG(u,w)+dG(w,v)dG(u,v)+2δ.

Proof.

Orient the path P from u to v and define u,v as the first and the last vertices from C appearing on P. Since u,v lie on a shortest (u,v)-path, we have dG(u,u)+dG(v,v)dG(u,v). Next, it holds that each of dG(w,u), dG(w,v) is at most δ. Hence dG(u,w)dG(u,u)+δ and dG(w,v)dG(v,v)+δ, which yields the desired inequality.

We will now show how, using a tree decomposition of the cluster graph of width 𝒪((1/ε)2), to construct a distance oracle and estimate eccentricities. We give a unified proof for both statements because the constructed oracle is directly applied to obtain the second result. The presented algorithm is arguably simpler than the recursive schemes based on shortest path separators since in the analysis we only need to manage 𝒪(1) rounding errors, rather than 𝒪(logn). We no longer need to assume that the excluded minor is an apex graph and this will allow us later to apply Theorem 17 in a more general setting.

Theorem 17.

Suppose we are given an edge-weighted n-vertex Kh-minor-free graph G, δ>0, a δ-radius clustering 𝒞 of G, and a binary rooted tree decomposition (T,χ) of G𝒞 of width w, depth 𝒪(logn), and size 𝒪(n).

  1. 1.

    In time 𝒪h(wnlogn) we can build a data structure that, when queried for u,vV(G), outputs x[dG(u,v),dG(u,v)+2δ] in time 𝒪(wlogn).

  2. 2.

    Assume additionally that G is connected and let τ=𝖽𝗂𝖺𝗆(G)/δ. In time 𝒪h(wh+1τhnlog2n) we can compute eccentricity of each vertex vV(G) within additive error 16δ. Moreover, within the same time we can also output a vertex uV(G) for which dG(v,u)𝖾𝖼𝖼G(v)16δ.

Let us clarify that the parameter τ does not have to be given and it only appears in the analysis. However, we can always assume that the diameter is known within factor 2 after computing any eccentricity.

Proof.

We begin with some notation that will be used throughout the proof. We will use variables u,v to denote vertices of G and variables i,j to index the set of clusters. For a cluster i𝒞, let 𝗅𝗈𝖼(i) denote the node tV(T) that is closest to the root among those satisfying iχ(t). We naturally extend this notation to vertices of G: all vertices vCi receive 𝗅𝗈𝖼(v)=𝗅𝗈𝖼(i). This mapping can be computed for all clusters and vertices in linear time by scanning T top-down.

For tV(T) let Ut𝒞 denote the set of clusters i𝒞 for which 𝗅𝗈𝖼(i) lies in the subtree of T rooted at t, inclusively. Next, let Vt=iUtCi.

Claim 18.

It holds that tV(T)|Vt|=𝒪(nlogn), and all the sets Vt can be computed in total time 𝒪(nlogn).

Proof.

For each i𝒞 the nodes t satisfying iUt must be lie on the 𝗅𝗈𝖼(i)-to-root path in T and so there are 𝒪(logn) of them. Hence each i𝒞 contributes 𝒪(|Ci|logn) to the sum tV(T)|Vt|, which yields the upper bound as 𝒞 is a partition of |V(G)|. This argument leads directly to an algorithm computing the sets Vt.

Distance oracle.

Consider tV(T), i𝒞, and vV(G). We call (t,i,v) a valid triple when t=𝗅𝗈𝖼(i) and vVt. For fixed tV(T), the number of valid triples in which t appears is at most (w+1)|Vt|, and so by Claim 18 the number of valid triples is 𝒪(wnlogn).

Recall that for i𝒞 the vertex ciCi is the center of cluster i. We will populate table 𝗂𝗇𝗇𝖾𝗋-𝖽𝗂𝗌𝗍 indexed by valid triples, so that 𝗂𝗇𝗇𝖾𝗋-𝖽𝗂𝗌𝗍[t,i,v] will store the exact (v,ci)-distance within the graph G[Vt]. If there is no such path, we set 𝗂𝗇𝗇𝖾𝗋-𝖽𝗂𝗌𝗍[t,i,v]=.

Claim 19.

We can compute 𝗂𝗇𝗇𝖾𝗋-𝖽𝗂𝗌𝗍[t,i,v] for all valid triples in total time 𝒪h(wnlogn).

Proof.

Consider tV(T). For each i𝒞 with log(i)=t, we compute all distances from ci in G[Vt] using the linear single-source shortest path algorithm for Kh-minor-free graphs [52]. The total running time, over all tV(T), is proportional to the number of valid triples.

We now argue that information gathered in table 𝗂𝗇𝗇𝖾𝗋-𝖽𝗂𝗌𝗍 is sufficient to retrieve all distances in G, up to small additive error. This is the only place where we rely on the fact that each cluster has small strong diameter.

Figure 2: Illustration to Claim 20. By inspecting the nodes tV(T) that are ancestral to both 𝗅𝗈𝖼(u),𝗅𝗈𝖼(v), we obtain a family of subgraphs H1H2H3H4H5=G, induced by the sets Vt. Here, H4 is the smallest among them that accommodates the shortest (u,v)-path Q. This path must intersect some cluster Ci for which 𝗅𝗈𝖼(i)=t, where G[Vt]=H4, as otherwise it would be contained in H3. Hence the (u,v)-distance in H4 is the same as in G and we can stretch Q within H4 to go through ci using Lemma 16.
Claim 20.

For each u,vV(G) there exist tV(T) and i𝒞 such that:

  1. 1.

    (t,i,u) and (t,i,v) are valid triples,

  2. 2.

    𝗂𝗇𝗇𝖾𝗋-𝖽𝗂𝗌𝗍[t,i,u]+𝗂𝗇𝗇𝖾𝗋-𝖽𝗂𝗌𝗍[t,i,v]dG(u,v)+2δ.

Proof.

Let Q be a shortest (u,v)-path in G. Next, let 𝒞Q𝒞 denote the set of clusters intersected by Q and let TQV(T) be the set of nodes in which 𝒞Q appear, i.e., TQ=χ1(𝒞Q). Since G𝒞 is a contraction of G, the subgraph G𝒞[𝒞Q] is connected. Consequently, TQ induces a connected subtree of T. Let tTQ be the node that is closest to the root among TQ. Note that t=𝗅𝗈𝖼(i) for some i𝒞Q.

We claim that the pair (t,i) satisfies the requested conditions. Note that for each j𝒞Q the node 𝗅𝗈𝖼(j) lies in the subtree of T rooted at t. Hence 𝒞QUt and so V(Q)Vt. In particular, we obtain that u,vVt so (t,i,u), (t,i,v) are valid triples (Item 1).

Since Q is a shortest (u,v)-path and V(Q)Vt, we infer that the (u,v)-distance in G[Vt] equals their distance in G. Now we apply Lemma 16 to the graph H=G[Vt] and C=Ci,w=ci. Because i𝒞Q, we know that Q intersects Ci. It is crucial that all Ci-vertices are within distance δ from ci when considering distances within G[Ci] (Definition 13(2)), not just in G. As CiVt, this property carries over to the graph H. Lemma 16 implies that dH(u,ci)+dH(ci,v)dH(u,v)+2δ. We have 𝗂𝗇𝗇𝖾𝗋-𝖽𝗂𝗌𝗍(t,i,u)=dH(u,ci), 𝗂𝗇𝗇𝖾𝗋-𝖽𝗂𝗌𝗍(t,i,v)=dH(ci,v), and dH(u,v)=dG(u,v), which yields Item 2.

Claim 21 (Oracle).

Let u,vV(G) be given. Using the table 𝗂𝗇𝗇𝖾𝗋-𝖽𝗂𝗌𝗍 we can output x[dG(u,v),dG(u,v)+2δ] in time 𝒪(wlogn).

Proof.

We iterate over all pairs tV(T),i𝒞 for which (t,i,u) and (t,i,v) are valid triples. There are only 𝒪(logn) candidates for t just because (t,i,u) is a valid triple and so t must lie on the 𝗅𝗈𝖼(u)-to-root path. For each such t there are clearly at most w+1 candidates for i.

We return x equal to the minimum value of 𝗂𝗇𝗇𝖾𝗋-𝖽𝗂𝗌𝗍[t,i,u]+𝗂𝗇𝗇𝖾𝗋-𝖽𝗂𝗌𝗍[t,i,v] taken over all such pairs (t,i). For each (t,i) the considered sum is either or it equals the length of some (u,v)-walk in G[Vt]. This implies that xdG(u,v). The inequality xdG(u,v)+2δ follows from Claim 20.

Claims 19 and 21 yield the additive distance oracle (Item 1). Now we move on to a proof sketch of Item 2, whose complete proof can be found in the full version of the paper.

Figure 3: Illustration to Claim 23. The blue area corresponds to the union of clusters Ci over iχ(t). For any vVt1, uVt2 the shortest (v,u)-path (red) must traverse some Ci so by Lemma 16 there is a slightly longer path that goes through ci (purple). The hollow discs represent the additive core-set of Vt2 with respect to the centers from χ(t). This core-set contains a vertex u which is comparable to u with respect to distances from {ci:iχ(t)} (e.g., the orange path). Hence u can simulate u for the task of estimating the eccentricity of v.

Eccentricities.

For a non-root tV(T) we refer to its parent in T as 𝗉𝖺𝗋𝖾𝗇𝗍(t). For u,vV(G) let 𝖺𝗉𝗑-𝖽𝗂𝗌𝗍(u,v) denote the value returned by the oracle from Claim 21 when queried for the pair u,v. This is a well-defined function because the oracle is deterministic. Recall the concept of an additive core-set from Lemma 1 and that τ=𝖽𝗂𝖺𝗆(G)/δ.

Claim 22 ().

In total time 𝒪((wτ)hn+w2nlog2n) we can compute for each non-root tV(T) a subset VtVt of size 𝒪(wh1τh) that is a (10δ)-additive core-set of Vt with respect to χ(𝗉𝖺𝗋𝖾𝗇𝗍(t)).

The total number of distances we care about is (w+1)tV(T)|Vt|=𝒪(wnlogn). Each of them can be estimated using the oracle in time 𝒪(wlogn). We would like to use those numbers to compute the additive core-sets, however a priori the bound from Lemma 1 might not hold for approximate distances. Nevertheless, we prove that a greedy procedure still constructs a small core-set, even after perturbation of distances. A similar issue is handled in [47] via randomization but we can afford a simpler argument because our strategy allows us to first query the oracle for all the distances between Vt and χ(𝗉𝖺𝗋𝖾𝗇𝗍(t)).

In the next claim, we argue that the core-sets suffice to estimate the maximal distance between v and u, where v is fixed and u is quantified over all vertices from some subtree. There are three sources of accuracy loss: relying on the additive core-set, on the approximate distance oracle, and stretching the paths along a center from χ(t) (Lemma 16).

Claim 23 ().

Consider tV(T) with children t1,t2. Let vVt1 and VVt2 be a ρ-additive core-set with respect to χ(t). Let y=maxdG(v,u) over all uVt2, and x be defined as follows:

x=maxuVminiχ(t)(𝖺𝗉𝗑-𝖽𝗂𝗌𝗍(v,ci)+𝖺𝗉𝗑-𝖽𝗂𝗌𝗍(ci,u)).

Then |xy|ρ+6δ. Furthermore, the vertex uV realizing x satisfies dG(v,u)yρ6δ.

We now use the additive core-sets to estimate the eccentricity of a vertex. Essentially, we apply Claim 23 for each choice of the lowest common ancestor of v,u; hence 𝒪(logn) times.

Claim 24 ().

For a given vertex vV(G) we can compute its eccentricity within additive error 16δ in time 𝒪(wh+1τhlog2n). Within the same time, we can output a vertex u for which dG(v,u)𝖾𝖼𝖼G(v)16δ.

Theorem 17(2) follows by applying Claim 24 to each vertex.

Theorem 2. [Restated, see original statement.]

Let H be an apex graph of size h. There is an algorithm that, given an edge-weighted H-minor-free graph G and ε>0, runs in time 𝒪h((1/ε)3h+2nlog2n) and estimates eccentricity of each vertex vertex vV(G) within additive error ε𝖽𝗂𝖺𝗆(G). Moreover, for each vV(G) the algorithm outputs vertex v for which dG(v,v)𝖾𝖼𝖼G(v)ε𝖽𝗂𝖺𝗆(G).

Proof.

One can assume that G is connected as otherwise the diameter is . We compute the eccentricity D of an arbitrary vertex v: this can be done in linear time [52]. The diameter of G must be contained in [D, 2D]. We apply Lemma 14 for δ=εD/16 in time 𝒪(nlogn); let 𝒞 denote the obtained δ-radius clustering. Next, let τ=𝖽𝗂𝖺𝗆(G)/δ; note that τ=𝒪(1/ε). By Lemma 14(2) we know that 𝗍𝗐(G𝒞)=𝒪h(1/ε). We use Lemma 15 to build a binary tree decomposition of 𝗍𝗐(G𝒞) of width w=𝒪h(ε2), depth 𝒪(logn) and size 𝒪(n); this takes time 𝒪h(ε7nlogn). Now we can take advantage of Theorem 17(2) to compute the eccentricities of all vertices within additive error 16δε𝖽𝗂𝖺𝗆(G), together with vertices that realize these distance approximately. This takes time 𝒪h(wh+1τhnlog2n)=𝒪h((1/ε)3h+2nlog2n). Finally, observe that h is greater than 1 in any non-trivial instance so 7<3h+2 and so the time needed to compute the tree decomposition is negligible.

In the full version of the article we show how to replace additive error in the distance oracle with multiplicative one, which yields Theorem 3.

5 Handling Apices

We move on to the proof of Theorem 4, extending the diameter approximation to graphs G with an apex set A, for which GA is apex-minor-free. We do not formulate an analogous theorem generalizing the distance oracle because it is trivial. To see this, first precompute all the distances from each wA and then, given u,v, return the minimum of their distance in GA and minwAd(u,w)+d(w,v). The first scenario can be readily handled with the same data structure as in Theorem 3.

The reason why we cannot apply the same reduction for diameter computation is that 𝖽𝗂𝖺𝗆(GA) might be huge compared to 𝖽𝗂𝖺𝗆(G). Hence we lose the relation between the diameter and radii of clusters (governing the additive error), crucial to bound the treewidth of the cluster graph. As a remedy, we will first preprocess the graph GA to chop it into connected components of bounded diameter.

Lemma 25.

Let H be a fixed graph and c. Let G be a connected edge-weighted n-vertex connected graph, AV(G) be such that GA is H-minor-free and |A|=c, and D satisfy 2D𝖽𝗂𝖺𝗆(G). There is an algorithm that, given the above and ε>0, runs in time 𝒪H,c((1/ε)cn) and either correctly reports that 𝖽𝗂𝖺𝗆(G)>D or outputs a connected edge-weighted n-vertex graph G and AV(G) of size c, with the following guarantees.

  1. 1.

    GA is H-minor-free.

  2. 2.

    𝖽𝗂𝖺𝗆(G)𝖽𝗂𝖺𝗆(G).

  3. 3.

    If 𝖽𝗂𝖺𝗆(G)D then 𝖽𝗂𝖺𝗆(G)(1+ε)D.

  4. 4.

    Each connected component of GA has strong diameter at most 8(2/ε)cD.

Proof.

First of all, we remove all edges with weight larger then 2D as they cannot contribute to any shortest path. Observe that G is Kh-minor-free for h=|V(H)|+c. We compute shortest paths from each vertex wA using the linear SSSP algorithm for minor-free graphs [52]. If any computed distance is greater than D, we can terminate the algorithm. Otherwise for each wA, vV(G), we insert the wv-edge with weight dG(w,v) or update the weight if the edge is already present. This preserves all the pairwise distances in G and does not affect the graph GA. We will keep the variable G to refer to the modified graph. The performed modification ensures the following property.

Claim 26.

Let u,vV(G) and suppose that there is a shortest (u,v)-path in G that intersects A. Then there is a shortest (u,v)-path with one internal vertex that belongs to A.

For u,vV(G) let d(u,v) denote the largest integer j for which jεD/2dG(u,v). For vV(G)A we define its signature as Sv=(d(v,a1),,d(v,ac)) where (a1,,ac) is some fixed ordering of A. Let 𝒮={Sv:vV(G)A}. Since we have not terminated the algorithm in the first step, each d(v,ai) is most 2/ε and so |𝒮|(2/ε)c.

We say that a pair S1,S2𝒮 is relevant if for each i[c] we have S1[i]+S2[i]>2/ε. We also call S𝒮 relevant if it appears in at least one relevant pair.

Claim 27.

Let u,vV(G)A be such that (Su,Sv) is a relevant pair. Then there is no (u,v)-path of length D that goes through A.

Proof.

If there was such a path then dG(u,w)+dG(w,v)D for some wA. But for each wA we have dG(u,w)+dG(w,v)(εD/2)(d(u,w)+d(w,v))>D.

Claim 28.

Let u,vV(G)A be such that Su=Sv and Su is relevant. If dGA(u,v)>2D then 𝖽𝗂𝖺𝗆(G)>D.

Proof.

Suppose that 𝖽𝗂𝖺𝗆(G)D. Since Su is relevant, there exists zV(G)A such that (Su,Sz) is a relevant pair. Due to Claim 27, the shortest (u,z)-path avoids A so dGA(u,z)D. By the same argument dGA(v,z)D and the claim follows from the triangle inequality.

For each relevant S𝒮 let us choose an arbitrary v with Sv=S; we denote the set of chosen vertices as B. Clearly |B||𝒮|(2/ε)c. For each bB we compute all the distances from b in GA in linear time and check whether there is any vV(G)A with Sv=Sb and dGA(b,v)>2D. If so, then by Claim 28 we can again terminate the algorithm.

Figure 4: Illustration to Claim 29. The set B of representatives for relevant signatures is given by the squares. By Claim 28, every vertex sharing the same signature as bB (represented by the same color) must lie in the 2D-radius ball around b in GA. If z is outside all 3D-radius balls, then every path in GA of length D traversing z must connect vertices u,v for which (Su,Sv) is an irrelevant pair. For such pairs, there must be an almost shortest path traversing A.
Claim 29.

Suppose that the algorithm has not been terminated and let ZV(G)A be the set of vertices z satisfying dGA(z,b)>3D for all bB. Next, let FE(GA) be the set of edges from GA with at least one endpoint in Z. Suppose that 𝖽𝗂𝖺𝗆(G)D. Then 𝖽𝗂𝖺𝗆(GF)(1+ε)D.

Proof.

Consider u,vV(G) and let P be a shortest (u,v)-path in G. By assumption, P is not longer than D. We need to show that there is a (u,v)-path of length (1+ε)D that avoids F. If P intersects A then by Claim 26 we can assume that P consists only of edges incident to A (at most two). Then clearly P avoids F.

Suppose now that V(P)A= and that P uses some edge from F. Then there is zV(P)Z whose distance in GA to each of u,v is at most D. We claim that Su,Sv are irrelevant. Assume w.l.o.g. that Su is relevant and let bB be the chosen vertex with Su=Sb. We have dGA(u,b)2D as otherwise we would have terminated the algorithm due to Claim 28. But dGA(u,z)D so dGA(z,b)3D. This contradicts the property used to define Z.

We established that Su,Sv are irrelevant, so the pair (Su,Sv) is also irrelevant. By definition, this means that there is wA such that d(u,w)+d(w,v)2/ε. We have dG(u,w)(εD/2)(d(u,w)+1) and likewise for the pair (v,w). We estimate

dG(u,w)+dG(w,v)(εD/2)(d(u,w)+d(w,v)+2)D+(εD/2)2=(1+ε)D.

Hence the path (u,w,v) is sufficiently short and it avoids F. The claim follows.

We showed that removing all edges from F is safe for approximating the diameter of G. It remains to prove that this operation splits GA into pieces of bounded strong diameter.

Claim 30.

Let CV(G)A be a set of vertices inducing a connected component of (GA)F. Then 𝖽𝗂𝖺𝗆(G[C])8(2/ε)cD.

Proof.

For bB let Cb be the set of vertices within distance 3D from b in GA. Observe that C is either a single vertex from Z or a union of Cb for bB for some BB. In the first case the diameter is 0 so let us focus on the second case.

Let u,vC and P be a shortest (u,v)-path in G[C]. Then uCb1 for some b1B. Let v1 be the farthest vertex on P (counting from u) that belongs to Cb1. The (u,v1)-distance in G[C] is at most their distance in G[Cb1] so dP(u,v1)6D as P is a shortest path. Next, take u2 to be the next vertex on P after v1 and pick b2B satisfying u2Cb2. Analogously as before, we find the vertex v2Cb2 that is farthest on P and continue this process. By construction, every vertex bB appears at most once as bi so this splits P into at most |B| subpaths of length 6D. Also for each i the edge between vi and ui+1 has weight at most 2D because we have removed all the heavier edges at the very beginning. The claim follows from |B||B|(2/ε)c.

We check that G=GF and A=A satisfy all the points of the lemma. First, GA is a subgraph of GA so it remains H-minor-free. Next, removing edges can only increase the diameter so 𝖽𝗂𝖺𝗆(G)𝖽𝗂𝖺𝗆(G) while the second inequality follows from Claim 29. The diameter bound for components of GA has been given in Claim 30. Finally, the sets Z and F can be identified in time 𝒪H(|B|n)=𝒪H,c((1/ε)cn).

We briefly explain how Lemma 25 leads to Theorem 4. Given D[𝖽𝗂𝖺𝗆(G), 2𝖽𝗂𝖺𝗆(G)] we want to learn that 𝖽𝗂𝖺𝗆(G)>D or that 𝖽𝗂𝖺𝗆(G)(1+ε)D. Let (G,A) be the output given by Lemma 25 and δ=Θ(εD). Each connected component Gi of GA satisfies 𝖽𝗂𝖺𝗆(Gi)=𝒪((1/ε)cD). We apply Lemma 14 to get a δ-radius clustering 𝒞i of Gi so that the treewidth of the cluster graph G𝒞ii is 𝒪(𝖽𝗂𝖺𝗆(Gi)/δ)=𝒪((1/ε)c+1). We combine those to get a δ-radius clustering 𝒞 of G by assigning each wA a singleton cluster.

Using Lemma 15 we can compute a balanced tree decomposition of G𝒞 of width w=𝒪((1/ε)2(c+1)). It can be now processed with Theorem 17(2): in time 𝒪(wh+1(1/ε)hnlog2n) we can estimate 𝖽𝗂𝖺𝗆(G) within additive error 16δ=Θ(εD). If this value is too large, we learn that 𝖽𝗂𝖺𝗆(G)>(1+ε)D, implying 𝖽𝗂𝖺𝗆(G)>D. Otherwise we infer that 𝖽𝗂𝖺𝗆(G)𝖽𝗂𝖺𝗆(G)(1+ε)D. Repeating this procedure for different D allows us to estimate 𝖽𝗂𝖺𝗆(G) within multiplicative error (1+ε). The details can be found in the full version of the article.

6 Conclusion and Open Problems

We have presented almost-linear algorithms approximating diameter that bypass topological arguments and work way beyond surface-embeddable graphs. A natural next step would be to generalize these results further, to all graph classes excluding a minor. The reason why we could not extend Corollary 5 to all cases covered in Theorem 4 is that we need to know the deletion set to the apex-minor-free class. The best known algorithm finding such a set requires quadratic time [50]. To apply the same strategy for the general case of H-minor-free graphs, one would need to compute some form of the Robertson and Seymour’s decomposition, which seems an even harder task. However, recent advances in minor testing [43] suggest that this may be possible in time 𝒪H(n1+o(1)) (see the section “Outlook” there). We have not attempted to generalize Theorem 4 to work on such decompositions because (1) this would require a tedious analysis of a balanced tree decomposition of the clique-sum decomposition, and (2) this strategy currently seems hopeless to achieve running time 𝒪H(𝗉𝗈𝗅𝗒(1/ε,logn)n). Is there an alternative approach that would work without the decomposition at hand?

Another question is whether one can improve the dependence on n to 𝒪(nlogn) or even 𝒪(n)? The current running time bound follows from the fact that we need to precompute Ω(nlogn) distances and each oracle call requires time Ω(logn). Can this be improved? For example, for planar metrics there exist distance oracles with constant query time (for constant ε) albeit with preprocessing time Ω(nlog3n) [12, 45].

When it comes to the dependence on ε, our running time is burdened by the fact that for k-treewidth graphs we compute a tree decomposition of width 𝒪(k2). Unfortunately, all the known almost-linear 𝒪(1)-approximation algorithms for treewidth require time exponential in k. Since we rely on a construction from [31] that works for general graphs, it is tempting to improve the width guarantee therein when the input graph is H-minor-free. Again, this is doable in planar graphs [38].

References

  • [1] Amir Abboud, Shay Mozes, and Oren Weimann. What Else Can Voronoi Diagrams Do for Diameter in Planar Graphs? In Inge Li Gørtz, Martin Farach-Colton, Simon J. Puglisi, and Grzegorz Herman, editors, 31st Annual European Symposium on Algorithms (ESA 2023), volume 274 of Leibniz International Proceedings in Informatics (LIPIcs), pages 4:1–4:20, Dagstuhl, Germany, 2023. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.ESA.2023.4.
  • [2] Amir Abboud, Virginia Vassilevska Williams, and Joshua R. Wang. Approximation and fixed parameter subquadratic algorithms for radius and diameter in sparse graphs. In Robert Krauthgamer, editor, Proceedings of the Twenty-Seventh Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2016, Arlington, VA, USA, January 10-12, 2016, pages 377–391. SIAM, 2016. doi:10.1137/1.9781611974331.CH28.
  • [3] Ittai Abraham and Cyril Gavoille. Object location using path separators. In Proceedings of the twenty-fifth annual ACM symposium on Principles of distributed computing, pages 188–197, 2006. doi:10.1145/1146381.1146411.
  • [4] Ittai Abraham, Cyril Gavoille, Dahlia Malkhi, and Udi Wieder. Strong-diameter decompositions of minor free graphs. In Proceedings of the nineteenth annual ACM symposium on Parallel algorithms and architectures, pages 16–24, 2007. doi:10.1145/1248377.1248381.
  • [5] Francisco Barahona. The max-cut problem on graphs not contractible to K5. Operations Research Letters, 2(3):107–111, 1983. doi:10.1016/0167-6377(83)90016-0.
  • [6] Romain Bourneuf and Marcin Pilipczuk. Bounding ϵ-scatter dimension via metric sparsity. In Yossi Azar and Debmalya Panigrahi, editors, Proceedings of the 2025 Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2025, New Orleans, LA, USA, January 12-15, 2025, pages 3155–3171. SIAM, 2025. doi:10.1137/1.9781611978322.101.
  • [7] Nicolas Bousquet and Stéphan Thomassé. VC-dimension and Erdős–Pósa property. Discrete Mathematics, 338(12):2302–2317, 2015. doi:10.1016/j.disc.2015.05.026.
  • [8] Vladimir Braverman, Shaofeng H-C Jiang, Robert Krauthgamer, and Xuan Wu. Coresets for clustering in excluded-minor graphs and beyond. In Proceedings of the 2021 ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 2679–2696. SIAM, 2021. doi:10.1137/1.9781611976465.159.
  • [9] Costas Busch, Ryan LaFortune, and Srikanta Tirthapura. Sparse covers for planar graphs and graphs that exclude a fixed minor. Algorithmica, 69:658–684, 2014. doi:10.1007/s00453-013-9757-4.
  • [10] 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. doi:10.1145/3218821.
  • [11] Dibyayan Chakraborty and Kshitij Gajjar. Finding geometric representations of apex graphs is NP-hard. Theor. Comput. Sci., 971:114064, 2023. doi:10.1016/J.TCS.2023.114064.
  • [12] Timothy M. Chan and Dimitrios Skrepetos. Faster Approximate Diameter and Distance Oracles in Planar Graphs. In Kirk Pruhs and Christian Sohler, editors, 25th Annual European Symposium on Algorithms (ESA 2017), volume 87 of Leibniz International Proceedings in Informatics (LIPIcs), pages 25:1–25:13, Dagstuhl, Germany, 2017. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.ESA.2017.25.
  • [13] Timothy M. Chan and Dimitrios Skrepetos. Approximate shortest paths and distance oracles in weighted unit-disk graphs. Journal of Computational Geometry, 10(2):3–20, February 2019. doi:10.20382/jocg.v10i2a2.
  • [14] Hsien-Chih Chang, Jonathan Conroy, Hung Le, Lazar Milenkovic, Shay Solomon, and Cuong Than. Covering planar metrics (and beyond): O(1) trees suffice. In 2023 IEEE 64th Annual Symposium on Foundations of Computer Science (FOCS), pages 2231–2261. IEEE, 2023. doi:10.1109/FOCS57990.2023.00139.
  • [15] Hsien-Chih Chang, Jonathan Conroy, Hung Le, Lazar Milenkovic, Shay Solomon, and Cuong Than. Resolving the steiner point removal problem in planar graphs via shortcut partitions. arXiv preprint arXiv:2306.06235, 2023. doi:10.48550/arXiv.2306.06235.
  • [16] Hsien-Chih Chang, Jonathan Conroy, Hung Le, Lazar Milenković, Shay Solomon, and Cuong Than. Shortcut partitions in minor-free graphs: Steiner point removal, distance oracles, tree covers, and more. In Proceedings of the 2024 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 5300–5331. SIAM, 2024. doi:10.1137/1.9781611977912.191.
  • [17] Hsien-Chih Chang, Jie Gao, and Hung Le. Computing Diameter+2 in Truly-Subquadratic Time for Unit-Disk Graphs. In Wolfgang Mulzer and Jeff M. Phillips, editors, 40th International Symposium on Computational Geometry (SoCG 2024), volume 293 of Leibniz International Proceedings in Informatics (LIPIcs), pages 38:1–38:14, Dagstuhl, Germany, 2024. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.SoCG.2024.38.
  • [18] Hsien-Chih Chang, Robert Krauthgamer, and Zihan Tan. Almost-linear ϵ-emulators for planar graphs. In Stefano Leonardi and Anupam Gupta, editors, STOC ’22: 54th Annual ACM SIGACT Symposium on Theory of Computing, Rome, Italy, June 20 - 24, 2022, pages 1311–1324. ACM, 2022. doi:10.1145/3519935.3519998.
  • [19] Panagiotis Charalampopoulos, Paweł Gawrychowski, Yaowei Long, Shay Mozes, Seth Pettie, Oren Weimann, and Christian Wulff-Nilsen. Almost optimal exact distance oracles for planar graphs. Journal of the ACM, 70(2):1–50, 2023. doi:10.1145/3580474.
  • [20] Krishnendu Chatterjee, Rasmus Ibsen-Jensen, and Andreas Pavlogiannis. Optimal tree-decomposition balancing and reachability on low treewidth graphs. IST Austria, 2014. doi:10.15479/AT:IST-2014-314-v1-1.
  • [21] Victor Chepoi, Bertrand Estellon, and Yann Vaxès. Covering planar graphs with a fixed number of balls. Discret. Comput. Geom., 37(2):237–244, 2007. doi:10.1007/S00454-006-1260-0.
  • [22] Vincent Cohen-Addad, Andrew Draganov, Matteo Russo, David Saulpic, and Chris Schwiegelshohn. A tight VC-dimension analysis of clustering coresets with applications. In Yossi Azar and Debmalya Panigrahi, editors, Proceedings of the 2025 Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2025, New Orleans, LA, USA, January 12-15, 2025, pages 4783–4808. SIAM, 2025. doi:10.1137/1.9781611978322.162.
  • [23] Vincent Cohen-Addad, Hung Le, Marcin Pilipczuk, and Michal Pilipczuk. Planar and minor-free metrics embed into metrics of polylogarithmic treewidth with expected multiplicative distortion arbitrarily close to 1. In 64th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2023, Santa Cruz, CA, USA, November 6-9, 2023, pages 2262–2277. IEEE, 2023. doi:10.1109/FOCS57990.2023.00140.
  • [24] Erik D. Demaine and Mohammad Taghi Hajiaghayi. Equivalence of local treewidth and linear local treewidth and its algorithmic applications. In J. Ian Munro, editor, Proceedings of the Fifteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2004, New Orleans, Louisiana, USA, January 11-14, 2004, pages 840–849. SIAM, 2004. URL: https://dl.acm.org/doi/10.5555/982792.982919.
  • [25] Erik D. Demaine, MohammadTaghi Hajiaghayi, and Ken-ichi Kawarabayashi. Approximation algorithms via structural results for apex-minor-free graphs. In Susanne Albers, Alberto Marchetti-Spaccamela, Yossi Matias, Sotiris E. Nikoletseas, and Wolfgang Thomas, editors, Automata, Languages and Programming, 36th International Colloquium, ICALP 2009, Rhodes, Greece, July 5-12, 2009, Proceedings, Part I, volume 5555 of Lecture Notes in Computer Science, pages 316–327. Springer, 2009. doi:10.1007/978-3-642-02927-1_27.
  • [26] 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 Journal on Computing, 51(5):1506–1534, 2022. doi:10.1137/20M136551X.
  • [27] Lech Duraj, Filip Konieczny, and Krzysztof Potepa. Better diameter algorithms for bounded vc-dimension graphs and geometric intersection graphs. In Timothy M. Chan, Johannes Fischer, John Iacono, and Grzegorz Herman, editors, 32nd Annual European Symposium on Algorithms, ESA 2024, September 2-4, 2024, Royal Holloway, London, United Kingdom, volume 308 of LIPIcs, pages 51:1–51:18. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2024. doi:10.4230/LIPICS.ESA.2024.51.
  • [28] David Eppstein. Diameter and treewidth in minor-closed graph families. Algorithmica, 27(3):275–291, 2000. doi:10.1007/S004530010020.
  • [29] Arnold Filtser. On sparse covers of minor free graphs, low dimensional metric embeddings, and other applications. CoRR, abs/2401.14060, 2024. doi:10.48550/arXiv.2401.14060.
  • [30] Arnold Filtser and Hung Le. Low treewidth embeddings of planar and minor-free metrics. In 2022 IEEE 63rd Annual Symposium on Foundations of Computer Science (FOCS), pages 1081–1092, 2022. doi:10.1109/FOCS54457.2022.00105.
  • [31] Fedor V. Fomin, Daniel Lokshtanov, Saket Saurabh, Michal Pilipczuk, and Marcin Wrochna. Fully polynomial-time parameterized computations for graphs and matrices of low treewidth. ACM Trans. Algorithms, 14(3):34:1–34:45, 2018. doi:10.1145/3186898.
  • [32] Eli Fox-Epstein, Philip N. Klein, and Aaron Schild. Embedding planar graphs into low-treewidth graphs with applications to efficient approximation schemes for metric problems. In Timothy M. Chan, editor, Proceedings of the Thirtieth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2019, San Diego, California, USA, January 6-9, 2019, pages 1069–1088. SIAM, 2019. doi:10.1137/1.9781611975482.66.
  • [33] Viktor Fredslund-Hansen, Shay Mozes, and Christian Wulff-Nilsen. Truly Subquadratic Exact Distance Oracles with Constant Query Time for Planar Graphs. In Hee-Kap Ahn and Kunihiko Sadakane, editors, 32nd International Symposium on Algorithms and Computation (ISAAC 2021), volume 212 of Leibniz International Proceedings in Informatics (LIPIcs), pages 25:1–25:12, Dagstuhl, Germany, 2021. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.ISAAC.2021.25.
  • [34] Pawel Gawrychowski, Haim Kaplan, Shay Mozes, Micha Sharir, and Oren Weimann. Voronoi diagrams on planar graphs, and computing the diameter in deterministic õ(n5/3) time. SIAM J. Comput., 50(2):509–554, 2021. doi:10.1137/18M1193402.
  • [35] Pawel Gawrychowski, Shay Mozes, Oren Weimann, and Christian Wulff-Nilsen. Better tradeoffs for exact distance oracles in planar graphs. In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 515–529. SIAM, 2018. doi:10.1137/1.9781611975031.34.
  • [36] Thore Husfeldt. Computing Graph Distances Parameterized by Treewidth and Diameter. In Jiong Guo and Danny Hermelin, editors, 11th International Symposium on Parameterized and Exact Computation (IPEC 2016), volume 63 of Leibniz International Proceedings in Informatics (LIPIcs), pages 16:1–16:11, Dagstuhl, Germany, 2017. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.IPEC.2016.16.
  • [37] Bart M. P. Jansen, Daniel Lokshtanov, and Saket Saurabh. A near-optimal planarization algorithm. In Chandra Chekuri, editor, Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2014, Portland, Oregon, USA, January 5-7, 2014, pages 1802–1811. SIAM, 2014. doi:10.1137/1.9781611973402.130.
  • [38] Frank Kammer and Torsten Tholey. Approximate tree decompositions of planar graphs in linear time. Theor. Comput. Sci., 645:60–90, 2016. doi:10.1016/J.TCS.2016.06.040.
  • [39] Adam Karczmarz and Da Wei Zheng. Subquadratic algorithms in minor-free digraphs: (weighted) distance oracles, decrementai reachability, and more. In Yossi Azar and Debmalya Panigrahi, editors, Proceedings of the 2025 Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2025, New Orleans, LA, USA, January 12-15, 2025, pages 4338–4351. SIAM, 2025. doi:10.1137/1.9781611978322.147.
  • [40] Ken-ichi Kawarabayashi, Philip N Klein, and Christian Sommer. Linear-space approximate distance oracles for planar, bounded-genus and minor-free graphs. In International Colloquium on Automata, Languages, and Programming, pages 135–146. Springer, 2011. doi:10.1007/978-3-642-22006-7_12.
  • [41] Philip Klein, Serge A. Plotkin, and Satish Rao. Excluded minors, network decomposition, and multicommodity flow. In Proceedings of the Twenty-Fifth Annual ACM Symposium on Theory of Computing, STOC ’93, pages 682–690, New York, NY, USA, 1993. Association for Computing Machinery. doi:10.1145/167088.167261.
  • [42] Kacper Kluk, Marcin Pilipczuk, Michal Pilipczuk, and Giannos Stamoulis. Faster diameter computation in graphs of bounded Euler genus. In Keren Censor-Hillel, Fabrizio Grandoni, Joël Ouaknine, and Gabriele Puppis, editors, 52nd International Colloquium on Automata, Languages, and Programming, ICALP 2025, July 8-11, 2025, Aarhus, Denmark, volume 334 of LIPIcs, pages 109:1–109:19. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2025. doi:10.4230/LIPICS.ICALP.2025.109.
  • [43] Tuukka Korhonen, Michal Pilipczuk, and Giannos Stamoulis. Minor containment and disjoint paths in almost-linear time. In 65th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2024, Chicago, IL, USA, October 27-30, 2024, pages 53–61. IEEE, 2024. doi:10.1109/FOCS61266.2024.00014.
  • [44] Hung Le. Approximate distance oracles for planar graphs with subpolynomial error dependency. In Nikhil Bansal and Viswanath Nagarajan, editors, Proceedings of the 2023 ACM-SIAM Symposium on Discrete Algorithms, SODA 2023, Florence, Italy, January 22-25, 2023, pages 1877–1904. SIAM, 2023. doi:10.1137/1.9781611977554.CH72.
  • [45] Hung Le and Christian Wulff-Nilsen. Optimal approximate distance oracle for planar graphs. In 62nd IEEE Annual Symposium on Foundations of Computer Science, FOCS 2021, Denver, CO, USA, February 7-10, 2022, pages 363–374. IEEE, 2021. doi:10.1109/FOCS52979.2021.00044.
  • [46] Hung Le and Christian Wulff-Nilsen. VC set systems in minor-free (di)graphs and applications. In David P. Woodruff, editor, Proceedings of the 2024 ACM-SIAM Symposium on Discrete Algorithms, SODA 2024, Alexandria, VA, USA, January 7-10, 2024, pages 5332–5360. SIAM, 2024. doi:10.1137/1.9781611977912.192.
  • [47] Jason Li and Merav Parter. Planar diameter via metric compression. In Proceedings of the 51st Annual ACM SIGACT Symposium on Theory of Computing, pages 152–163, 2019. doi:10.1145/3313276.3316358.
  • [48] Neil Robertson and Paul D Seymour. Graph minors. XVI. Excluding a non-planar graph. Journal of Combinatorial Theory, Series B, 89(1):43–76, 2003. doi:10.1016/S0095-8956(03)00042-X.
  • [49] 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.
  • [50] Ignasi Sau, Giannos Stamoulis, and Dimitrios M. Thilikos. k-apices of Minor-closed Graph Classes. II. Parameterized Algorithms. ACM Trans. Algorithms, 18(3):21:1–21:30, 2022. doi:10.1145/3519028.
  • [51] Norbert Sauer. On the density of families of sets. Journal of Combinatorial Theory, Series A, 13(1):145–147, 1972. doi:10.1016/0097-3165(72)90019-2.
  • [52] Siamak Tazari and Matthias Müller-Hannemann. Shortest paths in linear time on minor-closed graph classes, with an application to steiner tree approximation. Discret. Appl. Math., 157(4):673–684, 2009. doi:10.1016/J.DAM.2008.08.002.
  • [53] Mikkel Thorup. Compact oracles for reachability and approximate distances in planar digraphs. J. ACM, 51(6):993–1024, November 2004. doi:10.1145/1039488.1039493.
  • [54] Vladimir N Vapnik and A Ya Chervonenkis. On the uniform convergence of relative frequencies of events to their probabilities. In Measures of complexity: festschrift for alexey chervonenkis, pages 11–30. Springer, 2015. doi:10.1007/978-3-319-21852-6_3.
  • [55] Oren Weimann and Raphael Yuster. Approximating the diameter of planar graphs in near linear time. ACM Transactions on Algorithms (TALG), 12(1):1–13, 2015. doi:10.1145/2764910.