Charting the Landscape of Diameter Computation on Geometric Intersection Graphs in the Plane
Abstract
Computing the diameter of the intersection graphs of objects is a basic problem in computational geometry. Previous works showed that the complexity of computing the diameter mainly depends on the object types: for unit disks and squares in 2D, the problem is solvable in truly subquadratic time [9], while for other objects, including unit segments and equilateral triangles in 2D or unit balls and axis-parallel unit cubes in 3D, there is no truly subquadratic time algorithm under the Orthogonal Vector (OV) hypothesis [4].
We undertake a comprehensive study of computing the diameter of geometric intersection graphs for various types of objects. We discover many new irregularities, showing that the landscape is extremely nuanced: the source of hardness is a combination of the object type, the true diameter value, and how the objects intersect with each other. Our highlighted results for the 2D case include:
-
1.
The diameter of non-degenerate, axis-aligned line segments can be computed in truly subquadratic time. Previous hardness result [4] for line segments applies only to degenerate instances. On the other hand, for the degenerate case, we show that a truly subquadratic time algorithm exists when the true diameter is constant.
- 2.
-
3.
An -time algorithm to decide if the diameter of a unit-disk graph is at most 2. This improves upon the recent algorithm with running time [9].
-
4.
Deciding if the diameter of intersection graphs of fat triangles or line segments is at most 2 is truly subquadratic-hard under fine-grained complexity assumptions. Previous lower bounds [4] only hold when deciding if diameter is at most 3.
Our findings are presented in a pair of papers. This paper focuses solely on the 2D case, while the companion paper is devoted to higher-dimensional cases.
Keywords and phrases:
String graphs, Fine-grained complexityCategory:
Track A: Algorithms, Complexity and GamesFunding:
Timothy M. Chan: Supported by NSF grant CCF-2224271.Copyright and License:
and Da Wei Zheng; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Computational geometryEditors:
Sayan Bhattacharya, Danupon Nanongkai, Michael Benedikt, and Gabriele PuppisSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
Computing the diameter of sparse graphs is truly subquadratic hard: under the Strong Exponential Time Hypothesis (SETH), there is no algorithm for distinguishing diameter 2 vs. 3 of graphs with vertices and 111 hides polylogarithmic factors. edges [20]. This conditional lower bound implies that 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 [5, 16, 13, 18, 9].
For geometric intersection graphs, the complexity of diameter computation remains poorly understood due to the sheer diversity of geometric objects underlying the intersection graphs, for example, line segments, strings, (unit) disks, triangles, rectangles, balls, hypercubes, (axis-aligned) boxes, to name just a few. Another important subtlety is that intersection graphs can have edges; therefore, a truly subquadratic time algorithm must use an implicit graph representation. (In a geometric intersection graph, each vertex corresponds to a geometric object, and there is an edge between every two intersecting objects.)
The pioneering work by Bringmann et al. [4] studied computing the diameter of intersection graphs of several types of objects: axis-parallel unit segments, equilateral triangles, axis-parallel hypercubes, and balls. They showed that it is truly subquadratic hard to solve: (i) Diameter- for axis-parallel hypercubes in under the Hyperclique Hypothesis; (ii) Diameter- for (not necessarily axis-aligned) unit segments and equilateral triangles in under Orthogonal Vector (OV) Hypothesis; and (iii) Diameter- for unit balls and axis-parallel unit cubes in , and axis-parallel line segments in , all under OV Hypothesis. Here Diameter- asks to decide if a given input graph has diameter at most or at least . Notably, basic objects such as axis-aligned squares, disks, and their unit versions were absent from this list of lower bounds. However, the same paper showed that Diameter-2 for axis-aligned unit squares can be solved in time, which hinted at the possibility of truly subquadratic time for other diameter values and objects such as axis-aligned squares and (unit) disks. Later, Duraj, Konieczny, and Potępa [14] gave an algorithm with running time for Diameter- of axis-aligned unit squares: it is truly subquadratic when the true diameter is . Chang, Gao, and Le [11] (arXiv version) designed a truly subquadratic -approximation algorithm for the diameter of axis-aligned unit squares, unit disks, and more generally, similar-sized fat pseudo-disks. Recently, Chan et al. [9] gave algorithms for computing the exact diameter of unit disks and arbitrary axis-aligned squares; the running time is truly subquadratic regardless of the diameter value.
Altogether, the previous work reveals highly contrasting pieces of the complexity landscape of geometric intersection graphs which depend on object types: either computing a very small diameter (e.g., or ) is truly subquadratic hard for some objects, or the diameter can be computed in truly subquadratic time regardless of the value of the diameter for others.
We undertake a comprehensive study of computing the diameter of geometric intersection graphs for various types of objects. Our results are presented in two papers. The present paper focuses solely on the 2D case. All the previous truly subquadratic algorithms for diameter are for objects on the plane, and hence this basic case is of particular interest. We present numerous results, both positive and negative, on computing the diameter of the geometric intersection graphs of a wide variety of 2D objects. A high-level takeaway from our collection of results is that the complexity of computing the diameter depends not only on object type, but also on diameter range and how the objects intersect.
In the concurrent paper [8], we study objects in dimensions at least and present various upper and lower bounds. Both papers together show that the landscape of computing the diameter on geometric intersection graphs is much more nuanced than previously known.
| Graph class | Lower bound | Upper bound | |
|---|---|---|---|
| Unit disks | for general [9] for [9] | ||
| for (full version) | |||
| Axis-aligned squares | for [4] for [14] for general [9] | ||
| unit squares | for constant (Thm. 18) | ||
| general | for general [9] | ||
| Triangles in 2D | cong. & equi. | for (OV) [4] | |
| fat | for (3H6) (Thm. 22) | ||
| Line segments | unit-length | for (OV) [4] | |
| general | for (combK4) (Thm. 24) | ||
| axis-aligned w/ degeneracy | for general (OV) [4] | for any constant (Thm. 14) | |
| axis-aligned non-degenerate | for general (Thm. 10) | ||
| -slopes w/wo degen. | for & general (OV) (full version) | for constant & constant (Thm. 14) | |
| Strings | bends | for (3H6) (Thm. 20) | |
| bends | for (OV) (full version) | ||
1.1 Our Contributions
We focus on the intersection graphs of objects in 2D; see Table 1 for a complete catalog. Our first set of results concerns line segments. Previous results about line segments [4] are overwhelmingly negative: for unit line segments, Diameter-3 is (truly subquadratic) hard, and for axis-aligned unit segments, Diameter- is also hard when . For axis-aligned unit segments, the lower bound construction requires that there is an overlap between horizontal segments; in other words, the instance is degenerate. Both the requirement and the degeneracy seem like artifacts of the proof technique: better lower bounds seem achievable with a more refined technique. Surprisingly perhaps, we show that these “artifacts” are necessary by giving truly subquadratic-time algorithms otherwise. First, we provide a truly subquadratic algorithm for any diameter value on non-degenerate instances. Thus, degeneracy is a source of hardness for diameter computation. Second, we provide a truly subquadratic algorithm for Diameter- for any constant , even when the instances are degenerate. It implies that the diameter range is another source of hardness. Our second result holds even for a more general case of -slope line segments, where the slope of each segment is one of distinct values. (Axis-parallel line segments are -slope.) Finally, on the lower bound side, we strengthen the (truly subquadratic) lower bound for line segments by Bringmann et al. [4] from Diameter-3 under the OV hypothesis to Diameter-2 under the combinatorial 4-clique (combK4) hypothesis (Definition 8). We also give a separation between 2-slope and -slope non-degenerate segments: for 2-slope, we can get truly subquadratic time for any diameter value, whereas for 3-slope, the problem becomes hard for diameter .
Theorem 1.
Let be the intersection graph of line segments.
-
1.
Truly subquadratic algorithms:
-
Diameter can be solved in time for non-degen. axis-aligned line segments.
-
Diameter- can be solved in time for -slope line segments. Thus, the running time is truly subquadratic for any constant and .
-
-
2.
Lower bounds: there is no time algorithm for any constant for:
-
Diameter-2 for general line segments under the CombK4 hypothesis.
-
Diameter- for 3-slope non-degenerate line segments under the OV hypothesis.
-
To obtain the algorithms in Theorem 1, we apply the framework of Chan et al. [9]: (1) bounding the VC-dimension of the set system , where is the -neighborhood of , and (2) designing a geometric data structure for the objects. For line segments, the geometric data structure follows from standard techniques. The main difficulty is to bound the VC-dimension. We do so by decomposing into so-called types where each type induces a subset of set systems whose corresponding shortest paths share the same “color pattern”. We use the color pattern on top of the standard crossing argument to bound the VC-dimension of each subset. Our technique naturally generalizes to string graphs, giving the following theorem. See Section 3 for the details.
Theorem 2.
Let be the intersection graph of strings on the plane.
-
1.
If is bipartite, then the VC-dimension of is at most 8.
-
2.
If has diameter and chromatic number , then the VC-dimension of is .
Our lower bound for Diameter-2 for general line segments in Theorem 1 is inspired by the lower bound for Diameter-2 for axis-parallel hypercubes in from the hyperclique hypothesis by Bringmann et al. [4]. It is somewhat surprising that their proof approach can be carried out in dimension as low as 2 for line segments – a key challenge in such a reduction is avoiding unintended crossings of objects, which is tougher to do in 2D; see Section 6.
The VC-dimension underpins most recent truly subquadratic diameter algorithms. A major open question is to design an algorithm with nearly linear running time for the truly subquadratic easy cases. The VC-dimension technique does not seem suited for this fast running time. Only Diameter-2 for axis-aligned unit squares [4] is known to admit time. Here we give an almost linear () time algorithm222 notation hides a subpolynomial factor . for unit-square graphs of any constant diameter. Our algorithm is far more involved than the previous algorithm for diameter 2 (which did not work even for diameter 3), and uses a novel -way divide-and-conquer approach based on the coordinate values modulo 1. We identify a key special case that can be reduced to orthogonal range searching, not in dimension 2 but in a dimension that grows as a function of the diameter! Afterwards, we recursively reduce to this key special case. See Section 4 for the details. We are not aware of too many low-dimensional geometric problems that are solved using orthogonal range searching in a much higher dimension as a function of some parameter (one example is Cabello and Knauer’s algorithms for distance problems on bounded-treewidth graphs [6], but our algorithm is quite different).
Another simple, yet highly non-trivial, problem is Diameter-2 for unit disks; orthogonal range searching does not seem to help here. The best running time, based on VC-dimension, is [9]. Here, we improve the running time for Diameter-2 for unit disks to . Notably, we do not use VC-dimension. Instead, we exploit the fact that 1-neighborhoods behave like pseudodisks, and adapt known range searching techniques for pseudodisks. Note that our pseudodisks have non-constant complexity and can only be represented implicitly (similar ideas were used before in Agarwal, Sharir, and Welzl’s algorithm for the discrete 2-center problem [2]). See the full version for the details. The bound is natural for many problems about unit disks (related to Hopcroft’s problem); for example, the current best algorithm for counting the number of edges in a unit disk graph requires time [10].
Theorem 3.
Let be an intersection graph with vertices.
-
Diameter- can be solved in time when vertices of are axis-aligned unit squares.
-
Diameter-2 can be solved in time when vertices of are unit disks.
Finally, we show new lower bounds for triangles and strings. Since line segments are strings, our lower bounds for line segments also hold for strings. For triangles, we show that Diameter-2 is subquadratically hard even when the triangles are fat; the previous lower bound is only for Diameter-3 and non-fat triangles [4]. Here we follow the same idea in our lower bound for Diameter-2 of line segments in Theorem 1. The key challenge is handling the unintended crossings of triangles in 2D. The fatness requirement makes the overall argument more delicate. We then obtain the lower bound for Diameter-2 of strings with complexity as a simple corollary; details are given in Section 5. For strings of complexity, we show that Diameter-1 is subquadratically hard. Observe that Diameter-1 problem is equivalent to deciding if the intersection graph of a given set of objects is a clique. For objects that are semialgebraic sets of constant description complexity, Diameter-1 can be solved in truly subquadratic time by known data structures for intersection searching [3]. Our lower bound in Theorem 4 shows that the problem is hard for strings of complexity by a reduction from OV. The idea is to create a polygonal chain of vertices from each vector of dimension , such that there are two orthogonal vectors if and only if there are two non-intersecting chains; details are given in the full version.
Theorem 4.
There is no time algorithm for constant for:
-
Diameter- of fat triangles or strings of complexity under the 3-uniform 6-hyperclique hypothesis.
-
Diameter- of strings of complexity under OV hypothesis.
2 Preliminaries
Graph preliminaries.
Throughout this paper, we will let be a geometric intersection graph of geometric objects . We will assume that we are given the geometric objects . In this paper, we mostly consider connected objects that have complexity, unless noted otherwise. We use to denote the distance between two vertices in . We denote the 1-hop neighborhood of a vertex by , and the -neighborhood ball of by . For any two vertices and , we denote by the shortest path between them and its number of edges.
VC-dimension.
Given a set system with a ground set and a family of subsets of , its VC-dimension is the cardinality of the largest such that is shattered by – for every , there is some such that . We denote this VC-dimension by . We say that a graph has distance VC-dimension at most if the set system of neighborhood balls has VC dimension at most .
Let and be two families of subsets of the same ground set . We define . It is well known that:
Lemma 5 (Vapnik [21]).
.
Fine-grained complexity hypotheses.
Recent development of fine-grained complexity has identified a few hypotheses that we include here for completeness. We use them to prove our lower bounds.
Definition 6 (Orthogonal Vectors (OV) hypothesis).
Given sets of vectors in with , deciding whether there exists an orthogonal pair requires time.
Definition 7 (3-uniform 6-hyperclique (3H6) hypothesis [19]).
Given a -partite -uniform hypergraph where is the disjoint union of vertex set , each containing vertices, and such that each edge connects three vertices from different vertex sets. The problem is to decide whether there are vertices with , , forming a -clique, i.e., for all . The 3H6 hypothesis says that the problem requires time.
3 Line Segments and String Graphs
A string graph is an intersection graph of curves in the plane. Each curve is called a string. Note that intersection graphs of line segments are string graphs. In this section, we will devote to proving VC-dimension bounds for string graphs that will give subquadratic diameter algorithms for line-segment intersection graphs. Once we have upper bounds for VC-dimension, we can apply (variations of) the algorithmic framework of [9] to obtain subquadratic time algorithms.
Our key technical contribution in this section is a new color-based argument to bound the VC dimension. To set the stage, we need to introduce the notion of canonical curves. Let be the intersection graph of (connected) objects. For each object corresponding to a vertex , we pick a point as a representation of . For a path between two vertices and in , there is a planar curve, denoted by , that connects and , and traces the objects corresponding to the vertices in . We call the canonical curve of . For a pair of vertices and , we define their canonical curve to be the canonical curve of the shortest path in between and . (We will fix one arbitrary shortest path per pair to define the canonical curve.) We say that two paths and of cross on the plane if they do not share any endpoint and their canonical curves intersect in . Note that and might be vertex-disjoint; see Figure 1(a).
Our starting point is the -avoidance argument by Chang, Gao, and Le [11] for showing that the distance VC-dimension of any intersection graph of pseudo-disks is at most 4, which we briefly review here. The proof is by contradiction: suppose that 5 vertices are shattered, then, for every two points and where , there is a (distinct) vertex whose neighborhood contains and only. The two canonical curves form a curve between and on the plane. The set of 5 points and 10 curves between these points form a drawing of on the plane. Then, by the Hanani–Tutte theorem, there exist two curves that do not share endpoints and cross (an odd number of times). Consequently, there exists and for four distinct indices such that and cross on the plane. Using the fact that objects are pseudo-disks, they conclude that either (i) or (ii) ; see Figure 1(b). In the former case, the neighborhood of contains , contradicting that only contains and ; in the latter case, the neighborhood of contains , contradicting that only contains and . The last part of the argument depends crucially on the fact that objects are pseudo-disks, and therefore, does not apply to strings and line segments (which are not pseudo-disks).
Here, we devise a new argument based on vertex coloring on top of the -avoidance technique. Our idea is best illustrated in the case of bipartite string graphs (in Section 3.1). Specifically, each vertex can be colored as or , depending on which side it belongs to. Then we can view each canonical curve as a sequence of alternating colors: . Following the setup of the -avoidance argument, when and cross on the plane, our key idea is to align the corresponding color sequences and at the crossing objects, which have different colors. Then, by a simple case analysis, we can still show that either (i) or (ii) as in the case of pseudo-disks and get a contradiction. We note that the color alignment argument holds only when there are two colors (due to bipartiteness); it does not hold when there are three or more colors. Indeed, for the case of three colors, we have a quadratic conditional lower bound by Theorem 1, and the VC-dimension is unbounded.
For string graphs of bounded chromatic number and bounded diameter, we decompose the set system into set systems of different types, each type corresponds to a fixed sequence of (vertex) colors. Then, for each sequence of colors , we define a notion of ball that contains all vertices reachable from by paths whose vertex colors form a subsequence of ; the goal is then to bound the VC dimension of . Our key insight is that, by restricting the color sequences in the definition of to be subsequences of , we could apply our color alignment argument again. The case analysis is more delicate, but the underlying idea remains the same as in bipartite string graphs. The proof is given in Section 3.2.
Finally, in Section 3.3, we adapt the argument for string graphs of bounded chromatic number and bounded diameter to (possibly degenerate) line segments with few slopes. Here, the new issue is that the colors are not proper: the endpoints of an edge could share the same color. We get around this issue by exploiting the fact that objects are line segments. Roughly speaking, if two segments and of the same slope, say horizontal, intersect, then one of the neighbors of will intersect (or vice versa). This means we can align the color of a neighbor of with that of , and hence the color alignment argument can be applied again.
3.1 Bipartite String Graphs
Theorem 9.
Every bipartite string graph has distance VC-dimension at most .
Proof.
Suppose that at least vertices are shattered by the set system, then at least vertices in one side, say , are shattered. Let these be . Let and be such that . We call the the radius associated with .
For every string corresponding to a vertex , we pick a point , as a representation of . Recall that for every two vertices and and a shortest path between them in graph , the canonical curve is a planar curve tracing the strings corresponding to vertices in that connects and .
Write the vertices of the canonical curve from to as a sequence of alternating colors of length : where each color corresponds to which set (either or ) the vertices belong. The initial color of is since . We’ll use the notation to denote the th color in the sequence and the notation to denote the contiguous subsequence of between the indices and .
To get a contradiction, we follow the -avoidance argument using the Hanani–Tutte theorem. Specifically, observe that and the set of curves form a drawing of on the plane. Then by the Hanani–Tutte theorem, there exist two curves not sharing endpoints that cross an odd number of times, i.e., the curves cross at least once. Suppose that the crossing pair of canonical curves were and for four distinct indices . We will show that the following two facts result in a contradiction.
-
1.
There are two vertices corresponding to a string on the canonical curve and corresponding to a string on where either or crosses (i.e. ).
-
2.
and .
Suppose that was the th vertex out of total vertices on the canonical curve and that was the th vertex out of total vertices on the canonical curve . Recall that as , we must have . Without loss of generality, assume that .
First we consider the case where . Then there must be a path from to corresponding to the concatenated sequence . However the length of this sequence is , which means that which is a contradiction.
Next we consider the case that and cross. Note that exactly one of and is in while the other is in . In particular, this means that , since both and are alternating sequences beginning with A, so . As both are integers, . Now this means that the path corresponding with the sequence has length at most which again means that , a contradiction.
In the full version we show that this VC-dimension bound can be easily used in the framework of [9] to obtain a subquadratic time algorithm.
Theorem 10.
The diameter of axis-aligned segments in general position can be computed in time.
This sharply contrasts with the conditional lower bound by Bringmann et al. [4] who showed that computing the diameter of an intersection graph of axis-aligned segments that are not in general position requires time for any .
3.2 String Graphs of Bounded Diameter and Chromatic Number
In this section, we prove the following VC-dimension bound for string graphs with bounded chromatic number and bounded diameter.
Theorem 11.
Let be a string graph with chromatic number and diameter . Then has VC-dimension at most .
The key insight into proving Theorem 11 is to decompose into set systems of different types, and show that each type has bounded VC-dimension. First, we introduce the types. Let be the set of sequences of length at most where each element of a sequence is a color in . Observe that .
We will use the notation to denote a directed path obtained from an undirected path by directing all the edges away from . If and are two vertices in such that is reachable from on the path, then we denote by the subpath from to . We consider a proper coloring of the vertices in with at most different colors. The colors of the vertices in induce a sequence of colors, say . We say that is an -rainbow path from to . If a sequence of colors is a (not necessarily contiguous) subsequence of , we write . For every sequence , let
| (1) |
We show that these carefully defined balls have bounded VC-dimension using a generalization of the bipartite argument.
Lemma 12.
for any sequence of colors .
Proof.
We follow the setup (and proof technique) of Theorem 9. In particular, is the set of vertices shattered by , and is such that . Then, there exist four distinct indices inducing an -rainbow path with canonical curve and an -rainbow path with canonical curve which cross. Note that and . We show the following result in a contradiction.
-
1.
There are two vertices corresponding to a string on the canonical curve and corresponding to a string on where either or intersects (i.e. ).
-
2.
and .
As is a subsequence of , there exist some mapping for such that if then , and for all , we have that (this is by the formal definition of subsequence). We call the -index of . We similarly define the to be the -index of . Let denote the index of in the path and for the index of in . Without loss of generality, assume that .
Now consider if . There must exist a path from to to with the sequence . Furthermore, and . Since , then it follows that which is a contradiction as this would mean .
On the other hand suppose there is an edge between and . Note that as and have different colors, we must have , meaning that and as -indices take on integer values, . There must exist a path from to to with the sequence . As and , this shows that . This means which is a contradiction.
Proof of Theorem 11.
Since the diameter of is , every shortest path from to induces a sequence of at most colors. Recall that is the set of all sequences of colors of length at most , so . Let and . Observe that , and hence
3.3 Intersection Graphs of Line Segments with Few Slopes
Recall that we say that a collection of line segments is -slope if the slopes of the line segments have distinct values. To show the following theorem, we will again use the Hanani-Tutte theorem, but now we must allow overlaps for the curves. We say that two curves cross if they cross in the traditional sense after some sufficiently small local perturbations, as in [15].
Theorem 13.
Let be an intersection graph of -slope line segments with diameter . Then has VC-dimension at most .
Proof.
It is tempting to directly apply Theorem 11 to prove Theorem 13, but a set of -slope line segments may be degenerate, so two line segments of the same slope can intersect, and therefore, the graph is not -colorable. However, we can still create a (non-proper) coloring of the geometric intersection graph where each line segment is colored by its slope, and define -rainbow paths for sequences of colors as before. The only issue occurs in the proof of Lemma 12. If two canonical paths considered share any vertices we can apply the argument in Lemma 12.
It suffices to show that we can always find two adjacent vertices that correspond to different -indices. Unfortunately, the intersection guaranteed by the Hanani-Tutte theorem may consists of two canonical curves and that cross at two distinct edges (vertices of the intersection graph) and with the same -index, meaning that and have the same slope as line segments. By rotating the plane, we may assume that and are horizontal line segments. Note that both canonical curves consists of at least two vertices. If (or ) intersects with the predecessor/successor of (or ) on their corresponding canonical curve, we would be done (since that predecessor/successor vertex does not have identical -index) by the same argument of Lemma 12. The remainder of this proof is dedicated to showing that any such intersection given by the Hanani-Tutte theorem also guarantees an intersection between a predecessor/successor vertex.
See Figure 2 for illustrations of how the canonical curves can intersect at two vertices that correspond to horizontal line segments, where a blue canonical curve can intersect with a red canonical curve at two horizontal line segments. In the figure, the predecessor/successor edges can be either horizontal or non-horizontal. We illustrate them as non-horizontal for clarity, as only the location of intersection with the predecessor/successor edges matters. The cases reflect how the horizontal intervals on the two canonical curves can intersect, in case (i) the red and blue horizontal segments are nested, in cases (ii) and (iv) they intersect but do not nest, and in case (iii) they are completely disjoint. In case (i), the blue horizontal segment is nested in the red horizontal segment, and thus intersection of the blue predecessor/successor with the red horizontal segment is unavoidable. In case (iii) the horizontal segments of the red and blue curves are not intersecting at all, which is not a valid intersection that the Hanani-Tutte theorem can give us. In case (ii) and (iv) the blue and red horizontal segments intersect, but are not nested. In these cases either a predecessor/successor segment intersects the horizontal segment of the other as in case (ii), or they can be separated as curves in case (iv), and are not a valid intersection that is given by the Hanani-Tutte theorem (they can be perturbed to be non-intersecting).
We would like to apply Theorem 13 to the framework of [9] to obtain a result for Diameter- of line segments with slopes. However, there are technical issues with implementing an efficient data structure for line segments with slopes. Indeed, even for a collection of axis-aligned segments (i.e., with two slopes), we do not see how to implement the colored range searching data structure efficiently. We resolve these technical issues in the full paper by carefully computing neighborhood balls in the order of increasing length of sequences to reuse prior computation and ensure that the data structure problem involves exactly one type of slope at a time.
Theorem 14.
Diameter- of line segments with at most different slopes can be solved in time.
4 Almost-Linear Time Const-Diameter Algorithm for 2D Unit Squares
In this section, we present an -time algorithm for testing whether the diameter of a 2D unit-square graph is at most , for any given constant . The precise time bound is , interestingly. All squares in this section are axis-aligned. Our result significantly extends Bringmann et al.’s near-linear algorithm for unit-square graphs [4], which worked only for . It also significantly improves the time bound of Duraj, Konieczny, and Potępa’s algorithm [14] in the constant case; since Duraj et al.’s approach is based on distance VC-dimension, it does not seem possible to improve their time bound to near linear (the VC-dimension or shatter dimension for unit squares is at least 2 even for 1-neighborhoods!). Our new algorithm employs an unusual divide-and-conquer approach:
-
1.
Often in computational geometry, we divide based on (say) the median - or -coordinate, but in our new algorithm, we will divide based on coordinate values modulo 1.
-
2.
We will use a larger fan-out rather than dividing 2-way.
-
3.
We will repeatedly map input points to new points in a higher dimension (dependent on ), constructed in a nontrivial way, to enable orthogonal range searching techniques.
Even though the diameter problem may not at first seem amenable to divide-and-conquer (not being a “decomposable” problem), we show that a combination of these ideas is powerful enough to solve the problem efficiently for any constant (unlike the far more straightforward approach by Bringmann et al. for ).
For a point , denote by the unit square centered at . Let and denote the - and -coordinate of a point respectively. To keep the presentation simple, we assume that all coordinate values are distinct. It is straightforward to modify the algorithm below to handle cases when some values may be equal, just by being more careful about vs. signs and open vs. closed intervals. (This is unlike our other results on axis-aligned line segments, where degeneracies can make a big difference.) We will solve the problem in a slightly more general setting for point sets : testing whether all distances between and for are exactly in the -partite intersection graph of the unit squares centered at , i.e., the subgraph of the intersection graph where we include an edge between and only when and for some . The original problem reduces to the case when are identical sets (or almost identical, if we want to ensure general position).
Build a uniform grid over of unit side length. We first identify a special case which we can solve quickly. Specifically, suppose that the points lie in a fixed grid cell for a fixed , and points in lie in a fixed neighboring grid cell, w.l.o.g., say, to its right; furthermore, suppose that all such points satisfy and . Then we already know that , and so it suffices to enforce only the constraint that . Consequently, we can proceed greedily: for each , we only need to find the lowest point in reachable from , and for each , we only need to find the highest point in reachable from (or vice versa, depending on the position of neighboring cell), as explained in the lemma below:
Lemma 15.
Given point sets of total size , and given and , we can compute mappings and in time, satisfying the following property for every :
intersects for all , and
, and
.
Proof.
Define the weight of each point in to be its -coordinate; the weights of all other points in is set to . For each , define the weight of each point to be the min weight among all points in with -distance at most 1 from . These values can be computed by orthogonal range min queries. For each , define to be the weight of .
Similarly, define the weight of each point in to be its -coordinate; the weights of all other points in is set to . For each , define the weight of each point to be the max weight among all points in with -distance at most 1 from . These values can be computed by orthogonal range min queries. For each , define to be the weight of plus 1.
Then the property is satisfied ( and imply and , so we only need ).
Suppose lies in a fixed grid cell, say, . We apply Lemma 15 to solve the above special case for each of the choices for and each of the choices of grid cells for and its neighboring cells for . However, we cannot solve these cases separately, since the diameter problem is not decomposable. Instead, our idea is to view each special case as imposing an additional constraint in a new dimension, so that the combined problem can be reduced to an orthogonal range searching problem [3, 12] in a higher () dimension.
Lemma 16.
Given point sets of total size where , and given , we can compute mappings and in time, satisfying the following for every :
intersects for all , and
and , or vice versa)
does not dominate .
Proof.
For each with -norm at most , and each , we compute mappings and satisfying the following properties:
-
1.
intersects for all , and
, and
. -
2.
intersects for all , and
and
. -
3.
intersects for all , and
, and
. -
4.
intersects for all , and
and
.
The first two properties differ only in the location of versus , and the second two properties are identical to the first with the locations of and swapped. Each such mapping can be computed by Lemma 15 (shifting by , possibly with -coordinates negated and/or reversed). Finally, we define and as the Cartesian products of these mappings and over all choices of and choices of .
How can we reduce the problem in the general case to the case from Lemma 16? A natural approach is binary divide-and-conquer. We divide the input sets into two parts: points with -coordinates less than modulo 1, and points with -coordinates greater than modulo 1, where is the median of the -coordinates mod 1. There are 3 cases for a path : (i) it stays entirely in ; (ii) it stays entirely in ; (iii) it crosses between and . Case (i) can be handled by one recursive call with half of the points. Case (ii) can be handled by another recursive call with the other half of the points. If case (iii) occurs, there must be some for which and or vice versa – this is precisely the case handled by Lemma 16!
However, there is one important issue: the diameter problem is not decomposable. For example, consider a pair with and . It could be covered by case (i) or case (iii). If we are solving the distance oracle problem (testing whether and have distance for a given query pair ), we could consider both cases, recurse, and take the “or” of the answers, thus obtaining logarithmic query time. However, for the diameter problem, we need to exclude pairs that already pass the test from case (iii) when we make the recursive call to handle case (i). We cannot afford to enumerate all such pairs since there are quadratically many in the worst case. Our idea is to realize that the pairs we want to exclude are encodable by orthogonal range searching/dominance constraints in dimensions, according to Lemma 16. As we recurse, we just add more and more dimensions to the encoding.
A binary divide-and-conquer has recursion depth, and if the dimension were to increase to , we would no longer be able to solve the orthogonal range searching subproblems in near-linear time. A final idea is to use a larger fan-out for the divide-and-conquer (for example, the recursion depth is reducible to by setting , though we will suggest a slightly better choice of below). The details are made precise below:
Lemma 17.
Given point sets of total size where , parameter , and mappings and , we can decide whether for all with dominating , there exists , such that intersects for all , in time.
Proof.
We use -way divide-and-conquer for a parameter to be set later:
-
1.
Compute quantiles such that each interval contains roughly elements of . For each and , let .
-
2.
For each , compute mappings and , satisfying the following property:
intersects for all , and
and , or vice versa)
does not dominate . -
3.
For each , verify that there is no pair such that dominates . This can be done by -dimensional orthogonal range searching in time.
-
4.
For each , recursively solve the problem for with and replaced by and .
To see correctness, observe that for any and any , one of the following is true: (i) and , or vice versa, or (ii) and , or vice versa, or (iii) is in , or (iv) is in . (In other words, if the sequence of -coordinates in modulo 1 does not “cross” nor , then the sequence must stay completely inside the interval or completely outside.) For , it is (i) or (ii) (handled by step 3). For , it is (i), (ii), or (iii) (handled by step 4).
The running time satisfies the recurrence . There are levels of recursion, and the dimension parameter increases by at each level. The recurrence solves to . Setting yields .
Theorem 18.
Given point sets of total size , we can decide whether for all , there exists , such that intersects for all , in time , which is for any constant (or, in fact, for any ).
Proof.
Build a uniform grid of side length 1. For each nonempty grid cell (with ), we solve the problem for , , …, by Lemma 17 (with trivial mappings and , i.e., ). Each point participates in subproblems.
5 Diameter-2 Lower Bound for 2D Triangles
In this and the next three sections, we turn to proving conditional lower bounds. We begin with a proof of a near-quadratic lower bound for Diameter-2 for 2D triangles, assuming the 3-uniform 6-hyperclique hypothesis.
Consider convex chains on six points each (i.e., including endpoints), positioned so that for any point pair , the segment is disjoint from the interiors of the convex hulls of and . See Figure 3 for an example of such a configuration. Let denote the vertices along , and the segments , and , respectively. We define the segments analogously along .
Let be a 6-partite 3-uniform hypergraph with vertices in each of the six parts. Our idea is to encode some edges and non-edges of this graph via certain triangles. First, we associate specific points on the previously defined segments with certain pairs . We will then encode a triplet via the pairs , and .
Consider now the segment . For each let be the point of at distance from , where denotes the length of , and is a constant we can choose freely; for now, we can set . Similarly, for each and we set and to be the point of at distance from and the point of at distance from , respectively. Define the points , and along the segments analogously.
In each part of , we index the vertices from to , i.e., . We will drop the superscripts of the vertices when they can be inferred from the context. Let be three distinct symbols among . The triplet is considered a crossing triplet if has a non-empty intersection with both and .
Our reduction realizes an intersection graph similar to the intersection graph for a lower bound of [4] designed for -dimensional hypercubes.
Let be the intersection graph of the following triangles (see also Figure 4):
-
For each edge add the triangle
-
For each edge add the triangle
-
For each crossing triplet with and and each non-edge add a triangle
-
For each crossing triplet with and and each non-edge add a triangle
-
Add a triangle that covers all triangles , intersects all triangles corresponding to crossing triplets, and is in the open half-plane . Let be the mirror image of .
Observation 19.
The vertices of the constructed graph satisfy the following properties:
-
1.
if and only if and .
-
2.
if and only if .
-
3.
.
-
4.
and .
-
5.
and .
The analogous statements hold when exchanging with or exchanging the crossing triplets with other crossing triplets.
We can now prove the desired lower bound.
Theorem 20.
Assuming the 3-uniform 6-hyperclique hypothesis, there is no time algorithm for deciding if the intersection graph of a given set of triangles in the Euclidean plane has diameter at most 2.
Proof.
Bringmann et al. [4] show that an intersection graph that satisfies Conditions 1-3 as described in Observation 19 has a pair of vertices with hop distance greater than if and only if is a hyperclique of . We recall the argument briefly. Consider a pair of triangles and . They both correspond to edges, so we have that the tuple forms a hyperclique if and only if all crossing triplets among and are present in . Since we only represent non-crossing triplets in the graph, the tuple forms a hyperclique if and only if there is no crossing triangle connecting and , i.e., they have no shared neighbor, or equivalently, they have hop distance at least .
The reduction is almost complete. However, we need to ensure that no other vertex pairs can form a pair whose distance is at least in . Let denote the set of triangles , and let denote the set of triangles . One can verify that the triangles ensure that if a given pair of vertices of satisfies (a) , or (b) , or (c) at least one of is not in , then the hop distance of and is at most . Thus the only setting where distance is possible is the one discussed above.
We can strengthen Theorem 20 to fat triangles; in fact the angles of every triangle can be forced to be close to a right-angled isoceles triangle, henceforth called half-squares. For a fixed we say that a triangle is an -half-square if its longest side length is in the interval and its two shorter side lengths fall in the interval for some .
We claim that the above intersection graph can be realized with -half-squares for any fixed , as follows. First, we choose both convex chains in such a way that the segments for have length and there is a triangle with base of length whose third vertex is the midpoint of . We place the chain as depicted in Figure 5(i) so that it is symmetric on the axis, and the line through and have slope and , respectively, and they intersect the -axis at some point , where will be determined later. The segments are obtained by reflecting on the origin. Observe that the triangles and are -half-squares. For all other triangles, we modify them so that they are half-squares, as follows:
-
For each crossing triplet with and and each non-edge add the unique half-square with base and third vertex as follows:
-
–
We set ,
-
–
is chosen so that the intersection of with is the segment , and
-
–
lies in the half-plane .
-
–
-
For each crossing triplet with and and each non-edge we modify analogously.
-
The triangles are half-squares with the properties in Observation 19.
The following geometric properties establish Observation 19 for this modified construction.
Lemma 21.
For every there exist and such that:
-
(1)
The intersection of and is
the triangle and the point . -
(2)
The triangle is disjoint from all triangles corresponding to edges (i.e., the triangles and ) that are not incident to .
Proof.
First, notice that the placement of the segments (Figure 5(i)) ensures that , , ,and have angle with the -axis for some . Thus, if we set for a large enough , then any segment connecting the left and right convex chain has angle at most with the -axis, and thus the segment directions of () do not fall into the angle cone of for any crossing triangle . The symmetric claim holds for crossing triangles that intersect one of in an interval of positive length. This concludes the proof of (1).
Due to the placement of the segments (Figure 5(i)), any side of the triangle and any of the segments have angle at least for some (Figure 5(ii)). Observe that for the vertex of the crossing triangle the angle subtended by from is , thus is on a circular arc that has diameter (see Figure 5(iii)). On the other hand, the distance between the segment and any other point for is at least when . Consequently, the distance of any point on the segment and any triangle where is at least (see Figure 5(iv)). Thus, if we set for some large enough , then is disjoint from for all . This concludes the proof of (2).
Theorem 22.
Assuming the 3-uniform 6-hyperclique hypothesis, there is no time algorithm for deciding if the intersection graph of a given set of fat triangles (or even -half-squares for any given ) in the Euclidean plane has diameter at most 2.
6 Diameter-2 Lower Bound for Segments
In this section, we prove a near-quadratic lower bound for Diameter-2 for line segments for combinatorial algorithms, assuming the combinatorial 4-clique hypothesis. Our construction uses a geometric configuration that is similar to (but a bit simpler than) our lower bound construction for triangles in Section 5. We will also rely on a very similar encoding of number pairs .
Let be the convex chain given by the vertices . Let denote the segments , respectively. We define to be the reflection of on the origin, and we define the segments analogously along . See Figure 6. Let be a 4-partite graph with vertices in each of the four parts. Our idea is to encode some edges and non-edges of this graph via certain segments. First, we associate specific points on the previously defined segments with certain pairs . We will then represent certain edges and non-edges of with the help of these points.
Consider first the segment . For each let be the point of at distance from , where denotes the length of , and is a constant we can choose freely; for now, we can set . Similarly, for each we set to be the point of at distance from . Define the points , along the segments analogously.
In each part of , , we index the vertices from to , i.e., . We drop the superscripts of the vertices when they can be inferred from the context. Let be distinct symbols among . The pair is considered a crossing pair if has a non-empty intersection with both and .
Let be the intersection graph of the following segments (see Figure 7):
-
For each edge ) add the segment with endpoints We call these segments left segments.
-
For each edge add the triangle with endpoints We call these segments right segments.
-
For each crossing pair with and and each non-edge add a segment as defined in Lemma 23 below. We call these segments crossing segments.
-
Add the four sides of the square with vertices as well as its vertical diagonal from to . These five segments are called dummy segments.
The crossing segments are guaranteed due to the following lemma.
Lemma 23.
For each crossing pair with and and each there exists a segment that intersects the segment (resp., ) if and only if (resp., ).
We are now ready to prove our lower bound for segment intersection graphs.
Theorem 24.
Assuming the combinatorial 4-clique hypothesis, there is no time combinatorial algorithm for deciding if the intersection graph of a given set of segments in the plane has diameter at most 2.
Proof.
Consider a pair of edges and . We claim that and have hop distance at least in the constructed intersection graph if and only if is a -clique in . Indeed, they have hop distance at least if and only if there is no cross-edge connecting them. Since the segments are defined for non-edges, this is equivalent to saying that all of the edges are in , thus is a -clique.
It remains to show that no other pair of segments can have hop distance at least in the constructed intersection graph. Indeed, one can verify that unless is a left segment and is a right segment (or vice versa), there is always a dummy segment that is a shared neighbor of and . The construction takes linear time, thus the theorem follows.
References
- [1] Amir Abboud, Arturs Backurs, and Virginia Vassilevska Williams. If the current clique algorithms are optimal, so is Valiant’s parser. In 56th Annual IEEE Symposium on Foundations of Computer Science, pages 98–117, 2015. doi:10.1109/FOCS.2015.16.
- [2] P. K. Agarwal, M. Sharir, and E. Welzl. The discrete 2-center problem. Discrete & Computational Geometry, 20(3):287–305, 1998. doi:10.1007/pl00009387.
- [3] Pankaj K. Agarwal and Jeff Erickson. Geometric range searching and its relatives. In B. Chazelle, J. E. Goodman, and R. Pollack, editors, Advances in Discrete and Computational Geometry, pages 1–56. AMS Press, 1999.
- [4] Karl Bringmann, Sándor Kisfaludi-Bak, Marvin Künnemann, André Nusser, and Zahra Parsaeian. Towards sub-quadratic diameter computation in geometric intersection graphs. In 38th International Symposium on Computational Geometry (SoCG), pages 21:1–21:16, 2022. doi:10.4230/LIPIcs.SOCG.2022.21.
- [5] Sergio Cabello. Subquadratic algorithms for the diameter and the sum of pairwise distances in planar graphs. ACM Transactions on Algorithms, 15(2):1–38, December 2018. doi:10.1145/3218821.
- [6] Sergio Cabello and Christian Knauer. Algorithms for graphs of bounded treewidth via orthogonal range searching. Computational Geometry, 42(9):815–824, 2009. doi:10.1016/j.comgeo.2009.02.001.
- [7] Timothy M. Chan. A (slightly) faster algorithm for Klee’s measure problem. In 24th Annual Symposium on Computational Geometry, pages 94–100, 2008. doi:10.1145/1377676.1377693.
- [8] Timothy M. Chan, Hsien-Chih Chang, Jie Gao, Sándor Kisfaludi-Bak, Hung Le, and Da Wei Zheng. Charting the diameter computation landscape of geometric intersection graphs in three dimensions and higher. CoRR, abs/2603.21790, 2026. doi:10.48550/arXiv.2603.21790.
- [9] 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.
- [10] Timothy M. Chan and Da Wei Zheng. Hopcroft’s problem, log* shaving, two-dimensional fractional cascading, and decision trees. ACM Trans. Algorithms, 20(3):24, 2024. doi:10.1145/3591357.
- [11] Hsien-Chih Chang, Jie Gao, and Hung Le. Computing diameter+2 in truly-subquadratic time for unit-disk graphs. In 40th International Symposium on Computational Geometry (SoCG), pages 38:1–38:14, 2024. Arxiv version https://arxiv.org/abs/2401.12881. doi:10.4230/LIPIcs.SoCG.2024.38.
- [12] Mark de Berg, Otfried Cheong, Marc J. van Kreveld, and Mark H. Overmars. Computational Geometry: Algorithms and Applications. Springer, 3rd edition, 2008. doi:10.1007/978-3-540-77974-2.
- [13] Guillaume Ducoffe, Michel Habib, and Laurent Viennot. Diameter computation on -minor free graphs and graphs of bounded (distance) VC-dimension. In 30th ACM-SIAM Symposium on Discrete Algorithms (SODA), Proceedings, pages 1905–1922. Society for Industrial and Applied Mathematics, 2019.
- [14] Lech Duraj, Filip Konieczny, and Krzysztof Potępa. Better diameter algorithms for bounded VC-dimension graphs and geometric intersection graphs. In 32nd Annual European Symposium on Algorithms (ESA), volume 308, pages 51:1–51:18, 2024. doi:10.4230/LIPIcs.ESA.2024.51.
- [15] Radoslav Fulek and Jan Kyncl. Hanani-Tutte for approximating maps of graphs. In Proc. 34th International Symposium on Computational Geometry (SoCG), volume 99 of LIPIcs, pages 39:1–39:15, 2018. See full version at https://www.arxiv.org/pdf/1705.05243v3. doi:10.4230/LIPIcs.SOCG.2018.39.
- [16] Paweł Gawrychowski, Haim Kaplan, Shay Mozes, Micha Sharir, and Oren Weimann. Voronoi diagrams on planar graphs, and computing the diameter in deterministic time. SIAM Journal on Computing, 50(2):509–554, 2021. doi:10.1137/18M1193402.
- [17] Russell Impagliazzo and Ramamohan Paturi. On the complexity of -SAT. J. Comput. Syst. Sci., pages 367–375, 2001. doi:10.1006/JCSS.2000.1727.
- [18] Hung Le and Christian Wulff-Nilsen. VC set systems in minor-free (di)graphs and applications. In 35th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 5332–5360, 2024. doi:10.1137/1.9781611977912.192.
- [19] Andrea Lincoln, Virginia Vassilevska Williams, and Ryan Williams. Tight hardness for shortest cycles and paths in sparse graphs. In 29th Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1236–1252, 2018.
- [20] Liam Roditty and Virginia Vassilevska Williams. Fast approximation algorithms for the diameter and radius of sparse graphs. In 45th Annual ACM Symposium on Theory of Computing (STOC), pages 515–524, 2013. doi:10.1145/2488608.2488673.
- [21] Vladimir N. Vapnik. Statistical Learning Theory. Wiley-Interscience, 1998.
- [22] Ryan Williams. A new algorithm for optimal -constraint satisfaction and its implications. Theor. Comput. Sci., pages 357–365, 2005. doi:10.1016/J.TCS.2005.09.023.
