Abstract 1 Introduction 2 Diameter-3 for Unit Balls in 3D 3 A Near-Linear Diameter-2 Algorithm for 3D Unit Cubes 4 Subquadratic Diameter-3 Algorithm for 3D Unit Cubes References

Charting the Diameter Computation Landscape of Intersection Graphs in 3D and Above

Timothy M. Chan ORCID Siebel School of Computing and Data Science, University of Illinois Urbana-Champaign, IL, USA    Hsien-Chih Chang ORCID Department of Computer Science, Dartmouth College, Hanover, NH, USA    Jie Gao ORCID Department of Computer Science, Rutgers University, Piscataway, NJ, USA    Sándor Kisfaludi-Bak ORCID Department of Computer Science, Aalto University, Espoo, Finland    Hung Le ORCID Manning CICS, University of Massachusetts Amherst, Amherst, MA, USA    Da Wei Zheng ORCID Institute of Science and Technology Austria, Klosterneuburg, Austria
Abstract

Recent research on computing the diameter of geometric intersection graphs has made significant strides, primarily focusing on the 2D case [14, 11, 8] where truly subquadratic-time algorithms were given for simple objects such as unit-disks and (axis-aligned) squares. However, in three or higher dimensions, there is no known truly subquadratic-time algorithm for any intersection graph of non-trivial objects, even basic ones such as unit balls or (axis-aligned) unit cubes. This was partially explained by the pioneering work of Bringmann et al. [5] which gave several truly subquadratic lower bounds, notably for unit balls or unit cubes in 3D when the graph diameter Δ is at least Ω(logn), hinting at a pessimistic outlook for the complexity of the diameter problem in higher dimensions. In this paper, we substantially extend the landscape of diameter computation for objects in three and higher dimensions, giving a few positive results. Our highlighted findings include:

  1. 1.

    A truly subquadratic-time algorithm for deciding if the diameter of unit cubes in 3D is at most 3 (Diameter-3 hereafter), the first algorithm of its kind for objects in 3D or higher dimensions. Our algorithm is based on a novel connection to pseudolines, which is of independent interest.

  2. 2.

    A truly subquadratic time lower bound for Diameter-3 of unit balls in 3D under the Orthogonal Vector (OV) hypothesis, giving the first separation between unit balls and unit cubes in the small diameter regime. Previously, computing the diameter for both objects was known to be quadratic hard when the diameter is Ω(logn) [5].

  3. 3.

    A near-linear-time algorithm for Diameter-2 of unit cubes in 3D, generalizing the previous result for unit squares in 2D [5].

  4. 4.

    A truly subquadratic-time algorithm and lower bound for Diameter-2 and Diameter-3 of rectangular boxes (of arbitrary dimension and sizes), respectively.

Keywords and phrases:
Graph Diameter, Geometric Intersection Graphs, Unit Ball Graphs
Funding:
Timothy M. Chan: Supported by NSF grant CCF-2224271.
Hsien-Chih Chang: Supported by NSF CAREER award CCF-2443017.
Jie Gao: Supported by NSF DMS-2220271, DMS-2311064, IIS-2229876, CCF-2118953, CNS-2515159.
Sándor Kisfaludi-Bak: Supported by the Research Council of Finland, Grant 363444.
Hung Le: Supported by an NSF grant CCF-2517033 and an NSF CAREER Award CCF-2237288.
Da Wei Zheng: This project has received funding from the Austrian Science Fund (FWF) grant DOI 10.55776/I5982. For open access purposes, the author has applied a CC BY public copyright license to any author-accepted manuscript version arising from this submission.
Copyright and License:
[Uncaptioned image] © Timothy M. Chan, Hsien-Chih Chang, Jie Gao, Sándor Kisfaludi-Bak, Hung Le, and
Da Wei Zheng; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Computational geometry
Related Version:
Full Version: https://arxiv.org/abs/2603.21790
Editors:
Hee-Kap Ahn, Michael Hoffmann, and Amir Nayyeri

1 Introduction

Computing the diameter of sparse graphs is quadratic hard: under the Strong Exponential Time Hypothesis (SETH), there is no O(n2ε) algorithm for distinguishing diameter 2 vs. 3 of graphs with n vertices and O~(n)111O~() hides polylogarithmic factors in n. edges [19]. That is, the trivial algorithm for computing the diameter by doing BFS from every vertex is essentially optimal. Since then, the major research focus has been on substantially beating the BFS-based algorithm for structural families of graphs, especially planar/minor-free graphs and geometric intersection graphs. For planar/minor-free graphs, truly-subquadratic algorithms were known [6, 15, 13, 16, 8]. For geometric intersection graphs, the complexity of computing the diameter remains poorly understood, due to the sheer diversity of geometric objects underlying the graphs and the fact that geometric intersection graphs can have Ω(n2) edges.

The pioneering work of Bringmann et al. [5] studied the diameter of intersection graphs of several types of objects. In dimension three and above, they considered (axis-parallel) hypercubes222In this paper, hypercubes and boxes are axis-parallel by default, unless noted otherwise. and balls. Let Diameter-Δ be the problem to decide if a given input graph has diameter at most Δ or at least Δ+1. They showed that it is quadratic hard to solve: (1) Diameter-2 for hypercubes in 12 under the (3-uniform 6-)Hyperclique Hypothesis; (2) Diameter-3 for (not necessarily axis-aligned) unit segments and equilateral triangles in 2 under the Orthogonal Vector (OV) Hypothesis; and (3) Diameter-Ω(logn) for unit balls and unit cubes in 3, and axis-parallel line segments in 2, all under the OV Hypothesis.

