Tight Approximation Algorithms for Bichromatic Graph Diameter and Related Problems
I C A L P
Tight Approximation Algorithms for Bichromatic Graph Diameter and Related Problems
Mina Dalirrooyfard MIT 0
Cambridge 0
USA 0
Virginia Vassilevska Williams MIT 0
Cambridge 0
USA 0
Nikhil Vyas MIT 0
Cambridge 0
USA 0
Nicole Wein MIT 0
Cambridge 0
USA Abstract 0
Category Track A: Algorithms, Complexity and Games
0 Funding Mina Dalirrooyfard: Supported by an Akamai Presidential Fellowship and NSF Grant CCF6936484. Virginia Vassilevska Williams: Supported by an NSF CAREER Award, NSF Grants CCF1417238, CCF1528078 and CCF1514339, a BSF Grant BSF:2012338 and a Sloan Research Fellowship. Nikhil Vyas: Supported by an Akamai Presidential Fellowship and NSF Grant CCF1552651. Nicole Wein: Supported by an NSF Graduate Fellowship and NSF Grant CCF1514339 , USA
Some of the most fundamental and wellstudied graph parameters are the Diameter (the largest shortest paths distance) and Radius (the smallest distance for which a ?center? node can reach all other nodes). The natural and important ST variant considers two subsets S and T of the vertex set and lets the ST diameter be the maximum distance between a node in S and a node in T , and the ST radius be the minimum distance for a node of S to reach all nodes of T . The bichromatic variant is the special case in which S and T partition the vertex set. In this paper we present a comprehensive study of the approximability of ST and Bichromatic Diameter, Radius, and Eccentricities, and variants, in graphs with and without directions and weights. We give the first nontrivial approximation algorithms for most of these problems, including time/accuracy tradeoff upper and lower bounds. We show that nearly all of our obtained bounds are tight under the Strong Exponential Time Hypothesis (SETH), or the related Hitting Set Hypothesis. For instance, for Bichromatic Diameter in undirected weighted graphs with m edges, we present an O?(m3/2) time 1 5/3approximation algorithm, and show that under SETH, neither the running time, nor the approximation factor can be significantly improved while keeping the other unchanged. 2012 ACM Subject Classification Theory of computation ? Graph algorithms analysis; Theory of computation ? Approximation algorithms analysis; Theory of computation ? Problems, reductions and completeness; Theory of computation ? Shortest paths Acknowledgements The authors would like to thank Arturs Backurs for discussions during the early stages of this work. 1 O? notation hides polylogarithmic factors.
and phrases approximation algorithms; finegrained complexity; diameter; radius; eccentricities

