Approximate Dynamic Nearest Neighbor Searching in a Polygonal Domain
Abstract
We present efficient data structures for approximate nearest neighbor searching and approximate 2-point shortest path queries in a two-dimensional polygonal domain with vertices. Our goal is to store a dynamic set of point sites in so that we can efficiently find a site closest to an arbitrary query point . We will allow both insertions and deletions in the set of sites . However, as even just computing the distance between an arbitrary pair of points requires a substantial amount of space, we allow for approximating the distances. Given a parameter , we build an space data structure that can compute a -approximation of the distance between and in time. Building on this, we then obtain an space data structure that allows us to report a site so that the distance between query point and is at most -times the distance between and its true nearest neighbor in time. Our data structure supports updates in amortized time.
Keywords and phrases:
dynamic data structure, nearest neighbor search, polygonal domainCopyright 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
Nearest neighbor searching is a fundamental problem in which the goal is to store a set of point sites so that given a query point one can quickly report a site in that is closest to . For example, the set may be a set of (locations of) shops, and we may wish to efficiently find the shop closest to our current location. In addition, nearest neighbor searching shows up as an important subroutine in several other fundamental problems. For example, in computing closest pairs [7] and matchings [15]. In these applications, there are often two (additional) difficulties: (i) the point sites are typically embedded in some constrained domain, and (ii) the set of sites may change over time, and hence it may be necessary to insert and delete sites. In the example problem above other buildings, roads, and lakes etc. act as obstacles, and thus we actually have to measure the distance between two points and in terms of the length of a shortest obstacle avoiding path . Furthermore, shops may open and close (or may be too crowded or out of products etc.), and hence we want to consider only the currently open or available shops when querying.
In this paper, we consider dynamic nearest neighbor searching among a set of sites in a two-dimensional polygonal domain with vertices. We will allow both insertions and deletions in the set of sites . Agarwal, Arge, and, Staals [1] presented a near linear space data structure for this problem that allows efficient (polylogarithmic) queries and updates, provided that contains no holes; i.e. it is a simple polygon. However, extending these results to arbitrary polygonal domains seems to be far out of reach. It seems we need to at least be able to efficiently compute the (geodesic) distance between two arbitrary query points and in . Currently, the best data structures that support such queries in polylogarithmic time use space [11] (and it seems unlikely we can determine the site closest to without actually evaluating geodesic distances). Hence, we settle on answering queries approximately. Let be some parameter, and let be the site in closest to a query point , then our goal is to report a site whose distance to is at most . We will say that is -close to . Our main result is then:
Theorem 1.
Let be a polygonal domain with vertices, let be a dynamic set of point sites in , and let be a parameter. There is an space data structure that can
-
compute a site in that is -close to a query in time,
-
support insertions of sites into in amortized time,
-
and support deletions of sites from in amortized time.
Constructing the initially empty data structure takes time.
The crucial ingredient in our data structure is a data structure for -approximate 2-point shortest path queries. Thorup [19] presents an space data structure that, given two arbitrary query points in the polygonal domain , can compute an estimate of their distance so that in time. Thorup’s solution however assumes that distances are encoded as floating point numbers whose bits we can manipulate. This is inconsistent with the Real-RAM model of computation usually assumed in computational geometry. We stick to the Real-RAM model, and show that we can still compute approximate distances efficiently. We can actually improve the dependency on , and obtain:
Theorem 2.
Let be a polygonal domain with vertices, and let be a parameter. In time we can construct an space data structure that, given query points returns an -approximation of in time.
Our overall approach is actually the same as in Thorup’s approach: we recursively construct a separator, and estimate distances by going via a discrete set of anchor points on this separator. However, our approach provides stronger guarantees on these anchor points. We believe this may be useful for other problems as well. Indeed, it allows us to efficiently answer (approximate) nearest neighbor queries as well. This also still requires several additional ideas, as simply evaluating the distance between a query point and every site would only give us query time linear in .
Related Work.
Dynamic nearest neighbor searching in the Euclidean plane has a long history, with early results by Agarwal and Matoušek [2]. Chan [6] was the first to achieve expected polylogarithmic update and query times. Following a sequence of improvements, the best structure at this time uses space, allows for time queries, and for updates in deterministic, amortized time [15, 8]. For more general (constant complexity) distance functions, one can similarly achieve expected polylogarithmic query and update times [15, 16]. When the domain is a simple polygon with vertices, Oh and Ahn [17] presented a solution using space achieving query time, and update time. Agarwal, Arge, and, Staals [1] then showed how to achieve query time and expected update time using space. When the domain may have holes and the set of sites is static, there is an space data structure that allows querying the (exact) nearest neighbor in time [14]. Constructing the data structure uses time. Wang [21] recently showed that if is triangulated, the shortest path map of a single site can be computed in time, where is the number of holes in . Conceivably, his algorithm could be extended to handle multiple sites (as is the case in the algorithm by Hershberger and Suri). We are not aware of any results that allow updating sites. Even the case where we allow only insertions is challenging: we cannot easily apply a static-to-dynamic transformation [3] since rebuilding the static structure may require time.
2 Global Approach
We first present an overview of our data structure. See also Figure 1. We start by briefly reviewing the -approximate 2-point shortest path query data structure by Thorup [19].
Computing approximate shortest paths.
Thorup’s approach recursively partitions the domain using separators such that: each separator consists of at most three shortest paths, and the resulting subpolygons are of roughly the same size. This results in a balanced binary tree of height in which each node corresponds to some subpolygon that is further subdivided using a separator .
Consider the separator of the root of this tree , and let . The main idea is that each polygon vertex generates a set of so called anchor points111Thorup calls these points connections, but we use anchor points to avoid confusion with the paths connecting to these points. on , so that for any point the distance via one of these anchor points to is at most times the true distance . So, if a shortest path between two vertices and intersects then there is a path from to via two anchor points and (and the subcurve of ) of length . Given the anchor points (and the distances to their defining vertices) we can find the length of such a path in time. If the path does not intersect , it is contained in one of the subpolygons of the children of the root, and hence we can compute a -approximation of the distance in the appropriate subpolygon. As each vertex defines anchor points on , and appears in levels of the recursion. The total space used is .
To compute the anchor points efficiently, Thorup’s actual algorithm uses a graph in which the distance between and in the graph is already an -approximation of the true distance . Using the above approach with parameter then actually gives a path in with total length at most . Setting then gives a -approximation of the distances as desired.
However, using the graph results in slightly different (generally weaker) properties compared to the ideal case sketched above. In particular, his approach now guarantees that the distances from vertex are within a factor of the true distance only for a discrete subset of points on . For querying the distances between pairs of vertices this is not an issue. Thorup’s data structure can handle such queries in only time. To support queries between arbitrary points , his algorithm connects and to vertices in each, and then queries the all these pairs. This leads to the query time .
Reducing the query time.
Ideally, we would treat and identical to polygon vertices, so that we get anchor points on a separator . However, as such a candidate anchor point may lie anywhere on (in particular, it is not necessarily a vertex of yet), we may not have the required -approximation of the distance to such a point yet.
We will show that we can use a slightly different graph that includes additional “Steiner” points on . This leads to a different set of anchor points compared to Thorup’s approach, but does guarantee that for any vertex , and any point on , the distance to is at most . Furthermore, we show that we can efficiently compute an initial set of candidate anchor points for an arbitrary point , which we then reduce to . This results in query time for an arbitrary pair of query points .
Answering nearest neighbor queries.
As in the approximate 2-point shortest path data structure above, we construct a tree of separators. We associate every site with a root-to-leaf path in this tree. Namely, the nodes for which is contained in the subpolygon . For each node on this path, we will additionally maintain a set of anchor points on the separator corresponding to this node. In particular, we consider as a one dimensional space, and maintain an additively weighted Voronoi diagram on . The set of sites is the set of all anchor points of all sites that appear in . The weight of an anchor point is the distance estimate from to .
If a shortest path between a query point and its closest site intersects , then there is a sufficiently short path via one of the anchor points of and on . We can then find a sufficiently close site by querying the Voronoi diagram with all anchor points of . This leads to an overall query time of , as we perform such queries in nodes in .
The graph of the function that expresses the distance from a site to a point on via a given anchor point is nicely “V-shaped”. Hence, we can maintain by maintaining the lower envelope of these functions. This allows us to insert and remove sites in time. This leads to an overall update time of . Our structure uses space.
Organization.
In Section 3, we define our graph , and prove that it allows us to accurately estimate distances between any pair of points whose shortest path intersects . We then use this to construct our approximate 2-point shortest path data structure in Section 4. Finally, in Section 5 we describe our lower envelope data structure and the remaining tools needed for an efficient dynamic data structure for approximate nearest neighbor searching. Omitted proofs are in the full version [20].
3 Estimating distances using a graph
In this section we discuss how to approximate distances within a polygon . Our results are based on Clarkson’s cone graph [10] on which we can efficiently compute approximate distances between vertices. We review this result in Section 3.1. In Section 3.2 we then extend this approach so that we can represent the distance from any vertex of to any point on a given shortest path in . This involves computing the anchor points for each vertex of . Finally, in Section 3.3, we further augment the graph to also represent distances from a set of arbitrary point sites to (and via) the shortest path , and show how to compute the anchor points for such an arbitrary point efficiently.
3.1 Clarkson’s cone graph
Clarkson [10]’s graph is based on cones. A cone is characterized by an apex point , a cone direction which is a unit length vector and an angle . The boundary of the cone consists of two half lines who both start at and the difference in angle compared to is and respectively. We use to denote a cone to have its apex at point . A cone family is a set of cones that all have their apex at the origin, such that any point in is contained in at least one cone . See Figure 2(b) for an example.
Let be a parameter. Clarkson then defines a cone family consisting of cones, each with angle at most , and a cone graph based on .
Let be the set of vertices of . A vertex is a minimal cone neighbor of a point if and only if there exists a cone , so that is the vertex in the translated cone with minimum cone-distance to among all vertices that are visible from (i.e. for which the line segment is contained in ). We will also say that has an outgoing cone edge to w.r.t the cone . Let denote the set of these minimal cone neighbors of over all cones in . See Figure 3(a) for an example.
The cone graph then has an edge between two (polygon) vertices if and only if had as its minimal cone neighbor or vice versa, i.e. or . Each vertex has at most outgoing cone neighbors, and thus the total number of edges in is at most . Let denote the length of a shortest path between vertices in .
Lemma 3 (Clarkson [10]).
For every pair of vertices in the cone graph , there is a path of length so that
In time we can build a data structure of size so that for any point one can compute in time. Hence, can be constructed in time.
Extending the cone graph.
Let be a point, we define the extended cone graph by adding as a vertex, and connecting it to all of its outgoing cone neighbors. Note that this graph is different from Clarkson’s cone graph on . See Figure 4 for an illustration. Using essentially same argument as in Lemma 3, we can still prove that provides an -approximation of the distances to and from .
3.2 Continuous -approximation graphs
Let be a shortest path between two vertices in . Our goal is to define and compute, for each vertex of , a small set of weighted anchor points on , so that for any point on there is an obstacle avoiding path between and of length at most via one of these anchor points. More specifically, let be the weight of an anchor point . We then want that there is an obstacle avoiding path from to of length , and that is at most .
Thorup [19] argues that such a set of anchor points exists. Although his argument (Lemma 5 in his paper) is constructive, it is unclear how to efficiently construct such a set of anchor points. So, he constructs a set of anchor points with respect to Clarkson’s cone graph instead. In particular, let be a cone graph constructed with parameter . Thorup defines the graph by subdividing every edge in that intersects (at the intersection point), and connecting consecutive vertices along , and proves
Lemma 4 (Thorup [19]).
Let be an undirected weighted graph, let be a shortest path in , and let be a parameter. For each vertex , we can compute a set of discrete anchor points on , so that for any vertex we have
Computing all sets of anchor points takes a total of time.
By choosing and applying Lemma 4 on the graph this then allows him to efficiently estimate the distances between the vertices of . In particular, if the shortest path in between two vertices intersects then one can find an -approximation of their distance in using one of the constructed anchor points in time.
However, we want an -approximation for the distance between any vertex in and any point on ; i.e. not just the vertices of and the intersection points of with edges of . Thorup’s construction does not immediately provide that, see for example Figure 5.
A continuous graph .
We will instead define a slightly different graph that includes additional “Steiner” points on . This does allow us to accurately estimate the distance to any point on , and thus compute appropriate anchor points. We actually construct the cone graph with parameter , and then extend it into a continuous graph (see below). We obtain from and as follows:
-
We include all vertices of and of as vertices of .
-
For each vertex we consider the cones in the cone family centered at . For each cone boundary , we consider the first intersection point of with ; if the resulting line segment lies inside (i.e. the ray does not intersect the boundary of before reaching ), we add as a vertex, and as an edge. Let denote the set of vertices added by in this way. See Figure 6(a) for an illustration.
-
We add all edges of , and connect each pair of vertices that is consecutive along .
Observe that still has size ; as each vertex in adds additional vertices and edges, and also has at most vertices. It is straightforward to construct from in time, using data structures for fixed-directional ray shooting queries [18].
Lemma 5.
In time we can construct a data structure of size so that for any point we can compute the extra vertices in time. Hence, can be constructed in time.
Next, we argue that indeed allows us to -approximate the distances. We actually interpret as a continuous graph [5]. Every edge is a line segment in , so we can extend the (graph) distance to points in the interior of edges. In particular, for points on the same edge we define to simply be their Euclidean distance, and for and in the interior of different edges we have . We are only interested in points in the interior of edges of . Hence, we prove:
Lemma 6.
Let be two polygon vertices in . Then we have that
Furthermore, for any point and any vertex we have that
Computing and storing anchor points.
We can now compute the distances in , and use them to construct an appropriate set of anchor points. See Figure 6(b). Due to Lemma 6 we can now actually just reuse Thorup’s approach (i.e. Lemma 4) again:
Lemma 7.
For every vertex of , we can compute a set of anchor points on such that for any point on we have .
This takes time in total.
3.3 The augmented cone graph
Let be a dynamic set of point sites inside . As we are interested in distances to (and between) the points in , we also want to define and compute anchor points on for the points in . The most straightforward approach would be to just build the above continuous graph on the set of points (vertices) rather than just the polygon vertices . However, as computing the anchor points involves computing shortest paths in this graph, we cannot easily compute the anchor points for a single new site . Similarly, maintaining (the distances in) the graph as changes will be difficult. So, we argue that we can compute suitable anchor points for these new sites using a slightly different method instead.
Let be a new point site. Similar to Section 3.1, we now consider the (continuous) graph that we obtain from by introducing as additional vertices, connecting to every minimal cone neighbor in and to every point in , and subdividing the edges of to account for the additional vertices in . This (continuous) graph still has vertices and edges. Moreover, we can use this graph to accurately estimate distances from to any point on .
Lemma 8.
Let be a point in . For any vertex of there is a path from to in of length that passes through a cone neighbor . Furthermore, for any point we have
Defining anchor points.
Our goal is to define a set of anchor points on for point . To this end, we first define a set of candidate points on . We can prove that if we assign appropriate weights to this set of points it is indeed a set of anchor points. However, as we argue next, a subset of of these points suffices.
Let be an undirected weighted graph with vertex set . Vertex is connected to each vertex with an edge of length , and to by an edge of length . We connect vertices that appear consecutively on by an edge of length (which is the length of the subpath along ). Observe that the vertices of form a shortest path in the graph .
Lemma 9.
Let be a parameter such that . In time we can compute a set of discrete anchor points for , i.e. so that for any
We use Lemma 9 with to compute a set of anchor points for with respect to . Hence, for each point (so in particular for those in a set ) there is a path of length via an anchor point in . Next, we argue that this set is a valid set of anchor points for any point on .
Lemma 10.
Let be a point in . In time, we can compute a set of anchor points, so that for any point we have
Estimating distances via the shortest path .
Given a shortest path , and points whose shortest path in intersects , we can use the above tools to accurately estimate the distance between and . More specifically, we compute and the anchor points as defined above. Additionally, we fix an endpoint of and compute and store, for each vertex of the distance to (i.e. the path length along ). This can easily be done in additional time. Given a pair of points on (and the edges that contain and , respectively) we can then compute their distance (i.e. the length of the subpath ) in constant time.
Let and be anchor points of and on , respectively. The subpath from to in corresponds to an obstacle avoiding path in . Similarly, the subpath from to is obstacle avoiding. Furthermore, since is a shortest (obstacle-avoiding) path in , so is its subpath from to . So, the concatenation of , , and connects and and is obstacle avoiding, and has length . Now define
to be the length of a shortest such obstacle avoiding path . We then have:
Lemma 11.
Let be a polygonal domain with vertices, and let be a shortest path in . In time, we can construct a data structure on and of size that can answer the following queries in time: given any pair of points for which a shortest path intersects , return the length of an obstacle avoiding path so that .
4 A data structure for answering distance queries
In this section we develop an space data structure that stores the polygonal domain , so that given a pair of query points we can compute an -approximation of the distance in time. Our data structure is essentially a balanced hierarchical subdivision of the polygonal domain combined with the graph-based approach to estimate distances from the previous section.
A balanced hierarchical subdivision for polygonal domains.
A balanced hierarchical subdivision [9] is a recursive subdivision of a simple polygon into subpolygons. It is a crucial ingredient to obtain efficient solutions to many problems involving simple polygons [1, 13]. As was also recently observed [12], Thorup’s approach [19] essentially provides a balanced hierarchical subdivision for polygonal domains. The following lemma summarizes this result:
Lemma 12 ([19, 12]).
Let be a polygonal domain with vertices. In time, one can compute a tree so that
-
1.
the leaves of correspond to triangles in a triangulation of ,
-
2.
each node of corresponds to a subpolygon ,
-
3.
each internal node also corresponds to a set of shortest paths so that:
-
(a)
consists of at most three shortest paths (see Figure 7),
-
(b)
every shortest path is also a shortest path in , and
-
(c)
the paths in partition into and , corresponding to the children of ,
-
(a)
-
4.
the height of the tree is , and
-
5.
the total complexity of the subpolygons on each level of is , and thus the total complexity of is .
The data structure.
Our data structure now stores the balanced hierarchical subdivision from Lemma 12. We build a point location data structure [18] on the triangulation induced by the leaves of . Additionally, for each edge of this triangulation, let be the highest node in for which the edge appears on a shortest path (if such a node exists). We store a pointer from edge to this shortest path. We can easily compute these pointers during the construction of .
Consider a node . For each of the shortest paths we will construct the data structure from Lemma 11 (i.e. the graph and the sets of anchor points) with respect to the subpolygon . Since the total size of all subpolygons on each level of the tree is , the total size of all of these data structures on a given level of is , and thus in total. Similarly, the total preprocessing time is .
Query.
Given a pair of query points we find the leaf triangles and that contain points and , respectively. If and lie in the same triangle, we can trivially report the length as their shortest path. Otherwise, a shortest path from to must intersect one of the shortest paths for a common ancestor of the two leaves. In particular, let be the highest node of for which intersects a shortest path . It follows that the shortest path lies inside , and thus we can use the Lemma 11 data structure for to obtain a path of length at most . Unfortunately, we cannot easily find this node , so we query all Lemma 11 data structures for all shortest paths , for all common ancestors of the leaves representing and , and report the shortest distance found. If either or lies on an edge of the boundary of some triangle that is part of some shortest path , we use the pointer stored at to jump to the highest such node, and query only the common ancestors of these nodes instead. Since every query returns the length of an obstacle-avoiding path, the returned estimate satisfies as desired. Since each query takes time, the total query time is .
Improving the query time.
The term in the query time is only due to computing the ray shooting queries needed to compute the sets for each shortest path considered. Next, we argue that we can compute these sets in only time by building an additional space data structure. The overall space usage thus remains the same, and the final query time becomes as claimed.
Lemma 13.
In time, we can build an space data structure that given a query point , allows us to compute the sets for all shortest paths , where is the path in from the root to the leaf triangle containing .
Finally, we plug in that , which establishes Theorem 2.
Remark 14.
Thorup’s final approach [19] uses one additional idea: that one can guarantee that the boundary of a subgraph (used during the construction in Lemma 12) intersects only shortest paths from ancestor separator paths. Therefore, he can also store anchor points on these paths, and query only the shortest paths of the lowest common ancestor of the leaves corresponding to and . It is not clear to us if this idea is still applicable with our approach. For a shortest path on the boundary of some subpolyon , it is not clear in which (sub)polygon to place the path so that we can invoke Lemma 11.
5 Dynamic nearest neighbor searching
In this section, we develop our data structure for approximate nearest neighbor searching with a dynamic set of sites in a polygonal domain . In Section 5.1 we first develop a simple solution for when is simply a set of sites in the plane. In Section 5.2 we consider how to solve a restricted case in which we are given a shortest path in , and we have to only answer queries for which the shortest path between and any site in intersects . Then finally, in Section 5.3 we combine these results with the balanced hierarchical subdivision to obtain our data structure for the general problem.
5.1 Dynamic Euclidean -close neighbor searching
Let be a dynamic set of points in . We present a simple space data structure that given a query point can report a site for which the distance is at most in time. Here, is a site in closest to . Our data structure supports insertions and deletions in time as well. Our data structure essentially uses the cone based approach from Section 3.1; i.e. for each cone in the cone family , we build a dynamic data structure that can report the site with minimum cone distance. By the argument from Lemma 3 it follows that this then yields an -close site.
Lemma 15.
Let be a set of sites in . There is an space data structure that, given a query point can report an -close site from in time. Insertions and deletions of sites are supported in amortized time.
5.2 Maintaining an additively weighted Voronoi diagram
Let be the set of sites in the polygonal domain , and let be a shortest path. We describe a dynamic data structure that, given a query point can report an -close site , provided that the shortest path from to the closest site intersects . More specifically, our goal is to compute a site which achieves the following minimum
| (1) |
If the shortest path between and intersects , then by Lemma 11 this value is indeed at most , and thus the site that achieves this minimum is -close to . We rewrite Equation 1 to , where we define . Finding the optimal for the evaluation of is essentially the closest site problem with additive weights . Furthermore, we only have to consider a 1-dimensional closest site problem as all anchor points lie on a shortest path . This means we can map the coordinates of each point to the one-dimensional coordinate , this preserves distances as for all we have .
Since these functions a have nice structure (see Figure 8), we can relatively easily maintain and query using priority search trees [4]. We store all anchor points (constructed using Lemma 11) and obtain:
Lemma 16.
Let be a polygonal domain with vertices, let be a shortest path in , and let be a set of sites in . There is an space data structure such that:
-
For any point we can find and the site which achieves this minimum in time.
-
We can insert sites in amortized time, and delete sites in amortized time.
Constructing an initially empty data structure takes time.
5.3 The final data structure
Our data structure for general approximate nearest neighbor queries uses the same approach as in Section 4. Our data structure consists of the balanced hierarchical separator from Lemma 12, in which we store associated structures at each node. We again preprocess the triangulation formed by the leaves for efficient point location, and store a pointer from each edge to the highest shortest path in some that uses edge .
For each internal node , and for each shortest path , we now build an associated Lemma 16 data structure on . This structure will store a subset of the sites. In particular, the sites in that did not lie on shortest paths of ancestors of .
For each leaf of , which represents some triangle , we store (a subset of) the sites in in the data structure from Lemma 15. We again store only the sites that did not already appear on shortest paths stored at ancestors of .
Finally, we build the data structure from Lemma 13 that allows us to efficiently compute the sets on any root-to-leaf path.
Space and construction time.
Since the total complexity of all polygons associated with is , it readily follows that the total space of all Lemma 16 data structures is . As each site also appears in at most one leaf, it then follows that we use a total of space. Similarly, constructing an empty data structure takes time.
Answering a query.
Our goal is to report a site that is -close to a query .
We point locate to find a triangle that contains , and compute the sets for all nodes on the path towards this leaf using the Lemma 13 data structure. For each shortest path of each node along this path, we then query the Lemma 16 data structure. Each such query returns a site that minimizes among the sites in (as well as the actual distance estimate ). Finally, we query the Lemma 15 data structure of the leaf triangle , to compute an -close site from the subset of sites stored there. We report the site with overall minimum distance estimate.
Let be site in closest to . We now argue that the site and the distance estimate that we return indeed satisfies .
If also lies in , then Lemma 15 guarantees that is within distance . Otherwise, the shortest path from to must intersect one of the shortest paths on one of the nodes on the root-to-leaf path . In particular, consider a shortest path of the highest such node . It follows that is one of the sites in , and thus Lemma 16 guarantees that the candidate has the minimum value among all sites in . Hence, our distance estimate satisfies Lemma 11 tells us that as desired. Finally, since our distance estimate corresponds to the length of an obstacle avoiding path, we also have , and thus is indeed -close to .
Finding the triangle containing , and traversing the root-to-leaf path corresponding to this triangle takes time. Querying all Lemma 16 data structures along this path would take a total of time. Finally, the query to the Lemma 15 data structure stored at the leaf takes time. As before, the term in the query time is only due to computing the sets in every node separately. By querying the Lemma 13 data structure, we can again reduce this term to . This reduces the total time required to query the Lemma 16 data structures to , which simplifies to . As this term still dominates the other terms, this is also the final query time.
Updates.
We first describe the process for inserting a new site into . We point locate to find a triangle that contains . When lies in the interior of such a triangle, then it must lie in the interior of all ancestor subpolygons as well, so we insert into the Lemma 15 data structure of the leaf , and the Lemma 16 data structures along the root-to-leaf path. If lies on an edge of that is also an edge in a shortest path in one of the separators, we use the pointer stored at this edge to jump to the shortest path of the highest such node , and insert in the Lemma 16 data structures of and its ancestors.
We have to insert into at most one Lemma 15 data structure, (in time), and at most Lemma 16 data structures. Naively inserting them into every such structure then gives a total insertion time of . As with the queries, we can compute the sets in time in total using Lemma 13. This then gives us a total insertion time of .
When we delete a site, we simply delete the site from all places where it was inserted. This takes a total of time. Plugging in gives us Theorem 1.
References
- [1] Pankaj K. Agarwal, Lars Arge, and Frank Staals. Improved dynamic geodesic nearest neighbor searching in a simple polygon. In Bettina Speckmann and Csaba D. Tóth, editors, 34th International Symposium on Computational Geometry, SoCG 2018, June 11-14, 2018, Budapest, Hungary, volume 99 of LIPIcs, pages 4:1–4:14. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2018. doi:10.4230/LIPIcs.SOCG.2018.4.
- [2] Pankaj K. Agarwal and Jiří Matoušek. Dynamic Half-Space Range Reporting and its Applications. Algorithmica, 13(4):325–345, 1995. doi:10.1007/BF01293483.
- [3] Jon Louis Bentley and James B Saxe. Decomposable searching problems I. Static-to-dynamic transformation. Journal of Algorithms, 1(4):301–358, 1980. doi:10.1016/0196-6774(80)90015-2.
- [4] Mark de Berg, Otfried Cheong, Marc van Kreveld, and Mark Overmars. Computational Geometry: Algorithms and Applications. Springer-Verlag TELOS, Santa Clara, CA, USA, 3rd ed. edition, 2008.
- [5] Sergio Cabello, Delia Garijo, Antonia Kalb, Fabian Klute, Irene Parada, and Rodrigo I. Silveira. Algorithms for distance problems in continuous graphs. In Pat Morin and Eunjin Oh, editors, 19th International Symposium on Algorithms and Data Structures, WADS 2025, August 11-15, 2025, York University, Toronto, Canada, volume 349 of LIPIcs, pages 13:1–13:14. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2025. doi:10.4230/LIPIcs.WADS.2025.13.
- [6] Timothy M. Chan. A dynamic data structure for 3-d convex hulls and 2-d nearest neighbor queries. J. ACM, 57(3):16:1–16:15, 2010. doi:10.1145/1706591.1706596.
- [7] Timothy M. Chan. Dynamic generalized closest pair: Revisiting eppstein’s technique. In Martin Farach-Colton and Inge Li Gørtz, editors, 3rd Symposium on Simplicity in Algorithms, SOSA 2020, Salt Lake City, UT, USA, January 6-7, 2020, pages 33–37. SIAM, 2020. doi:10.1137/1.9781611976014.6.
- [8] Timothy M. Chan. Dynamic geometric data structures via shallow cuttings. Discret. Comput. Geom., 64(4):1235–1252, 2020. doi:10.1007/S00454-020-00229-5.
- [9] Bernard Chazelle and Leonidas J. Guibas. Visibility and intersection problems in plane geometry. Discrete & Computational Geometry, 4:551–581, 1989. doi:10.1007/BF02187747.
- [10] K. Clarkson. Approximation algorithms for shortest path motion planning. In Proceedings of the Nineteenth Annual ACM Symposium on Theory of Computing, STOC ’87, pages 56–65, New York, NY, USA, 1987. Association for Computing Machinery. doi:10.1145/28395.28402.
- [11] Sarita de Berg, Tillmann Miltzow, and Frank Staals. Towards space efficient two-point shortest path queries in a polygonal domain. In Wolfgang Mulzer and Jeff M. Phillips, editors, 40th International Symposium on Computational Geometry, SoCG 2024, June 11-14, 2024, Athens, Greece, volume 293 of LIPIcs, pages 17:1–17:16. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2024. doi:10.4230/LIPIcs.SOCG.2024.17.
- [12] Sarita de Berg, Frank Staals, and Marc J. van Kreveld. The complexity of geodesic spanners. J. Comput. Geom., 15(1):21–65, 2024. doi:10.20382/JOCG.V15I1A2.
- [13] Leonidas J. Guibas and John Hershberger. Optimal shortest path queries in a simple polygon. J. Comput. Syst. Sci., 39(2):126–152, 1989. doi:10.1016/0022-0000(89)90041-X.
- [14] John Hershberger and Subhash Suri. An optimal algorithm for euclidean shortest paths in the plane. SIAM Journal on Computing, 28(6):2215–2256, 1999. doi:10.1137/S0097539795289604.
- [15] Haim Kaplan, Wolfgang Mulzer, Liam Roditty, Paul Seiferth, and Micha Sharir. Dynamic planar voronoi diagrams for general distance functions and their algorithmic applications. Discret. Comput. Geom., 64(3):838–904, 2020. doi:10.1007/S00454-020-00243-7.
- [16] Chih-Hung Liu. Nearly optimal planar nearest neighbors queries under general distance functions. SIAM J. Comput., 51(3):723–765, 2022. doi:10.1137/20M1388371.
- [17] Eunjin Oh and Hee-Kap Ahn. Voronoi diagrams for a moderate-sized point-set in a simple polygon. Discret. Comput. Geom., 63(2):418–454, 2020. doi:10.1007/S00454-019-00063-4.
- [18] Neil Sarnak and Robert Endre Tarjan. Planar point location using persistent search trees. Commun. ACM, 29(7):669–679, 1986. doi:10.1145/6138.6151.
- [19] Mikkel Thorup. Compact oracles for approximate distances around obstacles in the plane. In Lars Arge, Michael Hoffmann, and Emo Welzl, editors, Algorithms – ESA 2007, pages 383–394, Berlin, Heidelberg, 2007. Springer Berlin Heidelberg. doi:10.1007/978-3-540-75520-3_35.
- [20] Joost van der Laan, Frank Staals, and Lorenzo Theunissen. Approximate dynamic nearest neighbor searching in a polygonal domain, 2026. arXiv:2603.11775.
- [21] Haitao Wang. A new algorithm for euclidean shortest paths in the plane. J. ACM, 70(2):11:1–11:62, 2023. doi:10.1145/3580475.