The hardness results can be interpreted as indicating that the radius-Δ neighborhood balls of each geometric shape class are sufficiently complex and expressive, capable of encoding the hard instances used in various fine-grained reductions. One possible way to quantify the complexity of the set system of neighborhood balls is the notion of VC-dimension. Given a set system (U,) with a ground set U and a family of subsets of U, its VC-dimension is the cardinality of the largest SU such that S is shattered by – for every SS, there is some X such that XS=S. We say that a graph G has distance VC-dimension at most d if the set system of radius-r neighborhood balls (VG,{Nr[v]}r0) has VC dimension at most d. Planar graphs (more generally, minor-free graphs) [12, 4, 17, 13, 16] and intersection graphs of pseudo-disks [1, 14, 11] both have bounded distance VC-dimension, whereas intersection graphs of unit segments and equilateral triangles do not. Recently Chan et al. [8] gave truly-subquadratic-time diameter algorithms for squares and unit-disks in the plane – both shapes being pseudo-disks, thus with finite distance VC-dimension. Together, these results hinted at finite VC-dimension as an overarching property for fast diameter computation.

We undertake a comprehensive study of computing diameter on geometric intersection graphs. Our results are presented in a pair of papers. While the companion paper [9] focuses solely on the 2D case, this paper is devoted to three or higher dimensions. In the higher-dimensional case, there is no known truly-subquadratic-time algorithm for any non-trivial type of objects, even for basic ones such as unit balls or unit cubes. Upper bound techniques for the 2D cases [5, 14, 11, 8] heavily rely on planarity in various places, most notably in bounding the VC dimension using the non-planarity of K5 [14, 11, 8]. These planarity-specific techniques, in addition to the negative results by Bringmann et al. [5], hint at a pessimistic outlook for the complexity of diameter problems in higher dimensions.

Question 1.

Does a truly-subquadratic-time algorithm for computing the diameter exist for any natural class of geometric intersection graphs in 3D or higher dimensions?

As a starting point, the hardness landscape for unit cubes seems peculiar. Recall that Bringmann et al. [5] showed that in 12D, distinguishing diameter 2 versus 3 is already quadratic hard (under the Hyperclique Hypothesis). However in 3D, the quadratic hardness does not kick in until ΔΩ(logn). Duraj, Konieczny, and Potępa [14] solves the 2D case in time O~(Δn7/4) for Diameter-Δ, which was later extended by [8] to solve Diameter in O~(n21/8) time for general Δ. What about unit cubes in 3D? The same question can be asked about unit balls, which typically behave similarly to unit cubes.

Question 2.

What is the complexity landscape of Diameter-Δ for unit cubes and unit balls in constant dimensions? Do radius-Δ neighborhood balls of their intersection graphs have bounded VC-dimension, in particular in 3D?

Table 1: Previous and new time bounds for deciding whether an intersection graph of geometric objects has diameter at most Δ. All hypercubes/boxes are axis-aligned. New results are shown in bold. Conditional lower bounds marked “(OV)”, “(3H6)”, and “(combK4)” assume the Orthogonal Vectors hypothesis, the 3-uniform 6-hyperclique hypothesis, and the combinatorial 4-clique hypothesis, respectively, where the latter is for combinatorial algorithms (all upper bounds are obtained from combinatorial algorithms). See the full version for definitions. “2D Paper” refers to the companion paper in the pair [9].

1.1 Our Contributions

We provide a comprehensive study on basic objects in higher dimensions; our results are summarized in Table 1. As corollaries, we make significant progress towards Question 1 and Question 2. Below, we discuss each of the contributions in more detail.

Unit cubes versus unit balls.

Our first result is a separation between unit (hyper)cubes and unit balls: Diameter-3 for unit balls is hard, whereas Diameter-3 for unit cubes admits a truly subquadratic-time algorithm.

Theorem 3.

There is no O(n2ε) algorithm for Diameter-3 for unit balls in 3 under the OV hypothesis for any ε>0, while for unit cubes in d for d3, Diameter-3 and Diameter-2 can be solved in O~(n21/13) and O~(n) time, respectively.

Our lower bound for Diameter-3 of unit balls is by reducing from Diameter-2 of sparse tripartite graphs G=(ABC,E), which is quadratic hard under the OV hypothesis. Our first idea for the reduction would be to create a unit ball for each vertex in ABC, as well as a unit ball for each edge in E. We encode edges in the original graph G by intersection: a vertex uABC is incident to an edge uvE if and only if the unit balls corresponding to u and uv intersect. Then a length-2 path abc in G will correspond to a length-4 path aabbbcc in the intersection graph, where x is the unit ball corresponding to (a vertex or an edge) x. With this idea, we could obtain hardness of Diameter-4. To obtain a lower bound for Diameter-3, we do not create unit balls for the middle set of vertices B; the path would then be aabbcc. The difficulty is to guarantee that ab only intersects bc, not b~c for some other vertex b~B; in the Diameter-4 case, this is enforced by the ball b. Here, we achieve the guarantee by introducing an angle parameter δ to control the intersections of the balls and prevent unwanted edges from being added. See Section 2.

The algorithms for Diameter-2 and 3 for unit cubes in Theorem 3 are perhaps most interesting. First, we show that the VC-dimension of the 2- and 3-neighborhoods of 3D unit cubes is bounded by a constant. Here we depart from existing techniques for the 2D case [14, 11, 8], which rely on the non-planarity of K5. In a small region, unit cubes behave like orthants, and so the intersection between unit cubes corresponds to a dominance relation. We divide the sequence of dominance relations on the length-2 and length-3 path into a number of special cases, bound the VC-dimension of each by 1 or 2 via direct arguments, and then bound the overall VC-dimension by combining subsystems together. See Section 3.1 and Section 4.1 for details.