47:2
1
Introduction
A fundamental and very well studied problem in algorithms is the Diameter of a graph,
where the output is the largest (shortest path) distance over all pairs of vertices. Over the
years many different algorithms have been developed for the problem, both in theory (e.g.
[3, 21, 24, 8, 4]) and in practice (e.g. [
10, 25, 20
]).
A very natural variant is the so called ST Diameter problem [4]: given a graph and two
subsets S and T of its vertex set, determine the largest distance between a vertex of S and a
vertex of T . In the Subset version of ST Diameter, we have S = T . Bichromatic Diameter is
the version of ST Diameter for which S and T partition the vertex set. Besides Diameter,
the Radius (the smallest distance for which a ?center? node can reach all other nodes) and
Eccentricities (the largest distance out of every vertex) problems are also very well studied,
and analogous ST , Subset, and Bichromatic versions are easy to define.
All of these parameters are simple to compute by computing all pairwise distances in the
graph, i.e. by solving AllPairs Shortest Paths (APSP). In sparse nnode graphs, where the
number of edges m is O?(n), APSP still needs ?(n2) time, as this is the size of the output,
whereas it is apriori unclear whether this much time is needed for computing the Diameter,
Radius and Eccentricities or their ST and bichromatic variants, as the output is small.
A related extremely wellstudied problem in computational geometry is Bichromatic
Diameter on point sets (commonly known as Bichromatic Farthest Pair), where one seeks to
determine the farthest pair of points in a given set of points in space (see e.g. [29, 13, 28, 2, 17]).
Another related problem is the Subset version of spanners (e.g. [19, 11]), as well as the ST
version of spanners (e.g. [9, 18]). Furthermore, the ST , Subset, and Bichromatic versions
of many problems have been of great interest; for instance Steiner Tree, Subset TSP, and
a number of problems in computational geometry such as Bichromatic Matching (e.g. [16])
and Bichromatic Line Segment Intersection (e.g. [7]).
There are several known approximation algorithms for the standard version of Diameter,
most of which have been developed in the last 6 years. Trivially, running Dijkstra?s algorithm
from an arbitrary vertex gives a simple O?(m) time 2approximation algorithm for directed and
weighted graphs. Nontrivial algorithms achieve an improved approximation factor with an
increased runtime: Building on Aingworth et al. [3], Roditty and Vassilevska W. [24] showed
for instance that an ?almost? 1.5 approximation for Diameter can be computed in O?(m?n)
time in medge nvertex directed weighted graphs ? the approximation factor is 1.5 if the
Diameter is divisible by 3, and there is a slight additive error otherwise. Chechik et al. [8]
gave a true 1.5 approximation at the expense of increasing the runtime to O?(mn2/3), and
Cairo, Grossi and Rizzi [5] generalized the approach giving an O?(mn1/(k+1)) time, ?almost?
2 ? 1/2k approximation algorithm for all k ? 1 which works only in undirected graphs.
In STOC?18, Backurs et al. [4] gave the first nontrivial approximation algorithms for
ST Diameter: an O?(m3/2) time 2approximation and an O?(m) time 3approximation. They
also showed that these algorithms cannot be improved significantly, unless the Strong
Exponential Time Hypothesis (SETH) fails. Backurs et al. did not provide algorithms for
ST Eccentricities or ST Radius, and they did not study the natural Subset and Bichromatic
versions. They also only focused on undirected graphs.
We study the following natural and fundamental questions:
How well can ST Eccentricities and ST Radius be approximated? Are any interesting
approximation algorithms possible for directed graphs for any of the ST variants? Does the
approximability of the problems change when one turns to the Subset versions in which
S = T , or the Bichromatic versions in which S and T are required to partition
the vertex set?
1.1
Our Results
We present a comprehensive study of the approximability of the ST , Subset and Bichromatic
variants of the Diameter, Radius and Eccentricities problems in graphs, both with and
without directions and weights. We obtain the first nontrivial approximation algorithms
for most of these problems, including time/accuracy tradeoff upper and lower bounds. We
show that nearly all of our approximation algorithms are tight under SETH (or under the
related Hitting Set Hypothesis for Radius). Additionally, we study a parameterized version
of these problems.
Our results are summarized in Tables 14.
All our algorithms in medge, nnode graphs, run in O?(m3/2) time or in O?(m?n) time
when a small additive error is allowed. For sparse graphs the m3/2 runtime beats the fastest
2 with high probability means with probability at least 1 ? 1/nc for all constants c.
APSP algorithms [6, 23, 22] as they run in O?(mn) time. The m?n time of the algorithms
that allow small additive error beat the APSP algorithms for every graph sparsity.
Bichromatic Diameter and Radius
Our first contribution is an algorithm with the same running time as the 2approximation ST
Diameter algorithm of [4], achieving a better, 5/3 approximation for Bichromatic Diameter.
In other words, when S and T partition the vertex set of the graph, ST Diameter can be
approximated much better! Moreover, we show that under SETH, neither the runtime nor
the approximation factor of our algorithm can be improved. The result is summarized in
Theorem 1 below, and proven in Theorems 11 and 12.
I Theorem 1. There is a randomized O?(m3/2) time algorithm, that given an undirected
graph G = (V, E) with nonnegative integer edge weights and S ? V, T = V \ S, can output
an estimate D0 such that 3DST /5 ? D0 ? DST with high probability, where DST is the
ST Diameter of G.
Moreover, if there is an O(m3/2??) time 5/3approximation algorithm for some ? > 0, or
if there is an O(m2??) time (5/3 ? ?)approximation algorithm for the problem, then SETH
is false.
We also obtain an O?(m?n) time algorithm that achieves an ?almost? 5/3approximation:
the guarantee for unweighted graphs is 3DST /5 ? 6/5 ? D0 ? DST . We also obtain a
nearlinear time algorithm for weighted graphs that returns an estimate D0 with DST /2 ? W/2 ?
D0 ? DST where W is the minimum weight of a S ? T edge. Using our general theorem 12,
we get that this result is also essentially tight, as a (2 ? ?)approximation for ? > 0 running
in nearlinear time would refute SETH.
To obtain our improvements for Bichromatic Diameter over the known ST Diameter
algorithms, we crucially exploit the basic fact that as S, T partition V any path that starts
from a vertex s ? S and ends in a vertex t ? T must cross a (u, v) edge such that u ? S, v ? T .
While this fact is clear, it not at all obvious how one might try to exploit it.
We explain our technique in more detail for the bichromatic diameter problem, and
similar ideas are used for our algorithms for the other problems. Let s? ? S and t? ? T
be endpoints of an ST Diameter path. Similarly to prior Diameter algorithms, our goal
is to run Dijkstra?s algorithm from some s ? S which is close to s?, and hence far from t?,
or from some t ? T which is close to t? and hence far from s? (by the triangle inequality).
Our 5/3approximation algorithms are a delicate combination of two themes: (1) randomly
sample nodes in S and nodes in T ? similarly to prior works, the sampling works well if there
are many nodes of S that are close to s?, or if there are many nodes of T that are close to t?.
If (1) is not good enough, in theme (2) we show that we can find a node w ? S close to t?
for which we can ?catch? an S ? T edge (s, t) on the shortest w ? t? path, such that t is
close to t?. Theme (2) is our new contribution. Because of theme (2), our algorithms are
more complicated than the ST Diameter algorithms, but run in asymptotically the same
time, and achieve a better approximation guarantee. In order to better separate the ideas in
our algorithms, we explain them in several steps, where Theme (1) can be seen in the first
steps and Theme (2) appears towards the last steps.
Following a similar approach to our Bichromatic Diameter algorithms, we develop similar
algorithms for Bichromatic Radius. First, we give a simple nearlinear time almost
2approximation algorithm, and then we adapt the 5/3approximation for Bichromatic Diameter
to also give a 5/3approximation for Bichromatic Radius. Moreover, we show that any
better approximation factor requires essentially quadratic time, under the Hitting Set (HS)
Hypothesis of [1] (see also [14]).
I Theorem 2. There is a randomized O?(m3/2) time algorithm, that given an undirected
graph G = (V, E) with nonnegative integer edge weights and S ? V, T = V \ S, can output an
estimate R0 such that RST ? R0 ? 5RST /3 with high probability, where RST is the ST Radius
of G. Moreover, if there is a 5/3 ? ? approximation algorithm running in O(m2??) time for
any ?, ? > 0, then the HS Hypothesis is false.
Similarly to the Bichromatic Diameter algorithm, if one is satisfied with a slight additive
error, one can improve the runtime to O?(m?n).
ST Eccentricities and ST Radius
Prior work only considered ST Diameter but did not consider the more general ST 
Eccentricities problem in which one wants to approximate for every s ? S, ?ST (s) := maxt?T d(s, t).
Here we show that one can achieve exactly the same approximation factors for ST
Eccentricities as for ST Diameter. Since any conditional lower bound for ST Diameter
also applies for the ST Eccentricities problem, the algorithms we obtain are conditionally
optimal, similarly to the ST Diameter algorithms in [4]. Interestingly, we show that the
same conditional lower bounds apply for Bichromatic Eccentricities (see the full version [12]),
and therefore our ST Eccentricities algorithms are optimal even for the Bichromatic case.
I Theorem 3. There is a randomized O?(m3/2) time algorithm, that given an undirected
graph G = (V, E) with nonnegative integer edge weights and S, T ? V , can output for every
s ? S, an estimate ?0(s) such that ?ST (s)/2 ? ?0(s) ? ?ST (s) with high probability. Moreover,
if there is a 2 ? ? approximation algorithm running in O(m2??) time for any ?, ? > 0 or a
2approximation algorithm running in O(m3/2??) time for ? > 0, even for the Bichromatic
case when T = V \ S, then SETH is false.
Again, as before, one can improve the runtime to O?(m?n) with a slight additive error,
and there is a simple nearlinear time 3approximation algorithm which is tight under SETH,
similar to the one in [4] for ST Diameter. A simple argument shows that these algorithms
imply algorithms with the same running time and approximation factor for ST Radius.
Bichromatic and ST Problems in Directed Graphs
Using simple reductions we first show that there can be no O(m2??) time (for ? > 0)
algorithms that achieve any finite approximation for ST Diameter or ST Eccentricities
(under SETH), or ST Radius (under HS). Interestingly, the same holds for Bichromatic
Eccentricities (under SETH, see the full version [12] ) and Bichromatic Radius (under HS, see
[12] ), but not Bichromatic Diameter! Surprisingly, unlike those two problems, Bichromatic
Diameter does admit a finite, in fact 2approximation algorithm running in subquadratic
time, and this algorithm is conditionally optimal:
I Theorem 4. There is a randomized O?(m3/2) time algorithm, that given a directed graph
G = (V, E) with nonnegative integer edge weights and S ? V, T = V \ S, can output
an estimate D0 such that DST /2 ? D0 ? DST with high probability, where DST is the
ST Diameter of G.
Moreover, if there is an O(m2??) time 2 ? ?approximation algorithm for the problem for
some ?, ? > 0, then SETH is false.
The previously known techniques for approximating Diameter in directed graphs fail
here. The main issue is that the prior techniques were general enough that they also gave
algorithms for Eccentricities and Radius as a byproduct. In the Bichromatic case, however,
there is a genuine difference between Diameter and Radius, as we noted above, and new
techniques are needed. Here again it turns out that combining theme (2) with a delicate
argument is sufficient to get conditionally tight algorithms under SETH.
Subset Versions
Recall that Subset Diameter, Radius, and Eccentricities are the versions of the corresponding
ST problems with the constraint that S = T . Interestingly, Subset Diameter, Radius, and
Eccentricities all exhibit the same sharp threshold behavior. For all three problems, there
are nearlinear time algorithms that achieve a 2 (or almost 2) approximation, as well as
conditional lower bounds that show that there is no 2 ? ? approximation in m2?o(1) time.
Parameterized Algorithms
We consider the Bichromatic Diameter, Radius, and Eccentricities problems parameterized
by the size of the boundary between the S and T sets. If S0 is the set of vertices in S that
have a neighbor in T , and T 0 is the set of vertices in T that have a neighbor in S, then
the boundary B is whichever of S0 or T 0 is smaller in size. Our lower bound constructions
already have small boundary so they rule out algorithms even for graphs with small boundary.
However, interestingly we obtain nearlinear time algorithms for graphs with small boundary
that achieve better multiplicative approximation factors than the optimal nonparameterized
algorithms. This is not a contradiction because our parameterized algorithms have a constant
additive error, while the apparently contradictory lower bounds do not tolerate additive error.
Preliminaries
Given a graph G = (V, E) (directed or undirected, weighted or unweighted), let d(u, v)
denote the distance from u ? V to v ? V . For a subset X ? V and v ? V , define
d(v, X) := minx?X d(v, x). Similarly d(X, v) := minx?X d(x, v).
Unless otherwise stated, m denotes the number of edges and n the number of vertices of
the underlying graph. Without loss of generality, we can assume that all undirected graphs
are connected, and all directed graphs are weakly connected, so that m ? n ? 1.
The Eccentricity ?(v) of a vertex v ? V is maxu?V d(v, u). The Diameter D(G) of G is
maxv?V ?(v), and the Radius R(G) of G is minv?V ?(v).
Given S, T ? V , we define analogous parameters as follows. The ST Eccentricity ?ST (v)
of v ? S is maxu?T d(v, u). The ST Diameter DST (G) is maxv?S ?ST (v), and the ST Radius
RST (G) is minv?S ?ST (v).
The above parameters are called Bichromatic Eccentricities, Diameter, and Radius if S
and T form a partition of V , i.e. T = V \ S.
The above parameters are called Subset Eccentricities, Diameter, and Radius if S = T
and are notated with subscript S instead of ST .
2.1
Preliminaries for algorithms
I Lemma 5. Let G = (V, E) be a (possibly directed and weighted graph) and let W ? V .
Let g ? ?(ln n) be an integer. Let S ? W be a random subset of c(W /g) ln n vertices for
some constant c > 1. For every v ? V , let W (v) be the set of vertices x ? W for which
d(v, x) < d(v, S). Then with probability at least 1 ? 1/nc?1, for every v ? V , W (v) ? g,
and moreover, if one takes the closest g vertices of W to v, they will contain W (v).
Proof. For each v ? V , imagine sorting the nodes x ? W according to d(v, x). Define Qv to
be the first g nodes in this sorted order  those are the nodes of W closest to v (in the v ? x
direction).
We pick S randomly by selecting each vertex of W with probability (c ln n)/g. The
probability that a particular q ? Qv is not in S is 1 ? (c ln n)/g, and the probability that
no q ? Qv is in S is (1 ? (c ln n)/g)g ? 1/nc. By a union bound, with probability at least
1 ? 1/nc?1, for every v ? V , we have that Qv ? S 6= ?.
Now, for each particular v, say that w(v) is a node in Qv ? S. Since all nodes x ? W
with d(v, x) < d(v, w(v)) must be in Qv, and since d(v, w(v)) ? d(v, S), we must have that
W (v) ? Qv. Hence, with probability at least 1 ? 1/nc?1, for every v ? V , W (v) ? g and
W (v) ? Qv. J
I Lemma 6. Let G = (V, E) be a (possibly directed and weighted) graph. Let M, W ? V
and let S ? W be a random subset of c(n/g) ln n vertices for some large enough constant c
and some integer g ? 1.
Then, for any D > 0 and for any w ? M with d(w, S) > D, if one takes the closest
g vertices of W to w, they will contain all nodes of W at distance < D from w, with
high probability.
Proof. Let Q be the closest g vertices of W to w. By Lemma 5, with high probability Q
contains all nodes of W at distance < d(w, S) from w, and hence Q contains all nodes of W
at distance < D from w, with high probability. J
We sometimes sample edges instead of vertices, so analogous lemmas to Lemmas 5 and 6
hold when the sample is from a set of edges. Here is the analogue of Lemma 6. The other
lemma is similar.
I Lemma 7. Let G = (V, E) be a (possibly directed and weighted graph) and let M, W ? V .
Let E0 ? E be a random subset of c(E/g) ln n edges for some large enough constant c and
some integer g ? 1. Let Q be the endpoints of edges in E0 that are in W .
Then, for any D > 0, and for any w with d(w, S) > D, if one takes the closest g edges
of E0 to w wrt the distance from their W endpoints, they will contain all edges of E0 whose
W endpoints are at distance < D from w, with high probability.
2.2
Preliminaries for lower bounds
The Strong Exponential Time Hypothesis (SETH) asserts that on a WordRAM with O(log n)
bit words, there is no (2 ? ?)n time (possibly randomized) algorithm for some constant ? > 0
that can determine whether a given CNFFormula with n variables and O(n) clauses is
satisfiable. (This version of SETH is equivalent to the original formulation by Impagliazzo,
Paturi and Zane [15].) By a result of Williams [27], the following Orthogonal Vectors (OV)
Problem requires n2?o(1)poly (d) time (on a wordRAM with O(log n) bit words), unless
SETH fails: given two sets U, V ? {0, 1}d with U  = V  = n and d = ?(log n), determine
whether there are u ? U, v ? V with u ? v = 0.
Given an arbitrary instance of OV with d = O?(1) (while respecting d = ?(log n), e.g.
d = ?(log2 n)), consider the following graph representation, which we call the OVgraph:
the vertex set consists of a node for every u ? U , for every v ? V and for every coordinate
c ? [d] = C, and there is an edge (x ? U ? V, c ? C) if and only if x[c] = 1. OV is then
equivalent to the question of whether there exist u ? U, v ? V such that d(u, v) > 2. In
fact, it is equivalent to distinguishing whether for every u ? U, v ? V , d(u, v) = 2 (no
OVsolution), or there is some u ? U, v ? V such that d(u, v) ? 4 (OVsolution). In other
words, if we set S = U, T = V , the ST Diameter of the OVgraph is 2 if and only if there
is no OVsolution and at least 4 otherwise. Because the OV graph has m = O?(n), under
SETH, any (2 ? ?)approximation algorithm for ST Diameter requires m2?o(1).
A related problem to OV is the Hitting Set (HS) problem [1, 14, 26]: given two sets
U, V ? {0, 1}d with U  = V  = n and d = ?(log n), determine whether there is u ? U such
that for all v ? V , u ? v 6= 0. A common hypothesis is that (on the wordRAM) HS requires
n2?o(1) time.
If we form the OVgraph on the HS instance input, then the HS problem becomes
equivalent to determining whether there is some u ? U such that for all v ? V , d(u, v) ? 2.
In other words, if we set S = U, T = V , the ST Radius of the OVgraph is 2 if and only
if there is a HSsolution and at least 4 otherwise. Thus, under the HS hypothesis, any
(2 ? ?)approximation algorithm for ST Radius requires m2?o(1).
Additionally for our constructions we assume that if there is a HS solution u0 then for all
c ? C, d(u0, c) ? 3. This is because for every coordinate index i there must be v ? V with
v[i] = 1 as otherwise we can just delete the ith bit from all vectors.
Let k ? 2 be an integer. Then, a generalization of the OV problem is kOV: given k
sets U1, . . . , Uk ? {0, 1}d, are there u1 ? U1, . . . , uk ? Uk so that Pcd=1 Qik=1 ui[c] = 0? It is
known that, under SETH, when d = ?(log n), there is no nk?o(1) time algorithm for kOV
(in the word RAM model) [27].
Similar to the OVgraph, Backurs et al. [4] define a graph for kOV which we will refer
to as the kOVgraph. We do not explicitly define the kOVgraph here; instead we list its
properties in the following theorem.
I Theorem 8 ([4]). Let k ? 2. Given a kOV instance consisting of sets W0, W1, . . . , Wk?1 ?
{0, 1}d, each of size n, we can in O(knk?1dk?1) time construct an unweighted, undirected
graph with O(nk?1 + knk?2dk?1) vertices and O(knk?1dk?1) edges that satisfies the following
properties.
1. The graph consists of k + 1 layers of vertices L0, L1, L2, . . . , Lk. The number of nodes in
the sets is L0 = Lk = nk?1 and L1, L2, . . . , Lk?1 ? nk?2dk?1.
2. L0 consists of all tuples (a0, a1, . . . , ak?2) where for each i, ai ? Wi. Similarly, Lk
consists of all tuples (b1, b2, . . . , bk?1) where for each i, bi ? Wi.
3. If the kOV instance has no solution, then d(u, v) = k for all u ? L0 and v ? Lk.
4. If the kOV instance has a solution a0, a1, . . . , ak?1 where for each i, ai ? Wi then if
? = (a0, . . . ak?2) ? L0 and ? = (a1, . . . , ak?1) ? Lk, then d(?, ?) ? 3k ? 2.
5. For all i from 1 to k ? 1, for all v ? Li there exists a vertex in Li?1 adjacent to v and a
vertex in Li+1 adjacent to v.
2.3
Organization
In Section 3 we present our algorithms and conditional lower bound for undirected bichromatic
diameter. We defer the rest of our algorithms and conditional lower bounds to the full
version [12].
3
Algorithms and Lower Bound for Undirected Bichromatic Diameter
We begin with a simple nearlinear time algorithm.
I Proposition 9. There is an O(m + n log n) time algorithm, that given an undirected graph
G = (V, E) and S ? V, T = V \ S, can output an estimate D0 such that DST (G)/2 ? W/2 ?
D0 ? DST , where W is the minimum weight of an edge in S ? T .
Proof. Let (s, t) be a minimum weight edge of G with s ? S and t ? T . Run Dijkstra?s
algorithm from s and from t. Let D0 = max{maxt0?T d(s, t0), maxs0?S d(s0, t)}. Let s? ?
S, t? ? T be endpoints of an ST Diameter path, i.e. d(s?, t?) = DST . Then, suppose
that maxt0?T d(s, t0) < DST /2 ? W/2. In particular, d(s, t?) < DST /2 ? W/2, and hence
d(s, s?) > DST /2 + W/2 by the triangle inequality. Also by the triangle inequality,
DST /2 + W/2 < d(s, t) + d(t, s?) ? w(s, t) + max d(s0, t).
s0?S
Hence, D0 > DST /2 ? W/2, where W is the minimum weight of an edge in S ? T .
J
Now we turn to our 5/3approximation algorithms. Our first theorem is for unweighted
graphs. Later on, we modify the algorithm in this theorem to obtain an algorithm for
weighted graphs as well, and at the same time remove the small additive error that appears
in the theorem below.
I Theorem 10. There is an O?(m?n) time algorithm, that given an unweighted undirected
graph G = (V, E) and S ? V, T = V \ S, can output an estimate D0 such that 3DST (G)/5 ?
D0 ? DST (G) if DST (G) is divisible by 5, and otherwise 3DST (G)/5 ? 6/5 ? D0 ? DST (G).
Proof. Let D = DST (G) and let us assume that D is divisible by 5. If D is not divisible
by 5, the estimate we return will have a small additive error. For clarity of presentation,
we omit the analysis of the case where D is not divisible by 5. However, we include such
analyses in our proofs for Bichromatic Radius and ST Eccentricities (see ARXIV) and the
analysis for Diameter is analogous.
Suppose the (bichromatic) ST Diameter endpoints are s? ? S and t? ? T and that the
ST Diameter is D. The algorithm does not know D, but we will use it in the analysis.
(Algorithm Step 1): The algorithm first samples Z ? S of size c?n ln n uniformly at random.
For every z ? Z, run BFS, and let D1 = maxz?Z,t?T d(z, t).
(Analysis Step 1): If for some s0 ? Z we have that d(s?, s0) ? 2D/5, then D1 ? d(s0, t?) ?
D ? d(s?, s0) ? 3D/5.
(Algorithm Step 2): Now, sample a set X from T of size C?n ln n uniformly at random for
large enough constant C. For every t ? X, run BFS and find the closest node s(t) of S
to t. Run BFS from every s(t). Let D2 = maxt?X,t0?T d(s(t), t0).
(Analysis Step 2): If s? is at distance ? D/5 from some node t of X, then d(s?, s(t)) ? 2D/5
(since s(t) is closer to t than s?), and so D2 ? d(s(t), t?) ? 3D/5.
If neither D1, nor D2 are good approximations, it must be that d(s?, X) > D/5 and
d(s?, Z) > 2D/5. Consider the nodes M of S that are at distance > 2D/5 from Z, then
the node w ? M that is furthest from X among all nodes of M . If neither D1, nor
D2 was a good approximation, s? ? M and since d(s?, X) > D/5, we must have that
d(w, X) > D/5 (and also d(w, Z) > 2D/5). In the next step we will look for such a w.
(Algorithm Step 3): For each s ? S define Ds to be the biggest integer which satisfies
d(s, X) > Ds/5 and d(s, Z) > 2Ds/5. Let w = arg max Ds and D0 = max Ds.
(Analysis Step 3): By Lemma 6 we have that whp, the number of nodes of T at distance
? D0/5 from w and the number of nodes of S at distance ? 2D0/5 from w are both ? ?n.
Also if neither D1, nor D2 are good approximations, it must be that d(s?, X) > D/5 and
d(s?, Z) > 2D/5 and hence D0 ? D.
(Algorithm Step 4): Run BFS from w. Take all nodes of S at distance ? 2D0/5 from w,
call these Sw, and run BFS from them. Whp, Sw ? ?n, so that this BFS run takes
O(m?n) time. Let D3 := maxs?Sw,t?T d(s, t).
For every s ? Sw, let t(s) be the closest node of T to s (breaking ties arbitrarily). Run
BFS from each t(s). Let D4 := maxs?Sw,s0?S d(s0, t(s)).
(Analysis Step 4): If D3 ? 3D/5 or D4 ? 3D/5, we are done, so let us assume that D3, D4 <
3D/5. Since D3 < 3D/5, and since D3 ? d(w, t?), it must be that d(w, t?) < 3D/5. Let
Pwt? be the shortest w to t? path. Consider the node b on Pwt? for which d(w, b) = 2D/5.
If b ? S, then since D0 ? D, b ? Sw and hence we ran BFS from t(b). But since
d(b, t?) = d(w, t?) ? 2D/5 < D/5, and d(b, t(b)) ? d(b, t?) we have that d(t(b), t?) ? 2D/5
and hence D4 ? d(s?, t(b)) ? D ? d(t(b), t?) ? 3D/5. Thus, if D4 < 3D/5, it must be
that b ? T .
(Algorithm Step 5): Take all nodes of T at distance ? D0/5 from w, call these Tw and run
BFS from them. Since d(w, X) > D0/5, whp Tw ? ?n, so this step runs in O(m?n)
time. Let D5 = maxt?Tw,s?S d(t, s).
(Analysis Step 5): If D5 ? 3D/5, we would be done, so assume that D5 < 3D/5. Let a be
the node on the shortest w to t? path Pwt? with d(w, a) = D/5. Suppose that a ? T . Since
D0 ? D, a ? Tw and we ran BFS from it. However, also d(a, t?) = d(w, t?) ? d(w, a) <
3D/5 ? D/5 = 2D/5, and hence D5 ? d(a, s?) ? d(t?, s?) ? d(t?, a) ? D ? 2D/5 = 3D/5.
Since D5 < 3D/5, it must be that a ? S.
Now, since a ? S and b ? T , somewhere on the a to b shortest path Pab, there must be
an edge (s0, t0) with s0 ? S, t0 ? T . Since s0 is before b, d(w, s0) ? 2D/5 ? 2D0/5, and hence
s0 ? Sw. Thus we ran BFS from t(s0). Since s0 has an edge to t0 ? T , d(s0, t(s0)) ? d(s0, t0) = 1.
Also, since d(w, s0) ? d(w, a) = D/5 and d(w, t?) ? 3D/5 ? 1, d(s0, t?) ? 2D/5 ? 1. Thus,
D4 ? d(t(s0), s?) ? d(s?, t?) ? d(t(s0), t?)
? D ? d(t(s0), s0) ? d(s0, t?)
? D ? 1 ? 2D/5 + 1 = 3D/5.
Hence if we set D00 = max{D1, D2, D3, D4, D5}, we get that 3D/5 ? D00 ? D.
J
We now modify the algorithm for unweighted graphs, both making the algorithm work for
weighted graphs and removing the additive error, at the expense of increasing the runtime to
O?(m3/2).
I Theorem 11. There is an O?(m3/2) time algorithm, that given an undirected graph G =
(V, E) with nonnegative integer edge weights and S ? V, T = V \ S, can output an estimate
D0 such that 3DST (G)/5 ? D0 ? DST .
Proof. Suppose as before the (bichromatic) ST Diameter endpoints are s? ? S and t? ? T
and that the ST Diameter is D.
(Algorithm Modified Step 1): The algorithm here samples E0 ? E of size c?m ln n
uniformly at random, for large enough c. Let Z be the endpoints of edges in E0 that are in
S. For every z ? Z, run Dijkstra?s algorithm, and let D1 = maxz?Z,t?T d(z, t).
(Analysis Step 1): If for some s0 ? Z we have that d(s?, s0) ? 2D/5, then D1 ? d(s0, t?) ?
D ? d(s?, s0) ? 3D/5. Let us then assume that d(s?, Z) > 2D/5.
(Algorithm Modified Step 2): Let X be the endpoints of edges in E0 that are in T . For
every t ? X, run Dijkstra?s algorithm and find the closest node s(t) of S to t. Run
Dijkstra?s algorithm from every s(t). Let D2 = maxt?X,t0?T d(s(t), t0).
(Analysis Step 2): If s? is at distance ? D/5 from some node t of X, then d(s?, s(t)) ? 2D/5
(since s(t) is closer to t than s?), and so D2 ? d(s(t), t?) ? 3D/5. Let us then assume
that d(s?, X) > D/5.
As before, if we consider the nodes M of S that are at distance > 2D/5 from Z, then
the node w ? M that is furthest from X among all nodes of M , would have both
d(w, Z) > 2D/5 and d(w, X) > D/5, as s? is in M and satisfies d(s?, X) > D/5. We will
find a node w with these properties in the next step.
(Algorithm Unmodified Step 3): Perform exactly the same Step 3 as before, finding the
largest integer D0 such that there is some node w ? S with d(w, Z) > 2D0/5 and
d(w, X) > D0/5.
(Analysis Step 3): Let w ? S be the node we found such that d(w, X) > D0/5, d(w, Z) >
2D0/5. By Lemma 7 we have that whp, the number of edges (s, g) where s ? S, g ? V and
d(w, s) ? 2D0/5 and the number of edges (t, g0) where t ? T, g0 ? V and d(w, t) ? D0/5
is at most ?m. Also, if D1, D2 < 3D/5, then D0 ? D, so that we also have that the
number of edges (s, b) where s ? S and d(w, s) ? 2D/5 and the number of edges (t, b0)
where t ? T and d(w, t) ? D/5 is at most ?m, whp.
(Algorithm Modified Step 4): Run Dijkstra?s algorithm from w. Take all edges incident to
nodes of S at dist ? 2D0/5 from w. Call these edges ES and their endpoints Sw. Run
Dijkstra?s algorithm from both of their end points. Whp, ES ? ?m and so Sw ? 2?m,
so that this Dijkstra run takes O?(m3/2) time. Let D3 := maxt?Sw?T,s?S d(s, t).
For every s ? Sw ? S, determine a closest node t(s) ? T to s, and run Dijkstra?s algorithm
from t(s) as well. This search also takes O(m3/2) time. Let D4 := maxs?Sw?S,s0?S d(s0, t(s)).
(Analysis Step 4): If d(w, t?) ? 3D/5, or D3 ? 3D/5 or D4 ? 3D/5, we are done, so let us
assume that d(w, t?), D3, D4 < 3D/5.
Now consider the node b on the shortest w to t? path Pwt? for which d(w, b) ? 2D/5, but
such that the node b0 after it on Pwt? has d(w, b0) > 2D/5.
Suppose that b ? S. Then since D0 ? D, we have d(w, b) ? 2D0/5 and hence (b, b0) ? ES.
Let us consider d(b0, t?) = d(w, t?) ? d(b0, w). Since d(w, t?) < 3D/5 and d(b0, w) > 2D/5,
d(b0, t?) < D/5. If b0 ? T , then since we ran Dijkstra?s algorithm from b0, we got
D3 ? D ? D/5 = 4D/5. If b0 ? S, then we ran Dijkstra?s algorithm from t(b0) and
d(t(b0), t?) ? d(t(b0), b0) + d(b0, t?) ? 2d(b0, t?) < 2D/5, and hence D4 ? d(t(b), s?) ?
D ? 2D/5 = 3D/5. Thus if neither d(w, t?), D3, nor D4 are good approximations, then
b ? T .
(Algorithm Modified Step 5): Take all edges incident to nodes of T at dist ? D0/5 from
w. Call these edges ET and their endpoints that are in T , Tw. Run Dijkstra?s algorithm
from all nodes in Tw.
Since d(w, X) > D0/5, whp Tw ? 2?m, so this step runs in O(m3/2) time. Let
D5 = maxt?Tw,s?S d(t, s).
(Analysis Step 5): If D5 ? 3D/5, we would be done, so assume that D5 < 3D/5. Let
a be the node on Pwt? with d(w, a) ? D/5 but so that the node a0 after a on Pwt?
has d(w, a0) > D/5. Suppose that a0 ? T . Since D0 ? D, (a, a0) ? ET , a0 ? Tw and
we ran Dijkstra?s algorithm from a0. However, also d(a0, t?) = d(w, t?) ? d(w, a0) <
3D/5 ? D/5 = 2D/5, and hence D5 ? d(a, s?) ? d(t?, s?) ? d(t?, a0) ? D ? 2D/5 = 3D/5.
Since D5 < 3D/5, it must be that a0 ? S.
Now, since a0 ? S and b ? T , somewhere on the a0 to b shortest path Pab, there
must be an edge (s0, t0) with s0 ? S, t0 ? T . However, since s0 is before b, we have that
d(w, s0) ? d(w, b) ? 2D/5 ? 2D0/5. Thus, (s0, t0) ? ES and we ran Dijkstra?s algorithm from
t0. However, d(t0, t?) = d(w, t?) ? d(w, t0) ? d(w, t?) ? d(w, a0) < 3D/5 ? D/5 = 2D/5, and
hence D3 ? d(t0, s?) ? d(s?, t?) ? d(t0, t?) > 3D/5.
Hence if we set D00 = max{d(w, t?), D1, D2, D3, D4, D5}, we get that 3D/5 ? D00 ? D.
J
Conditional Lower Bound
The following theorem implies that our algorithms for undirected Bichromatic Diameter from
Theorem 11 and Proposition 9 are tight under SETH.
I Theorem 12. Under SETH, for every k ? 2, every algorithm that can distinguish
between Bichromatic Diameter 2k ? 1 and 4k ? 3 in undirected unweighted graphs requires
m1+1/(k?1)?o(1) time.
In particular setting k = 2 and 3 in Theorem 12 implies that our m3/2 time 5/3approximation
algorithm from Theorem 11 is tight in approximation factor and runtime, respectively.
Furthermore, setting k to be arbitrarily large implies that our O?(m) time almost 2approximation
algorithm from Proposition 9 is tight under SETH.
Theorem 12 follows from the following lemma.
I Lemma 13. Let k ? 2 be any integer. Given a kOV instance, we can in O(knk?1dk?1)
time construct an unweighted, undirected graph with O(knk?1 + knk?2dk?1) vertices and
O(knk?1dk?1) edges that satisfies the following two properties.
1. If the kOV instance has no solution, then for all pairs of vertices u ? S and v ? T we
have d(u, v) ? 2k ? 1.
2. If the kOV instance has a solution, then there exists a pair of vertices u ? S and v ? T
such that d(u, v) ? 4k ? 3.
Proof.
Construction of the graph. We begin with the kOVgraph from Theorem 8. Additionally,
we add k ? 1 new layers of vertices Lk+1, . . . , L2k?1, where each new layer contains nk?1
vertices and is connected to the previous layer by a matching. That is, each new layer contains
one vertex for every tuple (a1, . . . , ak?1) where ai ? Wi for all i, and each (a1, . . . , ak?1) ? Lj
is connected to its counterpart (a1, . . . , ak?1) ? Lj?1 by an edge, for all j.
We let S = L0 and we let T contain the rest of the vertices in the graph.
Correctness of the construction.
Case 1: The kOV instance has no solution. By property 3 of Theorem 8 for all u ? S
and v ? Lk, d(u, v) = k. Then, since Lk, . . . , L2k?1 form a series of matchings, for all
u ? S and v ? Lk+1 ? ? ? ? ? L2k?1, d(u, v) ? 2k ? 1. Furthermore, property 5 of Theorem 8
implies that for all u ? S and v ? L1 ? ? ? ? ? Lk?1, d(u, v) ? 2k ? 1. Thus, we have shown
that for all u ? S and v ? T we have d(u, v) ? 2k ? 1.
Case 2: The kOV instance has a solution. Let (a0, a1, . . . , ak?1) be a solution to the k
OV instance where ai ? Wi for all i. We claim that d((a0, . . . , ak?2) ? S, (a1, . . . , ak?1) ?
L2k?1)) ? 4k ? 3. Since Lk, . . . , L2k?1 form a series of matchings, every path from
(a0, . . . , ak?2) ? S to (a1, . . . , ak?1) ? L2k?1 contains the vertex (a1, . . . , ak?1) ? Lk. By
property 4 of Theorem 8, d((a0, . . . , ak?2) ? S, (a1, . . . , ak?1) ? Lk) ? 3k ? 2. Thus,
d((a0, . . . , ak?2) ? S, (a1, . . . , ak?1) ? L2k?1)) ? 4k ? 3. J
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
29
Amir Abboud , Virginia Vassilevska Williams, and Joshua R. Wang . Approximation and Fixed Parameter Subquadratic Algorithms for Radius and Diameter in Sparse Graphs . In Proceedings of the TwentySeventh Annual ACMSIAM Symposium on Discrete Algorithms, SODA 2016 , Arlington , VA , USA, January 10  12 , 2016 , pages 377  391 , 2016 .
Pankaj K. Agarwal , Herbert Edelsbrunner, Otfried Schwarzkopf, and Emo Welzl . Euclidean Minimum Spanning Trees and Bichromatic Closest Pairs. Discrete Comput. Geom. , 6 ( 1 ): 407  422 , December 1991 .
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 .
Towards Tight Approximation Bounds for Graph Diameter and Eccentricities . In Proceedings of STOC'18 , page to appear, 2018 .
Massimo Cairo , Roberto Grossi, and Romeo Rizzi . New Bounds for Approximating Extremal Distances in Undirected Graphs . In Proceedings of the TwentySeventh Annual ACMSIAM Symposium on Discrete Algorithms, SODA 2016 , Arlington , VA , USA, January 10  12 , 2016 , pages 363  376 , 2016 .
STOC , pages 590  598 , 2007 .
Bernard Chazelle , Herbert Edelsbrunner, Leonidas J Guibas , and Micha Sharir . Algorithms for bichromatic linesegment problems and polyhedral terrains . Algorithmica , 11 ( 2 ): 116  132 , 1994 .
In Proceedings of the TwentyFifth Annual ACMSIAM Symposium on Discrete Algorithms, SODA 2014 , Portland, Oregon, USA, January 5 7 , 2014 , pages 1041  1052 , 2014 .
SIAM Journal on Discrete Mathematics , 20 ( 2 ): 463  501 , 2006 .
Pierluigi Crescenzi , Roberto Grossi, Leonardo Lanzi, and Andrea Marino . On Computing the Diameter of RealWorld Directed (Weighted) Graphs . In Ralf Klasing, editor, Experimental Algorithms: 11th International Symposium, SEA 2012 , Bordeaux, France, June 79, 2012 .
Proceedings , pages 99  110 , Berlin, Heidelberg, 2012 . Springer Berlin Heidelberg.
Marek Cygan , Fabrizio Grandoni, and Telikepalli Kavitha . On pairwise spanners . arXiv preprint , 2013 . arXiv: 1301 . 1999 .
Mina Dalirrooyfard , Virginia Vassilevska Williams, Nikhil Vyas , and Nicole Wein . Tight Approximation Algorithms for Bichromatic Graph Diameter and Related Problems , 2019 .
arXiv: 1904 .11601.
Graph Algorithms and Applications, 8 ( 1 ): 27  38 , 2004 .
Jiawei Gao , Russell Impagliazzo, Antonina Kolokolova, and R. Ryan Williams . Completeness for FirstOrder Properties on Sparse Structures with Algorithmic Applications . In Proceedings of the TwentyEighth Annual ACMSIAM Symposium on Discrete Algorithms, SODA 2017 , Barcelona, Spain, Hotel Porta Fira, January 1619 , pages 2162  2181 , 2017 .
R. Impagliazzo and R. Paturi . On the Complexity of kSAT . J. Comput. Syst. Sci. , 62 ( 2 ): 367  375 , 2001 .
Piotr Indyk . A near linear time constant factor approximation for Euclidean bichromatic matching (cost) . In SODA , volume 7 , pages 39  42 , 2007 .
Naoki Katoh and Kazuo Iwano . Finding K Farthest Pairs and K Closest/ Farthest Bichromatic Pairs for Points in the Plane . In Proceedings of the Eighth Annual Symposium on Computational Geometry, SCG '92 , pages 320  329 , 1992 .
Telikepalli Kavitha . New pairwise spanners . Theory of Computing Systems , 61 ( 4 ): 1011  1036 , 2017 .
Philip N Klein . A subset spanner for planar graphs, with application to subset TSP . In Proceedings of the thirtyeighth annual ACM symposium on Theory of computing , pages 749  756 .
ACM , 2006 .
Cl?mence Magnien , Matthieu Latapy, and Michel Habib . Fast Computation of Empirically Tight Bounds for the Diameter of Massive Graphs . J. Exp. Algorithmics , 13 :10: 1 . 10  10 : 1 .9, February 2009 .
David Peleg , Liam Roditty , and Elad Tal . Distributed Algorithms for Network Diameter and Girth . In Automata, Languages, and Programming: 39th International Colloquium, ICALP 2012 , Warwick , UK , July 9 13 , 2012 , Proceedings, Part II , pages 660  672 , 2012 .
Sci., 312 ( 1 ): 47  74 , 2004 .
Seth Pettie and Vijaya Ramachandran . A Shortest Path Algorithm for RealWeighted Undirected Graphs . SIAM J. Comput. , 34 ( 6 ): 1398  1431 , 2005 .
Liam Roditty and Virginia Vassilevska Williams . Fast approximation algorithms for the diameter and radius of sparse graphs . In Proceedings of the 45th annual ACM symposium on Symposium on theory of computing , STOC '13 , pages 515  524 , New York, NY, USA, 2013 .
ACM. doi: 10 .1145/2488608.2488673.
In Proceedings of the 20th ACM International Conference on Information and Knowledge Management , CIKM '11 , pages 1191  1196 , 2011 .
Virginia Vassilevska Williams . Hardness of Easy Problems: Basing Hardness on Popular Conjectures such as the Strong Exponential Time Hypothesis (Invited Talk) . In 10th International Symposium on Parameterized and Exact Computation , IPEC 2015, September 1618 , 2015 , Patras, Greece, pages 17  29 , 2015 .
R. Williams . A new algorithm for optimal 2constraint satisfaction and its implications . Theor.
Comput. Sci. , 348 ( 23 ): 357  365 , 2005 .
Ryan Williams . On the Difference Between Closest, Furthest, and Orthogonal Pairs: Nearlylinear vs Barelysubquadratic Complexity . In Proceedings of the TwentyNinth Annual ACMSIAM Symposium on Discrete Algorithms , SODA ' 18 , pages 1207  1215 , 2018 .
A. Yao . On Constructing Minimum Spanning Trees in kDimensional Spaces and Related Problems . SIAM Journal on Computing , 11 ( 4 ): 721  736 , 1982 .