Dynamic Nearest-Neighbor Searching Under General Metrics in and Its Applications
Abstract
Let be a compact, centrally-symmetric, strictly-convex region in , which is a semi-algebraic set of constant complexity, i.e. the unit ball of a corresponding metric, denoted as . Let be a set of homothetic copies of . This paper contains two main sets of results:
-
(i)
For a storage parameter , can be preprocessed in expected time into a data structure of size , so that for a query homothet of , an intersection-detection query (determine whether intersects any member of , and if so, report such a member) or a nearest-neighbor query (return the member of whose -distance from is smallest) can be answered in time; all homothets of intersecting can be reported in additional time. In addition, the data structure supports insertions/deletions in amortized expected time per operation. Here the notation hides factors of the form , where is an arbitrarily small constant, and the constant of proportionality depends on .
-
(ii)
Let denote the intersection graph of . Using the above data structure, breadth-first or depth-first search on can be performed in expected time. Combining this result with the so-called shrink-and-bifurcate technique, the reverse-shortest-path problem in a suitably defined proximity graph of can be solved in expected time. Dijkstraβs shortest-path algorithm, as well as Primβs MST algorithm, on a -proximity graph on points in , with edges weighted by , can also be performed in time.
Keywords and phrases:
Homothets, Minkowski metric, Shallow cuttings, Nearest-neighbor searching, Intersection and proximity graphs, Reverse-shortest-path problemFunding:
Pankaj K. Agarwal: Partially supported by NSF grants CCF-2223870 and IIS-2402823, and by a US-Israel Binational Science Foundation Grant 2022/131.Copyright and License:
2012 ACM Subject Classification:
Theory of computation Computational geometryEditors:
Hee-Kap Ahn, Michael Hoffmann, and Amir NayyeriSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl β Leibniz-Zentrum fΓΌr Informatik
1 Introduction
Problem statement.
Let be a compact, centrally-symmetric, strictly-convex region in , which is a semi-algebraic set of constant complexity.111Roughly speaking, a semi-algebraic set in is the set of points in that satisfy a Boolean formula over a set of polynomial inequalities; the complexity of a semi-algebraic set is the number of polynomials defining the set and their maximum degree. See [12] for formal definitions of a semi-algebraic set and its complexity. is the unit ball of a norm , and we denote its metric as .
A homothet (or homothetic copy) of is a scaled and translated copy of , expressed as , for and ; is the center of and is its size. We represent as the point . Let be the set of all homothets of , represented as the halfspace of . The -distance between points is the minimum value of for which (or, equivalently, ). Since is strictly convex, the triangle inequality is sharp unless lies on the segment . The -distance of a point from a homothet is defined as , and the distance of another homothet from is . Since is a constant-complexity semi-algebraic set, is a semi-algebraic function of constant complexity. The homothets and intersect if the distance between them is non-positive, i.e., , or equivalently, the point lies above the graph of in , or vice-versa.
Let be a set of homothets of , where . In this paper we study two classes of proximity problems related to .
- Proximity queries.
-
We wish to preprocess into a data structure so that various proximity queries for a query homothet , such as intersection-detection (determine whether intersects any homothet of ; if the answer is yes, return one such intersecting homothet of ), intersection reporting (report all homothets of that intersect ), and nearest-neighbor queries (report the homothet of at the minimum -distance from ), can be performed efficiently. In addition, the data structure should support insertions and deletions of homothets of .
- Searching in the intersection graph and related problems.
-
Let denote the intersection graph of , whose vertices are the homothets of and is an edge if . Similarly, for a threshold parameter , the -proximity graph of consists of those edges for which . We study efficient implementation of graph-search problems on , like BFS or DFS. We also study the reverse shortest path (RSP) problem on : given two elements and a parameter , compute the smallest value for which contains a path from to with at most edges.
Related work.
There is extensive work on nearest-neighbor (NN) searching in many different fields including computational geometry, database systems, and machine learning. We refer the readers to various survey papers [4, 10, 20] for a general overview of known results on this topic. Here we briefly mention a few results that are most closely related to the problems studied in this paper. Agarwal and MatouΕ‘ek [9] presented a dynamic NN data structure for a point set in , under the Euclidean metric, that answers a query in time, where and is a storage parameter, using space and preprocessing; the (amortized) update time for insertions/deletions of points is . The bounds were slightly improved β factors were replaced by factors β in [15, 26]. Kaplan et al. [26] presented a dynamic NN data structure for a set of points in under fairly general distance functions. Its performance depends on the complexity of the Voronoi diagram of under that distance function. For the Minkowski metric induced by a centrally-symmetric convex region, which is a semi-algebraic set of constant complexity, their data structure can answer an NN query in time, and handle insertion and deletion of a point in and amortized expected time, respectively, where , a variant of inverse Ackermannβs function, is an extremely slowly growing function; see also [31] for slightly improved bounds. These data structures, however, do not extend to .
The problem of NN searching under general distance functions in is much less understood. By reducing NN queries to ball-intersection queries [8] and using semi-algebraic range-searching data structures [2, 33, 1], an NN query amid the set of homothets in , as above, can be answered in time using space and preprocessing, or in time using space and preprocessing. Using recent standard techniques (see, e.g., the Appendix in [1]), one can obtain a space/query-time trade-off, as well as handle insertions/deletions of objects. Using a recent result by Agarwal et al. [5] on the vertical decomposition of the lower envelope of trivariate functions, an NN query amid can be answered in time using only space, but this data structure does not support efficient deletions (insertions can be handled in a standard manner, using the dynamization technique of Bentley and Saxe [13]). Furthermore, it was not known whether an NN query amid can be answered in time using space.
Motivated by numerous applications, there has been work on developing fast algorithms for intersection and proximity graphs of geometric objects. Although the intersection graph may have edges, the goal in this line of work is to develop algorithms, by exploiting the underlying geometry, that run in time (or at least in subquadratic time). Cabello and JejΔiΔ [14], and subsequently Chan and Skrepetos [21], presented implementations of BFS in unit-disk intersection graphs, which was recently extended to general disk-intersection graphs by de Berg and Cabello [22]; see also [25, 26, 29]. The algorithm in [22] can also perform DFS and Dijkstraβs algorithm in time. Katz et al. [28] showed that BFS in ball-intersection graphs (for congruent or arbitrary Euclidean balls) can be implemented in time, where , so in time for . The problem of devising efficient implementations for BFS/DFS in more general graphs in the plane also has received some attention, see, e.g., [6, 7, 27].
The reverse shortest path (RSP) problem for unit disks was studied by Wang and Zhao [36], who gave an -time solution. Kaplan et al. [25] improved the runtime to using the shrink-and-bifurcate technique (see [11]), and it was recently improved to by Chan and Huang [17]. The best-known RSP algorithm for arbitrary disks runs in expected time. Katz et al. [28] presented RSP algorithms for balls in β with time for congruent balls and for arbitrary balls. The RSP problem also has been studied for other geometric objects in [7, 28, 17].
Our results.
Our main result is a dynamic data structure for answering intersection and NN queries with a homothet of amid the set of homothets:
Theorem 1.
Let be a compact, centrally-symmetric strictly convex semi-algebraic set in of constant complexity. Let be a set of homothetic copies of . For a storage parameter , can be maintained in a dynamic data structure with storage, that can answer an intersection-detection or NN-query (under the -distance) with a homothet of in time and that supports insertions/deletions in amortized expected time. It can report all objects of intersecting in additional time.
Plugging Theorem 1 into Eppsteinβs technique [23], or its enhancement by Chan [16], for maintaining bichromatic closest pairs, using , we obtain:
Corollary 2.
Let be a compact, centrally-symmetric strictly-convex semi-algebraic set in of constant complexity. Let be two sets of homothets of of combined size . The -closest pair between and , under insertions/deletions of homothets (in and ), can be maintained in amortized expected time per update.
Theorem 1 is obtained by presenting two data structures. The first one (see Section 4.1) uses space, answers a query in time, and handles an insertion/deletion in amortized expected time. (The data structure in [5] also obtains a similar space/query-time bound but it cannot handle deletions efficiently.) This data structure is based on constructing vertical shallow cuttings, a notion originally introduced in [18, 15], of the graphs of the distance functions of . Roughly speaking, for a parameter , a vertical -shallow cutting of is a collection of pairwise openly disjoint semi-unbounded pseudo-prisms that covers the region lying below the -level of the arrangement of , where each prism, consisting of all points that lie vertically below a constant-complexity semi-algebraic -dimensional region, intersects the graphs of only functions of . The random-sampling based technique used in [15, 26] to construct a vertical shallow cutting does not immediately extend to our setting because one needs to decompose the -level, for some parameter , in the 4D arrangement of the distance functions of into constant-complexity cells. Although a recent result [5] constructs such a decomposition of the -level (with cells), it does not extend to larger values of . This problem remains elusive for arrangements of arbitrary trivariate semi-algebraic functions of constant complexity, but we develop a desired decomposition technique for our setting (in Section 2) by exploiting the structural geometric properties of the distance functions of . This result is one of the main technical contributions of the paper. Using our result on the decomposition of the -level, we construct a vertical -shallow cutting of of size , for any (Section 3).
The second data structure is a linear-size partition tree, with query time, constructed on the point set , that answers intersection-detection queries on with a homothet of as a query. The main technical challenge we face here is the construction of a so-called test set of (see [35] and below) of size , which represents well the distance functions of all -shallow homothets in , i.e., the homothets that intersect at most elements of . By adapting the technique in [35] and again exploiting the structural geometric properties of the distance functions, we show that a test set, of size , with the desired properties can be constructed efficiently.
Theorem 3.
-
(a)
Given a set of homothets of a constant-complexity, strictly convex, centrally-symmetric semi-algebraic set , BFS or DFS in the intersection graph of can be performed in expected time.
-
(b)
The single-source shortest-path tree as well as the minimum spanning forest of the -proximity graph of a set of points, for any threshold parameter , weighted by the pairwise -distances, can be computed in time.
Theorem 4.
Given a set of homothets of a constant-complexity, strictly convex, centrally-symmetric semi-algebraic set , two designated elements , , and an integer , the RSP problem on , of finding the smallest for which contains a path between and of length at most , can be solved in expected time.
2 Decomposing the -Level of an Arrangement of Distance Functions
Preliminaries.
Let , where each is a homothetic copy of represented by a point in . For , set , and let . (As noted, distances from points that lie inside some copy , still measured by , are nonpositive.) We will not distinguish between a function of and its graph. For a point , is the nearest neighbor of in (under the -distance ), i.e., , if appears on the lower envelope of at .
The level of a point in is the number of functions in whose graphs lie below . For a parameter , the -level of , denoted , is the (closure of the) locus of all points on whose level is . We define the -level of , denoted , to be the (closure of the) set of all points in of level at most , i.e., the set of points that lie on or below (not necessarily on ). The projection of onto , denoted by , is a subdivision of . If a cell of is the projection of a cell of that lies on the graph of , then is the -th nearest neighbor in (under the -distance function) of all points in . Note that is the lower envelope of , and is the Voronoi diagram of (under the -distance).
The decomposition.
The main technical result of this section is that can be decomposed into elementary cells, namely, constant-complexity semi-algebraic regions, each homeomorphic to a ball; see below for a more precise definition.
For , let be the bisector of and under the -distance. Note that if then, as is easily verified, for all and is undefined. The following lemma gives a useful property of bisectors.
Lemma 5.
Fix a homothet . Let be a ray in emanating from . For any such that , intersects in at most one point, say, . Furthermore, for all (where denotes the segment with endpoints and ) and for all .
We are now ready to describe the decomposition of the cells of into elementary cells. (Our ultimate goal is to decompose the region below into elementary cells, but we start with this subtask.) For , let denote the subset of cells of that lie on the graph of , and let denote their projections (which are the cells of for which is the -th nearest neighbor). We describe the algorithm for decomposing the cells of (or of ). Lemma 5 implies that, for any , can be viewed as the graph of a function in spherical coordinates with as the origin. That is, for a given , let be the ray emanating from in direction , and let be the intersection point of with the bisector if such an intersection point exists; otherwise is undefined. We set if is defined and otherwise. Let . We define the level of a point in (the 3D arrangement, within ) to be the number of functions in whose graphs intersect the (relatively open) segment . The following lemma will be useful in analyzing the complexity of the decomposition of .
Lemma 6.
For a parameter , let be a 3D cell of . Then is a cell of level at most in .
Proof.
It is obvious from the definition of that is a cell in . We now argue that its level in is at most . Choose a point . Let be the ray emanating from and passing through . Let be a function whose graph intersects the segment , say, at a point . (See Fig. 1.) By Lemma 5, for all points on preceding , and for all points on beyond . In particular, . Since is a cell of , does not intersect , so lies below in (in the -, or rather -direction). Furthermore, , so there are exactly functions of whose graphs lie below , implying that the level of in is at most , as claimed.
We decompose the cells of by constructing βvertical decompositionsβ of the corresponding 3D projections in the spherical coordinate system around . As for standard vertical decompositions in 3D, we proceed in two stages. The first stage erects a wall from each edge of as follows. Fix an edge of . For a point , let be the ray emanating from and passing through , and let . By Lemma 5, is a (connected) segment that touches at one of its endpoints β it is either the top endpoint, for all points on , or the bottom endpoint (with respect to distances from ). We erect the wall in ; parts of the wall may extend to infinity when is unbounded and is a bottom edge. We repeat this step for all edges of . These walls decompose into frustums (truncated cones), each of which, denoted by , has a unique pair of front and back faces; the other faces of lie on the created walls. (See Fig. 2.) The projections of the front and back faces of on (with as the origin) are identical, and we denote this identical projection by . The complexity of may be arbitrarily large (a typical situation in the first stage of vertical decompositions in general; see, e.g., [19]). The subcell itself is of the form , where are the functions of whose graphs contain the front and back faces of , respectively.
The second stage decomposes into constant-complexity frustums, which we refer to as pseudo-cones. We decompose into spherical pseudo-trapezoids, by drawing portions of meridians within from each vertex and meridian-tangency point. We then lift each pseudo-trapezoid to form the pseudo-cone in .
Repeating this step for all frustums created in the first stage, we obtain a decomposition of into pseudo-cones, each being a semi-algebraic set of constant complexity and bounded by up to six facets (compare with standard vertical decompositions in 3D [19]). We refer to these pseudo-cones as elementary cells. We note that each pseudo-cone is defined by a subset of at most seven functions of (the function and up to six additional functions that define the functions that form the frustum), in the sense that appears in the vertical decomposition of a 3D cell of . By repeating this step for all cells of and for all homothets of , we obtain a decomposition of into elementary cells. Finally, we lift each elementary cell of this decomposition vertically to in a straightforward manner, to obtain a corresponding decomposition of .
Kaplan et al. [26, Lemma 6.2] have shown that the complexity of the vertical decomposition of the -level of a set of of bivariate semi-algebraic functions of constant complexity is , where is the maximum complexity of the lower envelope of a subset of of size at most , is the maximum length of Davenport-Schnizel sequences of order composed of symbols [34], and is a constant depending on the complexity of the functions in . By applying the argument in [26] to our spherical coordinate system and using the worst-case bound on the complexity of the lower envelope of constant-complexity bivariate functions [34], we conclude that the cells of can be decomposed into elementary cells. Hence, , or , can be decomposed into elementary cells. By adapting the randomized incremental algorithm described in [26], , for each , can be computed in expected time. We thus obtain:
Theorem 7.
Let be a compact, centrally-symmetric strictly convex semi-algebraic set in of constant complexity. Let be a set of homothetic copies of . The cells of , and the cells of the -level in the arrangement of their -distance functions, can be decomposed into elementary cells, in expected time.
3 Vertical Shallow Cuttings
A key notion that we need for constructing the dynamic NN data structures of Section 4 is that of a vertical shallow cutting of , as studied in [15, 18, 26] (for simpler scenarios). For a parameter , a vertical -shallow cutting of is a collection of pairwise openly disjoint semi-unbounded pseudo-prisms (prisms for short), where each prism consists of all points that lie vertically below some pseudo-cone, of the decomposition (of Section 2) that covers , and is thus a semi-algebraic set of constant complexity. Furthermore, the ceilings of these prisms collectively form an -monotone surface that lies between and , and each prism is crossed by the graphs of at most functions of . The conflict list of a prism is the set of functions whose graphs cross .
Following the ideas in [26], for a parameter , we construct a vertical -shallow cutting as follows. We set two parameters: , where is a sufficiently large constant, independent of , and . We choose a random subset consisting of functions, construct , and compute the decomposition of into a family of pseudo-cones as described in Section 2. For each pseudo-cone , we associate a label which is the function of whose graph contains . Finally, we erect a semi-unbounded prism from each pseudo-cone of , given by . Let be the resulting set of pseudo-prisms. By Theorem 7, with large probability, . We next show that is a vertical -shallow cutting of , where , with high probability.
Range spaces and shallow -nets.
Let be a (finite) range space, where is a set of objects and a set of ranges. Let be a given parameter. A subset is called a shallow -net of if it satisfies the following two properties for every range and for any parameter :
-
(i)
If then , and
-
(ii)
If then .
Here is a suitable constant. Note the difference between shallow and standard -nets: Property (i) (with ) implies that a shallow -net is also a standard -net (possibly with a recalibration of ). Property (ii) has no parallel in the case of standard -nets β there is no guarantee how a standard net interacts with small ranges (of the entire set ). The following result by Sharir and Shaul [35] is a generalization of the result on standard -nets [24].
Lemma 8 (Theorem 2.2 of Sharir and Shaul [35]).
Let be a range space with VC-dimension . With a suitable choice of the constant of proportionality, a random sample of is a shallow -net with probability at least .
is a vertical shallow cutting.
We apply the above result to the range space , so that each range in is the subset of the surfaces of that cross some region in , taken from some family of regions. Concretely, this includes the following families : (i) the set of pseudo-cones generated by the decomposition of a set of at most seven functions of (recall that a pseudo-cone is defined by at most seven functions), (ii) the set of pseudo-prisms erected on these pseudo-cones, (iii) the set of edges in an arrangement of five functions of (an edge in the arrangement of a subset of is defined by at most five functions), and (iv) the set of rays in the positive -direction. Using standard arguments, it can be shown that the VC-dimension of is finite. Therefore, by applying Lemma 8 with and and choosing the constant of proportionality appropriately, the random subset is a -shallow net of with probability at least , so we assume that is indeed a -shallow net of . Recall that . Assuming , where is the constant in the definition of shallow nets, the converse of property (ii) of shallow nets, with , implies that the level of any point on with respect to is at least . Also, by property (i), the level of is at most . Finally, the shallow net property also implies that the size of the conflict-list of any prism in is . The conflict list of all prisms can be computed in time. Hence, we obtain:
Theorem 9.
Let be a compact, centrally-symmetric strictly convex semi-algebraic set in of constant complexity. Let be a set of homothetic copies of . For any parameter , there exists a vertical -shallow cutting of the arrangement of the distance functions of of size . The cutting , along with the conflict list of each of its prisms, can be computed in expected time.
4 Dynamic Data Structures for Proximity Queries
In this section we describe a dynamic data structure for answering intersection-detection queries amid . Namely, for a query homothet , determine whether intersects some homothet of , and, if the answer is yes, return such a homothet. In addition to answering queries, the data structure can be updated efficiently as a homothet is inserted into or deleted from . The data structure can be extended to answering intersection-reporting queries, namely, reporting all homothets of that intersect , at an additional cost of .
As already noted, the insertion of a new homothet into can be handled using the standard dynamization technique by Bentley and Saxe [13] (see also [9]). That is, assume that we have an intersection-detection data structure that can handle deletions, which can be constructed in time, so that a query can be answered in time and an object can be deleted in time. Then the amortized insertion time is , the deletion time remains , and the overall query time is , assuming that .
We first describe a data structure that answers a query in time using space and handles a deletion in amortized expected time, and then describe a linear-size data structure that answers a query in time and handles a deletion in amortized expected time.
4.1 Fast query-time data structure
We follow the same approach of Agarwal and MatouΕ‘ek for performing dynamic halfspace range reporting [9] (slightly improved but more involved approaches were proposed in [15, 26], but the one in [9] will do for our setting).
Data structure.
Let be the collection of distance functions corresponding to the elements of . Roughly speaking, we build a tree data structure on using vertical shallow cuttings. That is, we start with , choose a parameter , compute an -vertical shallow cutting of of size , in time, create a child for each prism of , recursively construct the data structure for the conflict list of every , and attach it as the subtree of the child corresponding to . The recursion proceeds until we reach cells with , in which case we just store at , as a list, say.
A query, with a copy of , is answered in a standard way, by traversing the tree in a top-down manner. At each node (prism) that we visit, we know that . We check whether lies in any child prism of , and, if so, recurse at that child. Otherwise, we locate the child prism for which lies above , and report any element whose function belongs to the conflict list .
However, this simple recursive approach runs into a technical difficulty when we delete a function from . When deleting a function from the root, the deletion has to be propagated to some of its children, to their children, and so on. On average, each function appears in the conflict lists of prisms of . When such a βgoodβ function is deleted, the deletion is propagated to only descendants, leading to overall deletion time, as can easily be verified. However, some of the functions (in fact, up to of them) may appear in the conflict lists of prisms of . If these βbadβ functions are the first functions to be deleted and then the data structure is reconstructed, the overall cost of the deletion operations will be too high. As in [9, 26], we circumvent this difficulty by maintaining a partition of into a few subsets and constructing a cutting for each subset that is good for all functions in that subset (i.e., each function in the subset appears in only conflict lists).
We now describe the data structure in detail. We fix a sufficiently large constant . The data structure is periodically reconstructed after performing some deletions. We use to denote the size of when the data structure was previously reconstructed and to denote its current size. We reconstruct the data structure after deleting functions from . Thus . Let denote the maximum time spent in constructing the data structure for a set of functions. We pay for the reconstruction cost by charging time to each of the delete operations that occurred before the reconstruction (the inequality holds because is assumed to be superlinear). The data structure for is a (recursively defined) tree . We describe how a subtree , for a subset of functions, is constructed.
If , for some sufficiently large constant , then is a single leaf, and we simply store at that leaf. So assume that . The root of stores the following data:
-
A partition of into subsets , , as described below.
-
For each , a vertical -shallow cutting for . For each , we store its conflict list .
-
For each and , a pointer to the tree .
-
For each function , the set of prisms crossed by the graph of .
-
A counter that keeps track of how many functions of can be deleted before we reconstruct .
After the construction of , before any deletions occur, the following properties hold:
-
(P1)
The counter is set to .
-
(P2)
For each , the -monotone surface formed by the pseudo-cones of (i.e., the ceilings of prisms of ) lie above .
-
(P3)
For every and , , for some suitable absolute constant .
-
(P4)
Each function appears in the conflict lists of at most prisms of , where and are the constants appearing in (1) below.
We now describe the construction of the partition , which proceeds iteratively. Suppose we have constructed . Set and put . If , we stop. Otherwise, set and .
We construct a vertical -shallow cutting of of size , for an arbitrarily small constant . For each , . We note that
| (1) |
A function is called good if it appears in the conflict list of at most prisms of and bad otherwise. Let be the set of good functions of ; set . By (1), . Hence, . It is easily seen that properties (P1)β(P4) hold after the construction. This completes the description of the data structure. The total size and preprocessing time are .
Query procedure.
Let be a query homothet. Recall that intersects a homothet of if the point lies above the lower envelope of the corresponding set of functions. The query is performed as follows. We search in a top-down manner with . Suppose we are at the root of a subtree . If is a leaf, we check all functions of in a brute-force manner and return an answer in time. Otherwise, for each , we check whether lies above the lower envelope of . If the answer is yes for any , we return yes and also return an intersecting homothet (see below). Otherwise, we return no.
For a fixed , we proceed as follows. We search with , in a brute force manner, in time, to determine the pseudo-cone in the projection of that contains . Let be the function associated with , i.e., the ceiling of lies in the graph of . We test whether . If so, and intersect, so we return yes and report as an intersection witness and terminate the query. If not, lies in the semi-unbounded prism , and we continue the search recursively in the data structure .
Let be the maximum time spent by the query procedure in the subtree storing at most functions. Then we obtain the following recurrence:
Its solution is easily seen to be , for any constant , provided that and are chosen sufficiently large.
Deletion procedure.
Let be a function that we wish to delete from . Again, we visit in a top-down manner. Suppose we are at the root of a subtree . If is a leaf, then we simply delete from and stop. If is an internal node, we first decrement the counter stored at . If becomes , we reconstruct from scratch (for the current ). Otherwise, we find the index such that . For each , we delete from and then recursively delete from . By construction, . The deletion procedure maintains the properties (P3) and (P4), and (P2) is replaced with a slightly weaker property:
- (P2β)
-
For every , the -monotone surface formed by the pseudo-cones of (i.e., the ceilings of prisms of ) lie above or on .
The correctness of the query procedure follows from property (P2β). Following the analysis in [9], the amortized deletion time, including the time spent in reconstructing the data structure, is . Putting everything together, and combining this with the technique of Bentley and Saxe [13] for insertions, we obtain:
Lemma 10.
can be preprocessed, in expected time, into a data structure of size , so that an intersection-detection query, including the cost of reporting an intersecting member of if one exists, can be performed in time. A homothet can be inserted into or deleted from in amortized expected time.
4.2 Linear-size data structure
Next, we present a linear-size dynamic data structure that supports intersection-detection queries in time each, and can handle updates (insertions and deletions) in amortized expected time per update.
For a homothet , let be the region lying above the graph of the distance function , which corresponds to the set of homothets that intersect . Put . For a query homothet , we wish to determine whether any point of lies in . We construct a linear-size partition tree for answering these queries, following the same approach as in [9, 32, 35]. We need a few definitions. Let be the set of distance functions corresponding to the homothets in . Let be a set of points (representing homothets of ). For a parameter , we call a semi-algebraic set , which is semi-unbounded in the -direction, -shallow if . A major ingredient of the approach in [32, 35] is to construct a so-called test set composed of a small number of semi-algebraic sets, which represent well (in the sense made precise below) all distance functions of that are -shallow, for a given parameter , with respect to . Formally, a finite collection of semi-algebraic sets of constant complexity (not necessarily a subset of ) is called a test set for -shallow ranges in with respect to if it satisfies the following properties:
-
(i)
Every set in is -shallow with respect to .
-
(ii)
The complement of the union of any sets of can be decomposed into at most βelementary cellsβ (semi-algebraic sets of constant complexity) for any , where is a suitable monotone increasing superlinear function of .
-
(iii)
Any -shallow set can be covered by the union of at most ranges of , where is a constant (independent of ).
Sharir and Shaul [35] showed that if there exists a test set of size for -shallow ranges of , then one can construct a linear-size partition tree on so that an -emptiness query can be answered in time, for the corresponding function .
Test-set construction.
We describe an algorithm for constructing a test set of size with and . Let be the set of distance functions of as above. We take a random subset of functions, for some sufficiently large constant , where is another sufficiently large absolute constant, independent of, and much smaller than , and construct the (standard) 4D vertical decomposition of the arrangement , of size , as described in [3, 30, 34]. By a standard random-sampling argument [24], with probability at least , each cell of is crossed by at most functions of , provided that is chosen sufficiently large. If this is not the case, we discard and choose another random subset, until we find, in expected trials, one with the desired property. We clip within the halfspace (to restrict it to within ). We choose a subset of the cells of , consisting of those cells that have at most functions of passing fully below them. By construction, these cells cover , and are contained in .
Let be a cell of . Set . Since and are semi-algebraic sets of constant complexity, is also a semi-algebraic set of constant complexity. For a homothet , the point lies in if and only if there is a point such that . This happens when , i.e., the graph of the function crosses or lies below . By construction, there are at most such functions. Consequently, is -shallow with respect to the points of with .
Set . is a family of constant-complexity semi-algebraic sets in , each of which is -shallow with respect to . This is the desired test set. Each set is unbounded in the positive -direction, therefore the complement of the union of a subset of sets is the region lying below their lower envelope. By a result in [5], the complement of their union (i.e., the region below their lower envelope) can be decomposed into pseudo-prisms. Hence, we obtain:
Lemma 11.
Let be a set of points and a parameter. A test set of size for the functions in that are -shallow with respect to can be computed in expected time, so that and .
Using Lemma 11 and adapting the approach in [35], we can preprocess into a linear-size data structure that supports intersection-detection queries in time. By (re)constructing portions of the partition tree periodically (as in the previous data structure), deletions can be handled efficiently. Omitting the straightforward details, we obtain:
Lemma 12.
Let be a set of homothets of . can be preprocessed, in expected time, into a data structure of size , so that an intersection-detection query can be answered in time. A homothet of can be inserted into or deleted from the data structure in amortized time.
By combining this data structure with Lemma 10 in a standard manner [1], we can obtain the following space/query-time trade-off:
Theorem 13.
Let be a set of homothets of , and let be a storage parameter. can be preprocessed, in expected time, into a data structure of size , so that an intersection-detection query can be answered in time. A homothet can be inserted into or deleted from the data structure in amortized time.
References
- [1] P. K. Agarwal, B. Aronov, E. Ezra, M. J. Katz, and M. Sharir. Intersection queries for flat semi-algebraic objects in three dimensions and related problems. ACM Transactions on Algorithms, 21:25:1β25:59, 2025. doi:10.1145/3721290.
- [2] P. K. Agarwal, B. Aronov, E. Ezra, and J. Zahl. An efficient algorithm for generalized polynomial partitioning and its applications. SIAM Journal on Computing, 50:760β787, 2021. doi:10.1137/19M1268550.
- [3] P. K. Agarwal, A. Efrat, and M. Sharir. Vertical decomposition of shallow levels in 3-dimensional arrangements and its applications. SIAM Journal on Computing, 29(3):912β953, 1999. doi:10.1137/S0097539795295936.
- [4] P. K. Agarwal and J. Erickson. Geometric range searching and its relatives. In Advances in Discrete and Computational Geometry, volume 223 of Contemporary Mathematics, pages 1β56. American Mathematical Society, Providence, RI, 1999. doi:10.1090/conm/223/03131.
- [5] P. K. Agarwal, E. Ezra, and M. Sharir. Vertical decomposition in 3D and 4D with applications to line nearest-neighbor searching in 3D. In 35th ACM-SIAM Symposium on Discrete Algorithms (SODA 2024), pages 150β170, 2024. doi:10.1137/1.9781611977912.8.
- [6] P. K. Agarwal, H. Kaplan, M. J. Katz, and M. Sharir. Segment proximity graphs and nearest neighbor queries amid disjoint segments. In 32nd European Symposium on Algorithms (ESA 2024), pages 7:1β7:20, 2024. doi:10.4230/LIPIcs.ESA.2024.7.
- [7] P. K. Agarwal, M. J. Katz, and M. Sharir. On reverse shortest paths in geometric proximity graphs. Computational Geometry, 117:102053, 2024. doi:10.1016/j.comgeo.2023.102053.
- [8] P. K. Agarwal and J. MatouΕ‘ek. Ray shooting and parametric search. SIAM Journal on Computing, 22:794β806, 1993. doi:10.1137/0222051.
- [9] P. K. Agarwal and J. MatouΕ‘ek. Dynamic half-space range reporting and its applications. Algorithmica, 13:325β345, 1995. doi:10.1007/BF01293483.
- [10] A. Andoni and P. Indyk. Nearest neighbors in high dimensional spaces. In J. E. Goodman, J. OβRourke, and C. D. TΓ³th, editors, Handbook of Discrete and Computational Geometry. CRC Press, Boca Raton, FL, 3rd edition, 2017. Chapter 43. doi:10.1201/9781315119601.
- [11] R. Ben Avraham, O. Filtser, H. Kaplan, M. J. Katz, and M. Sharir. The discrete and semicontinuous FrΓ©chet distance with shortcuts via approximate distance counting and selection. ACM Transactions on Algorithms, 11(4):29:1β29:29, 2015. doi:10.1145/2700222.
- [12] S. Basu, R. Pollack, and M.-F. Roy. Algorithms in Real Algebraic Geometry. Springer, Berlin, 2nd edition, 2006.
- [13] J. L. Bentley and J. B. Saxe. Decomposable searching problems I: Static-to-dynamic transformation. Journal of Algorithms, 1:301β358, 1980. doi:10.1016/0196-6774(80)90015-2.
- [14] S. Cabello and M. JejΔiΔ. Shortest paths in intersection graphs of unit disks. Computational Geometry, 48:360β367, 2015. doi:10.1016/j.comgeo.2014.12.003.
- [15] T. M. Chan. A dynamic data structure for 3-d convex hulls and 2-d nearest-neighbor queries. Journal of the ACM, 57:16:1β16:15, 2010. doi:10.1145/1706591.1706596.
- [16] T. M. Chan. Dynamic generalized closest pair: Revisiting Eppsteinβs technique. In 3rd Symposium on Simplicity in Algorithms (SOSA 2020), pages 33β37, 2020. doi:10.1137/1.9781611976014.6.
- [17] T. M. Chan and Z. Huang. Faster algorithms for reverse shortest path in unit-disk graphs and related geometric optimization problems: Improving the shrink-and-bifurcate technique. In 41st International Symposium on Computational Geometry (SoCG 2025), pages 32:1β32:14, 2025. doi:10.4230/LIPIcs.SoCG.2025.32.
- [18] T. M. Chan and K. Tsakalidis. Optimal deterministic algorithms for 2-d and 3-d shallow cuttings. Discrete & Computational Geometry, 56:866β881, 2016. doi:10.1007/S00454-016-9784-4.
- [19] B. Chazelle, H. Edelsbrunner, L. Guibas, and M. Sharir. A singly exponential stratification scheme for real semi-algebraic varieties and its applications. In 16th International Colloquium on Automata, Languages and Programming (ICALP 1989), pages 179β193, 1989. Also in Theoretical Computer Science 84 (1991), 77β105. doi:10.1007/BFB0035760.
- [20] K. L. Clarkson. Nearest neighbor searching and metric space dimensions. In G. Shakhnarovich, T. Darrell, and P. Indyk, editors, Nearest-Neighbor Methods in Learning and Vision. MIT Press, 2006.
- [21] K. L. Clarkson and P. W. Shor. Applications of random sampling in computational geometry, II. Discrete & Computational Geometry, 4:387β421, 1989. doi:10.1007/BF02187740.
- [22] M. de Berg and S. Cabello. An algorithm for single-source shortest paths in disk graphs. In 33rd European Symposium on Algorithms (ESA 2025), pages 81:1β81:15, 2025. doi:10.4230/LIPIcs.ESA.2025.81.
- [23] D. Eppstein. Fast hierarchical clustering and other applications of dynamic closest pairs. ACM Journal of Experimental Algorithmics, 5:1, 2000. doi:10.1145/351827.351829.
- [24] D. Haussler and E. Welzl. Epsilon-nets and simplex range queries. Discrete & Computational Geometry, 2:127β151, 1987. doi:10.1007/BF02187876.
- [25] H. Kaplan, M. J. Katz, R. Saban, and M. Sharir. The unweighted and weighted reverse shortest path problem for disk graphs. ACM Transactions on Algorithms, 2023. To appear. Also in 31st European Symposium on Algorithms (ESA 2023), 67:1β67:14.
- [26] H. Kaplan, W. Mulzer, L. Roditty, P. Seiferth, and M. Sharir. Dynamic planar voronoi diagrams for general distance functions and their algorithmic applications. Discrete & Computational Geometry, 64:838β904, 2020. doi:10.1007/s00454-020-00243-7.
- [27] M. J. Katz, R. Saban, and M. Sharir. Near-linear algorithms for visibility graphs over a 1.5-dimensional terrain. In 32nd European Symposium on Algorithms (ESA 2024), pages 77:1β77:17, 2024. doi:10.4230/LIPICS.ESA.2024.77.
- [28] M. J. Katz, R. Saban, and M. Sharir. BFS and reverse shortest paths for ball intersection graphs in three and higher dimensions. In 36th International Symposium on Algorithms and Computation (ISAAC 2025), pages 45:1β45:15, 2025. doi:10.4230/LIPICS.ISAAC.2025.45.
- [29] K. Klost. An algorithmic framework for the single source shortest path problem with applications to disk graphs. Computational Geometry, 111:101979, 2023. doi:10.1016/j.comgeo.2022.101979.
- [30] V. Koltun. Almost tight upper bounds for vertical decompositions in four dimensions. Journal of the ACM, 51:699β730, 2004. doi:10.1145/1017460.1017461.
- [31] C.-H. Liu. Nearly optimal planar nearest neighbors queries under general distance functions. SIAM Journal on Computing, 51(3):723β765, 2022. doi:10.1137/20M1388371.
- [32] J. MatouΕ‘ek. Reporting points in halfspaces. Computational Geometry, 2:169β186, 1992. doi:10.1016/0925-7721(92)90006-E.
- [33] J. MatouΕ‘ek and Z. PatΓ‘kovΓ‘. Multilevel polynomial partitioning and simplified range searching. Discrete & Computational Geometry, 54:22β41, 2015. doi:10.1007/s00454-015-9701-2.
- [34] M. Sharir and P. K. Agarwal. Davenport-Schinzel Sequences and Their Geometric Applications. Cambridge University Press, New York, 1995.
- [35] M. Sharir and H. Shaul. Semialgebraic range reporting and emptiness searching with applications. SIAM Journal on Computing, 40(4):1045β1074, 2011. doi:10.1137/090765092.
- [36] H. Wang and Y. Zhao. Reverse shortest path problem for unit-disk graphs. Journal of Computational Geometry, 14(1):14β47, 2023. doi:10.20382/JOCG.V14I1A2.