Our VC-dimension bound, in combination with existing techniques [8], is enough to imply truly-subquadratic-time algorithms for Diameter-2 and Diameter-3, but because of large constants, the running time would be awfully close to quadratic (about O(n1.99999992) for Diameter-3). We further build on the proof ideas to give ultra efficient algorithms: In the case of Diameter-2, because the subsystems from various cases actually all have VC-dimension 1, we are able to use orthogonal range searching, in combination with divide-and-conquer, to achieve near-linear time. (Large constants appear in the logarithmic factors, instead of in the main polynomial factor.) For Diameter-3, because the subsystems from various cases actually turn out to be special kinds of 2-dimensional systems corresponding to pseudoline arrangements, we are able to use known range searching techniques, in combination with a grid approach, to achieve a more reasonable running time O~(n21/13). (We find it surprising that pseudolines turn out to be relevant for a problem about 3D unit cubes!) The technical details are intricate, as we need to work with abstract pseudolines that are only implicitly represented via certain oracles. See Section 3 and §4 of full paper for details.

Our constant bound on the VC-dimension of the 2- and 3-neighborhoods of 3D unit cube graphs suggests an intriguing open question of independent interest to combinatorial geometers: do r-neighborhoods similarly have bounded VC-dimension for all constant r>3?

Conjecture 4 (VC-Dimension of Unit-Cube Graphs).

There exists a function f such that the VC dimension of (V,{Nr[v]}vV,r0) is at most f(r), where Nr[v] is the r-neighborhood of v in the unit cube graph G=(V,E).

Combining with [8], Conjecture 4 would imply that unit-cube graphs of constant diameter admit a truly-subquadratic-time algorithm for computing diameter, which is a natural class of intersection graphs motivated by Question 1.

Unit-hypercubes in 4+D.

Next, we show that Diameter-3 is quadratic hard for unit hypercubes in 4D. Therefore, there is no longer a meaningful separation between unit hypercubes and unit balls in dimension 4. When the dimension is even higher, say at least 6D, we can get hardness results for Diameter-2, under the 3-uniform 6-hyperclique (3H6) hypothesis or combinatorial 4-clique (combK4) hypothesis, by refining Bringmann et al.’s previous proof [5] which required 12 dimensions. We also rule out near-linear time combinatorial algorithms in 4D under the combinatorial boolean matrix multiplication (BMM) hypothesis. See Section 2 of full paper for details.

Theorem 5.

Let ε(0,1) be any given parameter. There is no O(n2ε) algorithm for:

  1. 1.

    Diameter-3 for unit hypercubes in 4 under the OV hypothesis.

  2. 2.

    Diameter-2 of unit balls in 7 under the CombK4 hypothesis.

  3. 3.

    Diameter-2 for unit hypercubes in 6 and 10 under CombK4 / 3H6 hypotheses, resp.

Theorem 6.

Let ε(0,1) be any given parameter. There is no combinatorial O(n3/2ε) algorithm for Diameter-2 of unit hypercubes in 4 under the combinatorial BMM hypothesis.

Cubes and boxes.

In 2D, the intersection graphs of (non-unit) squares admit a truly subquadratic-time algorithm for computing the diameter (of any value) [8]. In 3D, we show that for (non-unit) cubes, Diameter-3 is quadratic-hard; this, along with the algorithms in Theorem 3, gives a separation between cubes and their unit counterparts. In contrast, we show that Diameter-2 of (non-unit) cubes is solvable in truly-subquadratic time. Even for the more general case of 3D boxes, we also obtain a truly-subquadratic-time algorithm. (Note that this result is new even for 2D rectangles!) Instead of relying on VC-dimension, this subquadratic algorithm uses a different, grid-based approach. Grid-based approaches have been used before for solving other problems about boxes [7, 10], but one challenge arises from the fact that 3D boxes (or cubes) have quadratic union complexity, unlike 3D unit cubes or orthants. We show that in the case of diameter 2, some of the sides are irrelevant and some boxes can actually be replaced by orthants. See Section 5 of full paper for details.

Theorem 7.

There is no O(n2ε) algorithm for Diameter-3 for (non-unit) cubes in 3 under the OV hypothesis for any ε>0. On the other hand, Diameter-2 can be solved in time O~(n21/5) for cubes and O~(n21/6) for boxes in 3.

Finite VC-dimension as a sufficient condition?

Our collection of results for many types of objects in 2D (in the companion paper [9]) and higher-dimensional cases reinforces the same pattern: truly subquadratic-time algorithms are mostly for graphs with bounded VC dimension. We conjecture that these are special cases of a broader phenomenon.

Conjecture 8 (VC-Dimension vs Diameter Conjecture).

Diameter-Δ of the intersection graph of low-complexity geometric objects (regardless of the dimension) can be solved in truly-subquadratic time if the VC dimension of Δ-neighborhoods is bounded by a constant.

Here, by low-complexity, we mean that the geometric object has constant description complexity. A positive resolution of Conjecture 8 would provide a powerful algorithmic tool for solving the diameter problem on geometric intersection graphs. A non-trivial test case for Conjecture 8 is (non-unit) disks in 2D: the distance VC dimension is at most 4 [11] whereas currently there is no known truly-subquadratic algorithm even for Diameter-2.

It is tempting to strengthen Conjecture 8 to an “if and only if” statement; however, our truly-subquadratic algorithm for Diameter-2 of boxes in Theorem 7 provides a counter-example: the intersection graphs of diameter 2 for boxes and rectangles have unbounded VC-dimension. (For proof of unbounded VC-dimension, see the full paper for details)

Graph preliminaries.

Throughout this paper, let G=(V,E) be a geometric intersection graph on n geometric objects 𝒪. The input will be 𝒪 and the graph will be implicit. We use d(u,v) to denote the distance between two vertices u,vV in G. We denote the 1-hop neighborhood of a vertex vV by N[v], and the r-neighborhood ball of v by Nr[v]{uV:d(u,v)r}.

Shatter dimension.

For a set system (U,), define Sh(n):=max|S|=n|{SF:F}|. The shatter dimension of the set system is the minimum d such that Sh(n)=O(nd). By the Sauer-Shelah Lemma [20, 21], if the VC-dimension is d, then the shatter dimension is d. The converse partially holds: if the shatter dimension is d, then the VC-dimension is O(dlogd).

2 Diameter-3 for Unit Balls in 3D

Theorem 9.

Assuming the OV hypothesis, there is no O(n2ε) time algorithm for deciding if the intersection graph of a given set of n unit balls in 3 has diameter at most 3.

The reduction is from Diameter-2 for n-vertex sparse tripartite graphs G=(ABC,E), where the number of edges m is O~(n). It is well-known that solving Diameter-2 for sparse tripartite graphs in truly-subquadratic time would break the OV hypothesis [19].

Lemma 10 (Diameter-2 sparse tripartite graphs).

There is no O(n2ε) time algorithm for deciding if a sparse tripartite graph has diameter at most 2, assuming the OV hypothesis.

In this section, we work with balls of radius 1/2 instead of 1. Let ε=Θ(1/n4) and δ=Θ(1/n3). First, we map every vertex v in AC to a distinct number, also denoted by v, in [ε,2ε], such that mina1,a2A:a1a2|a1a2|Ω(ε/n) and minc1,c2C:c1c2|c1c2|Ω(ε/n). Vertices of B are mapped to distinct numbers in [0.9,1] such that minb1,b2B:b1b2|b1b2|Ω(1/n). Then we create four sets of balls as follows.

  1. 1.

    For every vertex aA, we add a ball centered at sa=(1+acosδ,asinδ,0).

  2. 2.

    For every edge (a,b)(A×B)E, we add a ball centered at pab=(1+acosδbsinδ,asinδ+bcosδ,1b2).

  3. 3.

    For every edge (b,c)(B×C)E, we add a ball centered at qbc=(c,b,1b2).

  4. 4.

    For every vertex cC, we add a ball centered at tc=(c,0,0).

Let i be the set of balls created in step i for i[4] and ii. Observe that:

Observation 11.

Let p be the ball of radius 1/2 centered at a point p. We have:

  1. 1.

    sapa~b if and only if a=a~.

  2. 2.

    pabqb~c if and only if b=b~.

  3. 3.

    pbctc~ if and only if c=c~.

  4. 4.

    Every two balls in i intersect for every i[4].

  5. 5.

    For any two balls b1i and b2j such that |ij|2, b1b2=.

Proof.

For item 1, observe that

sapa~b22=((aa~)cosδ+bsinδ)2+((aa~)sinδbcosδ)2+1b2=(aa~)2(cos2δ+sin2δ)+b2(sin2δ+cos2δ)+1b2=(aa~)2+1,

which is exactly 1 if a=a~, and at least 1+Ω(1/n10) if |aa~|Ω(ε/n).

For item 2, observe that

pabqb~c22=(1+acosδbsinδ+c)2+(asinδ+bcosδb~)2+(1b21b~2)2=(1+Θ(ε)Θ(δ)+Θ(ε))2+(Θ(εδ)+bΘ(δ2)b~)2+(1b21b~2)2=(1Θ(1/n3))2+(|bb~|±Θ(1/n6))2+(1b21b~2)2,

which is 1Θ(1/n3) if b=b~, and at least 1+Ω(1/n2) if |bb~|Ω(1/n).

For item 3, observe that qbctc~22=(c~c)2+1, which is exactly 1 if c=c~, and at least 1+Ω(1/n10) if |cc~|Ω(ε/n). Item 4 is easy to check. For item 5, observe that satc21+acosδ+c1+Ω(1/n4), whereas saqbc2 and pabtc2 are both 2±o(1).

In the real RAM model, balls can clearly be constructed in O(n+m)=O~(n) time. In the RAM model, it suffices to approximate all coordinates up to O(1/n10) additive error, which can be done in O~(1) time (we could actually pick “nice” choices of bB so that b and 1b2 are both rational, and also a nice δ so that cosδ and sinδ are both rational). Thus, the reduction can be done in O~(n) time. Theorem 9 follows from the following lemma.

Lemma 12.

Let K be the intersection graph of the set of balls . Then G has diameter at most 2 if and only if K has diameter at most 3.

Proof.

Observe by item 4 of Observation 11 that the balls in the same set i induce a clique in K. By item 5 of Observation 11, there is no edge between two balls in i and j when |ji|2. Thus, K has diameter at most 3 if and only if for every ball sa1 and every ball tc4, dK(sa,tc)3. Here we slightly abuse the notation by using the center of the ball to denote the corresponding vertex in K.

Suppose that G has diameter at most 2. Let P=(a,b,c) be any path of length 2 in G. Then by Observation 11, (sa,pab,qbc,tc) is a path of length 3 in K. Thus, K has diameter at most 3 by the above observation. For the other direction, if K has diameter at most 3, then for any two vertices sa and tc (such that sa1 and tc4), a path of length 3 between sa and tc in K must be of the form (sa,pa~b,qb~c,tc). Then again by Observation 11, a=a~ and b=b~, and therefore, (a,b,c) is a path of length 2 in G.

3 A Near-Linear Diameter-2 Algorithm for 3D Unit Cubes

In this section, we present an O~(n)-time algorithm for testing whether the diameter of a 3D unit-cube graph is 2. This shows that the near-linear Diameter-2 result of Bringmann et al. [5] for 2D unit squares surprisingly extends to 3D (ignoring logarithmic factors). It also complements our lower bound result in Theorem 6, which shows conditionally that there are no similar, near-linear combinatorial Diameter-2 algorithms for 4D unit hypercubes.

In Section 3.1, we study the combinatorial problem of bounding the VC-dimension of the distance-2 neighborhoods of 3D unit-cube graphs as a warm-up. In the full version, we use ideas from the combinatorial proof to design a near-linear-time divide-and-conquer algorithm.

For a point p3, denote p the unit cube centered at p. For simplicity, assume that the input is in general position, e.g., all coordinates are distinct. We will solve the problem in a slightly more general setting for 3 point sets P,Q,R, testing whether all distances between p and r for (p,r)P×R are exactly 2 in the tripartite intersection graph of the unit cubes centered at P,Q,R. The original problem reduces to the case when P,Q,R are all equal to the input point set (or almost equal, if we want to ensure general position); the diameter of the original point set is at most 2 iff every pair in P×R has distance exactly 2.

3.1 VC-dimension bound

For two points p,q3, write pxq if p has smaller x-coordinate than q, and pxq if p has larger x-coordinate than q. Define y, y, z, z similarly. Define the trivial relation which is always true. A generalized dominance relation is a relation where pq iff pxq and pyq and pzq, for some choices of x{x,x,}, y{y,y,}, and z{z,z,}.

The motivation for considering generalized dominance relations is this: Consider a uniform grid with unit side-length. Inside a grid cell, any unit cube is equivalent to an orthant. If p lies in a grid cell and q lies in a neighboring grid cell, then the condition that p and q intersect corresponds precisely to pq for some generalized dominance relation.

Let P, Q, R be 3 point sets in 3. Let =(1,2) be 2 generalized dominance relations in 3. For each rR, we can write N2[r] as {pP:qQwithp1qandq2r}. Define the set system 𝒮(P,Q,R)(P,{N2[r]:rR}). We first prove that this set system has bounded VC-dimension by bounding its shatter dimension.

Previous proofs of bounded distance VC-dimension usually involve planarity arguments (avoidance of K5), but for the 3D problem here, we use a different strategy. We divide into easier cases based on the separability of the given point sets – in the following, we say that two sets are x-separated if they are separated by a plane orthogonal to the x-axis; we define y- and z-separation similarly. We first show how to handle the case when P and Q are both x- and y-separated by a simple direct argument:

Lemma 13.

If P and Q are both x- and y-separated, then 𝒮(P,Q,R) has VC-dimension 1.

Proof.

Consider points p,pP. Suppose {p} and {p} are both shattered (by 𝒮(P,Q,R)). Then there exist r,rR with pN2[r], pN2[r], pN2[r], pN2[r]. Let q,qQ with p1q2r and p1q2r.

For any i, we define ix, iy, and iz to be the x-, y-, and z-coordinate dominance relation, respectively. Because P and Q are x- and y-separated, we already know that p1xq, p1yq, and p1xq, p1yq. Note that p1zq or p1zq, because otherwise, we must have 1z and q1zp1zq1zp1zq: a contradiction. Thus, p1q or p1q, implying pN2[r] or pN2[r].

We then handle the case when P and R are separated along all 3 axes.

Lemma 14.

If P and R are x-, y-, and z-separated, then 𝒮(P,Q,R) has shatter dimension at most 6.

Proof.

Without loss of generality, say P(,0)3 and R(0,)3. Consider the following 6 set systems of the form 𝒮(P,QΛ,R), where Λ can be one of

((0,)×(0,)×), (×(0,)×(0,)), ((0,)××(0,)),
((,0)×(,0)×), (×(,0))×(,0)), ((,0)××(,0)).

Each set system has VC-dimension at most 1 by Lemma 13 (or symmetric variants).

Each set in 𝒮(P,Q,R) can be expressed as the union of 6 sets (one of each) from these 6 set systems (since a point qQ must has two positive coordinates or two negative coordinates). So, the number of distinct sets in 𝒮(P,Q,R) is at most O(|P|6).

It remains to reduce the general case to the case when P and R are separated along all 3 axes. We accomplish this by a simple grid idea:

Lemma 15.

For any P,Q,R3, 𝒮(P,Q,R) has shatter dimension at most 51.

Proof.

Build a (non-uniform) grid formed by the x-, y-, and z-coordinates of all the points of P. The grid has O(|P|3) cells. For each grid cell interior γ, consider the 8 octants at an arbitrary point inside γ; for each such octant τ, the set system 𝒮(Pτ,Q,Rγ) has shatter dimension at most 6 by Lemma 14. For each rRγ, the set N2[r] is the union of 8 sets (one of each) from the set systems for the 8 octants. So for each γ, the number of distinct sets in {N2[r]:rRγ} is O((|P|6)8), summing across all cells gives |{N2[r]:rR}|=O(|P|3(|P|6)8).

We can now bound the shatter dimension for unit cubes.

Lemma 16.

For any P,Q,R3 with R(0,1)3, write N2[r] as

{pP:qQwith q intersecting both p and r}.

Then the set system (P,{N2[r]:rR}) has shatter dimension at most 37179.

Proof.

Fix α=(αP,αQ)(3)2 with αPαQ1. For pαP+(0,1)3 and qαQ+(0,1)3, p intersects q iff pαP1qαQ, where we define 1x to be x if x(αQ)=x(αP)+1, and x if x(αQ)=x(αP)1, and if x(αQ)=x(αP); we define 1y and 1z in the same way. Similarly, for qαQ+(0,1)3 and r(0,1)3, q intersects r iff qαQ2r for some generalized dominance relation 2. Define the set system 𝒮α𝒮(P(αP+(0,1)3)αP,(Q(αQ+(0,1)3))αQ,R).

Each set N2[r] is the union of at most 272 sets (one of each) from the set systems 𝒮α for the at most 272 choices of α. By Lemma 15, we have |{N2[r]:rR}|=O((|P|51)272).

Theorem 17.

For any P,Q,R3, the set system (P,{N2[r]:rR}) has shatter dimension at most 37179.

Proof.

Build a uniform grid of side length 1. For each grid cell αR+(0,1)3 (with αR3), the number of different N2[r] sets over all rR(αR+(0,1)3) is O(|P(αR+(2,3)3)|37179) by Lemma 16. Since each point pP belongs to O(1) number of expanded cells αR+(2,3)3, the sum over all αR is O(|P|37179).

In the interest of simplicity, we have not optimized the above constant (which admittedly is quite large, but fortunately will not matter in our final algorithm).

3.2 Algorithm

Knowing that the VC-dimension is bounded, we could apply the framework of Chan et al. [8] to obtain a subquadratic algorithm for Diameter-2 of 3D unit cubes. However, the exponent would be very close to 2 (much worse than our more general result for arbitrary 3D boxes in Theorem 7, see the full version). We present a faster, direct algorithm that runs in near-linear time. The key observation is that although the final shatter dimension bound is large, the proof in Section 3.1 tells us that the set system is in some sense “made up of” a constant number of simpler subsystems with much smaller VC-dimension, namely, VC-dimension 1 (Lemma 13)! We can’t just solve the problem for each subsystem separately – the diameter problem isn’t decomposable that way. Instead, we “encode” each subsystem by adding a single coordinate value to each element, and in the end reduce the whole problem to an orthogonal range searching problem for vectors in a sufficiently large constant dimension. Due to lack of space, see the full version of the paper for the algorithm.

4 Subquadratic Diameter-3 Algorithm for 3D Unit Cubes

In this section, we present a subquadratic algorithm for testing whether the diameter of a 3D unit-cube graph is at most 3. This complements our lower bound results, which show conditionally that there are no similar Diameter-3 algorithms for 3D unit-ball graphs (Theorem 9) nor for 4D unit-hypercube graphs (Theorem 6). This result is more challenging than our result for diameter 2 in Section 3. As before, we warm up by studying the corresponding combinatorial problem of bounding the VC-dimension of the 3-neighborhoods of 3D unit-cube graphs (Section 4.1). The combinatorial proof will reveal a surprising connection to 2D pseudolines that we defer to the full paper.

Again, for a point p3, recall that p denotes the unit cube centered at p. For simplicity, assume all coordinates are distinct. Like before, we will solve the problem in a slightly more general setting for 4 point sets P,Q,R,S, testing whether all distances between p and s for (p,s)P×S are at most 3 in the 4-partite intersection graphs of the unit cubes centered at P,Q,R,S.

4.1 VC-dimension bound

Following Section 3.1, we begin with the corresponding problem for generalized dominance relations. Let P,Q,R,S be four point sets in 3. Let =(1,2,3) be three generalized dominance relations in 3. For each sS, we can write N3[s] as {pP:(q,r)Q×Rwithp1qandq2randr3s}. Define the set system 𝒮(P,Q,R,S)(P,{N3[s]:sS}). We first prove that this set system has bounded shatter dimension.

As in Section 3.1, we do not use planarity arguments like previous proofs. Instead, we divide into cases based on separability of the given point sets. But as we go from 2- to 3-neighborhoods, we face more challenges. The first case turns out to be the most crucial (and interesting), where as the one that follows it is similar to Lemma 14.

Lemma 18.

If P and Q are x-separated, Q and R are y-separated, and R and S are z-separated, then the set system 𝒮(P,Q,R,S) has VC-dimension at most 2.

Proof.

Suppose pjq iff pjxq and pjyq and pjzq with jx{x,x,}, jy{y,y,}, and jz{z,z,}. We may assume that 1x (because if not, we can shift all the x-coordinates of P sufficiently far downward and replace 1x with x), and similarly, all other jx,jy,jz are not . We first prove the following property:

Property: Let p,pP and s,sS. If pN3[s], pN3[s], pN3[s], pN3[s], then pyp implies sys, where y{y,y} is a relation determined solely from the choices of 1,2,3.

Proof: Let q,qQ and r,rR with p1q2r3s and p1q2r3s. We may assume neither p1q nor p1q, because otherwise, pN3[s] or pN3[s]. Because P and Q are x-separated, we already know p1xq and p1xq. So, there are two remaining possibilities: (i) p1yq1yp1yq and p1zq1zp1zq, or (ii) p1yq1yp1yq and p1zq1zp1zq. (See Figure 1.)

Define 1z{z,z} to be 1z iff 1y is y. Then pyp implies q1zq.

Similarly, we may assume neither q2r nor q2r, because otherwise, pN3[s] or pN3[s]. Because Q and R are y-separated, q2yr and q2yr. There are two remaining possibilities: (i) q2zr2zq2zr and q2xr2xq2xr, or (ii) q2zr2zq2zr and q2xr2xq2xr.

Define 2x{x,x} to be 2x iff 2z is 1z. Then q1zq implies r2xr.

Similarly (and lastly), we may assume neither r3s nor r3s, because otherwise, pN3[s] or pN3[s]. Because R and S are z-separated, r3zs and r3zs. There are two remaining possibilities: (i) r3xs3xr3xs and r3ys3yr3ys, or (ii) r3xs3xr3xs and r3ys3yr3ys.

Define y{y,y} to be 3y iff 3x is 2x. Then r2xr implies sys.

Figure 1: In the yz plane, if p is dominated by q and p is dominated by q, but p is not dominated by q and p is not dominated by q, then (i) and (ii) depict the only two possibilities.

Now, consider 3 points p,p,p′′P, with pypyp′′. Suppose {p,p′′} and {p} are both shattered. Then there exist s,sS with p,p′′N3[s], pN3[s], pN3[s], p,p′′N3[s]. Applying the property twice yields sys and sys: a contradiction.

Lemma 19.

If (a) P, Q are both x- and y-separated, or (b) Q, R are both x- and y-separated, or (c) R, S are both x- and y-separated, then 𝒮(P,Q,R,S) has VC-dimension 1.

Proof.

Consider 2 points p,pP. Suppose {p} and {p} are both shattered. Then there exist s,sS with pN3[s], pN3[s], pN3[s], pN3[s]. Let q,qQ and r,rR with p1q2r3s and p1q2r3s.

For (a), p1xq, p1yq, and p1xq, p1yq by the separation assumptions. Note that p1zq or p1zq, because otherwise, q1zp1zq1zp1zq: a contradiction. Thus, p1q or p1q, implying pN3[s] or pN3[s].

Claims (b) and (c) follow from a similar argument.

We now handle the case when P and S are separated along all 3 axes, by invoking the previous cases some constant number of times:

Lemma 20.

If P and S are x-, y-, and z-separated, then 𝒮(P,Q,R,S) has shatter dimension at most 21.

Proof.

Denote + and to be (0,) and (,0), respectively. Without loss of generality, say P3 and S+3. Consider the following 15 set systems.

𝒮(P, Q(+××), R(×+×), S)
𝒮(P, Q(×+×), R(××+), S)
𝒮(P, Q(××+), R(+××), S)
𝒮(P, Q(×+×), R(+××), S)
𝒮(P, Q(××+), R(×+×), S)
𝒮(P, Q(+××), R(××+), S)
𝒮(P, Q(+×+×), R, S)
𝒮(P, Q(+××+), R, S)
𝒮(P, Q(×+×+), R, S)
𝒮(P, Q(××), R(+×+×), S)
𝒮(P, Q(××), R(+××+), S)
𝒮(P, Q(××), R(×+×+), S)
𝒮(P, Q, R(××), S)
𝒮(P, Q, R(××), S)
𝒮(P, Q, R(××), S).

The first 6 set systems have VC-dimension at most 2 by Lemma 18 (or symmetric variants); the next 9 have VC-dimension 1 by Lemma 19 (or symmetric variants).

Each set in 𝒮(P,Q,R,S) can be expressed as the union of 15 sets one from each of these 15 set systems: this is because, in any point sequence p,q,r,s with p(,0)3 and s(0,)3, there must be a consecutive pair going from negative to positive x-coordinate, and a consecutive pair going from negative to positive y-coordinate, and a consecutive pair going from negative to positive z-coordinate; all 3 such pairs could be distinct, or 2 of them could be the same. So, |𝒮(P,Q,R,S)|=O((|P|2)6|P|9). We can now reduce the general case to the case when P and S are separated along all 3 axes.

Lemma 21.

For any P,Q,R,S3, 𝒮(P,Q,R,S) has shatter dimension 171.

Proof.

Build a (non-uniform) grid formed by the x-, y-, and z-coordinates of all the points of P. The grid has O(|P|3) cells. For each grid cell γ, consider the 8 octants at an arbitrary point inside γ; for each such octant τ, the set system 𝒮(Pτ,Q,R,Sγ) has shatter dimension at most 18 by Lemma 20. For each sSγ, the set N3[s] is the union of 8 sets (one of each) from the set systems for the 8 octants. So for each γ, the number of distinct sets in {N3[s]:sSγ} is O((|P|21)8). Thus, we have |{N3[s]:sS}|=O(|P|3(|P|21)8).

As before, unit cubes reduce to generalized dominance relations:

Lemma 22.

For any P,Q,R,S3 with S(0,1)3, write N3[s] as

{pP:(q,r)Q×Rs.t. p intersects qq intersects r, and r intersects s}.

Then the set system (P,{N3[s]:sS}) has shatter dimension at most 3365793.

Proof.

Fix α=(αP,αQ,αR)(3)3 with αR,αQαR,αPαQ1. For pαP+(0,1)3 and qαQ+(0,1)3, p intersects q iff pαP1qαQ, for some generalized dominance relation 1 as in the proof of Lemma 16. Similarly, for qαQ+(0,1)3 and rαR+(0,1)3, q intersects r iff qαQ2rαR for some generalized dominance relation 2. Similarly, for rαR+(0,1)3 and s(0,1)3, r intersects s iff rαR3s for some generalized dominance relation 3. Define the set system 𝒮α=𝒮(P(αP+(0,1)3)αP,(Q(αQ+(0,1)3))αQ,(R(αR+(0,1)3))αR,S).

Each set N3[s] is the union of at most 273 sets (one of each) from the set systems 𝒮α for the at most 273 choices of α. By Lemma 21, we have |{N3[s]:sS}|=O((|P|171)273).

Theorem 23.

For any P,Q,R,S3, the set system (P,{N3[s]:sS}) has shatter dimension at most 3365793.

Proof.

Build a uniform grid of side length 1. For each grid cell αS+(0,1)3 (with αS3), the number of different N3[s] sets over all sS(αS+(0,1)3) is O(|P(αS+(3,4)3)|3365793) by Lemma 22. Since each point pP belongs to O(1) number of expanded cells αS+(3,4)3, the sum over all αS is O(|P|3365793).

4.2 Algorithm

Knowing that the VC-dimension is bounded, we could at this point apply the framework of [8] to obtain a subquadratic algorithm for Diameter-3 in 3D unit cubes. However, the exponent would be extremely close to 2 (around 21/(43365794)1.99999993). We present a faster, direct algorithm with a more reasonable exponent smaller than 2. The key observation is that although the final shatter dimension bound is large, the proof in Section 4.1 tells us that the set system is in some sense “made up of” a (very large but) constant number of simpler subsystems with much smaller VC-dimension, of 1 and 2 (Lemma 18 and Lemma 19). As in our Diameter-2 algorithm, we can’t just solve the problem for each subsystem separately, because the diameter problem isn’t decomposable. Instead, we “encode” each subsystem as an extra “2-dimensional constraint”, and in the end reduce the whole problem to a “multi-level” range searching problem in a sufficiently large constant dimension.

Multi-level range searching [2, 18] is usually solved by sampling-based geometric divide-and-conquer techniques, e.g., via so-called “cuttings”, but analogs of cuttings provably do not exist for abstract set systems, even with VC-dimension 2 (e.g., see [3, Remark 4.7]). Fortunately, our proof of VC-dimension 2 in the full paper reveals a stronger property, namely, that the 3-neighborhoods there actually form a point-pseudoline system. (It is quite unexpected that 3D unit cubes could naturally produce pseudoline arrangements.) Cuttings and multi-level range searching exists for pseudolines. Due to lack of space, details of the algorithm are given in the full paper.

References

  • [1] A. Karim Abu-Affash, Paz Carmi, Anil Maheshwari, Pat Morin, Michiel Smid, and Shakhar Smorodinsky. Approximating maximum diameter-bounded subgraph in unit disk graphs. Discret. Comput. Geom., 66(4):1401–1414, 2021. doi:10.1007/s00454-021-00327-y.
  • [2] Pankaj K Agarwal. Range searching. In Handbook of discrete and computational geometry, pages 1057–1092. Chapman and Hall/CRC, 2017. doi:10.1201/9781315119601.
  • [3] Sujoy Bhore, Timothy M. Chan, Zhengcheng Huang, Shakhar Smorodinsky, and Csaba D. Tóth. Sparse bounded hop-spanners for geometric intersection graphs. In Oswin Aichholzer and Haitao Wang, editors, 41st International Symposium on Computational Geometry, SoCG 2025, Kanazawa, Japan, June 23-27, 2025, volume 332 of LIPIcs, pages 17:1–17:15. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2025. doi:10.4230/LIPIcs.SOCG.2025.17.
  • [4] Nicolas Bousquet and Stéphan Thomassé. VC-dimension and Erdős–Pósa property. Discret. Math., 338(12):2302–2317, 2015. doi:10.1016/j.disc.2015.05.026.
  • [5] Karl Bringmann, Sándor Kisfaludi-Bak, Marvin Künnemann, André Nusser, and Zahra Parsaeian. Towards sub-quadratic diameter computation in geometric intersection graphs. In Xavier Goaoc and Michael Kerber, editors, 38th International Symposium on Computational Geometry, SoCG 2022, Berlin, Germany, June 7-10, 2022, volume 224, pages 21:1–21:16. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2022. doi:10.4230/LIPIcs.SoCG.2022.21.
  • [6] Sergio Cabello. Subquadratic algorithms for the diameter and the sum of pairwise distances in planar graphs. ACM Trans. Algorithms, 15(2):21:1–21:38, December 2019. doi:10.1145/3218821.
  • [7] Timothy M. Chan. Finding triangles and other small subgraphs in geometric intersection graphs. 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 1777–1805. SIAM, 2023. doi:10.1137/1.9781611977554.CH68.
  • [8] Timothy M. Chan, Hsien-Chih Chang, Jie Gao, Sándor Kisfaludi-Bak, Hung Le, and Da Wei Zheng. Truly subquadratic time algorithms for diameter and related problems in graphs of bounded VC-dimension. In 66th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 2728–2765, 2025. doi:10.48550/arXiv.2510.16346.
  • [9] Timothy M. Chan, Hsien-Chih Chang, Jie Gao, Sándor Kisfaludi-Bak, Hung Le, and Da Wei Zheng. Charting the diameter computation landscape on intersection graphs in 2D, 2026. Under preparation.
  • [10] Timothy M. Chan, Qizheng He, and Yuancheng Yu. On the fine-grained complexity of small-size geometric set cover and discrete k-center for small k. In Kousha Etessami, Uriel Feige, and Gabriele Puppis, editors, 50th International Colloquium on Automata, Languages, and Programming, ICALP 2023, Paderborn, Germany, July 10-14, 2023, volume 261 of LIPIcs, pages 34:1–34:19. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2023. doi:10.4230/LIPIcs.ICALP.2023.34.
  • [11] 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, Athens, Greece, June 11-14, 2024, volume 293, pages 38:1–38:14. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2024. Arxiv version https://arxiv.org/abs/2401.12881. doi:10.4230/LIPIcs.SoCG.2024.38.
  • [12] 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.
  • [13] Guillaume Ducoffe, Michel Habib, and Laurent Viennot. Diameter, eccentricities and distance oracle computations on H-minor free graphs and graphs of bounded (distance) vapnik-chervonenkis dimension. SIAM J. Comput., 51(5):1506–1534, 2022. doi:10.1137/20M136551X.
  • [14] Lech Duraj, Filip Konieczny, and Krzysztof Potępa. 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, Royal Holloway, London, United Kingdom, September 2-4, 2024, volume 308, pages 51:1–51:18. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2024. doi:10.4230/LIPIcs.ESA.2024.51.
  • [15] Paweł Gawrychowski, Haim Kaplan, Shay Mozes, Micha Sharir, and Oren Weimann. Voronoi diagrams on planar graphs, and computing the diameter in deterministic O~(n5/3) time. SIAM J. Comput., 50(2):509–554, 2021. doi:10.1137/18M1193402.
  • [16] 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.
  • [17] Jason Li and Merav Parter. Planar diameter via metric compression. In Moses Charikar and Edith Cohen, editors, Proceedings of the 51st Annual ACM SIGACT Symposium on Theory of Computing, STOC 2019, Phoenix, AZ, USA, June 23-26, 2019, pages 152–163, Phoenix, AZ, USA and New York, NY, USA, 2019. ACM. doi:10.1145/3313276.3316358.
  • [18] Jiří Matoušek. Range searching with efficient hierarchical cuttings. Discret. Comput. Geom., 10:157–182, 1993. doi:10.1007/BF02573972.
  • [19] Liam Roditty and Virginia Vassilevska Williams. Fast approximation algorithms for the diameter and radius of sparse graphs. In Dan Boneh, Tim Roughgarden, and Joan Feigenbaum, editors, Symposium on Theory of Computing Conference, STOC’13, Palo Alto, CA, USA, June 1-4, 2013, pages 515–524. ACM, 2013. doi:10.1145/2488608.2488673.
  • [20] Norbert Sauer. On the density of families of sets. J. Comb. Theory A, 13(1):145–147, 1972. doi:10.1016/0097-3165(72)90019-2.
  • [21] Saharon Shelah. A combinatorial problem; stability and order for models and theories in infinitary languages. Pacific Journal of Mathematics, 41(1):247–261, 1972. doi:10.2140/pjm.1972.41.247.