Get 20M+ Full-Text Papers For Less Than $1.50/day. Start a 14-Day Trial for You or Your Team.

Learn More →

A New Algorithmfor Euclidean Shortest Paths in the Plane

A New Algorithmfor Euclidean Shortest Paths in the Plane HAITAO WANG, University of Utah Given a set of pairwise disjoint polygonal obstacles in the plane, finding an obstacle-avoiding Euclidean shortest path between two points is a classical problem in computational geometry and has been studied extensively. Previously, Hershberger and Suri (in SIAM Journal on Computing, 1999) gave an algorithm of O (n log n) time and O (n log n) space, where n is the total number of vertices of all obstacles. Recently, by modifying Hershberger and Suri’s algorithm, Wang (in SODA’21) reduced the space to O (n) while the runtime of the algorithm is still O (n log n). In this article, we present a new algorithm of O (n + h logh) time and O (n) space, provided that a triangulation of the free space is given, where h is the number of obstacles. The algorithm is better than the previous work when h is relatively small. Our algorithm builds a shortest path map for a source point s so that given any query point t, the shortest path length from s to t can be computed in O (log n) time and a shortest s-t path can be produced in additional time linear in the number of edges of the path. CCS Concepts: • Theory of computation → Computational geometry; Design and analysis of algorithms; Additional Key Words and Phrases: Shortest path, shortest path map, shortest path query, Euclidean distance, obstacle avoidance, polygonal domain ACM Reference format: Haitao Wang. 2023. A New Algorithm for Euclidean Shortest Paths in the Plane. J. ACM 70, 2, Article 11 (March 2023), 62 pages. https://doi.org/10.1145/3580475 1 INTRODUCTION Let P be a set of h pairwise disjoint polygonal obstacles with a total of n vertices in the plane. Let F denote the free space—that is, the plane minus the interior of the obstacles. Given two points s and t in F , we consider the problem of finding a Euclidean shortest path from s to t in F .This is a classical problem in computational geometry and has been studied extensively (e.g., [3, 18–20, 22, 24, 25, 34, 36, 38, 42, 44, 45, 48]). To solve the problem, there are two commonly used methods: the visibility graph and the con- tinuous Dijkstra. The visibility graph method is to first construct the visibility graph of the vertices of P along with s and t, and then run Dijkstra’s shortest path algorithm on the graph to find a shortest s-t path. The best algorithms for constructing the visibility graph run in O (n log n + K) This research was supported in part by the NSF under grants CCF-2005323 and CCF-2300356. Author’s address: H. Wang, School of Computing, University of Utah, 50 Central Campus Drive, Salt Lake City, UT 84117; email: haitao.wang@utah.edu. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from permissions@acm.org. © 2023 Copyright held by the owner/author(s). Publication rights licensed to ACM. 0004-5411/2023/03-ART11 $15.00 https://doi.org/10.1145/3580475 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:2 H. Wang 1+ϵ time [18]orin O (n+h log h+K) time [7, 30] for any constant ϵ > 0 after the free spaceF is tri- angulated, where K is the number of edges of the visibility graph. Because K = Ω(n ) in the worst case, the visibility graph method inherently takes quadratic time. To deal with the case where h is relatively small compared to n, a variation of the visibility graph method was proposed that first constructs a so-called tangent graph (or relevant visibility graph) and then finds a shortest s-t path in the graph. Using this method, Kapoor et al. [31] gave an algorithm of O (n+ h log n) time; later Chen and Wang [6] derived a better algorithm of O (n + h logh + K ) time, after the free space F is triangulated, where K may be considered as the number of tangents among obstacles of P and 1+ϵ K = O (h ). Note that triangulating F can be done in O (n log n) time or in O (n + h log h) time for any constant ϵ > 0[2]. Hence, the running time of the preceding algorithm in the work of Chen and Wang [6] is still quadratic in the worst case. Using the continuous Dijkstra method, Mitchell [38] made a breakthrough and achieved the 3/2+ϵ first subquadratic algorithm of O (n ) time for any constant ϵ > 0. Also using the continuous Dijkstra approach plus a novel conforming subdivision of the free space, Hershberger and Suri [25] presented an algorithm of O (n log n) time and O (n log n) space; the running time is optimal when h = Θ(n) as Ω(n+h logh) is a lower bound in the algebraic computation tree model (which can be obtained by a reduction from sorting; e.g., see Theorem 3 in the work of de Rezende et al. [14]for a similar reduction). Recently, by modifying Hershberger and Suri’s algorithm, Wang [48] reduced the space to O (n) while the running time is still O (n log n). In addition, Inkulu et al. [28] announced an algorithm of O (n + h logh log n) time and O (n) space, which is also based on the continuous Dijkstra approach. All three continuous Dijkstra algorithms [25, 38, 48] construct the shortest path map, denoted by SPM (s), for a source point s. SPM (s) is of O (n) size and can be used to answer shortest path queries. By building a point location data structure on SPM (s) in additional O (n) time [16, 32], given a query point t, the shortest path length from s to t can be computed in O (log n) time and a shortest s-t path can be output in time linear in the number of edges of the path. The problem setting thus defined for P (i.e., h pairwise disjoint polygonal obstacles with a total of n vertices) is usually referred to as polygonal domains or polygons with holes in the literature. The problem in simple polygons is relatively easier [19, 20, 22, 24, 34] because there is a unique shortest path between any two points in a simple polygon. Guibas et al. [20] presented an algorithm that can construct a shortest path map in linear time. For the two-point shortest path query problem where both s and t are query points, Guibas and Hershberger [19, 22] built a data structure in linear time such that each query can be answered in O (log n) time. In contrast, the two-point query problem in polygonal domains is much more challenging (one reason is that there may be multiple topologically different shortest paths between two points in a polygonal domain): to achieve O (log n) time queries, the current best result uses O (n ) space [10]; alternatively Chiang and Mitchell [10] gave a data structure of O (n+h ) space with O (h log n) query time. Refer to their work [10] for other data structures with a trade-off between space and query time. The L counterpart of the problem where the path length is measured in the L metric also 1 1 attracted much attention (e.g., [1, 9, 12, 13, 35, 37]). For polygons with holes, Mitchell [35, 37]gave an algorithm that can build a shortest path map for a source point in O (n log n) time and O (n) space; for small h, Chen and Wang [9] proposed an algorithm of O (n + h logh) time and O (n) space, after the free space is triangulated. For simple polygons, Bae and Wang [1]built adata structure in linear time that can answer each two-point L shortest path query in O (log n) time. The two-point query problem in polygons with holes has also been studied [4, 5, 47]. To achieve 2 3 O (log n) time queries, the current best result uses O (n + h log h/log logh) space [47]. As discussed previously, the polygonal domainP is described by two parameters n and h. Since in many applications (e.g., geographic problems) h could be much smaller than n (Figure 1), the Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:3 Fig. 1. Illustrating a polygonal domain of h = 3 obstacles and n = 30 vertices. time complexities of algorithms for problems in P may be better measured by both n and h than by n itself. For example, comparing to an O (n log n) time algorithm, an algorithm of O (n+h logh) time would be preferred, not only because n + h logh is asymptotically smaller than n log n for sufficiently small h but also because an O (n + h logh) time algorithm suggests a very different view of the problem than an O (n log n) time algorithm. Indeed, an O (n + h logh) time algorithm conveys the idea that the boundary features of P only provide information defining the input and in some sense almost do not contribute to the complexity of the algorithm, while something akin to sorting needs to be done to the holes. 1.1 Our Result In this article, we show that the problem of finding an Euclidean shortest path among obstacles in P is solvable in O (n + h logh) time and O (n) space, after a triangulation of the free space F is given. If the time for triangulating F is included and the triangulation algorithm of Bar-Yehuda 1+ϵ and Chazelle [2] is used, then the total time of the algorithm is O (n+ h log h), for any constant ϵ > 0. With the assumption that the triangulation could be done in O (n + h logh) time, which has been an open problem and is beyond the scope of this work, our result settles Problem 21 in the Open Problem Project [15]. Our algorithm actually constructs the shortest path map SPM (s) for the source point s in O (n+ h logh) time and O (n) space. We give an overview of our approach in the following. The high-level scheme of our algorithm is similar to that for the L case [47] in the sense that we first solve the convex case where all obstacles of P are convex and then extend the algorithm to the general case with the help of the extended corridor structure of P [4, 7–9, 29–31, 39]. The Convex Case. We first discuss the convex case. Let V denote the set of topmost, bottom- most, leftmost, and rightmost vertices of all obstacles. Hence, |V| ≤ 4h. Using the algorithm of Hershberger and Suri [25], we build a conforming subdivisionS on the points ofV, without con- sidering the obstacle edges. Since |V| = O (h),the size of S is O (h). Then, we insert the obstacle edges into S to build a conforming subdivision S of the free space. The subdivision S has O (h) cells (in contrast, the conforming subdivision of the free space in the work of Hershberger and Suri [25]has O (n) cells). Unlike the subdivision in their work [25] where each cell is of constant size, here the size of each cell of S may not be constant but its boundary consists of O (1) trans- parent edges and O (1) convex chains (each of which belongs to the boundary of an obstacle of P). Like the subdivision in the work of Hershberger and Suri [25], each transparent edge e of S has a well-covering region U (e). In particular, for each transparent edge f on the boundary of U (e), the shortest path distance between e and f is at least 2· max{|e|,|f |}. Using S as a guidance, we 1 ∗ If randomization is allowed, the algorithm of Clarkson et al. [11] can compute a triangulation in O (n log n + h log h) expected time. If all obstacles of P are convex, the triangulation can be done in O (n + h log h) time [27]. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:4 H. Wang run the continuous Dijkstra algorithm as in the work of Hershberger and Suri [25]toexpandthe wavefront, starting from the source point s. A main challenge our algorithm needs to overcome (which is also a main difference between our algorithm and that in their work [ 25]) is that each cell in our subdivision S may not be of constant size. One critical property our algorithm relies on is that the boundary of each cell ofS has O (1) convex chains. Our strategy is to somehow treat each such convex chain as a whole. We also borrow some idea from the algorithm of Hershberger et al. [26] for computing shortest paths among curved obstacles. To guarantee the O (n + h logh) time, some global charging analysis is used. In addition, the tentative prune-and-search technique of Kirkpatrick and Snoeyink [33] is applied to perform certain operations related to bisectors, in logarithmic time each. Finally, the techniques presented in prior work [48] are utilized to reduce the space to O (n). All these efforts lead to an O (n + h logh) time and O (n) space algorithm to construct the shortest path map SPM (s) for the convex case. The General Case. We extend the convex case algorithm to the general case where obstacles may not be convex. To this end, we resort to the extended corridor structure of P, which was used before for reducing the time complexities from n to h (e.g., [4, 7–9, 29–31, 39]). The structure partitions the free space F into an ocean M, O (n) bays, and O (h) canals. Each bay is a simple polygon that shares an edge with M. Each canal is a simple polygon that shares two edges with M. But two bays or two canals, or a bay and a canal, do not share any edge. A common edge of a bay (or canal) with M is called a gate. Thus, each bay has one gate and each canal has two gates. Further, M is bounded by O(h) convex chains. An important property related to shortest paths is that if both s and t are in M, then any shortest s-t path must be in the union of M and all corridor paths, each of which is contained in a canal. As the boundary of M consists of O (h) convex chains, by incorporating all corridor paths, we can easily extend our convex case algorithm to computing SPM (M), the shortest path map SPM (s) restricted toM (i.e., SPM (M) = SPM (s)∩M). To compute the entire map SPM (s),weexpand SPM (M) to all bays and canals through their gates. For this, we process each bay/canal individually. For each bay/canal C, expanding the map into C is actually a special case of the (additively)-weighted geodesic Voronoi diagram problem on a simple polygon where all sites are outside C and can influence C only through its gates. In summary, after a triangulation of F is given, building SPM (M) takes O (n+ h logh) time, and expanding SPM (M) to all bays and canals takes additional O (n + h logh) time. The space of the algorithm is bounded by O (n). It should be noted that a fundamental difference between our algorithm and the O (n + h logh log n)-time algorithm of Inkulu et al. [28] is that our algorithm follows the framework of Hershberger and Suri [25] (as well as that of Hershberger et al. [26]) by using a conforming subdi- vision of the free space as an underlying structure to guide the wavefront expansion, whereas the algorithm of Inkulu et al. [28] does not use the conforming subdivision (it instead uses the trian- gulation as well as the corridor structure of the free space). In addition, our algorithm computes a shortest path map for the source point s, whereas the algorithm of Inkulu et al. [28] computes a shortest path from s to a single point t. Outline. The rest of thearticle is organized as follows. Section 2 defines notation and introduces some concepts. Section 3 presents the algorithm for the convex case. The general case is discussed in Section 4. 2 PRELIMINARIES For any two points a and b in the plane, denote by ab the line segment with a and b as endpoints; denote by |ab| the length of the segment. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:5 Fig. 2. Illustrating the shortest path map SPM(s). The solid (red) curves are walls, and the (blue) dotted segments are windows. The anchor of each cell is also shown with a black point. For any two points s and t in thefreespace F ,weuse π (s, t) to denote a shortest path from s to t in F . In the case where shortest paths are not unique, π (s, t) may refer to an arbitrary one. Denote by d(s, t) the length of π (s, t);wecall d(s, t) the geodesic distance between s and t. For two line segments e and f in F , their geodesic distance is defined to be the minimum geodesic distance between any point on e and any point on f (i.e., min d(s, t)); by slightly abusing s∈e,t∈f the notation, we use d(e, f ) to denote their geodesic distance. For any path π in the plane, we use |π| to denote its length. For any compact region A in the plane, let ∂A denote its boundary. We use ∂P to denote the union of the boundaries of all obstacles of P. Throughout the article, we use s to refer to the source point. For convenience, we consider s as a degenerate obstacle in P. We often refer to the vertices of P as obstacle vertices and refer to the edges of P as obstacle edges. For any point t ∈F , we call the adjacent vertex of t in π (s, t) the anchor of t in π (s, t). The shortest path map SPM (s) of s is a decomposition of the free space F into maximal regions such that all points in each region R have thesameanchor[25, 36] in their shortest paths from s (Figure 2). Each edge of SPM (s) is either an obstacle edge fragment or a bisecting curve, which is the locus of points p with d(s,u) + |pu| = d(s,v) + |pv| for two obstacle vertices u and v.Each bisecting curve is in general a hyperbola; a special case happens if one of u and v is the anchor of the other, in which case their bisecting curve is a straight line. Following the notation in the work of Eriksson-Bique et al. [17], we differentiate between two types of bisecting curves: walls and windows. A bisecting curve of SPM (s) is a wall if there exist two topologically different shortest paths from s to each point of the edge; otherwise (i.e., the preceding special case), it is a window (e.g., see Figure 2). We make a general position assumption that for each obstacle vertexv, there is a unique shortest path from s to v, and for any point p in the plane, there are at most three different shortest paths from s to p. The assumption assures that each vertex of SPM (s) hasdegreeatmost3,and there Usually “predecessor” is used in the literature instead of “anchor,” but here we reserve “predecessor” for other purposes. This is usually called bisector in the literature. Here we reserve the term bisector to be used later. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:6 H. Wang Fig. 3. Illustrating an elementary chain (the thick segments), which contains the vertex v but not u. are at most three bisectors of SPM (s) intersecting at a common point, which is sometimes called a triple point in the literature [17]. A curve in the plane is x-monotone if its intersection with any vertical line is connected; the y-monotone is defined similarly. A curve is xy-monotone if it is both x-and y-monotone. The following observation will be used throughout the article without explicitly mentioning it again. Observation 1. n + h log n = O (n + h logh). Proof. Indeed, if h < n/ log n,then n + h log n = Θ(n),whichis O (n + h logh); otherwise, log n = O (logh) and n + h log n = O (n + h logh). 3 THE CONVEX CASE In this section, we present our algorithm for the convex case where all obstacles of P are convex. The algorithm will be extended to the general case in Section 4. For each obstacle P ∈P, the topmost, bottommost, leftmost, and rightmost vertices of P are called rectilinear extreme vertices. The four rectilinear extreme vertices partition ∂P into four por- tions, and each portion is called an elementary chain, which is convex and xy-monotone. For tech- nical reasons that will be clear later, we assume that each rectilinear extreme vertex v belongs to the elementary chain counterclockwise of v with respect to the obstacle (i.e., v is the clockwise endpoint of the chain (Figure 3)). We use elementary chain fragment to refer to a portion of an elementary chain. We introduce some notation in the following that is similar in spirit to those from Hershberger et al. [26] for shortest paths among curved obstacles. Consider a shortest path π (s,p) from s to a point p in the free space F .Itisnot difficulttosee that π (s,p) is a sequence of elementary chain fragments and common tangents between obstacles ofP∪{p}. We define the predecessor of p, denoted by pred(p), to be the initial vertex of the last elementary chain fragment in π (s,p) (Figure 4(a)). Note that since each rectilinear extreme vertex belongs to a single elementary chain, pred(p) in π (s,p) is unique. A special case happens if p is a rectilinear extreme vertex and π (s,p) contains a portion of an elementary chain A clockwise of p.Inthiscase, we let pred(p) be endpoint of the fragment of A in π (s,p) other than p (e.g., see Figure 4 (b)); in this way, pred(p) is unique in π (s,p).Notethat p may still have multiple predecessors if there are multiple shortest paths from s to p. Intuitively, the reason we define predecessors as in the preceding is to treat each elementary chain somehow as a whole, which is essential for reducing the runtime of the algorithm from n to h. The rest of this section is organized as follows. In Section 3.1, we compute a conforming sub- division S of thefreespace F . Section 3.2 introduces some basic concepts and notation for our algorithm. The wavefront expansion algorithm is presented in Section 3.3, with two key subrou- tines of the algorithm described in Sections 3.4 and 3.5, respectively. Section 3.6 analyzes the time Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:7 Fig. 4. Illustrating the predecessor. complexity of the algorithm, where a technical lemma is proved separately in Section 3.7. Using the information computed by the wavefront expansion algorithm, Section 3.8 constructs the short- est path map SPM (s). The overall algorithm runs in O (n + h logh) time and O (n + h logh) space. Section 3.9 reduces the space to O (n) while keeping the same runtime, by using the techniques from prior work [48]. 3.1 Computing a Conforming Subdivision of the Free Space Let V denote the set of the rectilinear extreme vertices of all obstacles of P. Hence, |V| = O (h). Using the algorithm of algorithm of Hershberger and Suri [25](calledthe HS algorithm), we build a conforming subdivision S with respect to the vertices of V, without considering the obstacle edges. The subdivisionS,which is of size O (h), is a quad-tree-style subdivision of the plane into O (h) cells. Each cell ofS is a square or a square annulus (i.e., an outer square with an inner square hole). Each vertex ofV is contained in the interior of a square cell, and each square cell contains at most one vertex ofV.Eachedge e ofS is axis-parallel and well-covered—that is, there exists a set C(e) of O (1) cells ofS such that their unionU (e) contains e with the following properties: (1) the total complexity of all cells of C(e) is O (1), and thus the size of U (e) is O (1);(2) forany edge f of S that is on ∂U (e) or outsideU (e), the Euclidean distance between e and f (i.e., the minimum |pq| among all points p ∈ e and q ∈ f )isatleast2 · max{|e|,|f |}; and (3) U (e), which is called the well-covering region of e, contains at most one vertex of V. In addition, each cell c of S has O (1) edges on its boundary with the following uniform edge property: the lengths of the edges on the boundary of c differ by at most a factor of 4, regardless of whether c is a square or square annulus. The subdivisionS can be computed in O (h logh) time and O (h) space [25]. Next we insert the obstacle edges into S to produce a conforming subdivision S of the free space F .In S , there are two types of edges: those introduced by the subdivision construction (which are in the interior ofF except possibly their endpoints) and the obstacle edges; we call the former the transparent edges (which are axis-parallel) and the latter the opaque edges. The definition of S is similar to the conforming subdivision of the free space used in the HS algorithm. A main dieff renceisthathereendpointsofeachobstacleedgemay notbein V, a consequence of which is that each cell of S may not be of constant size (while each cell in the subdivision of the HS algorithm is of constant size). However, each cell c ofS has the following property that is critical to our algorithm: the boundary∂c consists of O (1) transparent edges and O (1) convex chains (each of which is a portion of an elementary chain (Figure 5)). More specifically, S is a subdivision ofF into O (h) cells. Each cell ofS is one of the connected components formed by intersectingF with an axis-parallel rectangle (which is the union of a set of adjacent cells ofS) or a square annulus ofS. Each cell ofS contains at most one vertex ofV.Each vertex of V is incident to a transparent edge. Each transparent edge e of S is well-covered—that Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:8 H. Wang Fig. 5. Illustrating a cell c of S , which is bounded by bold segments. The gray region is an obstacle. is, there exists a set C(e) of O (1) cells whose union U (e) contains e with the following property: for each transparent edge f on ∂U (e), the geodesic distance d(e, f ) between e and f is at least 2 · max{|e|,|f |}.The region U (e) is called the well-covering region of e and contains at most one vertex of V.NotethatS has O (h) transparent edges. In the following, we show howS is produced fromS. The procedure is similar to that in the HS algorithm. We overlay the obstacle edges on top ofS to obtain a subdivisionS . Because each overlay edge ofS is axis-parallel and all obstacle edges constitute a total of O (h) elementary chains, each of which is xy-monotone,S has O (h ) faces. We say that a face ofS is interesting if its overlay overlay boundary contains a vertex ofV or a vertex ofS. We keep intact the interesting faces ofS overlay while deleting every edge fragment of S not on the boundary of any interesting cell. Further, for each cell c containing a vertex v ∈V, we partition c by extending vertical edges from v until the boundary of c. This divides c into at most three subcells. Finally we divide each of the two added edges incident to v into segments of length at most δ,where δ is the length of the shortest edge on the boundary of c. By the uniform edge property ofS, ∂c has O (1) edges, whose lengths differ by at most a factor of 4; hence, dividing the edges incident to v as earlier produces only O (1) vertical edges. The resulting subdivision isS . As mentioned previously, the essential difference between our subdivision S and the one in the HS algorithm is that the role of an obstacle edge in the HS algorithm is replaced by an elementary chain. Therefore, each opaque edge in the subdivision of the HS algorithm becomes an elementary chain fragment in our case. Hence, by the same analysis as in the HS algorithm (see Lemma 2.2 [25]), S has the properties as described earlier and the well-covering region U (e) of each transparent edge e of S is defined in the same way as in the HS algorithm. The following lemma computesS . It should be noted that althoughS is defined with the help ofS , S is constructed directly without computingS first. overlay overlay Lemma 3.1. The conforming subdivision S can be constructed in O (n + h logh) time and O (n) space. Proof. We first construct S in O (h logh) time and O (h) space [25]. In the following, we con- struct S by inserting the obstacle edges into S. The algorithm is similar to that in the HS algo- rithm (see Lemma 2.3 [25]). The difference is that we need to handle each elementary chain as a whole. We first build a data structure so that for any query horizontal ray with origin in F ,the first obstacle edge of P hit by it can be computed in O (log n) time. This can be done by building a hori- zontal decomposition of F —that is, extend a horizontal segment from each vertex until it hits∂P. As all obstacles of P are convex, the horizontal decomposition can be computed in O (n + h logh) time and O (n) space [27]. By building a point location data structure [16, 32] on the horizontal decomposition in additional O (n) time, each horizontal ray shooting can be answered in O (log n) time. Similarly, we can construct the vertical decomposition of F in O (n + h logh) time and O (n) space so that each vertical ray shooting can be answered in O (log n) time. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:9 The edges ofS are obstacle edges, transparent edges incident to the vertices ofS, and transpar- ent edges subdivided on the vertical segments incident to the vertices ofV. To identify the second type of edges, we trace the boundary of each interesting cell separately. Starting from a vertex v ofS, we trace along each edge incident to v. Using the preceding ray-shooting data structure, we determine whether the next cell vertex is a vertex of S or the first point on ∂P hit by the ray. As S has O (h) edges and vertices, this tracing takes O (h log n) time in total. Tracing along obstacle edges is done by starting from each vertex of V and following each of its incident elementary chains. For each elementary chain, the next vertex is either the next obstacle vertex on e,where e is the current tracing edge of the elementary chain, or the intersection of e with a transparent edge of the current cell. Hence, tracing all elementary chains takes O (n) time in total. The third type of edges can be computed in linear time by local operations on each cell containing a vertex of V. Finally, we assemble all these edges together to obtain an adjacency structure for S . For this, we could use a plane sweep algorithm as in the HS algorithm. However, that would take O (n log n) time, as there are O (n) edges in S . To obtain an O (n + h logh) time algorithm, we propose the following approach. During the preceding tracing of elementary chains, we record the fragment of the chain that lies in a single cell. Since each such portion may not be of constant size, we represent it by a line segment connecting its two endpoints; note that this segment does not intersect any other cell edges because the elementary chain fragment is on the boundary of an obstacle (and thus the segment is inside the obstacle). Then, we apply the plane sweep algorithm to stitch all edges with each elementary chain fragment in a cell replaced by a segment as earlier. The algorithm takes O (h logh) time and O (h) space. Finally, for each segment representing an elementary chain portion, we locally replace it by the chain fragment in linear time. Hence, this step takes O (n) time altogether for all such segments. As such, the total time for computing the adjacency information for S is O (n + h log n),which is O (n + h logh). Clearly, the space complexity of the algorithm is O (n). 3.2 Basic Concepts and Notation Our shortest path algorithm uses the continuous Dijkstra method. The algorithm initially gener- ates a wavefront from s, which is a circle centered at s. During the algorithm, the wavefront consists of all points of F with the same geodesic distance from s (Figure 6). We expand the wavefront un- til all points of the free space are covered. The conforming subdivision S is utilized to guide the wavefront expansion. Our wavefront expansion algorithm follows the high-level scheme as the HS algorithm. The difference is that our algorithm somehow considers each elementary chain as a whole, which is in some sense similar to the algorithm of Hershberger et al. [26](calledthe HSY algorithm). Indeed, the HSY algorithm considers each xy-monotone convex arc as a whole, but the difference is that each arc in the HSY algorithm is of constant size, whereas in our case each elementary chain may not be of constant size. As such, techniques from both the HS algorithm and the HSY algorithm are borrowed. We useτ to denote the geodesic distance from s to all points in the wavefront. One may also think of τ as a parameter representing time. The algorithm simulates the expansion of the wavefront as time increases from 0 to ∞. The wavefront comprises a sequence of wavelets, each emanating from a generator. In the HS algorithm, a generator is simply an obstacle vertex. Here, since we want to treat an elementary chain as a whole, similar to the HSY algorithm (also similar to the concept “bunch” introduced in the work of Inkulu et al. [28]), we define a generator as a couple α = (A, a),where A is an elementary chain and a is an obstacle vertex on A, and further a clockwise or counterclockwise direction of A is designated for α; a has a weight w (a) (one may consider w (a) as the geodesic distance between s and a). We call a the initial vertex of the generator α. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:10 H. Wang Fig. 6. Illustrating the wavefront. The black region are obstacles. The green point is s. The red curves are bisecting curves of SPM(s). The gray region is the free space that has been covered by the wavefront. The boundary between the white region and the gray region is the wavefront. The figure is generated using the applet from Hershberger et al. [23]. Fig. 7. Illustrating a generator α = (A, a). A consists Fig. 8. Illustrating the wavelet generated by α = of the thick segments and is designated in the clock- (A,q), designated in the counterclockwise direction. wise direction around the obstacle. q is a reachable The wavelet has three pieces each of which is a cir- point through vertex v. cular arc. We say a point q is reachable by a generator α = (A, a) if one can draw a path in F from a to q by following A in the designated direction to a vertex v on A such that vq is tangent to A and then following the segment vq (Figure 7). The (weighted) distance between the generator α and q is the length of this path plus w (a); by slightly abusing the notation, we use d(α,q) to denote the distance. From the definition of reachable points, the vertex a partitions A into two portions and only the portion following the designated direction is relevant (e.g., in Figure 7, only the portion containing the vertex v is relevant). Henceforth, unless otherwise stated, we use A to refer to its relevant portion only and we call A the underlying chain of α. In this way, the initial vertex a becomes an endpoint of A. For convenience, sometimes we do not differentiate α and A. For example, when we say “the tangent from q to α,” we mean “the tangent from q to A”; in addition, when we say “a vertex of α,” we mean “a vertex of A.” The wavefront can thus be represented by the sequence of generators of its wavelets. A wavelet generated by a generator α = (A, a) at time τ is a contiguous set of reachable points q such that d(α,q) = τ and d(α ,q) ≥ τ for all other generators α in the wavefront; we also say that q is claimed by α.Notethatas A may not be of constant size, a wavelet may not be of constant size either; it actually consists of a contiguous sequence of circular arcs centered at the obstacle vertices A (Figure 8). If a point q is claimed by α,then d(s,q) = d(α,q) = τ and the predecessor pred(q) of q is a; sometimes for convenience, we also say that the generator α is the predecessor Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:11 Fig. 9. Illustrating a new generator α = (A ,q). (a) A general case where both A and A are marked with thick segments. (b) A special case where A is marked with solid (red) segments and A is marked with dashed (blue) segments. Fig. 10. Illustrating the bisector B(γ,γ ) defined by two generators γ = (A,q) and γ = (A ,q ). The portion between q and q is a hyperbola defined by v and v . of q.If q is on an elementary chain A and the tangent from q to a is also tangent to A ,thena new generator (A ,q) is added to the wavefront (Figure 9(a)). A special case happens when q is the counterclockwise endpoint of A (and thus q does not belong to A); in this case, a new generator α = (A ,q) is also added, where A is the elementary chain that contains q (e.g., see Figure 9(b)). As τ increases, the points bounding the adjacent wavelets trace out the bisectors that form the edges of the shortest path map SPM (s).The bisector between the wavelets of two generators α and α , denoted by B(α, α ), consists of points q with d(α,q) = d(α ,q). Note that since α and α may not be of constant size, B(α, α ) may not be of constant size either (in contrast, the bisector in HSY’s algorithm is always of constant size; note that a similar concept “I-curves” is introduced in the work of Inkulu et al. [28]). More specifically, B(α, α ) has multiple pieces, each of which is a hyperbola defined by two obstacle vertices v ∈ α and v ∈ α such that the hyperbola consists of all points that have two shortest paths from s with v and v as the anchors in the two paths, respectively (Figure 10). A special case happens if α is a generator created by the wavelet of α such as that illustrated in Figure 9(a), then B(α, α ) is the half-line extended from q along the direction from v to q (the dashed segment in Figure 9(a)); we call such a bisector an extension bisector.Note that in the case illustrated in Figure 9(b), B(α, α ), which is also an extension bisector, is the half- line extended from q along the direction from v to q (the dashed segment in Figure 9(b)), where v is the obstacle vertex adjacent to q in A. A wavelet gets eliminated from the wavefront if the two bisectors bounding it intersect, which is called a bisector event. Specifically, if α , α,and α are three consecutive generators of the 1 2 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:12 H. Wang Fig. 11. Illustrating the intersection of two bisectors. Fig. 12. Illustrating the map SPM (s). The red curves are non-extension bisectors. The green and blue seg- ments are extension bisectors, where the green and blue ones are Type (a) and (b) as illustrated in Figure 9. The predecessor in each cell is also shown with a black point. For example, all points in the cell containing q have a as their predecessor. wavefront, the wavelet generated by α will be eliminated when B(α , α ) intersects B(α, α ) 1 2 (Figure 11). Wavelets are also eliminated by collisions with obstacles and other wavelets in front of it. If a bisector B(α, α ) intersects an obstacle, their intersection is also called a bisector event. Let SPM (s) be the subdivision of F by the bisectors of all generators (Figure 12). The intersec- tions of bisectors and intersections between bisectors and obstacle edges are vertices of SPM (s). Each bisector connecting two vertices is an edge of SPM (s), called a bisector edge. As discussed before, a bisector, which consists of multiple hyperbola pieces, may not be of constant size. Hence, a bisector edge e of SPM (s) may not be of constant size. For differentiation, we call each hyperbola piece of e a hyperbolic-arc. In addition, if the boundary of an obstacle P contains more than one vertex of SPM (s), then the chain of edges of ∂P connecting two adjacent vertices of SPM (s) also forms an edge of SPM (s), called a convex chain edge. The following lemma shows that SPM (s) is very similar to SPM (s). Refer to Figure 13 for SPM (s). Lemma 3.2. Each extension bisector edge of SPM (s) is a window of SPM (s). The union of all non- extension bisector edges of SPM (s) is exactly the union of all walls of SPM (s). SPM (s) can be obtained from SPM (s) by removing all windows except those that are extension bisectors of SPM (s). Proof. We first prove that each extension bisector edge e of SPM (s) is a window of SPM (s).By definition, one endpoint of e, denoted by u, is an obstacle vertex such that e is a half-line extended Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:13 Fig. 13. Illustrating the map SPM (s). The dashed segments are windows that are not in SPM (s); removing them becomes SPM (s). The anchor of each cell is also shown. from u in the direction from v to u for another obstacle vertex v. Hence, for each point p ∈ e,there is a shortest s-p path π (s,p) such that vp is a segment of π (s,p).As u ∈ vp, p must be on a window w of SPM (s). This proves that e ⊆ w. However, for any point p ∈ w, there is a shortest s-p path π (s,p) that contains vp. Since u ∈ vp, p must be on the extension bisector edge e of SPM (s),and thus w ⊆ e. Therefore, e = w. This proves that each extension bisector edge of SPM (s) is a window of SPM (s). We next prove that the union of all non-extension bisector edges of SPM (s) is exactly the union of all walls of SPM (s): • We first show that the union of all non-extension bisector edges of SPM (s) is a subset of the union of all walls of SPM (s). Let q be a point on a non-extension bisector B(α, α ) of two generators α = (A, a) and α = (A , a ).Let v and v be the tangent points on A and A from q, respectively. Hence, q has two shortest paths from s, one containing qv and the other containing qv . Since B(α, α ) is not an extension bisector,v  qv andv  qv . This means that the two paths are combinatorially different, and thus q is on a wall of SPM (s). This proves that the union of all non-extension bisector edges of SPM (s) is a subset of the union of all walls of SPM (s). • We then show that the union of all walls of SPM (s) is a subset of the union of all non- extension bisector edges of SPM (s). Let q be a point on a wall of SPM (s). By definition, there are two obstacle vertices v and v such that there are two combinatorially different shortest paths from s to q whose anchors are v and v , respectively. Further, since the two paths are combinatorially different and also due to the general position assumption, v  qv and v  qv . Therefore, q must be on the bisector edge of the two generators α and α in SPM (s) whose underlying chains containing v and v , respectively. Further, since v  qv and v  qv, the bisector of α and α is not an extension bisector. This proves that the union of all walls of SPM (s) is a subset of the union of all non-extension bisector edges of SPM (s). The preceding proves that the first and second statements of the lemma. The third statement im- mediately follows the first two. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:14 H. Wang Corollary 3.3. The combinatorial size of SPM (s) is O (n). Proof. By Lemma 3.2, SPM (s) is a subset of SPM (s). As the combinatorial size of SPM (s) is O (n) [25, 36], the combinatorial size of SPM (s) is also O (n). Lemma 3.4. The subdivision SPM (s) has O (h) faces, vertices, and edges. In particular, SPM (s) has O (h) bisector intersections and O (h) intersections between bisectors and obstacle edges. Proof. By Lemma 3.2, for any vertex of SPM (s) that is the intersection of two non-extension bisectors, it is also the intersection of two walls of SPM (s), which is a triple point.Let SPM (s) refer to SPM (s) excluding all extension bisectors. We define a planar graph G corresponding to SPM (s) as follows. Each obstacle defines a node of G, and each triple point also defines a node of G. For any two nodes of G, if they are connected by a chain of bisector edges of SPM (s) such that the chain does not contain any other node of G,then G has an edge connecting the two nodes. It is proved in previous work [46]that G has O (h) vertices, faces, and edges. It is not difficult to see that a face of SPM (s) corresponds to a face of G and thus the number of faces of SPM (s) is O (h). For each bisector intersection of SPM (s), it must be a triple point and thus it is also a node of G.As G has O (h) nodes, the number of bisector intersections of SPM (s) is O (h). For each intersection v between a bisector and an obstacle edge in SPM (s), G must has an edge e corresponding a chain of bisector edges and v is the endpoint of the chain; we charge v to e.As e as two incident nodes of G, e can be charged at most twice. Since G has O (h) edges, the number of intersections between bisectors and obstacle edges in SPM (s) is O (h). We next prove that the total number of extension bisector edges of SPM (s) is O (h). For each extension bisection edge e, it belongs to one of the two cases (a) and (b) illustrated in Figure 9. For Case (b), one endpoint of e is a rectilinear extreme vertex. Since each rectilinear extreme vertex can define at most two extension bisector edges and there are O (h) rectilinear extreme vertices, the total number of Case (b) extension bisectors is O (h). For Case (a), e is an extension of a common tangent of two obstacles; we say that e is defined by the common tangent. Note that all such common tangents are interior disjoint, as they belong to shortest paths from s encoded by SPM (s). We now define a planar graph G as follows. The node set of G consists of all obstacles of P.Two obstacles have an edge in G if they have at least one common tangent that defines an extension bisector. Since all such common tangents are interior disjoint, G is a planar graph. Apparently, no two nodes of G share two edges and no node of G has a self-loop. Therefore, G is a simple planar graph. Since G has h vertices, the number of edges of G is O (h). By the definition of G ,each pair of obstacles whose common tangents define extension bisectors have an edge in G .Because each pair of obstacles can define at most four common tangents and thus at most four extension bisectors and also because G has O (h) edges, the total number of Case (a) extension bisectors is O (h). The bisector intersections of SPM (s) that are not vertices of SPM (s) involve extension bisec- tors of SPM (s). The intersections between bisectors and obstacle edges in SPM (s) that are not in SPM (s) also involve extension bisectors. Since all extension bisectors and all edges of SPM (s) are interior disjoint, each extension bisector can involve in at most two bisector intersections and at most two intersections between bisectors and obstacle edges. Because the total number of exten- sion bisector edges of SPM (s) is O (h), the number of bisector intersections involving extension bisectors is O (h) and the number of intersections between extension bisectors and obstacle edges is also O (h). Therefore, comparing to SPM (s), SPM (s) has O (h) additional vertices and O (h) addi- tional edges. Note that the number of convex chain edges of SPM (s) is O (h),for SPM (s) has O (h) vertices. The lemma thus follows. Corollary 3.5. There are O (h) bisector events and O (h) generators in SPM (s). Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:15 Proof. Each bisector event is either a bisector intersection or an intersection between a bisector and an obstacle edge. By Lemma 3.4,there are O (h) bisector intersections and O (h) intersections between bisectors and obstacle edges. As such, there are O (h) bisector events in SPM (s). By definition, each face of SPM (s) has a unique generator. Since SPM (s) has O (h) faces by Lemma 3.4, the total number of generators is O (h). By the definition of SPM (s), each cell C of SPM (s) has a unique generator α = (A, a), all points of the cell are reachable from the generator, and a is the predecessor of all points of C (e.g., see Figure 12; all points in the cell containing q have a as their predecessor). Hence, for any point q ∈ C, we can compute d(s,q) = d(α,q) by computing the tangent from q to A.Thus, SPM (s) can also be used to answer shortest path queries. In fact, given SPM (s), we can construct SPM (s) in additional O (n) time by inserting the windows of SPM (s) to SPM (s), as shown in the following lemma. Lemma 3.6. Given SPM (s), SPM (s) can be constructed in O (n) time (e.g., see Figures 12 and 13). Proof. It suffices to insert all windows of SPM (s) (except those that are also extension bisectors of SPM (s))to SPM (s).WeconsidereachcellC of SPM (s) separately. Let α = (A, a) be the generator of C. Our goal is to extend each obstacle edge of A along the designated direction of A until the boundary of C. To this end, since all points of C are reachable from α, the cell C is “star-shaped” with respect to the tangents of A (along the designated direction) and the extension of each obstacle edge of A intersects the boundary of C at most once. Hence, the order of the endpoints of these extensions is consistent with the order of the corresponding edges of A. Therefore, these extension endpoints can be found in order by traversing the boundary of C, which takes linear time in the size of C. Since the total size of all cells of SPM (s) is O (n) by Corollary 3.3, the total time of the algorithm is O (n). In light of Lemma 3.6, we will focus on computing the map SPM (s). 3.3 The Wavefront Expansion Algorithm To simulate the wavefront expansion, we compute the wavefront passing through each transparent edge of the conforming subdivisionS . As in the HS algorithm, since it is difficult to compute a true wavefront for each transparent edge e of S , a key idea is to compute two one-sided wavefronts (called approximate wavefronts)for e, each representing the wavefront coming from one side of e. Intuitively, an approximate wavefront from one side of e is what the true wavefront would be if the wavefront were blocked off at e by considering e as an opaque segment (with open endpoints). In the following, unless otherwise stated, a wavefront at a transparent edge e of S refers to an approximate wavefront. Let W (e) denote a wavefront at e. To make the description concise, as there are two wavefronts at e, depending on the context, W (e) may refer to both wavefronts—that is, the discussion onW (e) applies to both wavefronts. For example, “compute the wavefrontsW (e)” means “compute both wavefronts at e.” For each transparent edge e ofS ,define input (e) as the set of transparent edges on the bound- ary of the well-covering region U (e), and define output (e) = {д | e ∈ input (д)}∪ input (e). Because∂U (e ) for each transparent edge e ofS has O (1) transparent edges, both|input (e)| and |output (e)| are O (1). The Wavefront Propagation and Merging Procedures. The wavefronts W (e) at e are computed from the wavefronts at edges of input (e); this guarantees the correctness because e is in U (e) (and thus any shortest path π (s,p) must cross some edge f ∈ input (e) for any point p ∈ e). After We include input (e) in output (e) mainly for the proof of Lemma 3.23, which relies on output (e) havingacycle enclosing e. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:16 H. Wang the wavefronts W (e) at e are computed, they will pass to the edges of output (e). In addition, the geodesic distances from s to both endpoints of e will be computed. Recall that V is the set of rectilinear extreme vertices of all obstacles and each vertex ofV is incident to a transparent edge of S . As such, after the algorithm is finished, geodesic distances from s to all vertices of V will be available. The process of passing the wavefronts W (e) at e to all edges д ∈ output (e) is called the wavefront propagation procedure, which will compute the wavefront W (e,д),where W (e,д) is the portion of W (e) that passes to д through the well-covering region U (д) of д if e ∈ input (д) and through U (e) otherwise (in this case, д ∈ input (e)); whenever the procedure is invoked on e, we say that e is processed. The wavefronts W (e) at e are constructed by merging the wavefronts W (f, e) for edges f ∈ input (e); this procedure is called the wavefront merging procedure. The Main Algorithm. The transparent edges ofS are processed in a rough time order. The wave- ˜ ˜ fronts W (e) of each transparent edge e are constructed at the time d(s, e)+|e|,where d(s, e) is the minimum geodesic distance from s to the two endpoints of e.Define covertime(e) = d(s, e) + |e|. The value covertime(e) will be computed during the algorithm. Initially, for each edge e whose well-covering region U (e) contains s, W (e) and covertime(e) are computed directly (and set covertime(e) = ∞ for all other edges); we refer to this step as the initialization step,which will be elaborated in the following. The algorithm maintains a timer τ and processes the transparent edges e of S following the order of covertime(e). The main loop of the algorithm works as follows. As long asS has an unprocessed transparent edge, we do the following. First, among all unprocessed transparent edges, choose the one e with minimum covertime(e) and set τ = covertime(e). Second, call the wavefront merging procedure to construct the wavefronts W (e) from W (f, e) for all edges f ∈ input (e) satisfying covertime(f ) < covertime(e); compute d(s,v) from W (e) for each endpoint v of e.Third,process e—that is, call the wavefront propagation procedure on W (e) to compute W (e,д) for all edges д ∈ output (e);in particular, compute the time τ when the wavefronts W (e) first encounter an endpoint of д and set covertime(д) = min{covertime(д),τ + |д|}. The details of the wavefront merging procedure and the wavefront propagation procedure will be described in Sections 3.4 and 3.5, respectively. The Initialization Step. We provide the details on the initialization step. Consider a transparent edge e whose well-covering regionU (e) contains s. To compute W (e), we only consider straight- line paths from s to e inside U (e).If U (e) does not have any island inside, then the points of e that can be reached from s by straight-line paths in U (e) form an interval of e and the interval can be computed by considering the tangents from s to the elementary chains on the boundary of U (e). Since U (e) has O (1) cells of S , ∂U (e) has O (1) elementary chain fragments and thus computing the interval on e takes O (log n) time. IfU (e) has at least one island inside, then e may have multiple such intervals. AsU (e) is the union of O (1) cells ofS , the number of islands inside U (e) is O (1). Hence, e has O (1) such intervals, which can be computed in O (log n) time altogether. These intervals form the wavefront W (e)—that is, each interval corresponds to a wavelet with generator s.From W (e),the value covertime(e) can be immediately determined. More specifically, for each endpoint v of e, if one of the wavelets of W (e) covers v, then the segment sv is in U (e) and thus d(s,v) = |sv|; otherwise, we set d(s,v) = ∞. In this way, we find an upper bound for d(s, e) and set covertime(e) to this upper bound plus |e|. The Algorithm Correctness. At the time d(s, e) + |e|,all edges f ∈ input (e) whose wavefronts W (f ) contribute a wavelet toW (e) must have already been processed. This is due to the property of the well-covering regions ofS that d(e, f ) ≥ 2·max{|e|,|f |} since f is on∂U (e). The proof is the same as that of Lemma 4.2 [25], so we omit it. Note that this also implies that the geodesic distance Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:17 d(s,v) is correctly computed for each endpoint v of e. Therefore, after the algorithm is finished, geodesic distances from s to endpoints of all transparent edges ofS are correctly computed. Artificial Wavelets. As in the HS algorithm, to limit the interaction between wavefronts from different sides of each transparent edge e, when a wavefront propagates across e (i.e., whenW (e) is computed in the wavefront merging procedure), an artificial wavelet is generated at each endpoint v of e,withweight d(s,v). This is to eliminate a wavefront from one side of e if it arrives at e later than the wavefront from the other side of e. We will not explicitly discuss this anymore when we describe the algorithm. Topologically Different Paths. In the wavefront propagation procedure to pass W (e) to all edges д ∈ output (e), W (e) travels through the cells of the well-covering regionU of either д or e. Since U may not be simply connected (e.g., the square annulus), there may be multiple topologically different shortest paths between e and д inside U; the number of such paths is O (1) as U is the union of O (1) cells of S .Wepropagate W (e) in multiple components of U, each corresponding to a topologically different shortest path and defined by the particular sequence of transparent edges it crosses. These wavefronts are later combined in the wavefront merging step at д.This also happens in the initialization step, as discussed earlier. Claiming a Point. During the wavefront merging procedure at e,wehaveasetofwavefronts W (f, e) that reach e from the same side for edges f ∈ input (e). We say that a wavefront W (f, e) claims a point p ∈ e if W (f, e) reaches p before any other wavefront. Further, for each wavefront W (f, e), the set of points on e claimed by it forms an interval (the proof is similar to that of Lemma 4.4 [25]). Similarly, a wavelet of a wavefront claims a point p of e if the wavelet reaches p before any other wavelet of the wavefront, and the set of points on e claimed by any wavelet of the wavefront also forms an interval. For convenience, if a wavelet claims a point, we also say that the generator of the wavelet claims the point. Before presenting the details of the wavefront merging procedure and the wavefront propa- gation procedure in the next two sections, we first discuss the data structure (for representing elementary chains, generators, and wavefronts) and a monotonicity property of bisectors, which will be used later in our algorithm. 3.3.1 The Data Structure. We use an array to represent each elementary chain. Then, a genera- tor α = (A, a) can be represented by recording the indices of the two end vertices of its underlying chain A. In this way, a generator takes O (1) additional space to record and binary search on A can be supported in O (log n) time (e.g., given a point p, find the tangent from p to A). In addition, we maintain the lengths of the edges in each elementary chain so that given any two vertices of the chain, the length of the subchain between the two vertices can be obtained in O (1) time. All this preprocessing can be done in O (n) time and space for all elementary chains. For a wavefront W (e) of one side of e, it is a list of generators α , α ,... ordered by the in- 1 2 tervals of e claimed by these generators. Note that these generators are in the same side of e. Formally, we say that a generator α is in one side of e if the initial vertex of α lies in that side of the supporting line of e. We maintain these generators by a balanced binary search tree so that the following operations can be supported in logarithmic time each. Let W be a wavefront with generators α , α ,..., α : 1 2 Insert: Insert a generator α to W . In our algorithm, α is inserted either in the front of α or after α . Delete: Delete a generator α from W , for any 1 ≤ i ≤ k. Split:Split W into two sublists at some generator α so that the first i generators form a wave- front and the rest form another wavefront. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:18 H. Wang Fig. 14. Illustrating the reachable region R(α ) of a Fig. 15. Illustrating the ray ρ (a) and the region R . generator α = (A, a). Concatenate: Concatenate W with another list W of generators so that all generators of W are in the front of those of W in the new list. We will show later that each wavefront involved in our algorithm has O (h) generators. There- fore, each of the preceding operations can be performed in O (logh) time. We make the tree fully persistent by path-copying [43]. In this way, each operation on the tree will cost O (logh) addi- tional space but the older version of the tree will be kept intact (and operations on the old tree can still be supported). 3.3.2 The Monotonicity Property of Bisectors. Lemma 3.7. Suppose α = (A , a ) and α = (A , a ) are two generators on the same side of an 1 1 1 2 2 2 axis-parallel line (i.e., a and a are on the same side of; it is possible that intersects A and A ). 1 2 1 2 Then, the bisector B(α , α ) intersects at no more than one point. 1 2 Proof. Consider a generator α = (A, a).Recallthat a is an endpoint of A.Let a be the other endpoint of A. We consider the general case where A hasatleast oneedge, andthus a  a ;the other case can be handled analogously. We define R(α ) as the set of points in the plane that are reachable from α (without considering any other obstacles), and we call it the reachable region of α. The reachable region R(α ) is bounded by A,aray ρ(a) with origin a, and another ray ρ(a ) with origin a (Figure 14). Specifically, ρ(a) is along the direction from z to a,where z is the anchor of a in the shortest path from s to a; ρ(a ) is the ray from the adjacent obstacle vertex of a on A to a . We claim that the intersection∩R(α ) must be an interval of. Indeed, since A is xy-monotone, without loss of generality, we assume that a is to the northwest of a.Let ρ (a) be the vertically downward ray from a (Figure 15). Observe that the concatenation of ρ(a ), A,and ρ (a) is xy- monotone; let R be the region of the plane to the right of their concatenation. Since the boundary of R is xy-monotone and  is axis-parallel, R ∩ must be an interval of . Notice that ρ(a) must be in R , and thus it partitions R into two subregions, one of which is R(α ). Since intersects ρ(a) at most once and R ∩ is an interval, R(α ) ∩ must also be an interval. According to the preceding claim, both  ∩ R(α ) and  ∩ R(α ) are intervals of .Let I denote 1 2 the common intersection of the two intervals. Since B(α , α ) ⊆ R(α ) and B(α , α ) ⊆ R(α ),we 1 2 1 1 2 2 obtain that B(α , α ) ∩ ⊆ I. 1 2 Assume to the contrary that B(α , α )∩ contains two points, say, q and q . Then, both points 1 2 1 2 are in I.Let v and u be the tangents points of q on A and A , respectively. Let v and u be the 1 1 1 1 2 2 2 tangents points of q on A and A , respectively (Figure 16). As I = ∩R(α )∩R(α ) and I contains 2 1 2 1 2 both q and q , if we move a point q from q to q on, the tangent from q to A will continuously 1 2 1 2 1 change from q v to q v and the tangent from q to A will continuously change from q u to q u . 1 1 2 2 2 1 1 2 2 Since A and A are in the same side of  and each of A and A has a fixed designated direction 1 2 1 2 (i.e., either clockwise or counterclockwise), either q u intersects q v in their interiors or q v 1 1 2 2 1 1 intersects q u in their interiors; without loss of generality, we assume that it is the former case. 2 2 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:19 Fig. 16. Illustrating the proof of Lemma 3.7. Let p be the intersection of q u and q v (e.g., see Figure 16). Since q ∈ B(α , α ), points of q u 1 1 2 2 1 1 2 1 1 other than q have only one predecessor, which is a .As p ∈ q u and p  q , p has only one 1 2 1 1 1 predecessor a . Similarly, since q ∈ B(α , α ) and p ∈ q v , a is also p’s predecessor. We thus 2 2 1 2 2 2 1 obtain a contradiction. Note that similar monotonicity properties of bisectors were also used in previous work (e.g., [25, 26, 28]). Corollary 3.8. Suppose α = (A , a ) and α = (A , a ) are two generators both below a horizon- 1 1 1 2 2 2 tal line. Then, the portion of the bisector B(α , α ) above is y-monotone. 1 2 Proof. For any horizontal line  above, since both generators are below,theyare also below . By Lemma 3.7, B(α , α ) ∩ is either empty or a single point. The corollary thus follows. 1 2 3.4 The Wavefront Merging Procedure In this section, we present the details of the wavefront merging procedure. Given all contributing wavefronts W (f, e) of f ∈ input (e) for W (e), the goal of the procedure is to compute W (e).The algorithm follows the high-level scheme of the HS algorithm (i.e., Lemma 4.6 of Hershberger and Suri [25]), but the implementation details are quite different. We only consider the wavefronts W (f, e) and W (e) for one side of e since the algorithm for the other side is analogous. Without loss of generality, we assume that e is horizontal and all wavefrontsW (f, e) are coming from below e. We describe the algorithm for computing the interval of e claimed by W (f, e) if only one other wavefront W (f , e) is present. The common intersection of these intervals of all such f is the interval of e claimed by W (f, e). Since |input (e)| = O (1),the number of such f is O (1). We first determine whether the claim of W (f, e) is to the left or right of that of W (f , e).Tothis end, depending on whether both W (f, e) and W (f , e) reach the left endpoint v of e,there aretwo cases. Note that the intervals of e claimed by W (f, e) and W (f , e) are available from W (f, e) and W (f , e);let I and I  denote these two intervals, respectively: f f • If both I and I  contain v (i.e., both W (f, e) and W (f , e) reach v), then we compute the f f (weighted) distances from v to the two wavefronts. This can be done as follows. Since v ∈ I , v must be reached by the leftmost generator α of W (f, e). We compute the distance d(α,v) by computing the tangent fromv to α in O (log n) time. Similarly, we compute d(α ,v),where α is leftmost generator of W (f , e).If d(α,v) ≤ d(α ,v), then the claim of W (f, e) is to the left of that of W (f , e); otherwise, the claim of W (f, e) is to the right of that of W (f , e). • If both I and I  do not contain v, then the order of the left endpoints of I and I  gives the f f f f answer. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:20 H. Wang Without loss of generality, we assume that the claim of W (f, e) is to the left of that of W (f , e). We next compute the interval I of e claimed by W (f, e) with respect to W (f , e). Note that the left endpoint of I is the left endpoint of I . Hence, it remains to find the right endpoint of I, as follows. Let  be the supporting line of e.Let α be the rightmost generator of W (f, e), and let α be the leftmost generator of W (f , e).Let q be the left endpoint of the interval on e claimed by α in W (f, e)—that is, q is the intersection of the bisector B(α , α ) and e,where α is the left neighboring 1 1 1 generator of α in W (f, e). Similarly, let q be the right endpoint of the interval on e claimed by α in W (f , e)—that is, q is the intersection of e and the bisector B(α , α ),where α is the right 1 1 neighboring generator of α in W (f , e).Let q be the intersection of the bisector B(α, α ) and e. We assume that the three points q , i = 0, 1, 2 are available, and we will discuss later that each of them can be computed in O (log n) time by a bisector-line intersection operation given in Lemma 3.10. If q is between q and q ,then q is the right endpoint of I and we can stop the algorithm. If q is 0 1 2 0 0 to the left of q , then we delete α from W (f, e).If q is to the right of q , then we delete α from 1 0 2 W (f , e). In either case, we continue the same algorithm by redefining α or α (and recomputing q for i = 0, 1, 2). Clearly, the preceding algorithm takes O((1+k) log n) time, where k is the number of generators that are deleted. We apply the algorithm on f and other f in input (e) to compute the correspond- ing intervals for f . The common intersection of all these intervals is the interval of e claimed by W (f, e). We do so for each f ∈ input (e), after which W (e) is obtained. Since the size of input (e) is O (1), we obtain the following lemma. Lemma 3.9. Given all contributing wavefronts W (f, e) of edges f ∈ input (e) for W (e),wecan compute the interval of e claimed by each W (f, e) and thus construct W (e) in O((1+ k) log n) time, where k is the total number of generators in all wavefronts W (f, e) that are absent from W (e). Lemma 3.10 (Bisector-Line Intersection Operation). Each bisector-line intersection operation can be performed in O (log n) time. Proof. Given two generators α = (A , a ) and α = (A , a ) below a horizontal line, the goal 1 1 1 2 2 2 of the operation is to compute the intersection between the bisector B(α , α ) and. By Lemma 3.7, 1 2 B(α , α ) ∩ is either empty or a single point. 1 2 We apply a prune-and-search technique from Kirkpatrick and Snoeyink [33]. To avoid the lengthy background explanation, we follow the notation in their work [33] without definition. We will rely on Theorem 3.6 in their work [33] as well. To do so, we need to define a decreasing function f and an increasing function д. We first compute the intersection of  and the reachable region R(α ) of α ,asdefinedinthe 1 1 proofofLemma 3.7. This can be easily done by computing the intersections between  and the boundary of R(α ) in O (log n) time. Let I be their intersection, which is an interval of as proved 1 1 in Lemma 3.7. Similarly, we compute the intersection I of  and the reachable region R(α ) of α . 2 2 2 Let I = I ∩ I . For each endpoint of I, we compute its tangent point on A (along its designated 1 2 1 direction) to determine the portion of A whose tangent rays intersect I and let A denote the por- tion. Similarly, we determine the portion B of A whose tangent rays intersect I. All the preceding takes O (log n) time. We parameterize over [0, 1] each of the two convex chains A and B in clockwise order—that is, each value of [0, 1] corresponds to a slope of a tangent at a point on A (respectively, B). For each point a of A,wedefine f (a) to be the parameter of the point b ∈ B such that the tangent ray of A at a along the designated direction and the tangent ray of B at b along the designated direction intersect at a point on the bisector B(α , α ) (Figure 17, left); if the tangent ray at a does not intersect 1 2 B(α , α ),thendefine f (a) = 1. For each point b of B,wedefine д(b) to be the parameter of the 1 2 point a ∈ A such that the tangent ray of A at a and the tangent ray of B at b intersect at a point Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:21 Fig. 17. Illustrating the definitions of f (a) and д(b). on the line  (e.g., see Figure 17, right). One can verify that f is a continuous decreasing function while д is a continuous increasing function (the tangent at an obstacle vertex of A and B is not unique but the issue can be handled [33]). The fixed-point of the composition of the two functions д · f corresponds to the intersection of  and B(α , α ), which can be computed by applying the 1 2 prune-and-search algorithm of Theorem 3.6 [33]. As both chains A and B are represented by arrays (of size O (n)), to show that the algorithm can be implemented in O (log n) time, it suffices to show that given any a ∈ A and any b ∈ B,wecan determine whether f (a) ≥ b in O (1) time and determine whether д(b) ≥ a in O (1) time. To determine whether f (a) ≥ b, we do the following. We first find the intersection q of the tangent ray of A at a and the tangent ray of B at b.Then, f (a) ≥ b if and only if d(α ,q) ≤ d(α ,q). 1 2 Notice that d(α ,q) = w (a ) + |aa| + |aq|,where |aa| is the length of the portion of A between 1 1 1 1 1 a and a. Recall that we have a data structure on each elementary chain C such that given any two vertices on C, the length of the subchain of C between the two vertices can be computed in O (1) time. Using the data structure, |aa| can be computed in constant time. Since w (a ) is already 1 1 known, d(α ,q) can be computed in constant time. So is d(α ,q). In the case where the two tangent 1 2 rays do not intersect, either the tangent ray of A at a intersects the backward extension of the tangent ray of B at b or the tangent ray of B at b intersects the backward extension of the tangent ray of A at a. In the former case, f (a) ≤ b holds, whereas in the latter case, f (a) ≥ b holds. Hence, whether f (a) ≥ b can be determined in constant time. To determine whether д(b) ≥ a, we do the following. Find the intersection p between  and the tangent ray of A at a and the intersection p between and the tangent ray of B at b.If p is to b a the left of p ,then д(b) ≥ a; otherwise, д(b) ≤ a. Note that by the definition of A, the tangent ray at any point of A intersects I; the same is true for B. Hence, whether д(b) ≥ a can be determined in constant time. The preceding algorithm returns a point q in O (log n) time. If the intersection of and B(α , α ) 1 2 exists, then q is the intersection. Because we do not know whether the intersection exists, we finally validate q by computing d(α ,q) and d(α ,q) in O (log n) time as well as checking whether 1 2 q ∈ . The point q is valid if and only if d(α ,q) = d(α ,q) and q ∈ . 1 2 3.5 The Wavefront Propagation Procedure In this section, we discuss the wavefront propagation procedure, which is to compute the wave- front W (e,д) for all transparent edges д ∈ output (e) based on W (e). Consider a transparent edge д ∈ output (e). The wavefront W (e,д) refers to the portion of W (e) that arrives at д through the well-covering region U (д) of д if e ∈ input (д) and through U (e) otherwise (in the latter case, д ∈ input (e)). We will need to handle the bisector events—that is, the intersections between bisec- tors and the intersections between bisectors and obstacle edges. The HS algorithm processes the bisector events in temporal order—that is, in order of the simulation time τ.The HSYalgorithm Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:22 H. Wang instead proposes a simpler approach that processes the events in spatial order—thatis, in orderof their geometric locations. We will adapt the HSY’s spatial-order method. Recall that each wavefront W (e) is represented by a list of generators, which are maintained in the leaves of a fully persistent balanced binary search tree T (e). We further assign each generator a “next bisector event,” which is the intersection of its two bounding bisectors (it is set to null if the two bisectors do not intersect). More specifically, for each bisector α, we assign it the intersection of the two bisectors B(α , α ) and B(α, α ),where α and α are α’s left and right neighboring gen- l r l r erators in W (e), respectively; we store the intersection at the leaf for α. Our algorithm maintains a variant that the next bisector event for each generator in W (e) has already been computed and stored in T (e). We further endow the tree T (e) with additional node fields so that each internal node stores a value that is equal to the minimum (respectively, maximum) x-coordinate (respec- tively, y-coordinate) among all bisector events stored at the leaves of the subtree rooted at the node. Using these extra values, we can find from a query range of generators the generator whose bisector event has the minimum/maximum x-or y-coordinate in logarithmic time. The propagation from W (e) to д through U is done cell by cell, where U is either U (e) or U (д). We start propagatingW (e) to the adjacent cell c of e inU to compute the wavefront passing through all edges of c. Then by using the computed wavefronts on the edges of c, we iteratively run the algorithm on cells ofU adjacent to c.AsU has O (1) cells, the propagation passes through O (1) cells. Hence, the essential ingredient of the algorithm is to propagate a single wavefront, say, W (e), across a single cell c with e on its boundary. Depending on whether c is an empty rectangle, there are two cases. 3.5.1 c Is an Empty Rectangle. We first consider the case where c is an empty rectangle—that is, there is no island inside c and c does not intersect any obstacle. Without loss of generality, we assume that e is an edge on the bottom side of c, and thus all generators of W (e) are below e.Our goal is to compute W (e,д) (i.e., the generators of W (e) claiming д) for all other edges д of c.Our algorithm is similar to the HSY algorithm in the high level, but the low-level implementations are quite different. The main difference is that each bisector in the HSY algorithm is of constant size, although this is not the case in our problem. Due to this, it takes constant time to compute the intersection of two bisectors in the HSY algorithm, whereas in our problem, this costs O (log n) time. The technical crux of the algorithm is to process the intersections in c among the bisectors of generators ofW (e). Since all generators ofW (e) are below e, their bisectors in c are y-monotone by Corollary 3.8. This is a critical property our algorithm relies on. Due to the property, we only need to compute W (e,д) for all edges д on the left, right, and top sides of c. Another helpful property is that sincewepropagate W (e) through e inside c, if a generator of α of W (e) claims a point q ∈ c, then the tangent from q to α must cross e; we refer to this as the propagation property. Due to this property, the points of c claimed by α must be to the right of the tangent ray from the left endpoint of e to α (the direction of the ray is from the tangent point to the left endpoint of e), as well as to the left of the tangent ray from the right endpoint of e to α (the direction of the ray is from the tangent point to the right endpoint of e). We call the former ray the left bounding ray of α and the latter the right bounding ray of α. As such, for the leftmost generator of W (e),weconsiderits left bounding ray as its left bounding bisector; similarly, for the rightmost generator of W (e),we consider its right bounding ray as its right bounding bisector. Starting from e, we use a horizontal line segment to sweep c upward until its top side. At any moment during the algorithm, the algorithm maintains a subset W () of generators of W (e) for by a balanced binary search tree T (); initially,W () = W (e) and T () = T (e).Let [x , x ]×[y ,y ] 1 2 1 2 denote the coordinates of c. Using the extra fields on the nodes of the tree T (), we compute a Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:23 maximal prefix W () (respectively, W ()) of generators of W () such that the bisector events 1 2 assigned to all generators in it have x-coordinates less than x (respectively, larger than x ). Let 1 2 W () be the remaining elements of W (). By definition, the first and last generators of W () m m have their bisector events with x-coordinates in [x , x ]. As all bisectors are y-monotone in c, 1 2 the lowest bisector intersection in c above  must be the “next bisector event” b associated with a generator in W (), which can be found in O (log n) time using the tree T (). We advance to the y-coordinate of b by removing the generator α associated with the event b.Finally,we recompute the next bisector events for the two neighbors of α in W (). Specifically, let α and α be the left and right neighboring generators of α in W (), respectively. We need to compute the intersection of the two bounding bisectors of α and update the bisector event of α to this l l intersection. Similarly, we need to compute the intersection of the bounding bisectors of α and update the bisector event of α to this intersection. Lemma 3.11 shows that each of these bisector intersections can be computed in O (log n) time by a bisector-bisector intersection operation, using the tentative prune-and-search technique of Kirkpatrick and Snoeyink [33]. Note that if α is the leftmost generator, then α becomes the leftmost after α is deleted, in which case we compute the left bounding ray of α as its left bounding generator. If α is the rightmost generator, the process is symmetric. Lemma 3.11 (Bisector-Bisector Intersection Operation). Each bisector-bisector intersection operation can be performed in O (log n) time. Proof. We are given a horizontal line  and three generators α , α ,and α below  such that 1 2 3 they claim points on  in this order. The goal is to compute the intersection of the two bisectors B(α , α ) and B(α , α ) above , or determine that such an intersection does not exist. Using the 1 2 2 3 tentative prune-and-search technique of Kirkpatrick and Snoeyink [33], we present an O (log n) time algorithm. To avoid the lengthy background explanation, we follow the notation in the work of Kirkpatrick and Snoeyink [33] without definition. We will rely on Theorem 3.9 in their work [ 33]. To this end, we need to define three continuous and decreasing functions f , д,and h. We define them in a way similar to Theorem 4.10 in their work [33] for finding a point equidistant to three convex polygons. Indeed, our problem may be considered as a weighted case of their problem because each point in the underlying chains of the generators has a weight that is equal to its weighted distance from its generator. Let A, B,and C be the underlying chains of α , α ,and α , respectively. 1 2 3 We parameterize over [0, 1] each of the three convex chains A, B,and C from one end to the other in clockwise order—that is, each value of [0, 1] corresponds to a slope of a tangent at a point on the chains. For each point a of A,wedefine f (a) to be the parameter of the point b ∈ B such that the tangent ray of A at a (following the designated direction) and the tangent ray of B at b intersect at a point on the bisector B(α , α ) (e.g., see Figure 17, left); if the tangent ray at a does 1 2 not intersect B(α , α ),thendefine f (a) = 1. In a similar manner, we define д(b) for b ∈ B with 1 2 respect to C and define h(c) for c ∈ C with respect to A. One can verify that all three functions are continuous and decreasing (the tangent at an obstacle vertex of the chains is not unique, but the issue can be handled [33]). The fixed-point of the composition of the three functions h · д · f corresponds to the intersection of B(α , α ) and B(α , α ), which can be computed by applying the 1 2 2 3 tentative prune-and-search algorithm of Theorem 3.9 [33]. To guarantee that the algorithm can be implemented in O (log n) time, since each of the chains A, B,and C is represented by an array, we need to show that given any a ∈ A and any b ∈ B,we can determine whether f (a) ≥ b in O (1) time. This can be done in the same way as in the proof of Lemma 3.10. Similarly, given any b ∈ B and c ∈ C, we can determine whether д(b) ≥ c in O (1) Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:24 H. Wang time, and given any c ∈ C and a ∈ A, we can determine whether h(c) ≥ a in O (1) time. Therefore, applying Theorem 3.9 [33] can compute the intersection of B(α , α ) and B(α , α ) in O (log n) time. 1 2 2 3 The preceding algorithm is based on the assumption that the intersection of the two bisectors exists. However, we do not know whether that is true or not. To determine it, we finally validate the solution as follows. Let q be the point returned by the algorithm. We compute the distances d(α ,q) for i = 1, 2, 3. The point q is a true bisector intersection if and only if the three distances are equal. Finally, we return q if and only if q is above. The algorithm finishes once  is at the top side of c. At this moment, no bisector events of W () are in c. Finally, we run the following wavefront splitting step to split W () to obtain W (e,д) for all edges д on the left, right, and top sides of c. Our algorithm relies on the following observation. Let ζ be the union of the left, top, and right sides of c. Lemma 3.12. The list of generators of W () are exactly those in W () claiming ζ in order. Proof. It suffices to show that during the sweeping algorithm whenever a bisector B(α , α ) of 1 2 two generators α and α intersects ζ , it will never intersect∂c again. Let q be such an intersection. 1 2 Let ζ , ζ ,and ζ be the left, top, and right sides of c, respectively. l t r If q is on ζ , then since both α and α are below e,theyare also below ζ . By Lemma 3.7, B(α , α ) t 1 2 t 1 2 will not intersect the supporting line of ζ again and thus will not intersect ∂c again. If q is on ζ , then we claim that both generators α and α are to the right of the supporting l 1 2 line  of ζ . Indeed, since both generators claim q, the bounding rays (i.e., the left bounding ray l l of the leftmost generator of W () and the right bounding ray of the rightmost generator of W () during the sweeping algorithm) guarantee the propagation property: the tangents from q to the two generators must cross e. Therefore, both generators must be to the right of . By Lemma 3.7, B(α , α ) will not intersect the supporting line of ζ again and thus will not intersect ∂c again. 1 2 l If q is on ζ , the analysis is similar to the preceding second case. In light of the preceding lemma, our wavefront splitting step algorithm for computing W (e,д) of all edges д ∈ ζ works as follows. Consider an edge д ∈ ζ . Without loss of generality, we assume that the points of ζ are clockwise around c so that we can talk about their relative order. Let p and p be the front and rear endpoints of д, respectively. Let α and α be the generators r r l l of W () claiming p and p , respectively. Then all generators of W () to the left of α including l r l α form the wavefront for all edges of ζ in the front of д; all generators of W () to the right of α including α form the wavefront for all edges of ζ after д; and all generators of W () between r r α and α including α and α form W (e,д). Hence, once α and α are known, W (e,д) can be l r l r l r obtained by splitting W () in O (log n) time. It remains to compute α and α . In the following, we l r only discuss how to compute the generator α since α can be computed analogously. l r Starting from the root v ofT (), we determine the intersection q between B(α , α ) and ζ,where 1 2 α is the rightmost generator in the left subtree of v and α is the leftmost generator of the right 1 2 subtree of v.If q is in the front of д on ζ , then we proceed to the right subtree of v; otherwise, we proceed to the left subtree of v. It is easy to see that the runtime of the algorithm is bounded by O (η · log n) time, where η is the time for computing q. In the HSY algorithm, each bisector is of constant size and an oracle is assumed to exist that can compute q in O (1) time. In our problem, since a bisector may not be of constant size, it is not clear how to bound η by O (1).But η can be bounded by O (log n) using the bisector-line intersection operation in Lemma 3.10.Thus, α can be computed in O (log n) time. However, this is not sufficient for our purpose, as this would lead to an overall O (n+h log h) time algorithm. We instead use the following binary search plus bisector tracing approach. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:25 During the wavefront expansion algorithm, for each pair of neighboring generators α = (A, a) and α = (A , a ) in a wavefront (e.g., W (e)), we maintain a special point z(α, α ) on the bisector B(α, α ). For example, in the preceding sweeping algorithm, whenever a generator α is deleted from W () at a bisector event b = B(α , α ) ∩ B(α, α ), its two neighbors α and α now become l r l r neighboring in W (). Then, we initialize z(α , α ) to b (the tangent points from b to α and α are l r l r also associated with b). During the algorithm, the point z(α , α ) will move on B(α, α ) further l r away from the two defining generators α and α and the movement will trace out the hyperbolic- arcs of the bisector. We call z(α, α ) the tracing-point of B(α, α ). Our algorithm maintains a variant that the tracing-point of each bisector of W () is below the sweeping line  (initially, the tracing- point of each bisector of W (e) is below e). With the help of the preceding z-points, we compute the generator α as follows. Like the preced- ing algorithm, starting from the root v of T (),let α and α be the two generators as defined pre- 1 2 viously. To compute the intersection q between B(α , α ) and ζ , we trace out the bisector B(α , α ) 1 2 1 2 by moving its tracing-point z(α , α ) upward (each time trace out a hyperbolic-arc of B(α , α )) 1 2 1 2 until the current tracing hyperbolic-arc intersects ζ at q.If q is in the front of e on ζ,thenwe proceed to the right subtree of v; otherwise, we proceed to the left subtree of v. AfterW (e,д) is obtained, we computeW (e,д ) for other edges д on ζ using the same algorithm as earlier. For the time analysis, observe that each bisector hyperbolic-arc will be traced out at most once in the wavefront splitting step for all edges of ζ because the tracing-point of each bisector will never move “backward.” This finishes the algorithm for propagating W (e) through the cell c. Except for the final wave- front splitting step, the algorithm runs in O((1+h ) log n) time, where h is the number of bisector c c events in c.Because c has O (1) edges, the wavefront splitting step takes O (log n+ n ) time, where n is the number of hyperbolic-arcs of bisectors that are traced out. 3.5.2 c Is Not an Empty Rectangle. We now discuss the case in which the cell c is not an empty rectangle. In this case, c has a square hole inside or/and the boundary of c contains obstacle edges. Without loss of generality, we assume that e is on the bottom side of c. If c contains a square hole, then we partition c into four subcells by cutting c with two lines par- allel to e, each passing through an edge of the hole. If c has obstacle edges on its boundary, recall that these obstacles edges belong to O (1) convex chains (each of which is a fragment of an elemen- tary chain); we further partition c by additional edges parallel to e so that each resulting subcell contains at most two convex chains, one on the left side and the other on the right side. Since ∂c has O (1) convex chains, O (1) additional edges are sufficient to partition c into O (1) subcells as earlier. Then, we propagate e through the subcells of c, one by one. In the following, we describe the algorithm for one such subcell. By slightly abusing the notation, we still use c to denote the subcell with e on its bottom side. Since ∂c has obstacle edges, the propagation algorithm becomes more complicated. As in the HSY algorithm, comparing with the algorithm for the previous case, there are two new bisector events: • First, a bisector may intersect a convex chain (and thus intersect an obstacle). The HSY al- gorithm does not explicitly compute these bisector events because such an oracle is not assumed to exist. In our algorithm, however, because the obstacles in our problem are polyg- onal, we can explicitly determine these events without any special assumption. This is also a reason that the high-level idea of our algorithm is simpler than the HSY algorithm. • Second, new generators may be created at the convex chains. We still sweep a horizontal line from e upward. Let W () be the current wavefront at some moment during the algorithm. Consider two neighboring generators α and α in W () with α on the left of α .Weuse 1 2 1 2 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:26 H. Wang Fig. 18. Illustrating the creation of a new generator at q . ζ to denote the convex chain on the left side of c.Let q be the tangent point on ζ of the l l common tangent between ζ and α , and let q be the tangent point on α (Figure 18). If l 1 1 d(α ,q ) < d(α ,q ), then a new generator α on ζ with initial vertex q and weight equal 1 2 l to d(α ,q ) is created (designated counterclockwise direction) and inserted into W () right before α . The bisector B(α, α ) is the ray emanating from q and extending away from q . 1 1 The region to the left of the ray has α as its predecessor. When the sweeping line  is at q , all wavelets in W () to the left of α have already collided with ζ and thus the first three 1 l generators of W () are α, α ,and α . 1 2 In what follows, we describe our sweeping algorithm to propagate W (e) through c.Webegin with an easier case where only the left side of c is a convex chain, denoted by ζ (and the right side is a vertical transparent edge, denoted by ζ ). We use ζ to denote the top side of c,which is r t a transparent edge. As in the previous case, we sweep a line from e upward until the top side ζ . During the algorithm, we maintain a list W () of generators by a balanced binary search tree T (). Initially, W () = W (e) and T () = T (e). We compute the intersection q of the convex chain ζ and the bisector B(α , α ), for the leftmost l 1 2 bisectors of α and α of W ().Wecallitthe bisector-chain intersection operation. The following 1 2 lemma shows that this operation can be performed in O (log n) time, by using the tentative prune- and-search technique of Kirkpatrick and Snoeyink [33]. Lemma 3.13 (Bisector-Chain Intersection Operation). Each bisector-chain intersection op- eration can be performed in O (log n) time. Proof. We are given a convex chain ζ above a horizontal line and two generators α = (A , a ) l 1 1 1 and α = (A , a ) below such that they claim points on in this order. The goal is to compute the 2 2 2 intersection of B(α , α ) and ζ , or determine that they do not intersect. In the following, using the 1 2 l tentative prune-and-search technique of Kirkpatrick and Snoeyink [33], we present an O (log n) time algorithm. To avoid the lengthy background explanation, we follow the notation in the work of Kirkpatrick and Snoeyink [33] without definition. We will rely on Theorem 3.9 in their work [ 33]. To this end, we need to define three continuous and decreasing functions f , д,and h. Suppose q is the intersection of B(α , α ) and ζ .Let p and p be the tangent points from q to A 1 2 l 1 2 1 and A , respectively. Then, qp (respectively, qp ) does not intersect ζ other than q. We determine 2 1 2 l the portion C of ζ such that for each point p ∈ C, its tangent to A does not intersect ζ other l 1 l than p. Hence, q ∈ C. C can be determined by computing the common tangents between ζ and A , which can be done in O (log n) time [21, 41]. In addition, we determine the portion B of A 1 2 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:27 Fig. 19. Illustrating the definitions of д(b) and h(c). such that the tangent ray at any point of B must intersect C. This can be done by computing the common tangents between C and A in O (log n) time [21, 41]. Let A = A . 2 1 We parameterize over [0, 1] each of the three convex chains A, B,and C from one end to the other in clockwise order—that is, each value of [0, 1] corresponds to a slope of a tangent at a point on the chains A and B, whereas each value of [0, 1] corresponds to a point of C. For each point a of A,wedefine f (a) to be the parameter of the point b ∈ B such that the tangent ray of A at a (following the designated direction of α ) and the tangent ray of B at b intersect at a point on the bisector B(α , α ) (e.g., see Figure 17, left); if the tangent ray at a does not intersect B(α , α ), 1 2 1 2 then define f (a) = 1. For each point b of B,define д(b) to be the parameter of the point c ∈ C such that cb is tangent to B at b (Figure 19, left); note that by the definition of B, the tangent ray from any point of B must intersect C and thus such a point c ∈ C must exist. For each point c ∈ C, define h(c) to be the parameter of the point of a ∈ A such that ac is tangent to A at a (e.g., see Figure 19, right); note that by the definition of C, such a point a ∈ A must exist and ac does not intersect C other than c. One can verify that all three functions are continuous and decreasing (the tangent at an obstacle vertex of the chains is not unique, but the issue can be handled [33]). The fixed-point of the composition of the three functions h · д · f corresponds to the intersection q of B(α , α ) and ζ , which can be computed by applying the tentative prune-and-search algorithm of 1 2 l Theorem 3.9 [33]. To make sure that the algorithm can be implemented in O (log n) time, since each convex chain is part of an elementary chain and thus is represented by an array, it suffices to show the following: (1) given any a ∈ A and any b ∈ B, whether f (a) ≥ b can be determined in O (1) time; (2) given any b ∈ B and any c ∈ C, whether д(b) ≥ c can be determined in O (1) time; and (3) given any c ∈ C and any a ∈ A, whether h(c) ≥ a can be determined in O (1) time. We prove them in the following. Indeed, for (1), it can be done in the same way as in the proof of Lemma 3.10. For (2), д(b) ≥ c if and only if c is to the right of the tangent ray of B at b, which can be easily determined in O (1) time. For (3), h(c) ≥ a if and only c is to the right of the tangent ray of A at a, which can be easily determined in O (1) time. Therefore, applying the tentative prune-and-search technique in Theorem 3.9 [33] can compute q in O (log n) time. Note that the preceding algorithm is based on the assumption that the intersec- tion of B(α , α ) and ζ exists. However, we do not know whether this is true or not. To determine 1 2 l that, we finally validate the solution as follows. Let q be the point returned by the algorithm. We first determine whether q ∈ ζ . If not, then the intersection does not exist. Otherwise, we further compute the two distances d(α ,q) for i = 1,2in O (log n) time. If the distances are equal, then q is the true intersection; otherwise, the intersection does not exist. If the intersection q of ζ and B(α , α ) does not exist, then we compute the tangent between l 1 2 ζ and α , which can be done in O (log n) time [41]; let q be the tangent point at ζ . Regardless of l 1 l Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:28 H. Wang whether q exists or not, we compute the lowest bisector intersection b in c above in the same way as in the algorithm for the previous case where c is an empty rectangle. Depending on whether q exists or not, we proceed as follows. For any point p in the plane, let y(p) denote the y-coordinate of p: (1) If q exists, then depending on whether y(q) ≤ y(b), there are two subcases. If y(q) ≤ y(b), then we process the bisector event q:remove α from W () and then recompute q, q ,and b. Otherwise, we process the bisector event at b in the same way as in the previous case and then recompute q, q ,and b. (2) If q does not exist, then depending on whether y(b) ≤ y(q ), there are two subcases. If y(b) ≤ y(q ), then we process the bisector event at b in the same way as before and then recompute q, q ,and b. Otherwise, we insert a new generator α = (A,q ) to W () as the leftmost generator, where A is the fragment of the elementary chain containing ζ from q counterclockwise to the end of the chain, and α is designated the counterclockwise direction of A and the weight of q is d(α ,q ) (e.g., see Figure 18). The ray from q in the direction from q to q is the bisector of α and α ,where q is the tangent point on α of the common 1 1 tangent between α and ζ . We initialize the tracing-point z(α, α ) of B(α, α ) to q . Finally, 1 l 1 1 we recompute q, q ,and b. Once the sweep line reaches the top side ζ of c, the algorithm stops. Finally, as in the previous case, we run a wavefront splitting step. Because the left side ζ consists of obstacle edges, we split W () to compute W (e,д) for all transparent edges д on the top side ζ and the right side ζ of c. t r The algorithm is the same as the previous case. The preceding discusses the case where only the left side ζ of c is a convex chain. For the general case where both the left and right sides of c are convex chains, the algorithm is similar. The difference is that we have to compute a point p corresponding to q and a pointp corresponding to q on the right side ζ of c. More specifically, p is the intersection of B(α , α ) with ζ ,where α r r 2 1 2 and α are the two rightmost generators of W.If p does not exist, then we compute the common tangent between ζ and α ,and p is the tangent point on ζ . r r In the following, if q does not exist, we let y(q) be ∞; otherwise, q is not needed and we let y(q ) be ∞. We apply the same convention to p and p .Wedefine b as the bisector event in the same way as before. In each step, we process the lowest point r of {q,q ,b,p,p }.If r is q or p,we process it in the same way as before for q.If r is q or p , we process it in the same way as before for q .If r is b, we process it in the same way as before. After processing r, we recompute the five points. Each step takes O (log n) time. After the sweep line  reaches the top side ζ of c, W () is W (e, ζ ) for the top side ζ of c because both the left and right sides of c are obstacle edges. Finally, t t we run the wavefront splitting step onW () to compute the wavefrontsW (e,д) for all transparent edges д on ζ . In summary, propagatingW (e) through c takes O((1+h )·log n+n ) time, where h is the num- c c c ber of bisector events (including both the bisector-bisector intersection events and the bisector- obstacle intersection events) and n is the number of hyperbolic-arcs of bisectors that are traced out in the wavefront splitting step. We use the following lemma to summarize the algorithm for both cases (i.e., regardless of whether c is an empty rectangle or not). Lemma 3.14. Suppose W (e) is a wavefront on a transparent edge of a cell c of the subdivision S . Then, W (e) can be propagated through c to all other transparent edges of c in O((1+ h ) log n + n ) c c time, where h is the number of bisector events (including both the bisector-bisector intersection events and bisector-obstacle intersection events) and n is the number of hyperbolic-arcs of bisectors that are traced out in the wavefront splitting step. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:29 3.6 Time Analysis In this section, we show that the running time of our wavefront expansion algorithm described previously is bounded by O (n + h logh). For this and also for the purpose of constructing the shortest path map SPM (s) later in Section 3.8, as in the HS algorithm, we mark generators in the way that if a generator α is involved in a true bisector event of SPM (s) (either a bisector- bisector intersection or a bisector-obstacle intersection) in a cell c of the subdivisionS ,then α is guaranteed to be in a set of marked generators for c (but a marked generator for c may not actually participate in a true bisector event in c). The generator marking rules are presented next, which are consistent with those in the HS algorithm: Generator marking rules: (1) For any generator α = (A, a), if its initial vertex a lies in a cell c,thenmark α in c. (2) Let e be a transparent edge and let W (e) be a wavefront coming from some generator α’s side of e. (a) If α claims an endpoint b of e inW (e), or if it would do so except for an artificial wavefront, then mark α in all cells c incident to b. (b) If α’s claim in W (e) is shortened or eliminated by an artificial wavelet, then mark α for c, where c is the cell having e as an edge and on α’s side of e. (3) Let e and д be two transparent edges with д ∈ output (e). Mark a generator α ofW (e) in both cells having e as an edge if one of the following cases happens: (a) α claims an endpoint of д in W (e,д). (b) α participates in a bisector event either during the wavefront propagation procedure for computing W (e,д) from W (e), or during the wavefront merging procedure for computing W (д).Notethat α is also considered to participate in a bisector event if its claim on д is shortened or eliminated by an artificial wavelet. (4) If a generator α of W (e) claims part of an obstacle edge during the wavefront propagation procedure for propagating W (e) toward output (e) (this includes the case in which α partic- ipates in a bisector-obstacle intersection event), then mark α in both cells having e as an edge. Note that each generator may be marked multiple times, and each mark applies to one instance of the generator. As such, when we say “the number of marked generators,” we mean the number of instances of the marked generators. Lemma 3.15. The total number of marked generators during the algorithm is at most O (h). Because the proof of Lemma 3.15 is quite technical and lengthy, we devote the entirety of Sec- tion 3.7 to it. In the rest of this section, we use Lemma 3.15 to show that the running time of our wavefront expansion algorithm is bounded by O (n + h logh). Our goal is to prove the following lemma. Lemma 3.16. The wavefront expansion algorithm runs in O(n + h logh) time and space. First of all, by Lemma 3.1, constructing the conforming subdivision S can be done in O (n + h logh) time and O (n) space. The wavefront expansion algorithm has two main subroutines: the wavefront merging proce- dure and the wavefront propagation procedure. The wavefront merging procedure is to construct W (e) based on W (f, e) for the edges f ∈ input (e). By Lemma 3.9, this step takes O((1+k) log n) time, where k is the total number of genera- tors in all wavefrontsW (f, e) that are absent fromW (e). According to the algorithm, if a generator α is absent from W (e), it must be deleted at a bisector event. Thus, α must be marked by Rule 3(b). Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:30 H. Wang Fig. 20. Illustrating the definitions of u, v, q,and o. Due to Lemma 3.15, the total sum of k in the entire algorithm is O (h). As such, the wavefront merging procedure in the entire algorithm takes O (h log n) time in total. The wavefront propagation procedure is to compute W (e,д) by propagating W (e) to all edges д ∈ output (e) either through U (д) or U (e). By Lemma 3.14, the running time of the proce- dure is O((1 + h ) log n + n ) time, where h is the number of bisector events (including both c c c the bisector-bisector intersection events and bisector-obstacle intersection events) and n is the number of hyperbolic-arcs of bisectors that are traced out in the wavefront splitting step. For each bisector-bisector intersection event, at least one involved generator is marked by Rule 3(b). For each bisector-obstacle intersection event, at least one involved generator is marked by Rule 4. Hence, by Lemma 3.15, the total sum of h in the entire algorithm is O (h). In addition, Lemma 3.17 shows that the total sum of n in the entire algorithm is O (n). Therefore, the wavefront propagation procedure in the entire algorithm takes O (n + h log n) time in total. Lemma 3.17. The total number of traced hyperbolic-arcs of the bisectors in the entire algorithm is O (n). Proof. First of all, notice that each extension bisector consists of a single hyperbolic-arc, which is on a straight line. As each generator is marked by Rule 1, by Lemma 3.15, the total number of generators created in the algorithm is O (h). Since each generator can define at most one extension bisector, the number of hyperbolic-arcs on extension bisectors is at most O (h). In the following, we focus on hyperbolic-arcs of non-extension bisectors. Instead of counting the number of traced hyperbolic-arcs, we will count the number of their endpoints. Consider a hyperbolic-arc endpoint o that is traced out. According to our algorithm, o is traced out during the wavefront propagation procedure for propagating W (e) to compute W (e,д) for some transparent edge e and д ∈ output (e).Suppose o belongs to a non-extension bisector B(α, α ) of two generators α and α in W (e).Then, o must be defined by an obstacle edge uv of either α or α —thatis, theray ρ(u,v) emanating from v along the direction from u to v (which is consis- tent with the designated direction of the generator that contains uv) hits B(α, α ) at o (Figure 20). Without loss of generality, we assume that uv belongs to α. In the following, we argue that uv can define O (1) hyperbolic-arc endpoints that are traced out during the entire algorithm (a hyperbolic- arc endpoint defined by uv is counted twice as it is traced out twice), which will prove Lemma 3.17, as there are O (n) obstacle edges in total. We first discuss some properties. Since o ∈ B(α, α ),both α and α claim o. As both generators are inW (e),the ray ρ(u,v) must cross e, say, at a point q (e.g., see Figure 20). Because o is traced out when we propagateW (e) to computeW (e,д), oq must be in eitherU (д) orU (e) (i.e., oq ⊆U (e)∪ U (д)). We call (e,д) the defining pair of o for uv. According to our algorithm, during the propaga- tion fromW (e) toд,uv defines only one hyperbolic-arc endpoint, because it is uniquely determined by the wavefront W (e). As such, to prove that uv can define O (1) hyperbolic-arc endpoints that Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:31 Fig. 21. Illustrating the definitions of u, v, q,and o. Fig. 22. The dashed (red) path is π (s,v), which W (e) crosses e at b. are traced out during the entire algorithm, it suffices to show that there are at most O (1) defining pairs for uv.Let Π denote the set of all such defining pairs. We prove |Π| = O (1) in the following. For each pair (e ,д ) ∈ Π, according to the preceding discussion, uv and (e ,д ) define a hyperbolic-arc endpoint o such that o is on the ray ρ(u,v) and vo crosses e at a point q . Without loss of generality, we assume that (e,д) is a pair that minimizes the length |vq |.Let W (e ) refer to the wavefront at e whose propagation to д traces out o . We partition Π into two subsets Π and Π ,where Π consists of all pairs (e ,д ) of Π such that 1 2 1 qo intersects e and Π = Π \ Π . Since oq ⊆U (e)∪U (д), each well-covering region contains 2 1 O (1) cells, and |output (e )| = O (1) for each transparent edge e ,the size of Π is O (1). For Π , we further partition it into two subsets Π and Π ,where Π consists of all pairs 2 21 22 21 (e ,д ) of Π such that e is in the well-covering region U (e ) of e or e ∈U (e) ∪U (д),and Π = Π \ Π . Since e is in U (e ) for a constant number of transparent edges e ,eachof U (e) 22 2 21 and U (д) contains O (1) cells, and |output (e )| = O (1) for each e , it holds that |Π | = O (1).In the following, we argue that Π = ∅, which will prove |Π| = O (1). Assume to the contrary that |Π |  ∅ and let (e ,д ) beapairof Π . Since (e ,д ) ∈ Π ,by 22 22 2 the definition of Π , e does not intersect oq. By the definition of e, vq\{q} does not intersect e . Recall that q is the intersection of e and ρ(u,v). Therefore, the points v, q, o, q ,and o appear on the ray ρ(u,v) in this order (Figure 21). Further, since (e ,д ) ∈ Π , by the definition of Π , 22 22 e is not inU (e ) and e is not inU (e)∪U (д). Without loss of generality, we assume that e is horizontal and the wavefront W (e ) is from below e (thus, v is below e while o is above e ). Let F be the modified free space by replacing e with an opaque edge of open endpoints. Since the generator in W (e ) that contains v claims q , π (s,q ) is a shortest path from s to q in F ,where π (s,q ) is the path following the wavefront W (e ). Since v is in the generator of W (e ) that claims q , v is the anchor of q in π (s,q )—that is, the edge of the path incident to q is vq .Let π (s,v) be the subpath of π (s,q ) between s and v.Then, π (s,v) is a shortest path from s to v in F . Recall that v is in the generator α of W (e).Let π (s,v) be the path from s to v following W (e) W (e).Weclaim that |π (s,v)| = |π (s,v)| (Figure 22). Assume to the contrary this is not true. W (e) Then, either |π (s,v)| < |π (s,v)| or |π (s,v)| < |π (s,v)|: W (e) W (e) • If |π (s,v)| < |π (s,v)|, then since π (s,v) is a shortest path from s to v in the W (e) W (e) modified free space by considering e as an opaque edge of open endpoints, π (s,v) must cross the interior of e. This means that π (s,q ) = π (s,v) ∪ vq crosses e twice. Because π (s,q ) is a shortest path in F and e ∈F , it cannot cross e twice, a contradiction. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:32 H. Wang Fig. 23. The dashed (red) path is π (s,v ), which crosses e at b. W (e) • If |π (s,v)| < |π (s,v)|, then since π (s,v) is a shortest path from s to v in F , the path W (e) π (s,v) cannotbein F and thus must cross the interior of e , say, at a point b (e.g., see W (e) Figure 21). Let π (s,b) be the subpath of π (s,v) between s and b.Let π (b,q ) W (e) W (e) W (e) be a shortest path from b to q along e by considering it as an opaque edge with open endpoints. Note that if b and q are on different sides of e ,then π (b,q ) must be through W (e) an open endpoint of e . It is not difficult to see that |π (b,q )|≤|e |.Let π (s,q ) be W (e) W (e) the concatenation of π (s,b) and π (b,q ). Hence, π (s,q ) is a path in F . Since W (e) W (e) W (e) π (s,q ) is a shortest path from s to q in F , it holds that |π (s,q )|≤|π (s,q )|. W (e) Notice that |π (s,q )| = |π (s,b)| + |π (b,q )|≤|π (s,v)| + |e | < W (e) W (e) W (e) W (e) |π (s,v)| + |e |. However,|π (s,q )| = |π (s,v)|+|vq |≥|π (s,v)|+|qq |.Weclaim that|qq |≥ 2|e |. Indeed, since e is outsideU (e ), q ∈ e,and q ∈ e , qq must cross ∂U (e ) at a point b .Bythe prop- erty of well-covering regions ofS ,|b q |≥ 2|e |. Since|qq |≥|b q |,weobtain|qq |≥ 2|e |. In light of the claim, we have |π (s,q )|≥|π (s,v)|+ 2|e | > |π (s,v)|+|e | > |π (s,q )|. W (e) But this incurs contradiction since |π (s,q )|≤|π (s,q )|. W (e) Therefore, |π (s,v)| = |π (s,v)| holds. W (e) As q  qo,wedefine p as a point on oq \{o} infinitely close to o (Figure 23). Hence, p ∈ vq . Since π (s,q ) = π (s,v)∪vq is a shortest path from s to q in F , π (s,v)∪vp is a shortest path from s to p to F . Recall that o is on the non-extension bisector B(α, α ) of two generators α and α in W (e) and v is on α.Let v be the anchor of o in α (e.g., see Figure 23). Since |π (s,v)| = |π (s,v)|,wehave W (e) |π (s,v)|+|vo| = |π (s,v)|+|vo| = |π (s,v )|+|v o|,where π (s,v ) is the path from s to W (e) W (e) W (e) v following W (e). By the definition of p and because B(α, α ) is a non-extension bisector, it holds that |π (s,v)| + |vp| > |π (s,v )| + |v p|.As |π (s,v)| = |π (s,v)|,wehave |π (s,v)| + W (e) W (e) W (e) |vp| > |π (s,v )|+|v p|. Since π (s,v)∪vp is a shortest path from s to p inF , π (s,v )∪v p W (e) W (e) cannotbeapath from s to p in F . Therefore, π (s,v ) ∪ v p must intersect the interior of e . W (e) We claim that v p cannot intersect e . Indeed, since v p is covered by the wavefront W (e) when W (e) propagates to д in either U (e) or U (д), v p is in U (e)∪U (д). Since (e ,д ) ∈ Π and by the definition of Π , e is not in U (e)∪U (д). Therefore, v p cannot intersect e . The preceding claim implies that π (s,v ) must intersect the interior of e at a point, W (e) say, b (e.g., see Figure 23). Let π (s,b) be the subpath of π (s,v ) between s and b.Let W (e) W (e) π (b,q ) be a path from b to q along e by considering e as an opaque edge of open W (e) endpoints. As discussed earlier, |π (b,q )|≤|e |. Hence, π (s,b) ∪ π (b,q ) is a W (e) W (e) W (e) Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:33 path in F , whose length is at most |π (s,b)| + |e|≤|π (s,v )| + |e |.However, W (e) W (e) |π (s,v )| + |v o| + |oq | = |π (s,v)| + |vo| + |oq | = |π (s,v)| + |vq |. Since (e ,д ) ∈ Π and W (e) 22 by the definition of Π , e is outsideU (e ).Because q ∈ e and ov crosses e at a point q ,bythe property of well-covering regions ofS , |q o| + |oq |≥ 2|e |. Therefore, we obtain |π (s,v)| + |vq | = |π (s,v )| + |v o| + |oq | W (e) ≥|π (s,v )| + |q o| + |oq | W (e) ≥|π (s,v )| + 2|e |≥|π (s,b)| + 2|e | W (e) W (e) > |π (s,b)| + |e |≥|π (s,b)| + |π (b,q )|. W (e) W (e) W (e) This means that π (s,b)∪ π (b,q ) is a path from s to q in F that is shorter than the path W (e) W (e) π (s,v)∪vq . But this incurs a contradiction, as π (s,v)∪vq is a shortest path from s to q in F . This completes the proof of the lemma. In summary, the total time of the wavefront expansion algorithm is O (n + h log n),whichis O (n + h logh). For the space complexity of the algorithm, since each wavefront W (e) is maintained by a persis- tent binary tree, each bisector event costs additional O (logh) space. As discussed earlier, the total sum of k+h in the entire algorithm, which is the total number of bisector events, is O (h).Thus,the space cost by persistent binary trees is O (h logh). The space used by other parts of the algorithm is O (n). Hence, the space complexity of the algorithm is O (n + h logh). This proves Lemma 3.16. 3.7 Proving Lemma 3.15 In this section, we prove Lemma 3.15. The proof follows the same strategy in the high level as that in the HS algorithm, although many details are different. We start with the following lemma. Lemma 3.18. Suppose Π is the set of pairs (e, B) of transparent edges e and bisectors B such that B crosses e in the wavefront W (e) of e during our wavefront expansion algorithm but the same crossing does not occur in SPM (s).Then, |Π| = O (h). Proof. Let α = (A , a ) and α = (A , a ) be the two generators of B. Recall that the well- 1 1 1 2 2 2 covering region U (e) of e is the union of O (1) cells of S and each cell has O (1) elementary chain fragments on its boundary. Hence,U (e) has O (1) convex chains on its boundary. Recall also that W (e) is computed by merging all contributing wavefronts W (f, e) for f ∈ input (e) in the wavefront merging procedure, and W (f, e) is computed by propagating W (f ) to e through U (e) in the wavefront propagation procedure. We first argue that the number of pairs (e, B) of Π in the case where at least one of α and α is 1 2 in U (e) is O (h). Indeed, according to our wavefront propagation procedure, if a subcell c ∈U (e) is an empty rectangle, then no new generators will be created when W (f ) is propagating through c; otherwise, although multiple generators may be created, at most two (one on each side of c)are in the wavefront existing c.As U (e) has O (1) cells and each cell may be partitioned into O (1) subcells during the wavefront propagation procedure, only O (1) generators of W (e) are inside U (e). Since each generator ofW (e) may define at most two bisectors in W (e) and the total number of transparent edges ofS is O (h), the number of pairs (e, B) of Π such that at least one generator of B is inU (e) is at most O (h). In the following, we assume that both α and α are outside U (e)—that is, their initial vertices 1 2 a and a are outside U (e).Let q be the intersection of B and e.Let π (a ,q) denote the path 1 2 1 from q to a following the tangent from q to A and then to a along A ;define π (a ,q) similarly. 1 1 1 1 2 Clearly, both α and α claim q in W (e). Since α is outside U (e), α must be in W (f ) for some 1 2 1 1 1 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:34 H. Wang Fig. 24. Illustrating q and q . Fig. 25. Illustrating the psuedo-triangle (q,q ,q ) 1 1 2 (the shaded region). transparent edge f of∂U (e) so that α ofW (e) is fromW (f , e). Since α is outsideU (e), π (a ,q) 1 1 1 1 1 must intersects f ,say,atpoint q (Figure 24), and π (q ,q) is inside U (e),where π (q ,q) is the 1 1 1 1 subpath of π (a ,q) between q and q. In addition, f is processed (for the wavefront propagation 1 1 1 procedure) earlier than e because W (f ) contributes to W (e). We claim that q is claimed by α in SPM (s). Assume to the contrary that this is not true. Then, 1 1 let π (s,q ) be a shortest path from s to q in the free space F : 1 1 • If π (s,q ) does not intersect e,then π (s,q ) is in the modified free space F by replacing e 1 1 with an opaque edge of open endpoints. Since α claims q on e, π = π (s, a )∪π (a ,q) is 1 W (e) 1 1 a shortest path from s to q in the modified free space F ,where π (s, a ) is the path from W (e) 1 s to a following the wavefront W (e). Since q is in π and q is not claimed by α in SPM (s), 1 1 1 1 if we replace the portion between s and q in π by π (s,q ), we obtain a shorter path from s 1 1 to q in F than π. But this incurs a contradiction since π is a shortest path from s to q in F . • If π (s,q ) intersects e,say,atapoint b, then since f ∈ ∂U (e) and thus 1 1 d(f , e) ≥ 2 · max{|f |,|e|} by the properties of the well-covering regions of S ,we 1 1 show in the following that e must be processed earlier than f , which incurs a contradiction because f is processed earlier than e. 1 3 Indeed, covertime(e) = d(s, e) + |e|≤ d(s,b) + ·|e| + |e| = d(s,b) + ·|e|.However, 2 2 1 1 covertime(f ) = d(s, f ) + |f |≥ d(s,q ) − ·|f | + |f | = d(s,b) + d(b,q ) + ·|f |. 1 1 1 1 1 1 1 1 2 2 Since f ∈ ∂U (e), b ∈ e,and q ∈ f , d(b,q ) ≥ d(f , e) ≥ 2·|e|. Hence, we obtain 1 1 1 1 1 covertime(f ) > covertime(e) and thus e must be processed earlier than f . 1 1 Therefore, q must be claimed by α in SPM (s). 1 1 We define f , q ,and π (q,q ) analogously with respect to α . Similarly, we can show that q is 2 2 2 2 2 claimed by α in SPM (s). For each f ∈ ∂U (e), the generators of W (f ) that are also in W (e) may not form a single subsequence of the generator list of W (e), but they must form a constant number of (maximal) subsequences. Indeed, sinceU (e) is the union of O (1) cells ofS , the number of islands inU (e) is O (1). Thus, the number of topologically different paths from f to e inU (e) is O (1); each such path will introduce at most one subsequence of generators of W (e) that are also from W (f ). Therefore, the generators ofW (f ) that are also inW (e) form O (1) subsequences of the generator list ofW (e). Since ∂U (e) has O (1) transparent edges, the generator list of W (e) can be partitioned into O (1) subsequences each of which is from W (f ) following topologically the same path for a single transparent edge f of∂U (e). Due to this property, we have the following observation: the number of pairs of adjacent generators of W (e) that are from different subsequences is O (1). Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:35 Due to the preceding observation, the number of pairs of edges f and f on ∂U (e) in the case 1 2 where f  f ,or f = f but π (q,q ) and π (q,q ) are topologically different in U (e) is only O (1). 1 2 1 2 1 2 Therefore, the total number of pairs (e, B) of Π in that case is O (h). In the following, it suffices to consider the case where f = f ,and π (q,q ) and π (q,q ) are topologically the same inU (e);for 1 2 1 2 reference purpose, we use Π to denote the subset of pairs (e, B) of Π with the preceding property. In the following, we prove |Π | = O (h). Let f = f = f . Since π (q,q ) and π (q,q ) are topologically the same in U (e),the region 1 2 1 2 bounded by π (q,q ), π (q,q ),and q q must be in U (e);wecallthe preceding region a pseudo- 1 2 1 2 triangle,for both π (q,q ) and π (q,q ) are convex chains, and we use (q,q ,q ) to denote it 1 2 1 2 (Figure 25). Because (e, B) is not an incident pair in SPM (s), the point q must be claimed by a different generator α in SPM (s), which must be from the side of e different than α and α .We 1 2 proved earlier that q is claimed by α and q is claimed by α in SPM (s). Hence, there must be at 1 1 2 2 least one bisector event in SPM (s) that lies in the interior of the pseudo-triangle (q,q ,q ). We 1 2 charge the early demise of B to any one of these bisector events in (p,q ,q ). 1 2 Note that the path π (q,q ) (respectively, π (q,q )) is in a shortest path from s to q following the 1 2 wavefront W (e) in the modified free space by replacing e with an opaque edge of open endpoints. Hence, if Π has other pairs (e, B ) whose first element is e, then the corresponding paths π (q,q ) and π (q,q ) of all these pairs are disjoint, and thus the corresponding pseudo-triangles (q,q ,q ) 2 1 2 are also disjoint in U (e). Hence, each bisector event of SPM (s) inside (q,q ,q ) is charged at 1 2 most once for all pairs of Π that have e as the first element. Since each cell of S belongs to the well-covering region U (e) of O (1) transparent edges e,eachbisectorevent of SPM (s) is charged O (1) times for all pairs of Π .Because SPM (s) has O (h) bisector events by Corollary 3.5,the number of pairs of Π is at most O (h). This completes the proof of the lemma. Armed with Lemma 3.18, we prove the subsequent five lemmas, which together lead to Lemma 3.15. Lemma 3.19. The total number of marked generators by Rule 2(a) and Rule 3 is O (h). Proof. Suppose α is a generator marked by Rule 2(a) for a transparent edge e.Then, α must be the first or last non-artificial generator of W (e). Hence, at most two generators of W (e) can be marked by Rule 2(a). AsS has O (h) transparent edges, the total number of generators marked by Rule 2(a) is O (h). Suppose α is a generator marked by Rule 3(a) for the two transparent edges (e,д) with д ∈ output (e). Since α claims an endpoint of д, α must be the first or last generator of W (e,д). Hence, at most two generators of W (e,д) can be marked by Rule 3(a). Since |output (e)| = O (1),atmost O (1) generators can be marked for the pairs of transparent edges with e as the first edge. Since S has O (h) transparent edges, the total number of generators marked by Rule 3(a) is O (h). Suppose α is a generator marked by Rule 3(b) for the two transparent edges (e,д) with д ∈ output (e).Notethat α is a generator inW (e). We assume that α is not the first or last non-artificial generators ofW (e); the first and last non-artificial generators of W (e), countered separately, sum to O (h) for all transparent edges e ofS .Let α and α be the two neighboring generators of α inW (e). 1 2 Thus, both α and α are non-artificial. We assume that the bisectors B(α , α ) and B(α, α ) intersect 1 2 1 2 e in SPM (s); by Lemma 3.18, there are only O (h) bisector and transparent edge intersections that appear in some wavefront but not in SPM (s). This is also due to that for any point p ∈ q q , the shortest path π (s, p) cannot intersect e; this can be proved by a similar 1 2 argument to the preceding for proving that q is claimed by α in SPM (s). This observation implies that α cannot claim 1 1 any points on q q in SPM (s). 1 2 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:36 H. Wang Since α is marked by Rule 3(b), at least one of B(α , α ) and B(α, α ) fails to reach the boundary of 1 2 D(e) during the algorithm, where D(e) is the union of cells through which W (e) is propagated to all edges д ∈ output (e).Notethat D(e) ⊆U (e) ∪  U (д ), which contains O (1) cells д ∈output (e) of S as |output (e)| = O (1) and the well-covering region of each transparent edge is the union of O (1) cells ofS ; in addition, each cell of D(e) is within a constant number of cells of e.Without loss of generality, we assume that B(α , α ) does not reach the boundary of D(e) and a bisector event on B(α , α ) is detected during the algorithm. The detected bisector event on B(α , α ) also implies that 1 1 an actual bisector event in SPM (s) happens to B(α , α ) no later than the detected event; we charge the marking of α to that bisector actual endpoint (i.e., a vertex) in SPM (s), and the endpoint is in D(e) because B(α , α ) intersects e in SPM (s). Since each cell of D(e) is within a constant number of cells of e, each cell of S belongs to D(e ) for a constant number of transparent edges e of S . Therefore, each vertex of SPM (s) is charged O (1) times. Since SPM (s) has O (h) vertices by Lemma 3.4, the total number of generators marked by Rule 3(b) is O (h). Lemma 3.20. The total number of marked generators by Rule 1 is O (h). Proof. According to our algorithm, generators are only created during the wavefront prop- agation procedure, which is to propagate W (e) to compute W (e,д) for all edges д ∈ output (e) through U,where U is U (e) or U (д). The procedure has two cases depending on whether a cell c of U is an empty rectangle. If c is an empty rectangle, then no generators will be created in c. Otherwise, c may be partitioned into O (1) subcells, each of which may have a convex chain on its left side and/or its right side. Let c be such a subcell. Without loss of generality, we assume that the current wavefront W is propagating in c from bottom to top. We consider the generators created on the left side ζ of c. According to our algorithm, a generator on ζ is created by the leftmost generator of the current wavefront W . As such, if the leftmost wavelet of W does not create a generator, then no generator on ζ will be created. Otherwise, let α be a generator created on ζ , which becomes the leftmost l l generator ofW at the point of creation. Let α be the right neighbor of α inW . According to our al- gorithm, if α does not involve in any bisector event in c—that is, the bisector B(α, α ) does not inter- sect any other bisector in c during the propagation of W in c, then no more new generators will be created on ζ . Otherwise, we charge the creation of α to the bisector event involving B(α, α );each such event can be charged at most twice (one for a generator on ζ and the other for a generator created on the right side of c). Recall that for each bisector event, a generator is marked by Rule 3(b). In light of the preceding discussion, since each cell of S belongs to the well-covering region U (e ) of O (1) transparent edges e , the total number of generators marked by Rule 1 is O (h)+O (k), where k is the total number of generators marked by Rule 3(b), which is O (h) by Lemma 3.19.The lemma thus follows. Lemma 3.21. The total number of marked generators by Rule 4 is O (h). Proof. Let α be the generator and e be the transparent edge specified in the rule statement. According to Rule 4, α is marked because it claims part of an obstacle edge during the wavefront propagation procedure for propagating W (e) to compute W (e,д) for edges д ∈ output (e).Asin the proof of Lemma 3.19,define D(e) as the union of cells through which W (e) is propagated to all edges д ∈ output (e).Recallthat D(e) contains O (1) cells of S , and each cell of D(e) is within a constant number of cells of e, which implies that each cell of S belongs to D(e ) for a constant number of transparent edges e of S . First of all, for the case where α is a generator created during the wavefront propagation pro- cedure, the total number of such marked generators is no more than the total number of marked generators by Rule 1, which is O (h) by Lemma 3.20. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:37 Second, for the case where α is the first or last generator in W (e), the total number of such generators is clearly O (h) sinceS has O (h) transparent edges e. Third, for the case where α claims a rectilinear extreme vertex, the total number of such marked generators is O (h). To see this, since D(e) has O (1) cells of S and each cell contains at most one rectilinear extreme vertex, D(e) contains O (1) rectilinear extreme vertices. Therefore, at most O (1) generators will be marked in D(e). Since each cell ofS belongs to D(e ) for O (1) transparent edges e of S and S contains O (h) transparent edges e, the total number of marked generators in this case is O (h). Finally, any Rule 4 marked generator α that does not belong to any of the preceding cases has the following property: α does not claim a rectilinear extreme vertex, and is not the first or last non-artificial generator in W (e), and is not a generator created in D(e).Let α beaneighborof α in W (e). Due to the preceding property, α is a non-artificial generator. We can assume that B(α , α ) intersects e in SPM (s); by Lemma 3.18, there are only O (h) bisector and transparent edge intersec- tions that appear in some wavefront but not in SPM (s). Hence, in SPM (s), B(α , α ) terminates in D(e), either on an obstacle edge or in a bisector event before reaching an obstacle edge. In either case, we charge the mark of α at e to this endpoint of B(α , α ) in SPM (s), which is vertex of SPM (s). Because each cell ofS belongs to D(e ) for a constant number of transparent edges e ofS ,each vertex of SPM (s) is charged at most O (1) times. As SPM (s) has O (h) vertices by Lemma 3.4,the total number of marked generators by Rule 4 is O (h). Lemma 3.22. The total number of marked generators by Rule 2(b) is O (h). Proof. Let α be the generator and e be the transparent edge specified in the rule statement. First of all, the total number of marked generators in the case where α is inU (e) is O (h),because the number of Rule 1 marked generators is O (h) by Lemma 3.20 and U (e) has O (1) cells. In the following, we consider the other case where α is outsideU (e). Since α is outside U (e), there is a transparent edge f on ∂U (e) (i.e., f ∈ input (e)) such that α is in W (f ) and it is in W (e) because W (f ) is propagated to e through U (e). Since α’s claim is shortened or eliminated by an artificial wavefront, there must be a bisector event involving α during the computation of W (f, e) from W (f ). Hence, α is also marked by Rule 3(b). We charge α to this Rule 3(b) mark for f . Since there are O (h) generators marked by Rule 3(b) by Lemma 3.19, the total number of marked generators of Rule 2(b) is O (h). 3.8 Computing the Shortest Path Map SPM(s) In this section, we compute the shortest path map SPM (s). To this end, we need to mark genera- tors following our rules during our wavefront merging and propagation procedures. As the total number of all marked generators is O (h), marking these generators does not change the running time of our algorithm asymptotically. In the following, we show that SPM (s) can be constructed in O (n + h logh) time with the help of the marked generators. In light of Lemma 3.6, we will focus on constructing SPM (s). We first show in Section 3.8.1 that the marked generators are sufficient in the sense that if a generator participates in a true bisector event of SPM (s) in a cell c of S ,then α must be marked in c. Then, we present the algorithm for constructing SPM (s), which consists of two main steps. The first main step is to identify all vertices of SPM (s) and the second one is to compute the edges of SPM (s) and assemble them to obtain SPM (s). The first main step is described in Section 3.8.2, whereas the second one is discussed in Section 3.8.3. 3.8.1 Correctness of the Marked Generators. In this section, we show that if a generator partic- ipates in a bisector event of SPM (s) in a cell c of S ,then α must be marked in c. Our algorithm Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:38 H. Wang in the next section for computing SPM (s) relies on this property. Our proof strategy again follows the high-level structure of the HS algorithm. We first prove the following lemma. Lemma 3.23. Let α be a generator in an approximate wavefront W (e) for some transparent edge e. Suppose there is a point p ∈ e that is claimed by α inW (e) but not in SPM (s) (because the approximate wavefront from the other side of e reaches p first). Then, α is marked in the cell c on α’s side of e. Proof. Assume to the contrary that α is not marked in c.Then, α must have two neighboring non-artificial generators α and α inW (e) since otherwise Rule 2 would apply. In addition, because 1 2 all transparent edges of∂U (e) are in output (e), the two bisectors B(α , α ) and B(α, α ) must exist 1 2 the well-covering regionU (e) of e through the same transparent edge д ∈ ∂U (e), since otherwise Rule 3 or 4 would apply. Further, the region R bounded by B(α , α ), B(α, α ), e,and д must be a 1 2 subset of U (e).Indeed,if R contains an island not in U (e),then α would claim an endpoint of a boundary edge of the island, in which case Rule 3 would apply. Let α = (A, a) be the true predecessor of p in SPM (s). Without loss of generality, we assume that e is horizontal and α is below e and thus α is above e.Let π (a,p) be the path from p along its tangent to A and then following A to a. We first consider the case where α is not in the interior of the well-covering regionU (e)—that is, the initial vertex a is not in the interior of U (e). Since R is a subset of of U (e) without non- U (e) islands, a is not in the interior of R and thus π (a,p) intersects ∂R,say,atapoint q.Inthe following, we argue that α has been involved in a bisector event detected by our algorithm and thus marked in c.Let д be the portion of д between its intersections with B(α , α ) and B(α, α ). 1 2 Depending on whether q ∈ д , there are two subcases: • If q ∈ д (Figure 26), then d(s,д) ≤ d(s, a) + |π (a,q)| + |д|/2, where π (a,q) is the subpath of π (a,p) between a and q. Hence, the time τ when artificial wavefronts originating from the endpoints of д cover д is no later than d(s,д)+|д|≤ d(s, a)+|π (a,q)|+ 3|д|/2. Because д ∈ ∂U (e), |pq|≥ 2 · max{|д|,|e|}. Hence, τ ≤ d(s, a) + |π (a,q)| + 3|д|/2 < d(s, a) + |π (a,q)|+|qp| = d(s, a)+|π (a,p)| < d (s,p),where d (s,p) is the length of the path W (e) W (e) from s to p following the wavefront W (e); the last inequality holds because α is the true predecessor of p while α is not. However, the time τ when the wavefront W (e) reaches an endpoint of e cannotbeearlier than d (s,p)−|e|. Hence, the wavelet from α cannot reach д earlier than d (s,p) − W (e) W (e) |e| + d(e,д) ≥ d (s,p) −|e| + 2|e|≥ d (s,p) + |e|, which is larger than τ since W (e) W (e) д τ < d (s,p) as proved previously. Therefore, by the time the wavelet from α reaches д W (e) д, the artificial wavelets of д have already covered д, eliminating the wavelet from α from reaching д.Thus, α must be marked by Rule 3(b). • If q  д ,then q is on one of the bisectors B(α , α ) and B(α, α ).Let π (s, a) be a shortest path 1 2 from s to a and let π (s,p) = π (s, a) ∪ π (a,p), which is a shortest path from s to p.If π (s,p) intersects д, then we can use the same analysis as earlier to show that the wavelet from α will be eliminated from reaching д by the artificial wavelets of д and thus α must be marked by Rule 3(b). In the following, we assume that π (s,p) does not intersect д. Without of loss of generality, we assume that q ∈ B(α , α ) (Figure 27). Since π (a,p) is a subpath of the shortest path π (s,p), every point of π (a,p) has α as its predecessor. As q ∈ π (a,p), the predecessor of q is α .Let π (s,q) be the subpath of π (s,p) between s and q, which is a shortest s-q path. Since π (s,p) does not intersect д, π (s,q) does not intersect д. Hence, π (s,q) is a shortest s-q path in the modified free space F by replacing д with an opaque edge of open endpoints. Therefore, during the wavefront propagation procedure for computing W (e,д) or during the wavefront merging procedure for computing W (д),the Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:39 Fig. 26. Illustrating the case where q ∈ д . Fig. 27. Illustrating the case where q ∈ B(α , α ). point q, which is on the bisector B(α , α ),mustbeclaimed by α . Hence, a bisector event must be detected for B(α , α ) during the computation of W (e,д) or W (д).Ineithercase, α must be marked by Rule 3(b). We next consider the case where α lies inside U (e)—that is, its initial vertex a is inside U (e). If a is not between the two bisectors B(α , α ) and B(α, α ),then π (a,p) must intersect one of the 1 2 bisectors and thus we can use a similar argument as in the preceding second case to show that α must be marked. Otherwise, a is in the region R. This implies that not all points in R are claimed by α when W (e) is propagating to д, and therefore a bisector event involving α must happen during the wavefront propagation procedure to propagate W (e) to compute W (e,д) and thus α is marked by Rule 3(b). With the help of the preceding lemma, we prove the following lemma. Lemma 3.24. If a generator α participates in a bisector event of SPM (s) in a cell c of S ,then α must be marked in c. Proof. If a bisector has an endpoint on an obstacle edge of c, it either emanates from an obstacle vertex a on the edge (i.e., the bisector is an extension bisector) or is defined by two generators that claim part of the opaque edge. In the first case, a is the initial vertex of a new created generator in c and thus the generator is marked by Rule 1. In the second case, both generators are marked by Rule 4. Let α be a generator that participates in a bisector event of SPM (s) in a cell c of S . Assume to the contrary that α is not marked for c. Then, by Rule 2(a), there must be transparent edges e and f on the boundary of c such that both W (e) and W (f ) contain the three consecutive generators α , α,and α . Without loss of generality, we assume thatW (e) enters c andW (f ) leaves c.Let R be 1 2 the region of c bounded by e, f , and the two bisectors B(α , α ) and B(α, α ) (Figure 28). The region 1 2 R must be a subset of c. Indeed, if R contains an island not in c,then α would claim an endpoint of a boundary edge of the island, in which case Rule 3 would apply. Since α participates in a bisector event of SPM (s) in c,atleast onepoint p in R is not claimed by α in SPM (s).Let α = (A, a) be the true predecessor of p. Note that the initial vertex a must be outside R since otherwise a bisector event involving α must happen when W (e) is propagating through c and thus α would be marked by Rule 3(b). Let π (a,p) be the path from p along its tangent to A and then following A to a. Since a is outside R and p is inside R, π (a,p) must intersect the boundary of R. Because α , α,and α are three consecutive generators of W (e), no generator other than α on 1 2 thesamesideof e as α claims any point of R.Thus, π (a,p) does not cross e.Let b and b be 1 2 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:40 H. Wang Fig. 28. Illustrating the proof of Lemma 3.24. the intersections of f with B(α , α ) and B(α, α ), respectively. Then, if α claims both b and b in 1 2 1 2 SPM (s),then π (a,p) cannot cross either bisector on∂R, and thus it must cross b b , say, at a point 1 2 q (e.g., see Figure 28). Note that q satisfies the hypothesis of Lemma 3.23, and thus α is marked for c.If α does not claim either b or b , then that point satisfies the hypothesis of Lemma 3.23 and 1 2 thus α is marked for c. 3.8.2 Computing the Vertices of SPM (s). In this section, we compute the vertices of SPM (s). The next section will compute the edges of SPM (s) and assemble them to obtain SPM (s). Computing Active Regions. Because the wavefronts are represented by persistent trees, after the preceding wavefront expansion algorithm finishes, the wavefronts W (e) for all transparent edges e of S are still available. In addition, for each cell c and each transparent edge e of c,asetof marked generators in W (e) are known. Using these marked generators, we first break c into active and inactive regions such that no vertices of SPM (s) lie in the inactive regions. Note that each unmarked generator does not participate in a bisector event in SPM (s) by Lemma 3.24.If α and α are neighboring generators on∂c such that one of them is marked while the other is unmarked, their bisector belongs to SPM (s). Therefore, all such generators are disjoint and they together partition c into regions such that each region is claimed only by marked generators or only by unmarked generators; the former regions are active while the latter are inactive. We can compute these active regions as follows. Since the wavefronts W (e) for all transparent edges e of c are available, the list of all generators ordered along the boundary of c is also available. For each pair of adjacent generators α and α ,if 1 2 one of them is marked and the other is unmarked, then we explicitly compute the portion of their bisector B(α , α ) in c. We describe the details of this step in the following. 1 2 First of all, observe that α and α must be from W (e) for the same transparent edge e of c, since 1 2 otherwise each generator must claim an endpoint of their own transparent edge and thus must have been marked by Rule 2(a). Without loss of generality, we assume that e is horizontal and both α and α are below e. Note that we cannot afford computing the entire bisector B(α , α ) 1 2 1 2 and then determining its portion in c because the running time would be proportional to the size of B(α , α )—that is, the number of hyperbolic-arcs of B(α , α ). Instead, we first compute 1 2 1 2 the intersection b of B(α , α ) and e, which can be done in O (log n) time by the bisection-line 1 2 intersection operation in Lemma 3.10.Notethat b is one endpoint of the portion of B(α , α ) in c. 1 2 To determine the other endpoint b , we do the following. Our goal is to compute b in O (|B |+log n) time, with B = B(α , α ) ∩ c. To this end, we could trace B in c from b, and for each hyperbolic- c 1 2 c arc of B , we determine whether it intersects ∂c.Recallthat ∂c consists of O (1) transparent edges Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:41 and at most O (1) convex chains. To achieve the desired runtime, we need to determine whether each hyperbolic-arc of B intersects ∂c in O (1) time. However, it is not clear to us whether this is possible as the size of each convex chain may not be of O (1) size. To circumvent the issue, we use the following strategy. Before tracing B , we first compute the intersection between B(α , α ) and c 1 2 each convex chain on ∂c, which can be done in O (log n) time by the bisector-chain intersection operation in Lemma 3.13. Among all intersections, let b be the closest one to α. Then, we start to trace B from b, for each hyperbolic-arc e , we determine whether e intersects each of the transparent edges of ∂c. If not, we further check whether e contains b .If b  e ,then e is in c and we continue the tracing; otherwise, b is b and we stop the algorithm. If e intersects at least one of the transparent edges of ∂c, then among all such intersections as well as b , b is the one closest to α, which can be determined in O (log n) time by computing their tangents to α.In this way, computing the portion of B(α , α ) in c can be done in O (log n+ n (α , α )) time, where 1 2 c 1 2 n (α , α ) is the number of hyperbolic-arcs of B(α , α ) in c. c 1 2 1 2 In this way, all active regions of c can be computed in O (h log n+n ) time, where h is the total c c c number of marked generators in the wavefronts W (e) of all transparent edges e of c and n is the total number of hyperbolic-arcs of the bisector boundaries of these active regions. Computing the Vertices of SPM (s) in Each Active Region. In what follows, we compute the vertices of SPM (s) in each active region R of c. The boundary ∂R consists of O (1) pieces, each of which is a transparent edge fragment, an elementary chain fragment, or a bisector in SPM (s). Unlike the HS algorithm, where each of these pieces is of O (1) size, in our problem both an elementary chain fragment and a bisector may not be of constant size. Let e be a transparent edge of R. Without loss of generality, we assume that e is horizontal and R is locally above e. Without considering other wavefronts, we use W (e) to partition R into subregions, called Voronoi faces, such that each face has a unique predecessor in W (e).Weuse Vor (e) to denote the partition of R.Notethatif α is the predecessor of a Voronoi face, then for each point p in the face, its tangent to α must cross e and we assign p a weight that is equal to d(α,p). In addition, it is possible that these faces together may not cover the entire R; for those points outside these faces, their weights are ∞. We now discuss how to compute the partition Vor (e). To this end, we can use our wavefront propagation procedure to propagate W (e) inside R.Toapply thealgorithm,oneissueisthatthe boundary of R may contain bisectors, which consists of hyperbolic-arcs instead of polygonal seg- ments. To circumvent the issue, an observation is that the bisectors of W (e) do not intersect the bisectors on ∂R. Indeed, for each bisector B of ∂R, one of its defining generators is unmarked and thus does not participate in any bisector event in c, and therefore B does not intersect any bisec- tor in c. In light of the observation, we can simply apply the wavefront propagation procedure to propagate W (e) to c instead of R to partition c into Voronoi faces, denoted by Vor (e).The pre- ceding observation implies that each bisector on the boundary of R must lie in a single face of Vor (e). Hence, we can simply cutVor (e) to obtainVor (e) using the bisectors on the boundary of c c R. When we apply the wavefront propagation procedure to propagate W (e) to c,hereweadd an initial step to compute the intersection of e and B(α, α ) for each pair of neighboring generators α and α of W (e) and use it as the initial tracing-point z(α, α ). Since each such intersection can be computed in O (log n) time by the bisector-line intersection operation in Lemma 3.10, this initial step takes O (h log n) time, where h is the number of generators of W (e). Hence, the total time e e for propagating W (e) into c to obtain Vor (e) is O (h log n+ n (e)),where n (e) is the number of c e B B hyperbolic-arcs of the bisectors of W (e) in c. After having Vor (e), cutting it to obtain Vor (e) can be easily done in O (h +n (e)+n ) time, where n is the number of hyperbolic-arcs on the bisec- e B R R tors of ∂R. Therefore, the total time for computing the partition Vor (e) is O (h log n+ n (e)+ n ) e B R Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:42 H. Wang time. Note that since the bisectors of∂R do not intersect any bisectors involving the generators of W (e), all bisector events of W (e) in c are actually in R. After having the partition Vor (e) for all transparent edges e of R, we can now compute vertices of SPM (s) in R. Consider a transparent edge e of∂R. We process it as follows. For each transparent edge f of ∂R other than e, we merge the two partitions Vor (e) and Vor (f ) by using the merge step from the standard divide-and-conquer Voronoi diagram algorithm to compute the subregion of R closer to W (e) than to W (f ). This can be done in O (h + n (e) + n + h + n (f )) time by e B R f B finding a finding a curve γ in R that consists of points equal to W (e) and W (f ), and the algorithm is similar to the HS algorithm. Intersecting the results for all such f produces the region R(e) claimed byW (e) in R. Intersecting R(e) with Vor (e) gives the vertices of SPM (s) in R that W (e) contributes. Repeating the preceding for all transparent edges e of ∂R gives the vertices of SPM (s) in R. Since ∂R has O (1) transparent edges, the total time is O (h log n + n (R) + n ),where h is the number of generators in all R B R R wavefronts of all transparent edges of∂R and n (R) is the total number of hyperbolic-arcs in R on the bisectors of all wavefronts of all transparent edges of ∂R. We do the preceding for all active regions R of c, then all vertices of SPM (s) in c can be computed. The total time is O (h log n+n (c)+n (c)),where h is the total number of marked generators in c R B c the wavefronts W (e) of all transparent edges e of c, n (c) is the total number of hyperbolic-arcs of the bisector boundaries of the active regions of c,and n (c) is the total number of hyperbolic-arcs in c on the bisectors of the wavefronts of all transparent edges of c. Processing all cells c of S as earlier gives all vertices of SPM (s). For the running time, the total sum of n (c) among all cells c ∈S is O (n) because each hyperbolic-arc of a bisector on the boundary of any active region also appears in SPM (s), whose total size is O (n) by Corollary 3.3. The total sum of h among all cells c is O (h) by Lemma 3.15. For n (c), Lemma 3.17 is essentially a proof that the total sum of n (c) over all B B cells c is O (n). To see this, since c is a cell incident to e, the wavefrontW (e) will be propagated into c during the wavefront propagation procedure to propagateW (e) to edges of output (e), and thus the hyperbolic-arcs of the bisectors of W (e) are counted in the proof analysis of Lemma 3.17.Insum- mary, the total time for computing all vertices of SPM (s) is O (n+ h log n),which is O (n+ h logh). 3.8.3 Constructing SPM (s). With all vertices of SPM (s) computed previously, as in the HS algo- rithm, we next compute the edges of SPM (s) separately and then assemble them to obtain SPM (s). One difference is that the HS algorithm uses a standard plane sweep algorithm to assemble all edges to obtain SPM (s), which takes O (n log n) time as there are O (n) edges in SPM (s).Toachieve the desired O (n + h logh) time bound, here instead we propose a different algorithm. We first discuss how to compute the edges of SPM (s), given the vertices of SPM (s).Recallthat each vertex v of SPM (s) is either an intersection between a bisector and an obstacle edge, or an intersection of bisectors. By our general position assumption, in the former case, v is in the interior of an obstacle edge; in the latter case, v is the intersection of three bisectors (i.e., a triple point). During our preceding algorithm for computing vertices of SPM (s), we associate each vertex v with the two generators of the bisector that contains v (more specifically, we associate v with the initial vertices of the generators). We create a list of all vertices of SPM (s), each identified by a key consisting of its two generators. If a vertex v is a triple point, then we put it in the list for three times (each time with a different pair of generators); if v is a bisector-obstacle intersection, then it is put in the list once. We now sort all vertices of SPM (s) with their keys; by traversing the sorted list, we can group together all vertices belong to the same bisector. This sorting takes O (h log n) time, as there are O (h) vertices in SPM (s). We take all SPM (s) vertices in the same bisector and sort them along the bisector determined by their weighted distances from the generators of the bisector (each of these distances can be computed in additional O (log n) time by computing the tangents from the vertex to the generators). Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:43 Fig. 29. Illustrating v, u, u , v , b ,and b. These sorting takes O (h log n) time altogether. The preceding computes the bisector edges e of SPM (s) that connect two adjacent vertices. In fact, each edge e is only implicitly determined in the sense that the hyperbolic-arcs of e are not explicitly computed. In addition, for each obstacle P, we sort all vertices of SPM (s) on ∂P to compute the convex chain edges of SPM (s) connecting adjacent vertices of SPM (s) on ∂P. This sorting can be easily done in O (n + h log n) time for all obstacles. For each vertex v of SPM (s), the preceding computes its adjacent vertices. As discussed earlier, due to the general position assumption, v has at most three adjacent vertices. We next define a set E(v) of at most three points for v. For each adjacent vertex u of v in SPM (s),let e(v,u) be the edge of SPM (s) connecting them. e(v,u) is either a bisector edge or a convex chain edge. In the former case, we refer to each hyperbolic-arc of e(v,u) as a piece of e(v,u); in the latter case, we refer to each obstacle edge of e(v,u) as a piece. If we traverse e(v,u) from v to u, the endpoint u of the first piece (incident to v) is added to E(v);wedefine h(u ) to be u. Since v is adjacenttoatmost three vertices in SPM (s), |E(v)|≤ 3. In fact, E(v) is exactly the set of vertices adjacent to v in the shortest path map SPM (s). With all edges of SPM (s) and the sets E(v) of all vertices v of SPM (s) computed previously, we construct the Doubly-Connected-Edge-List (DCEL) of SPM (s), as follows. For convenience, we assume that there is a bounding box that contains all obstacles so that no bisector edge of SPM (s) will go to infinity and thus each face of SPM (s) is bounded. For each vertex v of SPM (s), we store its coordinate in the DCEL data structure. As |E(v)|≤ 3, there are at most three faces in SPM (s) incident to v, and we construct them one by one. For each point u in E(v), we construct the face F clockwise (with respect to v) incident to the edge e(v,u) of SPM (s) connecting v and u = ϕ(u ), as follows (Figure 29). We first trace out the edge e(v,u), which is either a bisector edge or a convex chain edge. In the former case, we compute the hyperbolic-arcs of e(v,u), one at a time, until we reach u, and add them to the DCEL data structure. Each hyperbolic-arc can be computed in constant time using the two generators of the bisector. In the latter case, we trace out the obstacle edges of e(v,u), one at a time and add them to the DCEL data structure. Let v be the last endpoint of the piece of e(v,u) containing u (e.g., see Figure 29). Note that v is in the set E(u).Let b be the first point of E(u) counterclockwise around u after v (e.g., see Figure 29). Let b = ϕ(b ), which is a vertex of SPM (s) adjacent to u. Hence, the edge e(u,b) of SPM (s) connecting u to b is incident to the face F. We trace out the edge e(u,b) in the same way as earlier. When we reach b, we continue to trace the next edge of F.Sinceeachfaceof SPM (s) is bounded, eventually we will arrive back to the vertex v again. This finishes the construction of the face F. We do the same for all other faces of SPM (s), after which the DCEL data structure for We could lift the assumption that each face of SPM (s) is bounded in the following way. During the preceding algorithm for constructing F,if F is unbounded, then we will reach a bisector edge that extends to the infinity. If that happens, then we construct other edges of F from the other direction of v. More specifically, starting from the first point of E (v ) Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:44 H. Wang SPM (s) is constructed. For the running time, since each edge of SPM (s) is traced at most twice, by Corollary 3.3, the total time of the preceding procedure for constructing the DCEL data structure is O (n). In summary, SPM (s) can be computed in O (n + h logh) time. By Lemma 3.6, the shortest path map SPM (s) can be built in additional O (n) time. 3.9 Reducing the Space to O(n) The preceding provides an algorithm for computing SPM (s) in O (n+h logh) time and O (n+h logh) space. In this section, we reduce the space to O (n), using the technique given in prior work [48]. The reason that the preceding algorithm needs O (n+h logh) space is twofold. First, it uses fully persistent binary trees (with the path-copying method) to represent wavefronts W (e).Because there are O (h) bisector events in the wavefront expansion algorithm and each event costs O (log n) additional space on a persistent tree, the total space of the algorithm is O (n + h log n).Second, to construct SPM(s) after the wavefront expansion algorithm, the wavefronts W (e) of all transparent edges e of S are needed, which are maintained in those persistent trees. We resolve these two issues in the following way. 3.9.1 Reducing the Space of the Wavefront Expansion Algorithm. We still use persistent trees to represent wavefronts. However, as there are O (h) bisector events in total in the algorithm, we divide the algorithm into O (logh) phases so that each phase has no more than h/ logh events. The total additional space for processing the events using persistent trees in each phase is O (h). At the end of each phase, we “reset” the space of the algorithm by only storing a “snapshot” of the algorithm (and discarding all other used space) so that (1) the snapshot contains sufficient information for the subsequent algorithm to proceed as usual and (2) the total space of the snapshot is O (h). Specifically, we make the following changes to the wavefront propagation procedure, which is to compute the wavefronts W (e,д) for all edges д ∈ output (e) using the wavefront W (e).We now maintain a counter count to record the number of bisector events that have been processed so far since the last space reset; count = 0 initially. Consider a wavefront propagation procedure on the wavefront W (e) of a transparent edge e. The algorithm will compute W (e,д) for all edges д ∈ output (e), by propagating W (e). We apply the same algorithm as before. For each bisector event, we first do the same as before. Then, we increment count by 1. If count < h/ logh,we proceed as before (i.e., process the next event). Otherwise, we have reached the end of the current phase and will start a new phase. To do so, we first reset count = 0 and then reset the space by constructing and storing a snapshot of the algorithm (other space occupied by the algorithm is discarded), as follows: (1) Let д refer to the edge of output (e) whose W (e,д) is currently being computed in the al- gorithm. We store the tree that is currently being used to compute W (e,д) right after the preceding event. To do so, we can make a new tree by copying the newest version of the current persistent tree the algorithm is operating on. The size of the tree is bounded by O (h). We will usethistreeto“resume”computing W (e,д) in the subsequent algorithm. (2) For eachд ∈ output (e)\{д} whoseW (e,д ) has been computed, we store the tree forW (e,д ). We will use the tree to compute the wavefronts W (д ) of д in the subsequent algorithm. (3) We store the tree for the wavefront W (e). Note that the tree may have many versions due to processing the events and we only keep its original version for W (e). Hence, the size of clockwise around v after u ,wetraceouttheedges of F in the same way as earlier, until we reach a bisector edge that extends to the infinity, at which moment all edges of F are constructed. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:45 the tree is O (h). This tree will be used in the subsequent algorithm to compute W (e,д ) for those edges д ∈ output (e)\{д} whose W (e,д ) have not been computed yet. (4) We check every transparent edge e ofS with e  e.If e has been processed (i.e., the wave- front propagation procedure has been called on W (e )) and there is an edge д ∈ output (e ) that has not been processed, we know that W (e ,д ) has been computed and is available; we store the tree for W (e ,д ). We will use the tree to compute the wavefronts W (д ) of д in the subsequent algorithm. We refer to the wavefronts stored in the algorithm as the snapshot; intuitively, the snapshot contains all wavelets in the forefront of the wavelet expansion. By analysis similar to that in previ- ous work [48], we can show that the snapshot contains sufficient information for the subsequent algorithm to proceed as usual and the total space of the snapshot is O (h). For completeness, we pro- vide the details in the following. Before doing so, we give a remark about the wavefront merging procedure. The preceding discusses our changes to the wavefront propagation procedure. For the wavefront merging procedure, which is to constructW (e) fromW (f, e) for the edges f ∈ input (e), notice that we do not need the old versions of W (f, e) anymore after W (e) is constructed. There- fore, it is not necessary to use the path-copying method to process each event in the procedure. Hence, the total space needed in the wavefront merging procedure in the entire algorithm is O (n). The following lemma shows that if we discard all persistent trees currently used in the algorithm and instead store the snapshot, then the algorithm will proceed without any issues. The proof is literally the same as that in prior work [48] because it only relies on the high-level algorithm scheme not the implementation details. Lemma 3.25. The snapshot stores sufficient information for the subsequent algorithm to proceed as usual. Proof. Let ξ be the moment of the algorithm when the snapshot construction algorithm starts. Let ξ be any moment of the algorithm after the snapshot is constructed. We show in the follow- ing that if the algorithm needs any information that was computed before ξ to perform certain operation at ξ , then that information is guaranteed to be stored at the snapshot. This will prove the lemma. At ξ , the transparent edges of S excluding e can be classified into two categories: those that have already been processed at ξ and those that have not been processed. Let E and E denote the 1 2 sets of the edges in these two categories, respectively. The edge e is special in the sense that it is currently being processed at ξ . Hence, it does not belong to either set. At ξ , depending on whether the algorithm is in the wavefront merging procedure or in the wavefront propagation procedure, there are two cases, which are presented next. The Algorithm Is in the Wavefront Merging Procedure. Suppose the algorithm is in the wavefront merging procedure at ξ , which is to compute W (e ) for some edge e by merging all wavefronts W (f , e ) for f ∈ input (e ). Because at ξ we need some information that was computed before ξ , that information must be the wavefront W (f , e ) for some edge f ∈ input (e ). Depending on whether f = e, there are two subcases: • If f = e, then since W (e, e ) was computed before ξ , W (e, e ) is stored in the snapshot by Step (2) of the snapshot construction algorithm. • If f  e, then since W (f , e ) was computed before ξ,the edge f must have been pro- cessed at ξ . Because the algorithm is computing W (e ) at ξ , e has not been processed at ξ . Therefore, W (f , e ) is stored in the snapshot by Step (4) of the snapshot construction algorithm. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:46 H. Wang Hence, in either subcase, the information needed by the algorithm at ξ is stored at the snapshot. The Algorithm Is in the Wavefront Propagation Procedure. Suppose the algorithm is in the wave- front propagation procedure at ξ , which is to process a transparent edge e —that is, compute W (e ,д ) for some д ∈ output (e ). Because at ξ the algorithm needs some information that was computed before ξ to computeW (e ,д ),W (e ) must have been computed before ξ (sinceW (e ,д ) relies on W (e )). We claim that e must be e. Indeed, if e ∈ E ,then e has been processed before ξ and thus the wavefront propagation procedure cannot happen to e at ξ , a contradiction. If e ∈ E ,then e has not been processed at ξ . According to our algorithm, for any transparent edge e , W (e ) is computed during the wavefront merging procedure for e , which is immediately followed by the wavefront propagation procedure to process e . Since at ξ the algorithm is in the wavefront propagation procedure to process e, the wavefront merging procedure for e must have not been invoked at ξ , and thus W (e ) must have not been computed at ξ . This contradicts with the fact that W (e ) has been computed at ξ . Therefore, e must be e. Depending on whether д is д, there are two subcases: • If д = д, then the tree at the moment ξ during the propagation for computing W (e,д) from W (e) is stored in the snapshot by Step (1) of the snapshot construction algorithm, and thus we can use the tree to “resume” computing W (e,д) at ξ . • If д  д, then to compute W (e,д ) at ξ , we need the wavefront W (e), which is stored in the snapshot by Step (3) of the snapshot construction algorithm. Hence, in either subcase, the information needed by the algorithm at ξ is stored at the snapshot. The lemma thus follows. Bounding the space of the snapshot is more challenging, which is established in the following lemma. As the proof is lengthy and technical, we devote the next section to it. Lemma 3.26. The total space of the snapshot is O (h). Since each phase has no more than h/ logh wavefront propagation operations, the total ex- tra space introduced by the persistent trees in each phase is O (h). Due to the space-reset and Lemma 3.26, the total space of the algorithm is O (n). For the running time of our new algorithm, comparing with the original HS algorithm, we spend extra time on constructing the snapshot at the end of each phase. In light of Lemma 3.26,as S has O (h) transparent edges, each call of the snapshot construction algorithm takes O (h) time. As there are O (logh) phases, the total time on constructing the snapshots in the entire algorithm is O (h logh). Hence, the running time of our new algorithm is still bounded by O (n + h logh). 3.9.2 Proof of Lemma 3.26. We now prove Lemma 3.26—that is, the space introduced by the four steps of the snapshot construction algorithm is O (h). For the first step, as each wavefront has O (h) generators (and representing each generator takes O (1) space), the size of the tree representing the wavefront is O (h). For the second step, since |output (e)| = O (1) and the size of each W (e,д ) is O (h), the total space is O (h). For the third step, since |W (e)| = O (h),the spaceis O (h). In the following, we focus on the fourth step. Let Π denote the collection of pairs (e,д) whose wavefront W (e,д) is stored in the fourth step of the snapshot construction algorithm. Our goal is to show that |W (e,д)| = O (h). (e,д)∈Π For an edge e, Π may have multiple pairs with e as the first element and the second elements of all these pairs are in output (e); among all those pairs, we only keep the pair (e,д) such that |W (e,д)| is the largest in Π and remove all other pairs from Π. Since |output (e)| = O (1), it suffices to show that the total sum of|W (e,д)| for all pairs (e,д) in the new Π is O (h).Now in thenew Π,no Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:47 two pairs have the same first element. However, for an edge д, it is possible that there are multiple pairs in Π whose second elements are all д and their first elements are all from input (д); among all those pairs, we only keep the pair (e,д) such that |W (e,д)| is the largest in Π and remove all other pairs from Π. Since |input (д)| = O (1), it suffices to show that the total sum of |W (e,д)| for all pairs (e,д) in the new Π is O (h). Now in the new Π, no two pairs have the same first element and no two pairs have the same second element. As S has O (h) transparent edges, the size of Π is O (h). For each pair (e,д) ∈ Π,recallthat W (e,д) may have up to two artificial generators (i.e., the endpoints of e). Since |Π| = O (h), there are a total of O (h) artificial generators in W (e,д) for all pairs (e,д) ∈ Π. In the following discussion, we ignore these artificial generators, and by slightly abusing the notation, we use W (e,д) to refer to the remaining wavefront without the artificial generators. Hence, each generator of W (e,д) is on an elementary chain. It suffices to prove |W (e,д)| = O (h). (e,д)∈Π For any three adjacent generators α = (A , a ), α = (A , a ),and α = (A , a ) in a wavefront, 1 1 1 2 2 2 3 3 3 we call (α , α , α ) an adjacent-generator-triple. For two generators α = (A, a) and α = (A , a ),we 1 2 3 say that α  α if A  A , a  a , or the designated directions of A and A are not the same in the case A = A and a = a . Two adjacent-generator-triples (α , α , α ) and (α , α , α ) are distinct if 1 2 3 1 2 3 α  α from some i ∈{1, 2, 3}. We have the following observation. Observation 2. The number of distinct adjacent-generator-triples in all wavefronts involved in the entire wavefront expansion step of the algorithm is O (h). Proof. Initially, the algorithm starts a wavefront from s with only one generator s. Whenever a distinct adjacent-generator-triple is produced during the algorithm, either a bisector event hap- pens or a new generator is created. In either case, a generator will be marked according to our generator marking rules. As the total number of marked generators during the algorithm is O (h) by Lemma 3.15, the observation follows. Lemma 3.26 is almost an immediate consequence of the following lemma. Lemma 3.27. Any adjacent-generator-triple (α , α , α ) can appear in the wavefront W (e,д) for at 1 2 3 most O (1) pairs (e,д) of Π. Before proving Lemma 3.27, we prove Lemma 3.26 with the help of Lemma 3.27. Indeed, there are O (h) distinct adjacent-generator-triples in the entire algorithm by Observation 2.Now that each such triple can only appear in a constant number of wavefronts W (e,д) for all (e,д) ∈ Π,the total number of generators in all wavefronts W (e,д) for all (e,д) ∈ Π is bounded by O (h).This leads to Lemma 3.26. Proving Lemma 3.27. We prove Lemma 3.27 in the rest of this section. Assume to the contrary that an adjacent-generator-triple (α , α , α ) appears in the wavefront W (e,д) formorethan O (1) 1 2 3 pairs (e,д) of Π; let Π denote the set of all such pairs. Consider a pair (e,д) ∈ Π .Recallthat W (e,д) is obtained by propagating W (e) from e to д through the well-covering region U (д) if e ∈ input (д) and through U (e) otherwise. If one of the generator initial vertices a , a ,and a is in U (д) ∪U (e),thenwecall (e,д) a special pair. 1 2 3 The properties of the subdivision S guarantee that each cell of S is in U (f ) for at most O (1) transparent edges f of S , implying that each vertex a ,1 ≤ i ≤ 3, is in U (f ) for at most O (1) transparent edges f ofS , and thus Π has at most O (1) special pairs. We remove all special pairs from Π , after which Π still has more than O (1) pairs and for each pair (e,д) ∈ Π the initial By “more than O (1) pairs,” we intend to say “more than c pairs for a constant c to be fixed later.” To simplify the discussion, we use “more than O (1) pairs” instead with the understanding that such a constant c can be fixed. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:48 H. Wang vertices of the three generators α , α ,and α are all outside U (д)∪U (e). Therefore, α , α ,and 1 2 3 1 2 α are also generators in W (e) in this order (although they may not be adjacent in W (e)). Because (α , α , α ) is an adjacent-generator-triple in W (e,д), B(α , α ) (respectively, B(α , α )) intersects 1 2 3 1 2 2 3 д.Inaddition,notethat α , α ,and α are on the same side of the supporting line of e; since they 1 2 3 are generators of both W (e) and W (e,д), the bisector B(α , α ) (respectively, B(α , α )) intersects 1 2 2 3 e (although the intersection may not appear in W (e), i.e., the intersection may be claimed by a different generator in W (e)). Further, α is closer to the intersection of B(α , α ) (respectively, 2 1 2 B(α , α )) with e than with д.Let (e ,д ) be the pair in Π such that the intersection of B(α , α ) 2 3 1 1 1 2 with its first element is closest to α among the intersections of B(α , α ) with the first elements 2 1 2 of all pairs of Π . By the property ofS ,U (д )∪U (e ) contains O (1) transparent edges. Because |Π | is not O (1), 1 1 Π must have a pair, denoted by (e ,д ), such that e is outsideU (д )∪U (e ).RecallthatW (e ,д ) 2 2 2 1 1 1 1 is obtained by propagating W (e ) from e to д inside U (д ) or U (e ). Hence, if we move along 1 1 1 1 1 the bisector B(α , α ) from its intersection with e to its intersection with д , all encountered edges 1 2 1 1 ofS are inU (д )∪U (e ). Therefore, by the definitions of e and e , B(α , α ) intersects e , д , e , 1 1 1 2 1 2 1 1 2 and д in this order following their distances from α (Figure 30). 2 2 By definition (i.e., the fourth step of our snapshot construction algorithm), e has been processed but д has not. According to the wavefront expansion algorithm, covertime(e ) ≤ covertime(д ). 1 2 1 In the following, we will obtain covertime(e ) > covertime(д ), which leads to a contradiction. 2 1 Let b be the intersection between the bisector B(α , α ) and д (e.g., see Figure 30). Let π (b, a ) 1 2 2 2 be the path from b to a following the tangent from b to A and then following A to a (e.g., the 2 2 2 2 dashed segment in Figure 30). Since α and α are two adjacent generators in W (e ,д ), π (b, a ) 1 2 2 2 2 is in the free space F .As W (e ,д ) is obtained from W (e ) and α is also a generator in W (e ), 2 2 2 2 2 π (b, a ) must intersect e , say, at a point q (e.g., see Figure 30). Further, we have the following 2 2 observation. Observation 3. π (b, a ) intersects д (e.g., see Figure 30). 2 1 Proof. Since (α , α , α ) is an adjacent-generator-triple in both wavefronts W (e ,д ) and 1 2 3 1 1 W (e ,д ), each of the bisectors B(α , α ) and B(α , α ) intersects both д and д .Let z and z 2 2 1 2 2 3 1 2 1 2 be the intersections of д with B(α , α ) and B(α , α ), respectively. Let b be the intersection of 1 1 2 2 3 д and B(α , α ).Then, z z , which is a subsegment of д ,isclaimed by α in W (e ,д ). Similarly, 2 2 3 1 2 1 2 1 1 bb , which is a subsegment of д ,isclaimed by α in W (e ,д ).Recallthat α is closer to z than 2 2 2 2 2 1 to b. Hence, for any point p ∈ bb , π (p, α ) must intersect z z ,where π (p, α ) is defined in a way 2 1 2 2 similar to π (b, α ). This leads to the observation, for z z ⊆ д and b ∈ bb . 2 1 2 1 In light of the preceding observation, let z be an intersection point of π (b, a ) and д (e.g., see 2 1 Figure 30). For any two points p and p of π (b, a ),weuse π (p,p ) to refer to the subpath of π (b, a ) between p and p . Using the properties of the well-covering regions of S ,wehavethe following observation. Observation 4. |π (q, z)|≥ 2·|д |. Proof. Since q ∈ e is outside the well-covering region U (д ) of д , z ∈ д ,and π (q, z) is in 2 1 1 1 the free space F , π (q, z) must cross the boundary of U (д ), say, at a point p. By the property of the conforming subdivision S , |π (p, z)|≥ 2·|д |.As |π (q, z)|≥|π (p, z)|, the observation follows. The following lemma, which is a consequence of Observation 4, leads to a contradiction, for covertime(д ) ≥ covertime(e ), and thus Lemma 3.27 is proved. 1 2 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:49 Fig. 30. Illustrating the two bisectors B(α , α ) and Fig. 31. Illustrating the proof of Lemma 3.28. 1 2 B(α , α ) as well as the four transparent edges e , д , 2 3 1 1 e ,and д (each of these edges may also be vertical). 2 2 Lemma 3.28. covertime(д ) < covertime(e ). 1 2 Proof. Let x and y be the two endpoints of д , respectively. Let x and y be the two endpoints 1 1 1 2 2 of e , respectively. Refer to Figure 31.As π (z, a ) ⊆ π (b, a ) is in the free space F ,wehavethe 2 2 2 following for covertime(д ): covertime(д ) = min{d(s, x ),d(s,y )} + |д | 1 1 1 1 ≤ d(s, a ) + |π (a , z)| + |д |/2+ |д | 2 2 1 1 = d(s, a ) + |π (a , z)| + 3|д |/2. 2 2 1 However, because α claims b in W (e ,д ) (as explained in the proof of Observation 3), α 2 2 2 2 is also a generator in W (e ),and π (b, a ) intersects e at q, α must claim q in W (e ). Hence, 2 2 2 2 2 min{d(s, x ),d(s,y )}+|e |≥ d(s, a )+|π (a ,q)| must hold, since otherwise the artificial wavelets 2 2 2 2 2 at the endpoints of e would have prevented α from claiming q. Therefore, we have the following 2 2 for covertime(e ): covertime(e ) = min{d(s, x ),d(s,y )} + |e | 2 2 2 2 ≥ d(s, a ) + |π (a ,q)| 2 2 = d(s, a ) + |π (a , z)| + |π (z,q)| 2 2 ≥ d(s, a ) + |π (a , z)| + 2·|д |. 2 2 1 The last inequality is due to Observation 4.As |д | > 0, we obtain covertime(д ) < covertime(e ). 1 1 2 3.9.3 Reducing the Space of Constructing SPM (s). For the second issue of constructing SPM (s), our original algorithm relies on the wavefronts W (e) for all transparent edges e, which are main- tained by persistent trees. Due to the space-reset, our new algorithm does not maintain the wave- fronts anymore, and thus we need to somehow restore these wavefronts to construct SPM (s).To this end, a key observation is that by marking a total of O (h) additional wavelet generators, it is possible to restore all historical wavefronts that are needed for constructing SPM (s). In this way, SPM (s) can be constructed in O (n + h logh) time and O (n) space. More specifically, our algorithm considers each cell c of S individually. For each cell c,the algorithm has two steps. First, compute the active regions of c. Second, for each active region R, compute the vertices of SPM (s) in R. For both steps, our algorithm utilizes the wavefronts W (e) Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:50 H. Wang of the transparent edges e on the boundary of c. Due to the space-reset, the wavefronts W (e) are not available anymore in our new algorithm. We use the following strategy to resolve the issue. First, to compute the active regions in c, we need to know the bisectors B(α, α ) defined by an unmarked generator α and a marked generator α in the wavefrontsW (e) of the transparent edges e of c. Consider such a bisector B(α, α ). Observe that α and α must be from the same wavefront W (e) of a transparent edge e of c. Indeed, assume to the contrary that α is from W (e ) and α is from W (e ) of two different transparent edges e and e of c. Then, because α and α are adjacent 2 1 2 generators along the boundary of c, the wavelet of α inW (e ) must claim an endpoint of e and the 1 1 wavelet of α in W (e ) must claim an endpoint of e . Hence, both α and α are marked by Rule 2(a) 2 2 of the generator marking rules. But this incurs a contradiction, as α is unmarked. Therefore, α and α must be from the same wavefront W (e) and they are actually neighboring in W (e). Based on the preceding observation, we slightly modify our wavefront expansion algorithm as follows. In addition to our original marking rules, we add the following new rule: If a generator α in a wavefront W (e) is marked for a cell by the original rules during the algorithm, we also mark both neighboring generators of α in W (e). We call the generators marked by the new rule newly marked generators, whereas the generators marked by the original rules are called originally marked generators. If a generator is both newly marked and originally marked, we consider it as originally marked. As each generator has two neighbors in a wavefront, the total number of marked generators is still O (h). The newly marked generators and the originally marked generators are sufficient for computing all active regions of each cell c as before. Indeed, the active regions are decomposition of c by the bisectors of adjacent generators with one originally marked and the other newly marked in W (e) of the transparent edges e of c. Second, to compute the vertices of SPM (s) in each active region R of c, we need to restore the wavefronts W (e) of the transparent edges e on the boundary of R.Tothisend,the algorithmin the preceding first step determines a list L(e) of originally marked generators that claim e. It turns out that L(e) is exactly W (e), as shown next. Observation 5. L(e) = W (e). Proof. Since each generator of L(e) is marked for e and c, L(e) is a subset ofW (e). However, be- cause R is an active region, R is claimed by originally marked generators only. Since each generator of W (e) claims at least one point of e and e ⊆ R, all generators are originally marked. Therefore, all generators of W (e) are in L(e). The observation thus follows. In light of the preceding observation, the wavefronts W (e) for all transparent edges e of all active regions R of c can be restored once all active regions of c are computed in the first step. Subsequently, the same algorithm as before can be applied to compute the vertices of SPM (s) in R. When computing the partition Vor (e) of R,wepropagate W (e) using the wavefront propagation procedure, which uses persistent trees to representW (e). Since here we do not need to keep the old versions of W (e) anymore, we can use an ordinary balanced binary search tree (without the path- copying method) to represent W (e). In this way, processing each bisector event only introduces O (1) additional space. In summary, SPM (s) can now be constructed in O (n + h logh) time and O (n) space. 4 THE GENERAL CASE In this section, we extend our algorithm for the convex case in Section 3 to the general case where obstacles of P may not be convex. To this end, we resort to an extended corridor structure of P, which has been used to solve various problems in polygonal domains [4, 7–9, 29–31, 39]. The structure decomposes the free space F into three types of regions: an ocean M, O (h) canals,and O (n) bays. The details are given in the following. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:51 Fig. 32. Illustrating a triangulation of P with two obstacles. There are two junction triangles indicated by the large dots inside them, connected by three solid (red) curves. Removing the two junction triangles results in three corridors. 4.1 The Extended Corridor Structure Let Tri(P) denote an arbitrary triangulation of P.Let G(P) be the (planar) dual graph of Tri(P)— that is, each node of G(F ) corresponds to a triangle in Tri(P) and each edge connects two nodes of G(P) corresponding to two triangles sharing a triangulation diagonal of Tri(P). We compute a corridor graph G as follows. First, repeatedly remove every degree-1 node from G(P) until no such node remains. Second, repeatedly remove every degree-2 node from G(P) and replace its two incident edges by a single edge until no such node remains. The resulting graph is G (Figure 32), which has O (h) faces, nodes, and edges [31]. Each node of G corresponds to a triangle in Tri(P), which is called a junction triangle (e.g., see Figure 32). The removal of all junction triangles results in O (h) corridors (defined in the following), and each corridor corresponds to an edge of G. The boundary of a corridor C consists of four parts (Figure 33): (1) a boundary portion of an obstacle, from an obstacle vertex a to an obstacle vertex b; (2) a triangulation diagonal of a junction triangle from b to an obstacle vertex e; (3) a boundary portion of an obstacle from e to an obstacle vertex f ; and (4) a diagonal of a junction triangle from f to a. The two diagonals be and af are called the doors of C, and the other two parts of the boundary of C are the two sides of C.Note that C is a simple polygon. A point is in the interior of C if it is in C excluding the two doors. Let π (a,b) (respectively, π (e, f )) be the shortest path from a to b (respectively, e to f )in C. C C The region H bounded by π (a,b), π (e, f ), be,and fa is called an hourglass,whichis open if C C C π (a,b) ∩ π (e, f ) = ∅ and closed otherwise (see Figure 33). If H is open, then both π (a,b) and C C C C π (e, f ) are convex chains and called the sides of H ; otherwise, H consists of two “funnels” and C C C apath π = π (a,b)∩ π (e, f ) joining the two apices of the funnels, called the corridor path of C. C C C Each side of a funnel is also convex. LetM be the union of all O (h) junction triangles, open hourglasses, and funnels. We callM the ocean,whose boundary∂M consists of O (h) convex chains that are sides of open hourglasses and funnels. The other space of P (i.e.,P\M) is further partitioned into two types of regions—bays and canals—defined as follows. Consider the hourglass H of a corridor C. If H is open (see Figure 33), then H has two sides. Let S be a side of H . The obstacle vertices C C 1 C on S all lie on the same side of C.Let c and d be any two consecutive vertices on S such that cd 1 1 is not an obstacle edge of P (e.g., see Figure 33, left). The region enclosed by cd and the boundary portion of C between c and d is called a bay, denoted by bay(cd).Wecall cd the gate of bay(cd). If H is closed, let x and y be the two apices of the two funnels. Consider two consecutive vertices c and d on a side of a funnel such that cd is not an obstacle edge of P.If c and d are on the same side of the corridor C,then cd also defines a bay. Otherwise, either c or d is a funnel apex, say, c = x,and we call xd a canal gate at x = c (e.g., see Figure 33, right). Similarly, there is also a Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:52 H. Wang Fig. 33. Illustrating an open hourglass (left) and a closed one (right) with a corridor path connecting the apices x and y of the two funnels. The dashed segments are diagonals. The paths π (a,b) and π (e, f ) are C C marked by thick solid curves. A bay bay(cd) with gate cd (left) and a canal canal (x,y) with gates xd and yz (right) are also shown. canal gate at the other funnel apex y,say yz. The region of C between the two canal gates xd and yz is the canal of H , denoted by canal (x,y). Each bay or canal is a simple polygon. All bays and canals together constitute the spaceP\M. Each vertex of ∂M is a vertex of P and each edge of ∂M is either an edge of P or a gate of a bay/canal. Gates are common boundaries betweenM and bays/canals. AfterP is triangulated,M and all bays and canals can be obtained in O (n) time [31]. The reason that the extended corridor structure can help find a shortest path is the following. Suppose we want to find a shortest s-t path for two points s and t.Weconsider s and t as two special obstacles and build the extended corridor structure. If a shortest s-t path π (s, t) contains a point in the interior of a corridor C,then π (s, t) must cross both doors of C andstayinthe hourglasses of C, and further, if the hourglass is closed, then its corridor path must be contained in π (s, t). In fact, π (s, t) must be in the union of the oceanM and all corridor paths [31]. In light of the preceding properties, we propose the following algorithm. Let s be a given source point. By considering s as a special obstacle of P, we construct the extended corridor structure of P. Consider any query point t, which may be in the oceanM,abay bay(cd), or a canal canal (x,y): • If t ∈M, then the union ofM and all corridor paths contains a shortest s-t path. To handle this case, we will build a shortest path map SPM (M) inM with respecttothe unionofM and all corridor paths. In fact, SPM (M) is exactly the portion of SPM (s) inM (i.e., SPM (s)∩M). To build SPM (M), a key observation is that the boundary ∂M consists of O (h) convex chains. Therefore, we can easily adapt our previous algorithm for the convex case. However, the algorithm needs to be modified so that the corridor paths should be taken into consideration. Intuitively, corridor paths provide certain kind of “shortcuts” for wavefronts to propagate. • If t is in a bay bay(cd), then any shortest s-t path must cross its gate cd. To handle this case, we will extend SPM (M) into bay(cd) through the gate cd to construct the shortest path map in bay(cd)—that is, the portion of SPM (s) in bay(cd), SPM (s) ∩ bay(cd). • If t is in a canal canal (x,y), then any shortest s-t path must cross one of the two gates of the canal. To handle this case, we will extend SPM (M) into canal (x,y) through the two gates to construct the shortest path map in canal (x,y)—that is, the portion of SPM (s) in canal (x,y), SPM (s) ∩ canal (x,y). In the following, we first describe our algorithm for constructing SPM (M) in Section 4.2.We then expand SPM (M) into all bays in Section 4.3 and expand SPM (M) into all canals in Section 4.4. The algorithm for the canal case utilizes the bay case algorithm as a subroutine. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:53 4.2 Constructing the Shortest Path Map in the Ocean SPM (M) As the boundary of M consists of O (h) convex chains, we can apply and slightly modify our algorithm for the convex case. To do so, for each convex chain of ∂M, we define its rectilinear extreme vertices in the same way as before. Let V be the set of the rectilinear extreme vertices of all convex chains. Hence, |V| = O (h). In addition, to incorporate the corridor paths into the algorithm, we include the endpoints of each corridor path inV.Asthere are O (h) corridor paths, thesizeof V is still bounded by O (h). Note that each corridor path endpoint is also an endpoint of a convex chain of ∂M. We construct the conforming subdivision S based on the points of V and then insert the convex chains ofM intoS to obtainS . The algorithm is essentially the same as before. In addition, we make the following changes toS , which is mainly for incorporating the corridor paths into our wavefront expansion algorithm, as will be clear later. Let v be an endpoint of a corridor path π. Since v is in V, v is incident to O (1) transparent edges in S . For each such transparent edge e,if |π| < 2·|e|, then we divide e into two subedges such that the length of the one incident to v is equal to |π|/2; for each subedge, we set its well- covering region the same asU (e). Note that this does not affect the properties of S . In particular, each transparent edge e is still well-covered. This change guarantees the following property: for each corridor path π, |π|≥ 2·|e | holds, where e is any transparent edge ofS incident to either endpoint of π. For reference purposes, we refer to it as the corridor path length property. Next we apply the wavefront expansion algorithm. Here we need to incorporate the corridor paths into the algorithm. Intuitively, each corridor path provides a “shortcut” for the wavefront— that is, if a wavelet hits an endpoint of a corridor path, then the wavelet will come out of the corridor path from its other endpoint but with a delay of distance equal to the length of the corridor path. More details are given in the following. Since all corridor path endpoints are inV, they are vertices of transparent edges ofS .Consider an endpoint v of a corridor path π.Let u be the other endpoint of π. Recall that the wavefront prop- agation procedure forW (e) is to propagateW (e) to computeW (e,д) for all edges д ∈ output (e).In addition to the previous algorithm for the procedure, we also propagateW (e) through the corridor path π to u. This is done as follows. Recall that when e is processed, since v is an endpoint of e,the weighted distance of v through W (e) is equal to d(s,v). Hence, the wavefront W (e) hits u through π at time d(s,v) + |π|.Wethenupdate covertime(д) = min{covertime(д),d(s,v) + |π| + |д|},for each transparent edge д incident to u. We also set the wavefront W (e,д) consisting of the only wavelet with u as the generator with weight equal to d(s,v)+|π|. Since there are O (1) transparent edges д incident to u, the preceding additional step takes O (1) time, which does not change the time complexity of the overall algorithm asymptotically. The corridor path length property assures that if W (e) contributes to a wavefront W (д) at д,then e must be processed earlier than д.This guarantees the correctness of the algorithm. In this way, we can first construct a decomposition SPM (M) ofM in O (n+h logh) time and O (n) space, where SPM (M) is defined similarly as SPM (s) in Section 3. Then, by a similar algorithm as that for Lemma 3.6, SPM (M) can be obtained in additional O (n) time. 4.3 Expanding SPM (M) into All Bays We now expand SPM (M) into all bays in O (n + h logh) time and O (n) space. In fact, we expand SPM (M) to the bays. We process each bay individually. Consider a bay bay(cd) with gate cd. Without loss of generality, we assume that cd is horizontal, c is to the left of d,and bay(cd) is locally above cd. Let v ,v ,...,v be the vertices of SPM (M) on cd ordered from left to right (Figure 34). Let c = 1 2 m v and d = v . Hence, each v v is claimed by a generator α = (A , a ) for all i = 0, 1,...,m. 0 m+1 i i+1 i i i Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:54 H. Wang Fig. 34. Illustrating bay(cd) and the generators. The thick segments on obstacles are A , i = 0, 1,...,m. Let b and c be the tangent points on A and A fromv , respectively, for each i = 1, 2,...,m (e.g., i i i−1 i i see Figure 34). For v , only c is defined; for v , only b is defined. Observe that for any point 0 0 m+1 m+1 p ∈ v v , which is claimed by α , its tangent point on A must be on the portion of A between i i+1 i i i c and b and we use A to denote that portion. So with respect to bay(cd),weuse α = (A , a ) i i+1 i i i i to refer to the generator, where a refers to the one of c and b that is closer to a . Hence, for i i+1 i any point t ∈ bay(cd), any shortest path π (s, t) from s to t must be via one of the generators α for i = 0, 1,...,m. Consider the region R bounded by A for all i ∈ [0,m], the tangents from v to their generators for all i ∈ [0,m+ 1], and the boundary of the bay excluding its gate. Notice that R is a simple polygon. For any point t ∈ bay(cd), the preceding observation implies any shortest s-t path π (s, t) is the concatenation of a shortest path from s to a generator initial vertex a and the shortest path from a to t in R. According to the preceding discussion, expanding SPM (M) into bay(cd) is equivalent to the following weighted geodesic Voronoi diagram problem in a simple polygon: Partition R into cells with respect to the point sites a , a ,..., a (with weights equal to their geodesic distances to s) 0 1 such that all points in the same cell have the same closest site. Let n be the number of vertices in bay(cd) (the subscript “b” represents “bay”). Let n be the total number of obstacle vertices in A for all i ∈ [0,m] (the subscript “g” represents “generator”). Note that v for all i = 1,...,m are also vertices of R. Hence, the number of vertices of R is n + n + m. The preceding problem can b д be solved in O (m logm + n + n ) time by the techniques of Oh [40]. Indeed, given m point sites b д in a simple polygon P of n vertices, Oh [40] gave an algorithm that can compute the geodesic Voronoi diagram of the sites in P in O (n + m logm ) time and O (n + m ) space. Although the point sites in Oh’s problem do not have weights, our problem is essentially an intermediate step of Oh’s algorithm because all weighted point sites in our problem are on one side of cd. Therefore, we can run Oh’s algorithm from “the middle” and solve our problem in O (m logm + n + n ) b д and O (n + n ) space. In fact, our problem is a special case of Oh’s problem because there are no b д sites in bay(cd). For this reason, we propose our own algorithm to solve this special case and the algorithm is much simpler than Oh’s algorithm; our algorithm also runs in O (m logm + n + n ) b д and O (n + n + m) space. This also makes our work more self-contained. b д Before presenting the algorithm, we analyze the total time for processing all bays. Since SPM (M) has O (h) vertices, the total sum of m for all bays is O (h). The total sum of n for all bays is at most n. Notice that the obstacle edges on A are disjoint for different bays, and thus the Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:55 total sum of n for all bays is O (n). Hence, expanding SPM (M) to all bays takes O (n + h logh) time and O (n) space in total. The preceding actually only considers the case where the gate cd contains at least one vertex of SPM (M). It is possible that no vertex of SPM (M) is on cd, in which case the entire gate is claimed by one generator α of SPM (M). We can still define the region R in the same way. But now, R has only one weighted site and thus the geodesic Voronoi diagram problem becomes computing a shortest path map in the simple polygon R for a single source point. This problem can be solved in O (n + n ) time [20]; note that m = 0 in this case. Hence, the total time for processing all bays b д in this special case is O (n). 4.3.1 Solving the Special Weighted Geodesic Voronoi Diagram Problem. We present an algorithm for the preceding special case of the weighted geodesic Voronoi diagram problem, and the algo- rithm runs in O (m logm + n + n ) and O (n + n + m) space. b д b д If we consider all generators α for i = 0, 1,...,m as a wavefront at cd, denoted by W (cd),then our algorithm is essentially to propagate W (cd) inside bay(cd). To this end, we first triangulate bay(cd) and will use the triangulation to guide the wavefront propagation. Each time, we propa- gate the wavefront through a triangle. In the following, we first discuss how to propagate W (cd) through the triangle cda with cd as an edge and a as the third vertex. This is a somewhat special case, as cda is the first triangle the wavefront will propagate through, but the general case is quite similar. Recall that each convex chain A is represented by an array, and the generator list W (cd) is represented by a balanced binary search tree T (W (cd)). We build a point location data structure on the triangulation of bay(cd) in O (n ) time [16, 32] so that given any query point p,wecan determine the triangle that contains p in O (log n ) time. An an initialization step, we compute the intersection of the adjacent bisectors B(α , α ) and i−1 i B(α , α ) for all i = 1, 2,...,m − 1. Each intersection can be computed in O (log n ) time by i i+1 д the bisector-bisector intersection operation in Lemma 3.11. Computing all intersections takes O (m log n ) time. For each intersection q, called a bisector event, we use the point location data structure to find the triangle of the triangulation that contains q and store q in the triangle. Since all generators are outsidebay(cd), by Corollary 3.8, all bisectors are monotone with respect to the direction orthogonal to cd. Our algorithm for propagating the wavefront through cda is based on this property. We sort all bisector events in cda according to their perpendicular distances to the supporting line of cd. Then, we process these events in the same way as in our wavefront propagation procedure. Specifically, for each bisector event q of two bisectors B(α , α ) and B(α, α ), we process it as follows. Let α be the other neighboring generator of α than α,and let α be the other neighbor of α than α.Weremove α from the generator list. In addition, we remove the intersection of B(α , α ) and B(α , α ) from the triangle of bay(cd) that contains it; we do the same for the intersection of B(α , α ) and B(α , α ). Finally, we compute the intersection q of B(α , α ) with B(α , α ), and we use the point location data structure to find the triangle of bay(cd) that contains q and store q in the triangle. If q ∈ cda, then we insert it into the bisector event sorted list of cda.Wedothe same for B(α , α ) and B(α , α ). After all events in cda are processed, we split the current wavefront W at the vertex a.To this end, we first find the generator α of W that claims a. For this, we use the same algorithm as before—that is, binary search plus bisector tracing. So we need to maintain a tracing-point for each bisector as before (initially, we can set v as the tracing-point for B(α , α ), i = 1, 2,...,m). i i−1 i The correctness of the preceding algorithm for finding the generator α relies on the property of the following lemma. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:56 H. Wang Fig. 35. Illustrating the proof of Lemma 4.1. Lemma 4.1. The bisector B(α, α ) intersects ad ∪ ac at most once for any two bisectors of α and α of W (cd). Proof. Notethatwecannotapplythe result of Lemma 3.7 sincetodosoweneed to have ad and ac parallel to cd. But the proof is somewhat similar to that for Lemma 3.7. Assume to the contrary that B(α, α ) intersects ad∪ ac at two points, q and q .Let A and A be 1 2 the underlying arcs of α and α , respectively. Let v and u be the tangents points of q on A and 1 1 1 A , respectively (Figure 35). Let v and u be the tangents points of q on A and A , respectively. 2 2 2 Since both A and A are on one side of cd while ad ∪ ac is on the other side, if we move a point q from q to q on ad ∪ ac, the tangent from q to A will continuously change from q v to q v 1 2 1 1 2 2 and the tangent from q to A will continuously change from q u to q u . Therefore, either q u 1 1 2 2 1 1 intersects q v in their interiors or q v intersects q u in their interiors; without loss of generality, 2 2 1 1 2 2 we assume that it is the former case. Let p be the intersection of q u and q v (e.g., see Figure 35). 1 1 2 2 Since q ∈ B(α, α ), points of q u other than q have only one predecessor, which is α .As p ∈ q u 1 1 1 1 1 1 and p  q , p has only one predecessor α . Similarly, since q ∈ B(α, α ) and p ∈ q v , α is also p’s 1 2 2 2 predecessor. We thus obtain a contradiction. ∗ ∗ After α is found, depending on whether α is the first or last generator of W , there are three cases: (1) If α is not the first or last generator of W , then we split W into two wavefronts, one for ca and the other for ad.Todoso, we first splitthe binary tree T (W ) that represents the current ∗ ∗ wavefront W at α . Then, we do binary search on A to find the tangent point from a,where ∗ ∗ ∗ ∗ A is the underlying chain of α .Wealsosplit α into two at the tangent point of A —that is, split A into two chains that form two generators, one for ac and the other for ad (Figure 36). ∗ ∗ As A is represented by an array, splitting α can be performed in O (1) time by resetting the end indices of the chains in the array. This finishes the propagation algorithm in acd.The preceding splits W into two wavefronts, one for ac and the other for ad; we then propagate the wavefronts through ac and ad recursively. ∗ ∗ (2) If α is the first generator of W ,then α must be α —that is, the leftmost generator of W (cd). In this case, we do not need to split W . But we still need to split the generator α at the tangent point p of α from a. To find the tangent point p ,however,thistimewedonot 0 0 0 use binary search, as it is possible that we will need to do this for Ω(n ) vertices of bay(cd), which would take Ω(n log n ) time in total. Instead, we use the following approach. Recall b д that the vertex c = v connects to α by a tangent with tangent point c (e.g., see Figure 34), 0 0 0 and c is an endpoint of A . We traverse A from c to b —that is, the other endpoint of A ; 0 0 0 0 0 0 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:57 ∗ ∗ Fig. 36. Splitting the generator α . Assume that A is the convex chain from p to p with p as the initial 2 3 2 vertex of the generator. ap is tangent to A at p . After the split, the chain from p to p becomes a generator 1 1 3 1 withp as the initial vertex and the chain fromp top becomes another generator withp as the initial vertex. 1 1 2 2 Fig. 37. Illustrating the case for propagating the one-generator wavefront to R(ac). for each vertex, we check whether it is the tangent from a. In this way, p can be found in time linear in the number of vertices of A between c and the tangent point p (Figure 37). 0 0 After that, we still split α into two generators at p ; one is the only generator for ac and the 0 0 other becomes the first generator of the wavefront for ad. For ad, we propagate its wavefront through ad recursively. For ac, to propagate its wave- front through ac, since the wavefront has only one generator, we can simply apply the lin- ear time shortest path map algorithm for simple polygons [20]; we refer to this as the one- generator case. Indeed, ac partitions bay(cd) into two subpolygons and let R(ac) denote the one that does not contain cda (e.g., see Figure 37). Hence, all points of R(ac) are claimed by the only generator for ac, whose underlying chain A is the subchain of A from c to p and 0 0 whose initial vertex is p . Consider the region R (ac) bounded by cc , A , p a, and the bound- 0 0 0 ary of R(ac) excluding ac. It is a simple polygon with a single weighted source p . Therefore, our problem is equivalent to computing the shortest path map in R (ac) with respect to the source point p , which can be done in O (|R(ac)|+|A |) time [20], where |R(ac)| and |A | are the numbers of vertices of R(ac) and |A |, respectively. (3) If α is the last generator of W , the algorithm is symmetric to the preceding second case. The preceding describes our algorithm for propagating the wavefront W (cd) through the first triangle cda. Next, we discuss the general case where we propagate a wavefront W of more than one generator through an arbitrary triangle of the triangulation of bay(cd). For the sake of nota- tional convenience, we consider the problem of propagating the wavefront W (ad) at ad through ad into the region R(ad),where R(ad) is the one of the two subpolygons of bay(cd) partitioned by ad that does not contain cda.Let adb be the triangle in R(ad) with ad with as an edge—that is, b is the third vertex of the triangle. The algorithm for propagating W (ad) through adb is quite similar to the preceding. We first sort all bisector events in adb, following their perpendicular Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:58 H. Wang distances to the supporting line of ad. Then we process these events in the same way as before. After all events are processed, the wavefront is finally split at the vertex b. The preceding algorithm is for the case where ad is a triangulation diagonal. If ad is an obstacle edge, then the wavefront W (ad) stops at ad. Notice that each bisector of the wavefront W (ad) must intersect ad. For each bisector of the wavefront, starting from its current tracing-point, we trace it out until the current traced hyperbolic-arc intersects ad. The algorithm stops once all triangles are processed as previously. Time Analysis. We now analyze the time complexity. As discussed before, the initial step for computing the intersections of adjacent bisectors of the wavefrontW (cd) and locating the triangles containing them together takes O (m log(n + n )) time. During the entire algorithm, each traced д b bisector hyperbolic-arc belongs to the shortest path map in bay(cd) (i.e., the portion of SPM (s) in bay(cd)), whose size is O (n + n + m). Hence, the total time on the bisector tracing in the entire b д algorithm is O (n +n +m). For the one-generator case where only one generator is available for ac, b д the time for processing the subpolygon R(ac) is O (|R(ac)|+|A |). Notice that all such subpolygons R(ac) in the one-generator case are interior disjoint. Hence, the total sum of their sizes is O (n ).In addition, all such generator underlying chains A are also interior disjoint, and thus the total sum of their sizes is O (n ). Therefore, the overall time for processing the one-generator case subpolygons is O (n + n ). д b For the general case of processing a triangle of the triangulation, the total time for processing all events is O (m log(n + n )), where m is the number of events in , both valid and invalid. д b Each event is computed either in the initial step or after a generator is deleted. The total number of bisector events in the former case in the entire algorithm is at most m− 1. The total number in the latter case in the entire algorithm is no more than the number of generators that are deleted in the algorithm, which is at most m because once a generator is deleted it will never appear in any wavefront again. Hence, the total time for processing events in the entire algorithm is O (m log(n + n )). Once all events in are processed, we need to find the generator α of the current wavefront W that claims the third vertex b of the triangle, by binary search plus bisector tracing. The time is O (logm) plus the time for tracing the bisector hyperbolic-arcs. Hence, excluding the time for tracing the bisector hyperbolic-arcs, which has been counted previously, the total time for this operation in the entire algorithm is O (m logm),where m is the number of triangles the algorithm processed for the case where α is not the first or last generator. We will show later in Lemma 4.2 that m = O (m). ∗ ∗ After α is found, depending on whether α is the first or last generator of W , there are three ∗ ∗ cases. If α is not the first or last generator of W,thenwefind thetangent from b to α by binary search in O (log n ) time and split both W and α; otherwise, we find the tangent by a linear scan ∗ ∗ on α andonlyneed to split α . Splitting W takes O (logm) time while splitting a generator only takes O (1) time as discussed before. Therefore, the total time for splitting generators in the entire algorithm is O (n ),asthere are O (n ) triangles in the triangulation. If α is either the first or last b b generator of W , then a one-generator case subproblem will be produced and the time of the linear scan for finding the tangent is O (|A |),where A is the subchain of α that belongs to the one- generator case subproblem. As discussed earlier, all such A in all one-generator case subproblems are interior disjoint, and thus the total time on the linear scan in the entire algorithm is O (n ). Therefore, the total time for finding the tangent point and splitting W is O (m log n + n ) as д b m ≤ n . More specifically, sorting all events takes O (m logm ) time and processing each event takes O (log(n + n )) time. д b Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:59 Lemma 4.2. m ≤ m − 1. Proof. Initially W = W (cd), which consists of m generators. Each split operation splits a wave- frontW at a generator α into two wavefronts, each of which has at least two generators (such that both wavefronts contain α ). More specifically, if a wavefront of size k is split, then one wavefront has k generators and the other has k−k + 1 generators with k ≥ 2and k−k + 1 ≥ 2. The value m is equal to the number of all split operations in the algorithm. We use a tree structure T to characterize the split operations. The root of T corresponds to the initial generator sequence W (cd). Each split on a wavefront W corresponds to an internal node of T with two children corresponding to the two subsequences ofW after the split. Hence, m is equal to the number of internal nodes of T.Inthe worstcase, T has m leaves, each corresponding to two generators α and α for i = 0, 1,...,m. Since each internal node of T has two children and T has i i+1 at most m leaves, the number of internal nodes of T is at most m − 1. Therefore, m ≤ m − 1. With the preceding lemma, the total time of the algorithm is O (m log(n +n )+n +n ),which д b д b is O (m logm + n + n ) by similar analysis as Observation 1.The spaceis O (n + n + m), as no д b д b persistent data structures are used. 4.4 Expanding SPM (M) into All Canals Consider a canal canal (x,y) with two gates xd and yz. The goal is to expand the map SPM (M) into canal (x,y) through the two gates to obtain the shortest path map in the canal, denoted by SPM (canal (x,y)). The high-level scheme of the algorithm is similar in spirit to that for the L problem [9]. The algorithm has three main steps. First, we expand SPM (M) into canal (x,y) through the gate xd, by applying our algorithm for bays. Let SPM (canal (x,y)) denote the map of canal (x,y) obtained by the algorithm. Second, we expand SPM (M) into canal (x,y) through the gate yz by a similar algorithm as earlier; let SPM (canal (x,y)) denote the map of canal (x,y) obtained by the algorithm. Third, we merge the two maps SPM (canal (x,y)) and SPM (canal (x,y)) to obtain SPM (canal (x,y)). 1 2 This is done by using the merge step from the standard divide-and-conquer Voronoi diagram al- gorithm to compute the region closer to the generators at xd than those at yz. We will provide more details for this step in the following, and we will show that this step can be done in time linear in the total size of the two maps SPM (canal (x,y)) and SPM (canal (x,y)). Before doing so, 1 2 we analyze the complexities of the algorithm. The first step takes O (n + h logh) time for all canals. So does the second step. The third step takes linear time in the total size of SPM (canal (x,y)) and SPM (canal (x,y)). Since the total size 1 2 of the two maps over all canals is O (n), the total time of the third step for all canals is O (n).In summary, the time for computing the shortest path maps in all canals is O (n + h logh) and the space is O (n). In the following, we provide more details for the third step of the algorithm. Recall that x and y are the two endpoints of the corridor path π in canal (x,y).Itispossiblethat the shortest s-x path π (s, x) contains y or the shortest s-y path π (s,y) contains x. To determine that, we can simply check whether d(s, x) +|π| = d(s,y) and whether d(s,y) +|π| = d(s, x).Note that both d(s, x) and d(s,y) are available once SPM (M) is computed. We first consider the case where neither π (s, x) contains y nor π (s,y) contains x.Inthiscase, ∗ ∗ ∗ ∗ there must be a point p in π such that d(s, x)+|π (x,p )| = d(s,y)+|π (y,p )|,where π (x,p ) (re- ∗ ∗ spectively, π (y,p )) is the subpath of π between x (respectively, y)and p . We can easily find p in O (|π|) time. To merge the two maps SPM (canal (x,y)) and SPM (canal (x,y)) to obtain 1 2 SPM (canal (x,y)), we find a dividing curve Γ in canal (x,y) such that W (xd) claims all points of Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:60 H. Wang canal (x,y) on one side of Γ while W (yz) claims all points of canal (x,y) on the other side of Γ, where W (xd) is the set of generators of SPM (M) claiming xd (one may consider W (xd) is a wave- front) and W (yz) is the set of generators of SPM (M) claiming yz. The curve Γ consists of all points in canal (x,y) that have equal weighted distances toW (xd) andW (yz). Therefore, the point ∗ ∗ p must be on Γ. Starting from p , we can trace Γ out by walking simultaneously in the cells of the two maps SPM (canal (x,y)) and SPM (canal (x,y)). The running time is thus linear in the total 1 2 size of the two maps. We then consider the case where either π (s, x) contains y or π (s,y) contains x.Without loss of generality, we assume the latter case. We first check whether π (s,p) contains x for all points p on the gate yz. To do so, according to the definitions of corridor paths and gates of canals, for any point p ∈ yz, its shortest path to x in canal (x,y) is the concatenation of the corridor path π and yp. Hence, it suffices to check whether d(s, z) = d(s,y) + |yz|: • If yes, then all points of yz are claimed by the generators of W (xd) (in fact, they are claimed by x because for any point q ∈ xd and any point p ∈ yz, their shortest path in canal (x,y) is the concatenation of qx, π,and yp). Hence, all points in canal (x,y) are claimed by W (xd) and SPM (canal (x,y)) is SPM (canal (x,y)). • Otherwise, some points of yz are claimed by W (xd) while others are claimed by W (yz). As in the preceding case, we need to find a dividing curve Γ consisting of all points with equal weighted distances to W (xd) and W (yz). To this end, we again first find a point p in Γ. For this, since π (s,y) contains x, y is claimed by W (xd). However, since d(s, z) d(s,y)+|yz|, z is claimed byW (yz). Therefore, yz must contains a point p ∈ Γ. Such a point p can be found by traversing yz simultaneously in the cells of both SPM (canal (x,y)) and SPM (canal (x,y)). After p is found, we can again trace Γ out by walking simultaneously in the cells of SPM (canal (x,y)) and SPM (canal (x,y)). The running time is also linear in the 1 2 total size of the two maps. 4.5 Wrapping Things Up The following theorem summarizes our result. Theorem 4.3. SupposeP is a set of h pairwise disjoint polygonal obstacles with a total of n vertices in the plane and s is a source point. Assume that a triangulation of the free space is given. The shortest path map SPM (s) with respect to s can be constructed in O (n + h logh) time and O (n) space. Proof. Using the triangulation, we decompose the free space F into an ocean M, canals, and bays in O (n) time [31]. Then, the shortest path map SPM (M) in the ocean M can be constructed in O (n + h logh) time and O (n) space. Next, SPM (M) can be expanded into all bays and canals in additional O (n+ h logh) time and O (n) space. The shortest path map SPM (s) is thus obtained. The current best algorithms can compute a triangulation of the free space in O (n log n) time or 1+ϵ in O (n + h log h) time for any small ϵ > 0[2]. After SPM (s) is computed, by building a point location data structure [16, 32]on SPM (s) in ad- ditional O (n) time, given a query point t, the shortest path length from s to t can be computed in O (log n) time and a shortest s-t path can be produced in time linear in the number of edges of the path. Corollary 4.4. Suppose P is a set of h pairwise disjoint polygonal obstacles with a total of n vertices in the plane and s is a source point. Assume that a triangulation of the free space is given. A data structure of O (n) space can be constructed in O (n + h logh) time and O (n) space so that given Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:61 any query point t, the shortest path length from s to t can be computed in O (log n) time and a shortest s-t path can be produced in time linear in the number of edges of the path. REFERENCES [1] S. W. Bae and H. Wang. 2019. L shortest path queries in simple polygons. Theoretical Computer Science 790 (2019), 105–116. [2] R. Bar-Yehuda and B. Chazelle. 1994. Triangulating disjoint Jordan chains. International Journal of Computational Geometry and Applications 4, 4 (1994), 475–481. [3] D. Z. Chen, J. Hershberger, and H. Wang. 2013. Computing shortest paths amid convex pseudodisks. SIAM Journal on Computing 42, 3 (2013), 1158–1184. [4] D. Z. Chen, R. Inkulu, and H. Wang. 2016. Two-point L shortest path queries in the plane. Journal of Computational Geometry 1 (2016), 473–519. [5] D. Z. Chen, K. S. Klenk, and H.-Y. T. Tu. 2000. Shortest path queries among weighted obstacles in the rectilinear plane. SIAM Journal on Computing 29, 4 (2000), 1223–1246. [6] D. Z. Chen and H. Wang. 2015. Computing shortest paths among curved obstacles in the plane. ACM Transactions on Algorithms 11 (2015), Article 26. [7] D. Z. Chen and H. Wang. 2015. A new algorithm for computing visibility graphs of polygonal obstacles in the plane. Journal of Computational Geometry 6 (2015), 316–345. [8] D. Z. Chen and H. Wang. 2017. Computing the visibility polygon of an island in a polygonal domain. Algorithmica 77 (2017), 40–64. [9] D. Z. Chen and H. Wang. 2019. Computing L shortest paths among polygonal obstacles in the plane. Algorithmica 81 (2019), 2430–2483. [10] Y.-J. Chiang and J. S. B. Mitchell. 1999. Two-point Euclidean shortest path queries in the plane. In Proceedings of the Annual ACM-SIAM Symposium on Discrete Algorithms (SODA’99). 215–224. [11] K. L. Clarkson, R. Cole, and R. E. Tarjan. 1992. Randomized parallel algorithms for trapezoidal diagrams. International Journal of Computational Geometry and Application 2 (1992), 117–133. [12] K. Clarkson, S. Kapoor, and P. Vaidya. 1987. Rectilinear shortest paths through polygonal obstacles in O (n log n) time. In Proceedings of the 3rd Annual Symposium on Computational Geometry (SoCG’87). 251–257. 2/3 [13] K. Clarkson, S. Kapoor, and P. Vaidya. 1988. Rectilinear shortest paths through polygonal obstacles in O (n log n) time. Manuscript. [14] P. J. de Rezende, D. T. Lee, and Y. F. Wu. 1989. Rectilinear shortest paths in the presence of rectangular barriers. Discrete and Computational Geometry 4 (1989), 41–53. [15] E. D. Demaine, J. S. B. Mitchell, and J. O’Rourke. 2020. The Open Problems Project. Retrieved January 23, 2023 from https://topp.openproblem.net/. [16] H. Edelsbrunner, L. Guibas, and J. Stolfi. 1986. Optimal point location in a monotone subdivision. SIAM Journal on Computing 15, 2 (1986), 317–340. [17] S. D. Eriksson-Bique, J. Hershberger, V. Polishchuk, B. Speckmann, S. Suri, T. Talvitie, K. Verbeek, and H. Yıldız. 2015. Geometric k shortest paths. In Proceedings of the 26th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA’15). 1616–1625. [18] S. K. Ghosh and D. M. Mount. 1991. An output-sensitive algorithm for computing visibility graphs. SIAM Journal on Computing 20, 5 (1991), 888–910. [19] L. J. Guibas and J. Hershberger. 1989. Optimal shortest path queries in a simple polygon. Journal of Computer and System Sciences 39, 2 (1989), 126–152. [20] L. J. Guibas, J. Hershberger, D. Leven, M. Sharir, and R. E. Tarjan. 1987. Linear-time algorithms for visibility and shortest path problems inside triangulated simple polygons. Algorithmica 2, 1-4 (1987), 209–233. [21] L. Guibas, J. Hershberger, and J. Snoeyink. 1991. Compact interval trees: A data structure for convex hulls. Interna- tional Journal of Computational Geometry and Applications 1, 1 (1991), 1–22. [22] J. Hershberger. 1991. A new data structure for shortest path queries in a simple polygon. Information Processing Letters 38, 5 (1991), 231–235. [23] J. Hershberger, V. Polishchuk, B. Speckmann, and T. Talvitie. 2014. Geometric kth shortest paths. In Proceedings of the 30th Annual Symposium on Computational Geometry (SoCG’14). Article 96, 2 pages. http://www.computational- geometry.org/SoCG-videos/socg14video/ksp/applet/index.html. [24] J. Hershberger and J. Snoeyink. 1994. Computing minimum length paths of a given homotopy class. Computational Geometry: Theory and Applications 4 (1994), 63–97. [25] J. Hershberger and S. Suri. 1999. An optimal algorithm for Euclidean shortest paths in the plane. SIAM Journal on Computing 28 (1999), 2215–2256. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:62 H. Wang [26] J. Hershberger, S. Suri, and H. Yıldız. 2013. A near-optimal algorithm for shortest paths among curved obstacles in the plane. In Proceedings of the 29th Annual Symposium on Computational Geometry (SoCG’13). 359–368. [27] S. Hertel and K. Mehlhorn. 1985. Fast triangulation of the plane with respect to simple polygons. Information and Control 64 (1985), 52–76. [28] R. Inkulu, S. Kapoor, and S. N. Maheshwari. 2010. A near optimal algorithm for finding Euclidean shortest path in polygonal domain. arXiv:1011.6481v1 (2010). [29] S. Kapoor and S. N. Maheshwari. 1988. Efficient algorithms for Euclidean shortest path and visibility problems with polygonal obstacles. In Proceedings of the 4th Annual ACM Symposium on Computational Geometry (SoCG’88). 172–182. [30] S. Kapoor and S. N. Maheshwari. 2000. Efficiently constructing the visibility graph of a simple polygon with obstacles. SIAM Journal on Computing 30, 3 (2000), 847–871. [31] S. Kapoor, S. N. Maheshwari, and J. S. B. Mitchell. 1997. An efficient algorithm for Euclidean shortest paths among polygonal obstacles in the plane. Discrete and Computational Geometry 18 (1997), 377–383. [32] D. Kirkpatrick. 1983. Optimal search in planar subdivisions. SIAM Journal on Computing 12 (1983), 28–35. [33] D. Kirkpatrick and J. Snoeyink. 1995. Tentative prune-and-search for computing fixed-points with applications to geometric computation. Fundamenta Informaticae 22 (1995), 353–370. [34] D. T. Lee and F. P. Preparata. 1984. Euclidean shortest paths in the presence of rectilinear barriers. Networks 14 (1984), 393–410. [35] J. S. B. Mitchell. 1989. An optimal algorithm for shortest rectilinear paths among obstacles. In Abstracts of the 1st Canadian Conference on Computational Geometry. [36] J. S. B. Mitchell. 1991. A new algorithm for shortest paths among obstacles in the plane. Annals of Mathematics and Artificial Intelligence 3 (1991), 83–105. [37] J. S. B. Mitchell. 1992. L shortest paths among polygonal obstacles in the plane. Algorithmica 8 (1992), 55–88. [38] J. S. B. Mitchell. 1996. Shortest paths among obstacles in the plane. International Journal of Computational Geometry and Applications 6 (1996), 309–332. [39] J. S. B. Mitchell and S. Suri. 1995. Separation and approximation of polyhedral objects. Computational Geometry: Theory and Applications 5 (1995), 95–114. [40] E. Oh. 2019. Optimal algorithm for geodesic nearest-point Voronoi diagrams in simple polygons. In Proceedings of the 20th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA’19). 391–409. [41] M. Overmars and J. van Leeuwen. 1981. Maintenance of configurations in the plane. Journal of Computer and System Sciences 23 (1981), 166–204. [42] H. Rohnert. 1986. Shortest paths in the plane with convex polygonal obstacles. Information Processing Letters 23 (1986), 71–76. [43] N. Sarnak and R. E. Tarjan. 1986. Planar point location using persistent search trees. Communications of the ACM 29 (1986), 669–679. [44] M. Sharir and A. Schorr. 1986. On shortest paths in polyhedral spaces. SIAM Journal on Computing 15 (1986), 193–215. [45] J. A. Storer and J. H. Reif. 1994. Shortest paths in the plane with polygonal obstacles. Journal of the ACM 41 (1994), 982–1012. [46] H. Wang. 2019. Quickest visibility queries in polygonal domains. Discrete and Computational Geometry 62 (2019), 374–432. [47] H. Wang. 2020. A divide-and-conquer algorithm for two-point L shortest path queries in polygonal domains. Journal of Computational Geometry 11 (2020), 235–282. [48] H. Wang. 2021. Shortest paths among obstacles in the plane revisited. In Proceedings of the 32nd Annual ACM-SIAM Symposium on Discrete Algorithms (SODA’21). 810–821. Received 30 June 2021; revised 21 October 2022; accepted 10 January 2023 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. http://www.deepdyve.com/assets/images/DeepDyve-Logo-lg.png Journal of the ACM (JACM) Association for Computing Machinery

A New Algorithmfor Euclidean Shortest Paths in the Plane

Journal of the ACM (JACM) , Volume 70 (2): 62 – Mar 21, 2023

Loading next page...
 
/lp/association-for-computing-machinery/a-new-algorithmfor-euclidean-shortest-paths-in-the-plane-4gOSvuPAHU

References

References for this paper are not available at this time. We will be adding them shortly, thank you for your patience.

Publisher
Association for Computing Machinery
Copyright
Copyright © 2023 Copyright held by the owner/author(s). Publication rights licensed to ACM.
ISSN
0004-5411
eISSN
1557-735X
DOI
10.1145/3580475
Publisher site
See Article on Publisher Site

Abstract

HAITAO WANG, University of Utah Given a set of pairwise disjoint polygonal obstacles in the plane, finding an obstacle-avoiding Euclidean shortest path between two points is a classical problem in computational geometry and has been studied extensively. Previously, Hershberger and Suri (in SIAM Journal on Computing, 1999) gave an algorithm of O (n log n) time and O (n log n) space, where n is the total number of vertices of all obstacles. Recently, by modifying Hershberger and Suri’s algorithm, Wang (in SODA’21) reduced the space to O (n) while the runtime of the algorithm is still O (n log n). In this article, we present a new algorithm of O (n + h logh) time and O (n) space, provided that a triangulation of the free space is given, where h is the number of obstacles. The algorithm is better than the previous work when h is relatively small. Our algorithm builds a shortest path map for a source point s so that given any query point t, the shortest path length from s to t can be computed in O (log n) time and a shortest s-t path can be produced in additional time linear in the number of edges of the path. CCS Concepts: • Theory of computation → Computational geometry; Design and analysis of algorithms; Additional Key Words and Phrases: Shortest path, shortest path map, shortest path query, Euclidean distance, obstacle avoidance, polygonal domain ACM Reference format: Haitao Wang. 2023. A New Algorithm for Euclidean Shortest Paths in the Plane. J. ACM 70, 2, Article 11 (March 2023), 62 pages. https://doi.org/10.1145/3580475 1 INTRODUCTION Let P be a set of h pairwise disjoint polygonal obstacles with a total of n vertices in the plane. Let F denote the free space—that is, the plane minus the interior of the obstacles. Given two points s and t in F , we consider the problem of finding a Euclidean shortest path from s to t in F .This is a classical problem in computational geometry and has been studied extensively (e.g., [3, 18–20, 22, 24, 25, 34, 36, 38, 42, 44, 45, 48]). To solve the problem, there are two commonly used methods: the visibility graph and the con- tinuous Dijkstra. The visibility graph method is to first construct the visibility graph of the vertices of P along with s and t, and then run Dijkstra’s shortest path algorithm on the graph to find a shortest s-t path. The best algorithms for constructing the visibility graph run in O (n log n + K) This research was supported in part by the NSF under grants CCF-2005323 and CCF-2300356. Author’s address: H. Wang, School of Computing, University of Utah, 50 Central Campus Drive, Salt Lake City, UT 84117; email: haitao.wang@utah.edu. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from permissions@acm.org. © 2023 Copyright held by the owner/author(s). Publication rights licensed to ACM. 0004-5411/2023/03-ART11 $15.00 https://doi.org/10.1145/3580475 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:2 H. Wang 1+ϵ time [18]orin O (n+h log h+K) time [7, 30] for any constant ϵ > 0 after the free spaceF is tri- angulated, where K is the number of edges of the visibility graph. Because K = Ω(n ) in the worst case, the visibility graph method inherently takes quadratic time. To deal with the case where h is relatively small compared to n, a variation of the visibility graph method was proposed that first constructs a so-called tangent graph (or relevant visibility graph) and then finds a shortest s-t path in the graph. Using this method, Kapoor et al. [31] gave an algorithm of O (n+ h log n) time; later Chen and Wang [6] derived a better algorithm of O (n + h logh + K ) time, after the free space F is triangulated, where K may be considered as the number of tangents among obstacles of P and 1+ϵ K = O (h ). Note that triangulating F can be done in O (n log n) time or in O (n + h log h) time for any constant ϵ > 0[2]. Hence, the running time of the preceding algorithm in the work of Chen and Wang [6] is still quadratic in the worst case. Using the continuous Dijkstra method, Mitchell [38] made a breakthrough and achieved the 3/2+ϵ first subquadratic algorithm of O (n ) time for any constant ϵ > 0. Also using the continuous Dijkstra approach plus a novel conforming subdivision of the free space, Hershberger and Suri [25] presented an algorithm of O (n log n) time and O (n log n) space; the running time is optimal when h = Θ(n) as Ω(n+h logh) is a lower bound in the algebraic computation tree model (which can be obtained by a reduction from sorting; e.g., see Theorem 3 in the work of de Rezende et al. [14]for a similar reduction). Recently, by modifying Hershberger and Suri’s algorithm, Wang [48] reduced the space to O (n) while the running time is still O (n log n). In addition, Inkulu et al. [28] announced an algorithm of O (n + h logh log n) time and O (n) space, which is also based on the continuous Dijkstra approach. All three continuous Dijkstra algorithms [25, 38, 48] construct the shortest path map, denoted by SPM (s), for a source point s. SPM (s) is of O (n) size and can be used to answer shortest path queries. By building a point location data structure on SPM (s) in additional O (n) time [16, 32], given a query point t, the shortest path length from s to t can be computed in O (log n) time and a shortest s-t path can be output in time linear in the number of edges of the path. The problem setting thus defined for P (i.e., h pairwise disjoint polygonal obstacles with a total of n vertices) is usually referred to as polygonal domains or polygons with holes in the literature. The problem in simple polygons is relatively easier [19, 20, 22, 24, 34] because there is a unique shortest path between any two points in a simple polygon. Guibas et al. [20] presented an algorithm that can construct a shortest path map in linear time. For the two-point shortest path query problem where both s and t are query points, Guibas and Hershberger [19, 22] built a data structure in linear time such that each query can be answered in O (log n) time. In contrast, the two-point query problem in polygonal domains is much more challenging (one reason is that there may be multiple topologically different shortest paths between two points in a polygonal domain): to achieve O (log n) time queries, the current best result uses O (n ) space [10]; alternatively Chiang and Mitchell [10] gave a data structure of O (n+h ) space with O (h log n) query time. Refer to their work [10] for other data structures with a trade-off between space and query time. The L counterpart of the problem where the path length is measured in the L metric also 1 1 attracted much attention (e.g., [1, 9, 12, 13, 35, 37]). For polygons with holes, Mitchell [35, 37]gave an algorithm that can build a shortest path map for a source point in O (n log n) time and O (n) space; for small h, Chen and Wang [9] proposed an algorithm of O (n + h logh) time and O (n) space, after the free space is triangulated. For simple polygons, Bae and Wang [1]built adata structure in linear time that can answer each two-point L shortest path query in O (log n) time. The two-point query problem in polygons with holes has also been studied [4, 5, 47]. To achieve 2 3 O (log n) time queries, the current best result uses O (n + h log h/log logh) space [47]. As discussed previously, the polygonal domainP is described by two parameters n and h. Since in many applications (e.g., geographic problems) h could be much smaller than n (Figure 1), the Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:3 Fig. 1. Illustrating a polygonal domain of h = 3 obstacles and n = 30 vertices. time complexities of algorithms for problems in P may be better measured by both n and h than by n itself. For example, comparing to an O (n log n) time algorithm, an algorithm of O (n+h logh) time would be preferred, not only because n + h logh is asymptotically smaller than n log n for sufficiently small h but also because an O (n + h logh) time algorithm suggests a very different view of the problem than an O (n log n) time algorithm. Indeed, an O (n + h logh) time algorithm conveys the idea that the boundary features of P only provide information defining the input and in some sense almost do not contribute to the complexity of the algorithm, while something akin to sorting needs to be done to the holes. 1.1 Our Result In this article, we show that the problem of finding an Euclidean shortest path among obstacles in P is solvable in O (n + h logh) time and O (n) space, after a triangulation of the free space F is given. If the time for triangulating F is included and the triangulation algorithm of Bar-Yehuda 1+ϵ and Chazelle [2] is used, then the total time of the algorithm is O (n+ h log h), for any constant ϵ > 0. With the assumption that the triangulation could be done in O (n + h logh) time, which has been an open problem and is beyond the scope of this work, our result settles Problem 21 in the Open Problem Project [15]. Our algorithm actually constructs the shortest path map SPM (s) for the source point s in O (n+ h logh) time and O (n) space. We give an overview of our approach in the following. The high-level scheme of our algorithm is similar to that for the L case [47] in the sense that we first solve the convex case where all obstacles of P are convex and then extend the algorithm to the general case with the help of the extended corridor structure of P [4, 7–9, 29–31, 39]. The Convex Case. We first discuss the convex case. Let V denote the set of topmost, bottom- most, leftmost, and rightmost vertices of all obstacles. Hence, |V| ≤ 4h. Using the algorithm of Hershberger and Suri [25], we build a conforming subdivisionS on the points ofV, without con- sidering the obstacle edges. Since |V| = O (h),the size of S is O (h). Then, we insert the obstacle edges into S to build a conforming subdivision S of the free space. The subdivision S has O (h) cells (in contrast, the conforming subdivision of the free space in the work of Hershberger and Suri [25]has O (n) cells). Unlike the subdivision in their work [25] where each cell is of constant size, here the size of each cell of S may not be constant but its boundary consists of O (1) trans- parent edges and O (1) convex chains (each of which belongs to the boundary of an obstacle of P). Like the subdivision in the work of Hershberger and Suri [25], each transparent edge e of S has a well-covering region U (e). In particular, for each transparent edge f on the boundary of U (e), the shortest path distance between e and f is at least 2· max{|e|,|f |}. Using S as a guidance, we 1 ∗ If randomization is allowed, the algorithm of Clarkson et al. [11] can compute a triangulation in O (n log n + h log h) expected time. If all obstacles of P are convex, the triangulation can be done in O (n + h log h) time [27]. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:4 H. Wang run the continuous Dijkstra algorithm as in the work of Hershberger and Suri [25]toexpandthe wavefront, starting from the source point s. A main challenge our algorithm needs to overcome (which is also a main difference between our algorithm and that in their work [ 25]) is that each cell in our subdivision S may not be of constant size. One critical property our algorithm relies on is that the boundary of each cell ofS has O (1) convex chains. Our strategy is to somehow treat each such convex chain as a whole. We also borrow some idea from the algorithm of Hershberger et al. [26] for computing shortest paths among curved obstacles. To guarantee the O (n + h logh) time, some global charging analysis is used. In addition, the tentative prune-and-search technique of Kirkpatrick and Snoeyink [33] is applied to perform certain operations related to bisectors, in logarithmic time each. Finally, the techniques presented in prior work [48] are utilized to reduce the space to O (n). All these efforts lead to an O (n + h logh) time and O (n) space algorithm to construct the shortest path map SPM (s) for the convex case. The General Case. We extend the convex case algorithm to the general case where obstacles may not be convex. To this end, we resort to the extended corridor structure of P, which was used before for reducing the time complexities from n to h (e.g., [4, 7–9, 29–31, 39]). The structure partitions the free space F into an ocean M, O (n) bays, and O (h) canals. Each bay is a simple polygon that shares an edge with M. Each canal is a simple polygon that shares two edges with M. But two bays or two canals, or a bay and a canal, do not share any edge. A common edge of a bay (or canal) with M is called a gate. Thus, each bay has one gate and each canal has two gates. Further, M is bounded by O(h) convex chains. An important property related to shortest paths is that if both s and t are in M, then any shortest s-t path must be in the union of M and all corridor paths, each of which is contained in a canal. As the boundary of M consists of O (h) convex chains, by incorporating all corridor paths, we can easily extend our convex case algorithm to computing SPM (M), the shortest path map SPM (s) restricted toM (i.e., SPM (M) = SPM (s)∩M). To compute the entire map SPM (s),weexpand SPM (M) to all bays and canals through their gates. For this, we process each bay/canal individually. For each bay/canal C, expanding the map into C is actually a special case of the (additively)-weighted geodesic Voronoi diagram problem on a simple polygon where all sites are outside C and can influence C only through its gates. In summary, after a triangulation of F is given, building SPM (M) takes O (n+ h logh) time, and expanding SPM (M) to all bays and canals takes additional O (n + h logh) time. The space of the algorithm is bounded by O (n). It should be noted that a fundamental difference between our algorithm and the O (n + h logh log n)-time algorithm of Inkulu et al. [28] is that our algorithm follows the framework of Hershberger and Suri [25] (as well as that of Hershberger et al. [26]) by using a conforming subdi- vision of the free space as an underlying structure to guide the wavefront expansion, whereas the algorithm of Inkulu et al. [28] does not use the conforming subdivision (it instead uses the trian- gulation as well as the corridor structure of the free space). In addition, our algorithm computes a shortest path map for the source point s, whereas the algorithm of Inkulu et al. [28] computes a shortest path from s to a single point t. Outline. The rest of thearticle is organized as follows. Section 2 defines notation and introduces some concepts. Section 3 presents the algorithm for the convex case. The general case is discussed in Section 4. 2 PRELIMINARIES For any two points a and b in the plane, denote by ab the line segment with a and b as endpoints; denote by |ab| the length of the segment. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:5 Fig. 2. Illustrating the shortest path map SPM(s). The solid (red) curves are walls, and the (blue) dotted segments are windows. The anchor of each cell is also shown with a black point. For any two points s and t in thefreespace F ,weuse π (s, t) to denote a shortest path from s to t in F . In the case where shortest paths are not unique, π (s, t) may refer to an arbitrary one. Denote by d(s, t) the length of π (s, t);wecall d(s, t) the geodesic distance between s and t. For two line segments e and f in F , their geodesic distance is defined to be the minimum geodesic distance between any point on e and any point on f (i.e., min d(s, t)); by slightly abusing s∈e,t∈f the notation, we use d(e, f ) to denote their geodesic distance. For any path π in the plane, we use |π| to denote its length. For any compact region A in the plane, let ∂A denote its boundary. We use ∂P to denote the union of the boundaries of all obstacles of P. Throughout the article, we use s to refer to the source point. For convenience, we consider s as a degenerate obstacle in P. We often refer to the vertices of P as obstacle vertices and refer to the edges of P as obstacle edges. For any point t ∈F , we call the adjacent vertex of t in π (s, t) the anchor of t in π (s, t). The shortest path map SPM (s) of s is a decomposition of the free space F into maximal regions such that all points in each region R have thesameanchor[25, 36] in their shortest paths from s (Figure 2). Each edge of SPM (s) is either an obstacle edge fragment or a bisecting curve, which is the locus of points p with d(s,u) + |pu| = d(s,v) + |pv| for two obstacle vertices u and v.Each bisecting curve is in general a hyperbola; a special case happens if one of u and v is the anchor of the other, in which case their bisecting curve is a straight line. Following the notation in the work of Eriksson-Bique et al. [17], we differentiate between two types of bisecting curves: walls and windows. A bisecting curve of SPM (s) is a wall if there exist two topologically different shortest paths from s to each point of the edge; otherwise (i.e., the preceding special case), it is a window (e.g., see Figure 2). We make a general position assumption that for each obstacle vertexv, there is a unique shortest path from s to v, and for any point p in the plane, there are at most three different shortest paths from s to p. The assumption assures that each vertex of SPM (s) hasdegreeatmost3,and there Usually “predecessor” is used in the literature instead of “anchor,” but here we reserve “predecessor” for other purposes. This is usually called bisector in the literature. Here we reserve the term bisector to be used later. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:6 H. Wang Fig. 3. Illustrating an elementary chain (the thick segments), which contains the vertex v but not u. are at most three bisectors of SPM (s) intersecting at a common point, which is sometimes called a triple point in the literature [17]. A curve in the plane is x-monotone if its intersection with any vertical line is connected; the y-monotone is defined similarly. A curve is xy-monotone if it is both x-and y-monotone. The following observation will be used throughout the article without explicitly mentioning it again. Observation 1. n + h log n = O (n + h logh). Proof. Indeed, if h < n/ log n,then n + h log n = Θ(n),whichis O (n + h logh); otherwise, log n = O (logh) and n + h log n = O (n + h logh). 3 THE CONVEX CASE In this section, we present our algorithm for the convex case where all obstacles of P are convex. The algorithm will be extended to the general case in Section 4. For each obstacle P ∈P, the topmost, bottommost, leftmost, and rightmost vertices of P are called rectilinear extreme vertices. The four rectilinear extreme vertices partition ∂P into four por- tions, and each portion is called an elementary chain, which is convex and xy-monotone. For tech- nical reasons that will be clear later, we assume that each rectilinear extreme vertex v belongs to the elementary chain counterclockwise of v with respect to the obstacle (i.e., v is the clockwise endpoint of the chain (Figure 3)). We use elementary chain fragment to refer to a portion of an elementary chain. We introduce some notation in the following that is similar in spirit to those from Hershberger et al. [26] for shortest paths among curved obstacles. Consider a shortest path π (s,p) from s to a point p in the free space F .Itisnot difficulttosee that π (s,p) is a sequence of elementary chain fragments and common tangents between obstacles ofP∪{p}. We define the predecessor of p, denoted by pred(p), to be the initial vertex of the last elementary chain fragment in π (s,p) (Figure 4(a)). Note that since each rectilinear extreme vertex belongs to a single elementary chain, pred(p) in π (s,p) is unique. A special case happens if p is a rectilinear extreme vertex and π (s,p) contains a portion of an elementary chain A clockwise of p.Inthiscase, we let pred(p) be endpoint of the fragment of A in π (s,p) other than p (e.g., see Figure 4 (b)); in this way, pred(p) is unique in π (s,p).Notethat p may still have multiple predecessors if there are multiple shortest paths from s to p. Intuitively, the reason we define predecessors as in the preceding is to treat each elementary chain somehow as a whole, which is essential for reducing the runtime of the algorithm from n to h. The rest of this section is organized as follows. In Section 3.1, we compute a conforming sub- division S of thefreespace F . Section 3.2 introduces some basic concepts and notation for our algorithm. The wavefront expansion algorithm is presented in Section 3.3, with two key subrou- tines of the algorithm described in Sections 3.4 and 3.5, respectively. Section 3.6 analyzes the time Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:7 Fig. 4. Illustrating the predecessor. complexity of the algorithm, where a technical lemma is proved separately in Section 3.7. Using the information computed by the wavefront expansion algorithm, Section 3.8 constructs the short- est path map SPM (s). The overall algorithm runs in O (n + h logh) time and O (n + h logh) space. Section 3.9 reduces the space to O (n) while keeping the same runtime, by using the techniques from prior work [48]. 3.1 Computing a Conforming Subdivision of the Free Space Let V denote the set of the rectilinear extreme vertices of all obstacles of P. Hence, |V| = O (h). Using the algorithm of algorithm of Hershberger and Suri [25](calledthe HS algorithm), we build a conforming subdivision S with respect to the vertices of V, without considering the obstacle edges. The subdivisionS,which is of size O (h), is a quad-tree-style subdivision of the plane into O (h) cells. Each cell ofS is a square or a square annulus (i.e., an outer square with an inner square hole). Each vertex ofV is contained in the interior of a square cell, and each square cell contains at most one vertex ofV.Eachedge e ofS is axis-parallel and well-covered—that is, there exists a set C(e) of O (1) cells ofS such that their unionU (e) contains e with the following properties: (1) the total complexity of all cells of C(e) is O (1), and thus the size of U (e) is O (1);(2) forany edge f of S that is on ∂U (e) or outsideU (e), the Euclidean distance between e and f (i.e., the minimum |pq| among all points p ∈ e and q ∈ f )isatleast2 · max{|e|,|f |}; and (3) U (e), which is called the well-covering region of e, contains at most one vertex of V. In addition, each cell c of S has O (1) edges on its boundary with the following uniform edge property: the lengths of the edges on the boundary of c differ by at most a factor of 4, regardless of whether c is a square or square annulus. The subdivisionS can be computed in O (h logh) time and O (h) space [25]. Next we insert the obstacle edges into S to produce a conforming subdivision S of the free space F .In S , there are two types of edges: those introduced by the subdivision construction (which are in the interior ofF except possibly their endpoints) and the obstacle edges; we call the former the transparent edges (which are axis-parallel) and the latter the opaque edges. The definition of S is similar to the conforming subdivision of the free space used in the HS algorithm. A main dieff renceisthathereendpointsofeachobstacleedgemay notbein V, a consequence of which is that each cell of S may not be of constant size (while each cell in the subdivision of the HS algorithm is of constant size). However, each cell c ofS has the following property that is critical to our algorithm: the boundary∂c consists of O (1) transparent edges and O (1) convex chains (each of which is a portion of an elementary chain (Figure 5)). More specifically, S is a subdivision ofF into O (h) cells. Each cell ofS is one of the connected components formed by intersectingF with an axis-parallel rectangle (which is the union of a set of adjacent cells ofS) or a square annulus ofS. Each cell ofS contains at most one vertex ofV.Each vertex of V is incident to a transparent edge. Each transparent edge e of S is well-covered—that Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:8 H. Wang Fig. 5. Illustrating a cell c of S , which is bounded by bold segments. The gray region is an obstacle. is, there exists a set C(e) of O (1) cells whose union U (e) contains e with the following property: for each transparent edge f on ∂U (e), the geodesic distance d(e, f ) between e and f is at least 2 · max{|e|,|f |}.The region U (e) is called the well-covering region of e and contains at most one vertex of V.NotethatS has O (h) transparent edges. In the following, we show howS is produced fromS. The procedure is similar to that in the HS algorithm. We overlay the obstacle edges on top ofS to obtain a subdivisionS . Because each overlay edge ofS is axis-parallel and all obstacle edges constitute a total of O (h) elementary chains, each of which is xy-monotone,S has O (h ) faces. We say that a face ofS is interesting if its overlay overlay boundary contains a vertex ofV or a vertex ofS. We keep intact the interesting faces ofS overlay while deleting every edge fragment of S not on the boundary of any interesting cell. Further, for each cell c containing a vertex v ∈V, we partition c by extending vertical edges from v until the boundary of c. This divides c into at most three subcells. Finally we divide each of the two added edges incident to v into segments of length at most δ,where δ is the length of the shortest edge on the boundary of c. By the uniform edge property ofS, ∂c has O (1) edges, whose lengths differ by at most a factor of 4; hence, dividing the edges incident to v as earlier produces only O (1) vertical edges. The resulting subdivision isS . As mentioned previously, the essential difference between our subdivision S and the one in the HS algorithm is that the role of an obstacle edge in the HS algorithm is replaced by an elementary chain. Therefore, each opaque edge in the subdivision of the HS algorithm becomes an elementary chain fragment in our case. Hence, by the same analysis as in the HS algorithm (see Lemma 2.2 [25]), S has the properties as described earlier and the well-covering region U (e) of each transparent edge e of S is defined in the same way as in the HS algorithm. The following lemma computesS . It should be noted that althoughS is defined with the help ofS , S is constructed directly without computingS first. overlay overlay Lemma 3.1. The conforming subdivision S can be constructed in O (n + h logh) time and O (n) space. Proof. We first construct S in O (h logh) time and O (h) space [25]. In the following, we con- struct S by inserting the obstacle edges into S. The algorithm is similar to that in the HS algo- rithm (see Lemma 2.3 [25]). The difference is that we need to handle each elementary chain as a whole. We first build a data structure so that for any query horizontal ray with origin in F ,the first obstacle edge of P hit by it can be computed in O (log n) time. This can be done by building a hori- zontal decomposition of F —that is, extend a horizontal segment from each vertex until it hits∂P. As all obstacles of P are convex, the horizontal decomposition can be computed in O (n + h logh) time and O (n) space [27]. By building a point location data structure [16, 32] on the horizontal decomposition in additional O (n) time, each horizontal ray shooting can be answered in O (log n) time. Similarly, we can construct the vertical decomposition of F in O (n + h logh) time and O (n) space so that each vertical ray shooting can be answered in O (log n) time. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:9 The edges ofS are obstacle edges, transparent edges incident to the vertices ofS, and transpar- ent edges subdivided on the vertical segments incident to the vertices ofV. To identify the second type of edges, we trace the boundary of each interesting cell separately. Starting from a vertex v ofS, we trace along each edge incident to v. Using the preceding ray-shooting data structure, we determine whether the next cell vertex is a vertex of S or the first point on ∂P hit by the ray. As S has O (h) edges and vertices, this tracing takes O (h log n) time in total. Tracing along obstacle edges is done by starting from each vertex of V and following each of its incident elementary chains. For each elementary chain, the next vertex is either the next obstacle vertex on e,where e is the current tracing edge of the elementary chain, or the intersection of e with a transparent edge of the current cell. Hence, tracing all elementary chains takes O (n) time in total. The third type of edges can be computed in linear time by local operations on each cell containing a vertex of V. Finally, we assemble all these edges together to obtain an adjacency structure for S . For this, we could use a plane sweep algorithm as in the HS algorithm. However, that would take O (n log n) time, as there are O (n) edges in S . To obtain an O (n + h logh) time algorithm, we propose the following approach. During the preceding tracing of elementary chains, we record the fragment of the chain that lies in a single cell. Since each such portion may not be of constant size, we represent it by a line segment connecting its two endpoints; note that this segment does not intersect any other cell edges because the elementary chain fragment is on the boundary of an obstacle (and thus the segment is inside the obstacle). Then, we apply the plane sweep algorithm to stitch all edges with each elementary chain fragment in a cell replaced by a segment as earlier. The algorithm takes O (h logh) time and O (h) space. Finally, for each segment representing an elementary chain portion, we locally replace it by the chain fragment in linear time. Hence, this step takes O (n) time altogether for all such segments. As such, the total time for computing the adjacency information for S is O (n + h log n),which is O (n + h logh). Clearly, the space complexity of the algorithm is O (n). 3.2 Basic Concepts and Notation Our shortest path algorithm uses the continuous Dijkstra method. The algorithm initially gener- ates a wavefront from s, which is a circle centered at s. During the algorithm, the wavefront consists of all points of F with the same geodesic distance from s (Figure 6). We expand the wavefront un- til all points of the free space are covered. The conforming subdivision S is utilized to guide the wavefront expansion. Our wavefront expansion algorithm follows the high-level scheme as the HS algorithm. The difference is that our algorithm somehow considers each elementary chain as a whole, which is in some sense similar to the algorithm of Hershberger et al. [26](calledthe HSY algorithm). Indeed, the HSY algorithm considers each xy-monotone convex arc as a whole, but the difference is that each arc in the HSY algorithm is of constant size, whereas in our case each elementary chain may not be of constant size. As such, techniques from both the HS algorithm and the HSY algorithm are borrowed. We useτ to denote the geodesic distance from s to all points in the wavefront. One may also think of τ as a parameter representing time. The algorithm simulates the expansion of the wavefront as time increases from 0 to ∞. The wavefront comprises a sequence of wavelets, each emanating from a generator. In the HS algorithm, a generator is simply an obstacle vertex. Here, since we want to treat an elementary chain as a whole, similar to the HSY algorithm (also similar to the concept “bunch” introduced in the work of Inkulu et al. [28]), we define a generator as a couple α = (A, a),where A is an elementary chain and a is an obstacle vertex on A, and further a clockwise or counterclockwise direction of A is designated for α; a has a weight w (a) (one may consider w (a) as the geodesic distance between s and a). We call a the initial vertex of the generator α. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:10 H. Wang Fig. 6. Illustrating the wavefront. The black region are obstacles. The green point is s. The red curves are bisecting curves of SPM(s). The gray region is the free space that has been covered by the wavefront. The boundary between the white region and the gray region is the wavefront. The figure is generated using the applet from Hershberger et al. [23]. Fig. 7. Illustrating a generator α = (A, a). A consists Fig. 8. Illustrating the wavelet generated by α = of the thick segments and is designated in the clock- (A,q), designated in the counterclockwise direction. wise direction around the obstacle. q is a reachable The wavelet has three pieces each of which is a cir- point through vertex v. cular arc. We say a point q is reachable by a generator α = (A, a) if one can draw a path in F from a to q by following A in the designated direction to a vertex v on A such that vq is tangent to A and then following the segment vq (Figure 7). The (weighted) distance between the generator α and q is the length of this path plus w (a); by slightly abusing the notation, we use d(α,q) to denote the distance. From the definition of reachable points, the vertex a partitions A into two portions and only the portion following the designated direction is relevant (e.g., in Figure 7, only the portion containing the vertex v is relevant). Henceforth, unless otherwise stated, we use A to refer to its relevant portion only and we call A the underlying chain of α. In this way, the initial vertex a becomes an endpoint of A. For convenience, sometimes we do not differentiate α and A. For example, when we say “the tangent from q to α,” we mean “the tangent from q to A”; in addition, when we say “a vertex of α,” we mean “a vertex of A.” The wavefront can thus be represented by the sequence of generators of its wavelets. A wavelet generated by a generator α = (A, a) at time τ is a contiguous set of reachable points q such that d(α,q) = τ and d(α ,q) ≥ τ for all other generators α in the wavefront; we also say that q is claimed by α.Notethatas A may not be of constant size, a wavelet may not be of constant size either; it actually consists of a contiguous sequence of circular arcs centered at the obstacle vertices A (Figure 8). If a point q is claimed by α,then d(s,q) = d(α,q) = τ and the predecessor pred(q) of q is a; sometimes for convenience, we also say that the generator α is the predecessor Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:11 Fig. 9. Illustrating a new generator α = (A ,q). (a) A general case where both A and A are marked with thick segments. (b) A special case where A is marked with solid (red) segments and A is marked with dashed (blue) segments. Fig. 10. Illustrating the bisector B(γ,γ ) defined by two generators γ = (A,q) and γ = (A ,q ). The portion between q and q is a hyperbola defined by v and v . of q.If q is on an elementary chain A and the tangent from q to a is also tangent to A ,thena new generator (A ,q) is added to the wavefront (Figure 9(a)). A special case happens when q is the counterclockwise endpoint of A (and thus q does not belong to A); in this case, a new generator α = (A ,q) is also added, where A is the elementary chain that contains q (e.g., see Figure 9(b)). As τ increases, the points bounding the adjacent wavelets trace out the bisectors that form the edges of the shortest path map SPM (s).The bisector between the wavelets of two generators α and α , denoted by B(α, α ), consists of points q with d(α,q) = d(α ,q). Note that since α and α may not be of constant size, B(α, α ) may not be of constant size either (in contrast, the bisector in HSY’s algorithm is always of constant size; note that a similar concept “I-curves” is introduced in the work of Inkulu et al. [28]). More specifically, B(α, α ) has multiple pieces, each of which is a hyperbola defined by two obstacle vertices v ∈ α and v ∈ α such that the hyperbola consists of all points that have two shortest paths from s with v and v as the anchors in the two paths, respectively (Figure 10). A special case happens if α is a generator created by the wavelet of α such as that illustrated in Figure 9(a), then B(α, α ) is the half-line extended from q along the direction from v to q (the dashed segment in Figure 9(a)); we call such a bisector an extension bisector.Note that in the case illustrated in Figure 9(b), B(α, α ), which is also an extension bisector, is the half- line extended from q along the direction from v to q (the dashed segment in Figure 9(b)), where v is the obstacle vertex adjacent to q in A. A wavelet gets eliminated from the wavefront if the two bisectors bounding it intersect, which is called a bisector event. Specifically, if α , α,and α are three consecutive generators of the 1 2 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:12 H. Wang Fig. 11. Illustrating the intersection of two bisectors. Fig. 12. Illustrating the map SPM (s). The red curves are non-extension bisectors. The green and blue seg- ments are extension bisectors, where the green and blue ones are Type (a) and (b) as illustrated in Figure 9. The predecessor in each cell is also shown with a black point. For example, all points in the cell containing q have a as their predecessor. wavefront, the wavelet generated by α will be eliminated when B(α , α ) intersects B(α, α ) 1 2 (Figure 11). Wavelets are also eliminated by collisions with obstacles and other wavelets in front of it. If a bisector B(α, α ) intersects an obstacle, their intersection is also called a bisector event. Let SPM (s) be the subdivision of F by the bisectors of all generators (Figure 12). The intersec- tions of bisectors and intersections between bisectors and obstacle edges are vertices of SPM (s). Each bisector connecting two vertices is an edge of SPM (s), called a bisector edge. As discussed before, a bisector, which consists of multiple hyperbola pieces, may not be of constant size. Hence, a bisector edge e of SPM (s) may not be of constant size. For differentiation, we call each hyperbola piece of e a hyperbolic-arc. In addition, if the boundary of an obstacle P contains more than one vertex of SPM (s), then the chain of edges of ∂P connecting two adjacent vertices of SPM (s) also forms an edge of SPM (s), called a convex chain edge. The following lemma shows that SPM (s) is very similar to SPM (s). Refer to Figure 13 for SPM (s). Lemma 3.2. Each extension bisector edge of SPM (s) is a window of SPM (s). The union of all non- extension bisector edges of SPM (s) is exactly the union of all walls of SPM (s). SPM (s) can be obtained from SPM (s) by removing all windows except those that are extension bisectors of SPM (s). Proof. We first prove that each extension bisector edge e of SPM (s) is a window of SPM (s).By definition, one endpoint of e, denoted by u, is an obstacle vertex such that e is a half-line extended Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:13 Fig. 13. Illustrating the map SPM (s). The dashed segments are windows that are not in SPM (s); removing them becomes SPM (s). The anchor of each cell is also shown. from u in the direction from v to u for another obstacle vertex v. Hence, for each point p ∈ e,there is a shortest s-p path π (s,p) such that vp is a segment of π (s,p).As u ∈ vp, p must be on a window w of SPM (s). This proves that e ⊆ w. However, for any point p ∈ w, there is a shortest s-p path π (s,p) that contains vp. Since u ∈ vp, p must be on the extension bisector edge e of SPM (s),and thus w ⊆ e. Therefore, e = w. This proves that each extension bisector edge of SPM (s) is a window of SPM (s). We next prove that the union of all non-extension bisector edges of SPM (s) is exactly the union of all walls of SPM (s): • We first show that the union of all non-extension bisector edges of SPM (s) is a subset of the union of all walls of SPM (s). Let q be a point on a non-extension bisector B(α, α ) of two generators α = (A, a) and α = (A , a ).Let v and v be the tangent points on A and A from q, respectively. Hence, q has two shortest paths from s, one containing qv and the other containing qv . Since B(α, α ) is not an extension bisector,v  qv andv  qv . This means that the two paths are combinatorially different, and thus q is on a wall of SPM (s). This proves that the union of all non-extension bisector edges of SPM (s) is a subset of the union of all walls of SPM (s). • We then show that the union of all walls of SPM (s) is a subset of the union of all non- extension bisector edges of SPM (s). Let q be a point on a wall of SPM (s). By definition, there are two obstacle vertices v and v such that there are two combinatorially different shortest paths from s to q whose anchors are v and v , respectively. Further, since the two paths are combinatorially different and also due to the general position assumption, v  qv and v  qv . Therefore, q must be on the bisector edge of the two generators α and α in SPM (s) whose underlying chains containing v and v , respectively. Further, since v  qv and v  qv, the bisector of α and α is not an extension bisector. This proves that the union of all walls of SPM (s) is a subset of the union of all non-extension bisector edges of SPM (s). The preceding proves that the first and second statements of the lemma. The third statement im- mediately follows the first two. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:14 H. Wang Corollary 3.3. The combinatorial size of SPM (s) is O (n). Proof. By Lemma 3.2, SPM (s) is a subset of SPM (s). As the combinatorial size of SPM (s) is O (n) [25, 36], the combinatorial size of SPM (s) is also O (n). Lemma 3.4. The subdivision SPM (s) has O (h) faces, vertices, and edges. In particular, SPM (s) has O (h) bisector intersections and O (h) intersections between bisectors and obstacle edges. Proof. By Lemma 3.2, for any vertex of SPM (s) that is the intersection of two non-extension bisectors, it is also the intersection of two walls of SPM (s), which is a triple point.Let SPM (s) refer to SPM (s) excluding all extension bisectors. We define a planar graph G corresponding to SPM (s) as follows. Each obstacle defines a node of G, and each triple point also defines a node of G. For any two nodes of G, if they are connected by a chain of bisector edges of SPM (s) such that the chain does not contain any other node of G,then G has an edge connecting the two nodes. It is proved in previous work [46]that G has O (h) vertices, faces, and edges. It is not difficult to see that a face of SPM (s) corresponds to a face of G and thus the number of faces of SPM (s) is O (h). For each bisector intersection of SPM (s), it must be a triple point and thus it is also a node of G.As G has O (h) nodes, the number of bisector intersections of SPM (s) is O (h). For each intersection v between a bisector and an obstacle edge in SPM (s), G must has an edge e corresponding a chain of bisector edges and v is the endpoint of the chain; we charge v to e.As e as two incident nodes of G, e can be charged at most twice. Since G has O (h) edges, the number of intersections between bisectors and obstacle edges in SPM (s) is O (h). We next prove that the total number of extension bisector edges of SPM (s) is O (h). For each extension bisection edge e, it belongs to one of the two cases (a) and (b) illustrated in Figure 9. For Case (b), one endpoint of e is a rectilinear extreme vertex. Since each rectilinear extreme vertex can define at most two extension bisector edges and there are O (h) rectilinear extreme vertices, the total number of Case (b) extension bisectors is O (h). For Case (a), e is an extension of a common tangent of two obstacles; we say that e is defined by the common tangent. Note that all such common tangents are interior disjoint, as they belong to shortest paths from s encoded by SPM (s). We now define a planar graph G as follows. The node set of G consists of all obstacles of P.Two obstacles have an edge in G if they have at least one common tangent that defines an extension bisector. Since all such common tangents are interior disjoint, G is a planar graph. Apparently, no two nodes of G share two edges and no node of G has a self-loop. Therefore, G is a simple planar graph. Since G has h vertices, the number of edges of G is O (h). By the definition of G ,each pair of obstacles whose common tangents define extension bisectors have an edge in G .Because each pair of obstacles can define at most four common tangents and thus at most four extension bisectors and also because G has O (h) edges, the total number of Case (a) extension bisectors is O (h). The bisector intersections of SPM (s) that are not vertices of SPM (s) involve extension bisec- tors of SPM (s). The intersections between bisectors and obstacle edges in SPM (s) that are not in SPM (s) also involve extension bisectors. Since all extension bisectors and all edges of SPM (s) are interior disjoint, each extension bisector can involve in at most two bisector intersections and at most two intersections between bisectors and obstacle edges. Because the total number of exten- sion bisector edges of SPM (s) is O (h), the number of bisector intersections involving extension bisectors is O (h) and the number of intersections between extension bisectors and obstacle edges is also O (h). Therefore, comparing to SPM (s), SPM (s) has O (h) additional vertices and O (h) addi- tional edges. Note that the number of convex chain edges of SPM (s) is O (h),for SPM (s) has O (h) vertices. The lemma thus follows. Corollary 3.5. There are O (h) bisector events and O (h) generators in SPM (s). Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:15 Proof. Each bisector event is either a bisector intersection or an intersection between a bisector and an obstacle edge. By Lemma 3.4,there are O (h) bisector intersections and O (h) intersections between bisectors and obstacle edges. As such, there are O (h) bisector events in SPM (s). By definition, each face of SPM (s) has a unique generator. Since SPM (s) has O (h) faces by Lemma 3.4, the total number of generators is O (h). By the definition of SPM (s), each cell C of SPM (s) has a unique generator α = (A, a), all points of the cell are reachable from the generator, and a is the predecessor of all points of C (e.g., see Figure 12; all points in the cell containing q have a as their predecessor). Hence, for any point q ∈ C, we can compute d(s,q) = d(α,q) by computing the tangent from q to A.Thus, SPM (s) can also be used to answer shortest path queries. In fact, given SPM (s), we can construct SPM (s) in additional O (n) time by inserting the windows of SPM (s) to SPM (s), as shown in the following lemma. Lemma 3.6. Given SPM (s), SPM (s) can be constructed in O (n) time (e.g., see Figures 12 and 13). Proof. It suffices to insert all windows of SPM (s) (except those that are also extension bisectors of SPM (s))to SPM (s).WeconsidereachcellC of SPM (s) separately. Let α = (A, a) be the generator of C. Our goal is to extend each obstacle edge of A along the designated direction of A until the boundary of C. To this end, since all points of C are reachable from α, the cell C is “star-shaped” with respect to the tangents of A (along the designated direction) and the extension of each obstacle edge of A intersects the boundary of C at most once. Hence, the order of the endpoints of these extensions is consistent with the order of the corresponding edges of A. Therefore, these extension endpoints can be found in order by traversing the boundary of C, which takes linear time in the size of C. Since the total size of all cells of SPM (s) is O (n) by Corollary 3.3, the total time of the algorithm is O (n). In light of Lemma 3.6, we will focus on computing the map SPM (s). 3.3 The Wavefront Expansion Algorithm To simulate the wavefront expansion, we compute the wavefront passing through each transparent edge of the conforming subdivisionS . As in the HS algorithm, since it is difficult to compute a true wavefront for each transparent edge e of S , a key idea is to compute two one-sided wavefronts (called approximate wavefronts)for e, each representing the wavefront coming from one side of e. Intuitively, an approximate wavefront from one side of e is what the true wavefront would be if the wavefront were blocked off at e by considering e as an opaque segment (with open endpoints). In the following, unless otherwise stated, a wavefront at a transparent edge e of S refers to an approximate wavefront. Let W (e) denote a wavefront at e. To make the description concise, as there are two wavefronts at e, depending on the context, W (e) may refer to both wavefronts—that is, the discussion onW (e) applies to both wavefronts. For example, “compute the wavefrontsW (e)” means “compute both wavefronts at e.” For each transparent edge e ofS ,define input (e) as the set of transparent edges on the bound- ary of the well-covering region U (e), and define output (e) = {д | e ∈ input (д)}∪ input (e). Because∂U (e ) for each transparent edge e ofS has O (1) transparent edges, both|input (e)| and |output (e)| are O (1). The Wavefront Propagation and Merging Procedures. The wavefronts W (e) at e are computed from the wavefronts at edges of input (e); this guarantees the correctness because e is in U (e) (and thus any shortest path π (s,p) must cross some edge f ∈ input (e) for any point p ∈ e). After We include input (e) in output (e) mainly for the proof of Lemma 3.23, which relies on output (e) havingacycle enclosing e. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:16 H. Wang the wavefronts W (e) at e are computed, they will pass to the edges of output (e). In addition, the geodesic distances from s to both endpoints of e will be computed. Recall that V is the set of rectilinear extreme vertices of all obstacles and each vertex ofV is incident to a transparent edge of S . As such, after the algorithm is finished, geodesic distances from s to all vertices of V will be available. The process of passing the wavefronts W (e) at e to all edges д ∈ output (e) is called the wavefront propagation procedure, which will compute the wavefront W (e,д),where W (e,д) is the portion of W (e) that passes to д through the well-covering region U (д) of д if e ∈ input (д) and through U (e) otherwise (in this case, д ∈ input (e)); whenever the procedure is invoked on e, we say that e is processed. The wavefronts W (e) at e are constructed by merging the wavefronts W (f, e) for edges f ∈ input (e); this procedure is called the wavefront merging procedure. The Main Algorithm. The transparent edges ofS are processed in a rough time order. The wave- ˜ ˜ fronts W (e) of each transparent edge e are constructed at the time d(s, e)+|e|,where d(s, e) is the minimum geodesic distance from s to the two endpoints of e.Define covertime(e) = d(s, e) + |e|. The value covertime(e) will be computed during the algorithm. Initially, for each edge e whose well-covering region U (e) contains s, W (e) and covertime(e) are computed directly (and set covertime(e) = ∞ for all other edges); we refer to this step as the initialization step,which will be elaborated in the following. The algorithm maintains a timer τ and processes the transparent edges e of S following the order of covertime(e). The main loop of the algorithm works as follows. As long asS has an unprocessed transparent edge, we do the following. First, among all unprocessed transparent edges, choose the one e with minimum covertime(e) and set τ = covertime(e). Second, call the wavefront merging procedure to construct the wavefronts W (e) from W (f, e) for all edges f ∈ input (e) satisfying covertime(f ) < covertime(e); compute d(s,v) from W (e) for each endpoint v of e.Third,process e—that is, call the wavefront propagation procedure on W (e) to compute W (e,д) for all edges д ∈ output (e);in particular, compute the time τ when the wavefronts W (e) first encounter an endpoint of д and set covertime(д) = min{covertime(д),τ + |д|}. The details of the wavefront merging procedure and the wavefront propagation procedure will be described in Sections 3.4 and 3.5, respectively. The Initialization Step. We provide the details on the initialization step. Consider a transparent edge e whose well-covering regionU (e) contains s. To compute W (e), we only consider straight- line paths from s to e inside U (e).If U (e) does not have any island inside, then the points of e that can be reached from s by straight-line paths in U (e) form an interval of e and the interval can be computed by considering the tangents from s to the elementary chains on the boundary of U (e). Since U (e) has O (1) cells of S , ∂U (e) has O (1) elementary chain fragments and thus computing the interval on e takes O (log n) time. IfU (e) has at least one island inside, then e may have multiple such intervals. AsU (e) is the union of O (1) cells ofS , the number of islands inside U (e) is O (1). Hence, e has O (1) such intervals, which can be computed in O (log n) time altogether. These intervals form the wavefront W (e)—that is, each interval corresponds to a wavelet with generator s.From W (e),the value covertime(e) can be immediately determined. More specifically, for each endpoint v of e, if one of the wavelets of W (e) covers v, then the segment sv is in U (e) and thus d(s,v) = |sv|; otherwise, we set d(s,v) = ∞. In this way, we find an upper bound for d(s, e) and set covertime(e) to this upper bound plus |e|. The Algorithm Correctness. At the time d(s, e) + |e|,all edges f ∈ input (e) whose wavefronts W (f ) contribute a wavelet toW (e) must have already been processed. This is due to the property of the well-covering regions ofS that d(e, f ) ≥ 2·max{|e|,|f |} since f is on∂U (e). The proof is the same as that of Lemma 4.2 [25], so we omit it. Note that this also implies that the geodesic distance Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:17 d(s,v) is correctly computed for each endpoint v of e. Therefore, after the algorithm is finished, geodesic distances from s to endpoints of all transparent edges ofS are correctly computed. Artificial Wavelets. As in the HS algorithm, to limit the interaction between wavefronts from different sides of each transparent edge e, when a wavefront propagates across e (i.e., whenW (e) is computed in the wavefront merging procedure), an artificial wavelet is generated at each endpoint v of e,withweight d(s,v). This is to eliminate a wavefront from one side of e if it arrives at e later than the wavefront from the other side of e. We will not explicitly discuss this anymore when we describe the algorithm. Topologically Different Paths. In the wavefront propagation procedure to pass W (e) to all edges д ∈ output (e), W (e) travels through the cells of the well-covering regionU of either д or e. Since U may not be simply connected (e.g., the square annulus), there may be multiple topologically different shortest paths between e and д inside U; the number of such paths is O (1) as U is the union of O (1) cells of S .Wepropagate W (e) in multiple components of U, each corresponding to a topologically different shortest path and defined by the particular sequence of transparent edges it crosses. These wavefronts are later combined in the wavefront merging step at д.This also happens in the initialization step, as discussed earlier. Claiming a Point. During the wavefront merging procedure at e,wehaveasetofwavefronts W (f, e) that reach e from the same side for edges f ∈ input (e). We say that a wavefront W (f, e) claims a point p ∈ e if W (f, e) reaches p before any other wavefront. Further, for each wavefront W (f, e), the set of points on e claimed by it forms an interval (the proof is similar to that of Lemma 4.4 [25]). Similarly, a wavelet of a wavefront claims a point p of e if the wavelet reaches p before any other wavelet of the wavefront, and the set of points on e claimed by any wavelet of the wavefront also forms an interval. For convenience, if a wavelet claims a point, we also say that the generator of the wavelet claims the point. Before presenting the details of the wavefront merging procedure and the wavefront propa- gation procedure in the next two sections, we first discuss the data structure (for representing elementary chains, generators, and wavefronts) and a monotonicity property of bisectors, which will be used later in our algorithm. 3.3.1 The Data Structure. We use an array to represent each elementary chain. Then, a genera- tor α = (A, a) can be represented by recording the indices of the two end vertices of its underlying chain A. In this way, a generator takes O (1) additional space to record and binary search on A can be supported in O (log n) time (e.g., given a point p, find the tangent from p to A). In addition, we maintain the lengths of the edges in each elementary chain so that given any two vertices of the chain, the length of the subchain between the two vertices can be obtained in O (1) time. All this preprocessing can be done in O (n) time and space for all elementary chains. For a wavefront W (e) of one side of e, it is a list of generators α , α ,... ordered by the in- 1 2 tervals of e claimed by these generators. Note that these generators are in the same side of e. Formally, we say that a generator α is in one side of e if the initial vertex of α lies in that side of the supporting line of e. We maintain these generators by a balanced binary search tree so that the following operations can be supported in logarithmic time each. Let W be a wavefront with generators α , α ,..., α : 1 2 Insert: Insert a generator α to W . In our algorithm, α is inserted either in the front of α or after α . Delete: Delete a generator α from W , for any 1 ≤ i ≤ k. Split:Split W into two sublists at some generator α so that the first i generators form a wave- front and the rest form another wavefront. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:18 H. Wang Fig. 14. Illustrating the reachable region R(α ) of a Fig. 15. Illustrating the ray ρ (a) and the region R . generator α = (A, a). Concatenate: Concatenate W with another list W of generators so that all generators of W are in the front of those of W in the new list. We will show later that each wavefront involved in our algorithm has O (h) generators. There- fore, each of the preceding operations can be performed in O (logh) time. We make the tree fully persistent by path-copying [43]. In this way, each operation on the tree will cost O (logh) addi- tional space but the older version of the tree will be kept intact (and operations on the old tree can still be supported). 3.3.2 The Monotonicity Property of Bisectors. Lemma 3.7. Suppose α = (A , a ) and α = (A , a ) are two generators on the same side of an 1 1 1 2 2 2 axis-parallel line (i.e., a and a are on the same side of; it is possible that intersects A and A ). 1 2 1 2 Then, the bisector B(α , α ) intersects at no more than one point. 1 2 Proof. Consider a generator α = (A, a).Recallthat a is an endpoint of A.Let a be the other endpoint of A. We consider the general case where A hasatleast oneedge, andthus a  a ;the other case can be handled analogously. We define R(α ) as the set of points in the plane that are reachable from α (without considering any other obstacles), and we call it the reachable region of α. The reachable region R(α ) is bounded by A,aray ρ(a) with origin a, and another ray ρ(a ) with origin a (Figure 14). Specifically, ρ(a) is along the direction from z to a,where z is the anchor of a in the shortest path from s to a; ρ(a ) is the ray from the adjacent obstacle vertex of a on A to a . We claim that the intersection∩R(α ) must be an interval of. Indeed, since A is xy-monotone, without loss of generality, we assume that a is to the northwest of a.Let ρ (a) be the vertically downward ray from a (Figure 15). Observe that the concatenation of ρ(a ), A,and ρ (a) is xy- monotone; let R be the region of the plane to the right of their concatenation. Since the boundary of R is xy-monotone and  is axis-parallel, R ∩ must be an interval of . Notice that ρ(a) must be in R , and thus it partitions R into two subregions, one of which is R(α ). Since intersects ρ(a) at most once and R ∩ is an interval, R(α ) ∩ must also be an interval. According to the preceding claim, both  ∩ R(α ) and  ∩ R(α ) are intervals of .Let I denote 1 2 the common intersection of the two intervals. Since B(α , α ) ⊆ R(α ) and B(α , α ) ⊆ R(α ),we 1 2 1 1 2 2 obtain that B(α , α ) ∩ ⊆ I. 1 2 Assume to the contrary that B(α , α )∩ contains two points, say, q and q . Then, both points 1 2 1 2 are in I.Let v and u be the tangents points of q on A and A , respectively. Let v and u be the 1 1 1 1 2 2 2 tangents points of q on A and A , respectively (Figure 16). As I = ∩R(α )∩R(α ) and I contains 2 1 2 1 2 both q and q , if we move a point q from q to q on, the tangent from q to A will continuously 1 2 1 2 1 change from q v to q v and the tangent from q to A will continuously change from q u to q u . 1 1 2 2 2 1 1 2 2 Since A and A are in the same side of  and each of A and A has a fixed designated direction 1 2 1 2 (i.e., either clockwise or counterclockwise), either q u intersects q v in their interiors or q v 1 1 2 2 1 1 intersects q u in their interiors; without loss of generality, we assume that it is the former case. 2 2 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:19 Fig. 16. Illustrating the proof of Lemma 3.7. Let p be the intersection of q u and q v (e.g., see Figure 16). Since q ∈ B(α , α ), points of q u 1 1 2 2 1 1 2 1 1 other than q have only one predecessor, which is a .As p ∈ q u and p  q , p has only one 1 2 1 1 1 predecessor a . Similarly, since q ∈ B(α , α ) and p ∈ q v , a is also p’s predecessor. We thus 2 2 1 2 2 2 1 obtain a contradiction. Note that similar monotonicity properties of bisectors were also used in previous work (e.g., [25, 26, 28]). Corollary 3.8. Suppose α = (A , a ) and α = (A , a ) are two generators both below a horizon- 1 1 1 2 2 2 tal line. Then, the portion of the bisector B(α , α ) above is y-monotone. 1 2 Proof. For any horizontal line  above, since both generators are below,theyare also below . By Lemma 3.7, B(α , α ) ∩ is either empty or a single point. The corollary thus follows. 1 2 3.4 The Wavefront Merging Procedure In this section, we present the details of the wavefront merging procedure. Given all contributing wavefronts W (f, e) of f ∈ input (e) for W (e), the goal of the procedure is to compute W (e).The algorithm follows the high-level scheme of the HS algorithm (i.e., Lemma 4.6 of Hershberger and Suri [25]), but the implementation details are quite different. We only consider the wavefronts W (f, e) and W (e) for one side of e since the algorithm for the other side is analogous. Without loss of generality, we assume that e is horizontal and all wavefrontsW (f, e) are coming from below e. We describe the algorithm for computing the interval of e claimed by W (f, e) if only one other wavefront W (f , e) is present. The common intersection of these intervals of all such f is the interval of e claimed by W (f, e). Since |input (e)| = O (1),the number of such f is O (1). We first determine whether the claim of W (f, e) is to the left or right of that of W (f , e).Tothis end, depending on whether both W (f, e) and W (f , e) reach the left endpoint v of e,there aretwo cases. Note that the intervals of e claimed by W (f, e) and W (f , e) are available from W (f, e) and W (f , e);let I and I  denote these two intervals, respectively: f f • If both I and I  contain v (i.e., both W (f, e) and W (f , e) reach v), then we compute the f f (weighted) distances from v to the two wavefronts. This can be done as follows. Since v ∈ I , v must be reached by the leftmost generator α of W (f, e). We compute the distance d(α,v) by computing the tangent fromv to α in O (log n) time. Similarly, we compute d(α ,v),where α is leftmost generator of W (f , e).If d(α,v) ≤ d(α ,v), then the claim of W (f, e) is to the left of that of W (f , e); otherwise, the claim of W (f, e) is to the right of that of W (f , e). • If both I and I  do not contain v, then the order of the left endpoints of I and I  gives the f f f f answer. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:20 H. Wang Without loss of generality, we assume that the claim of W (f, e) is to the left of that of W (f , e). We next compute the interval I of e claimed by W (f, e) with respect to W (f , e). Note that the left endpoint of I is the left endpoint of I . Hence, it remains to find the right endpoint of I, as follows. Let  be the supporting line of e.Let α be the rightmost generator of W (f, e), and let α be the leftmost generator of W (f , e).Let q be the left endpoint of the interval on e claimed by α in W (f, e)—that is, q is the intersection of the bisector B(α , α ) and e,where α is the left neighboring 1 1 1 generator of α in W (f, e). Similarly, let q be the right endpoint of the interval on e claimed by α in W (f , e)—that is, q is the intersection of e and the bisector B(α , α ),where α is the right 1 1 neighboring generator of α in W (f , e).Let q be the intersection of the bisector B(α, α ) and e. We assume that the three points q , i = 0, 1, 2 are available, and we will discuss later that each of them can be computed in O (log n) time by a bisector-line intersection operation given in Lemma 3.10. If q is between q and q ,then q is the right endpoint of I and we can stop the algorithm. If q is 0 1 2 0 0 to the left of q , then we delete α from W (f, e).If q is to the right of q , then we delete α from 1 0 2 W (f , e). In either case, we continue the same algorithm by redefining α or α (and recomputing q for i = 0, 1, 2). Clearly, the preceding algorithm takes O((1+k) log n) time, where k is the number of generators that are deleted. We apply the algorithm on f and other f in input (e) to compute the correspond- ing intervals for f . The common intersection of all these intervals is the interval of e claimed by W (f, e). We do so for each f ∈ input (e), after which W (e) is obtained. Since the size of input (e) is O (1), we obtain the following lemma. Lemma 3.9. Given all contributing wavefronts W (f, e) of edges f ∈ input (e) for W (e),wecan compute the interval of e claimed by each W (f, e) and thus construct W (e) in O((1+ k) log n) time, where k is the total number of generators in all wavefronts W (f, e) that are absent from W (e). Lemma 3.10 (Bisector-Line Intersection Operation). Each bisector-line intersection operation can be performed in O (log n) time. Proof. Given two generators α = (A , a ) and α = (A , a ) below a horizontal line, the goal 1 1 1 2 2 2 of the operation is to compute the intersection between the bisector B(α , α ) and. By Lemma 3.7, 1 2 B(α , α ) ∩ is either empty or a single point. 1 2 We apply a prune-and-search technique from Kirkpatrick and Snoeyink [33]. To avoid the lengthy background explanation, we follow the notation in their work [33] without definition. We will rely on Theorem 3.6 in their work [33] as well. To do so, we need to define a decreasing function f and an increasing function д. We first compute the intersection of  and the reachable region R(α ) of α ,asdefinedinthe 1 1 proofofLemma 3.7. This can be easily done by computing the intersections between  and the boundary of R(α ) in O (log n) time. Let I be their intersection, which is an interval of as proved 1 1 in Lemma 3.7. Similarly, we compute the intersection I of  and the reachable region R(α ) of α . 2 2 2 Let I = I ∩ I . For each endpoint of I, we compute its tangent point on A (along its designated 1 2 1 direction) to determine the portion of A whose tangent rays intersect I and let A denote the por- tion. Similarly, we determine the portion B of A whose tangent rays intersect I. All the preceding takes O (log n) time. We parameterize over [0, 1] each of the two convex chains A and B in clockwise order—that is, each value of [0, 1] corresponds to a slope of a tangent at a point on A (respectively, B). For each point a of A,wedefine f (a) to be the parameter of the point b ∈ B such that the tangent ray of A at a along the designated direction and the tangent ray of B at b along the designated direction intersect at a point on the bisector B(α , α ) (Figure 17, left); if the tangent ray at a does not intersect 1 2 B(α , α ),thendefine f (a) = 1. For each point b of B,wedefine д(b) to be the parameter of the 1 2 point a ∈ A such that the tangent ray of A at a and the tangent ray of B at b intersect at a point Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:21 Fig. 17. Illustrating the definitions of f (a) and д(b). on the line  (e.g., see Figure 17, right). One can verify that f is a continuous decreasing function while д is a continuous increasing function (the tangent at an obstacle vertex of A and B is not unique but the issue can be handled [33]). The fixed-point of the composition of the two functions д · f corresponds to the intersection of  and B(α , α ), which can be computed by applying the 1 2 prune-and-search algorithm of Theorem 3.6 [33]. As both chains A and B are represented by arrays (of size O (n)), to show that the algorithm can be implemented in O (log n) time, it suffices to show that given any a ∈ A and any b ∈ B,wecan determine whether f (a) ≥ b in O (1) time and determine whether д(b) ≥ a in O (1) time. To determine whether f (a) ≥ b, we do the following. We first find the intersection q of the tangent ray of A at a and the tangent ray of B at b.Then, f (a) ≥ b if and only if d(α ,q) ≤ d(α ,q). 1 2 Notice that d(α ,q) = w (a ) + |aa| + |aq|,where |aa| is the length of the portion of A between 1 1 1 1 1 a and a. Recall that we have a data structure on each elementary chain C such that given any two vertices on C, the length of the subchain of C between the two vertices can be computed in O (1) time. Using the data structure, |aa| can be computed in constant time. Since w (a ) is already 1 1 known, d(α ,q) can be computed in constant time. So is d(α ,q). In the case where the two tangent 1 2 rays do not intersect, either the tangent ray of A at a intersects the backward extension of the tangent ray of B at b or the tangent ray of B at b intersects the backward extension of the tangent ray of A at a. In the former case, f (a) ≤ b holds, whereas in the latter case, f (a) ≥ b holds. Hence, whether f (a) ≥ b can be determined in constant time. To determine whether д(b) ≥ a, we do the following. Find the intersection p between  and the tangent ray of A at a and the intersection p between and the tangent ray of B at b.If p is to b a the left of p ,then д(b) ≥ a; otherwise, д(b) ≤ a. Note that by the definition of A, the tangent ray at any point of A intersects I; the same is true for B. Hence, whether д(b) ≥ a can be determined in constant time. The preceding algorithm returns a point q in O (log n) time. If the intersection of and B(α , α ) 1 2 exists, then q is the intersection. Because we do not know whether the intersection exists, we finally validate q by computing d(α ,q) and d(α ,q) in O (log n) time as well as checking whether 1 2 q ∈ . The point q is valid if and only if d(α ,q) = d(α ,q) and q ∈ . 1 2 3.5 The Wavefront Propagation Procedure In this section, we discuss the wavefront propagation procedure, which is to compute the wave- front W (e,д) for all transparent edges д ∈ output (e) based on W (e). Consider a transparent edge д ∈ output (e). The wavefront W (e,д) refers to the portion of W (e) that arrives at д through the well-covering region U (д) of д if e ∈ input (д) and through U (e) otherwise (in the latter case, д ∈ input (e)). We will need to handle the bisector events—that is, the intersections between bisec- tors and the intersections between bisectors and obstacle edges. The HS algorithm processes the bisector events in temporal order—that is, in order of the simulation time τ.The HSYalgorithm Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:22 H. Wang instead proposes a simpler approach that processes the events in spatial order—thatis, in orderof their geometric locations. We will adapt the HSY’s spatial-order method. Recall that each wavefront W (e) is represented by a list of generators, which are maintained in the leaves of a fully persistent balanced binary search tree T (e). We further assign each generator a “next bisector event,” which is the intersection of its two bounding bisectors (it is set to null if the two bisectors do not intersect). More specifically, for each bisector α, we assign it the intersection of the two bisectors B(α , α ) and B(α, α ),where α and α are α’s left and right neighboring gen- l r l r erators in W (e), respectively; we store the intersection at the leaf for α. Our algorithm maintains a variant that the next bisector event for each generator in W (e) has already been computed and stored in T (e). We further endow the tree T (e) with additional node fields so that each internal node stores a value that is equal to the minimum (respectively, maximum) x-coordinate (respec- tively, y-coordinate) among all bisector events stored at the leaves of the subtree rooted at the node. Using these extra values, we can find from a query range of generators the generator whose bisector event has the minimum/maximum x-or y-coordinate in logarithmic time. The propagation from W (e) to д through U is done cell by cell, where U is either U (e) or U (д). We start propagatingW (e) to the adjacent cell c of e inU to compute the wavefront passing through all edges of c. Then by using the computed wavefronts on the edges of c, we iteratively run the algorithm on cells ofU adjacent to c.AsU has O (1) cells, the propagation passes through O (1) cells. Hence, the essential ingredient of the algorithm is to propagate a single wavefront, say, W (e), across a single cell c with e on its boundary. Depending on whether c is an empty rectangle, there are two cases. 3.5.1 c Is an Empty Rectangle. We first consider the case where c is an empty rectangle—that is, there is no island inside c and c does not intersect any obstacle. Without loss of generality, we assume that e is an edge on the bottom side of c, and thus all generators of W (e) are below e.Our goal is to compute W (e,д) (i.e., the generators of W (e) claiming д) for all other edges д of c.Our algorithm is similar to the HSY algorithm in the high level, but the low-level implementations are quite different. The main difference is that each bisector in the HSY algorithm is of constant size, although this is not the case in our problem. Due to this, it takes constant time to compute the intersection of two bisectors in the HSY algorithm, whereas in our problem, this costs O (log n) time. The technical crux of the algorithm is to process the intersections in c among the bisectors of generators ofW (e). Since all generators ofW (e) are below e, their bisectors in c are y-monotone by Corollary 3.8. This is a critical property our algorithm relies on. Due to the property, we only need to compute W (e,д) for all edges д on the left, right, and top sides of c. Another helpful property is that sincewepropagate W (e) through e inside c, if a generator of α of W (e) claims a point q ∈ c, then the tangent from q to α must cross e; we refer to this as the propagation property. Due to this property, the points of c claimed by α must be to the right of the tangent ray from the left endpoint of e to α (the direction of the ray is from the tangent point to the left endpoint of e), as well as to the left of the tangent ray from the right endpoint of e to α (the direction of the ray is from the tangent point to the right endpoint of e). We call the former ray the left bounding ray of α and the latter the right bounding ray of α. As such, for the leftmost generator of W (e),weconsiderits left bounding ray as its left bounding bisector; similarly, for the rightmost generator of W (e),we consider its right bounding ray as its right bounding bisector. Starting from e, we use a horizontal line segment to sweep c upward until its top side. At any moment during the algorithm, the algorithm maintains a subset W () of generators of W (e) for by a balanced binary search tree T (); initially,W () = W (e) and T () = T (e).Let [x , x ]×[y ,y ] 1 2 1 2 denote the coordinates of c. Using the extra fields on the nodes of the tree T (), we compute a Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:23 maximal prefix W () (respectively, W ()) of generators of W () such that the bisector events 1 2 assigned to all generators in it have x-coordinates less than x (respectively, larger than x ). Let 1 2 W () be the remaining elements of W (). By definition, the first and last generators of W () m m have their bisector events with x-coordinates in [x , x ]. As all bisectors are y-monotone in c, 1 2 the lowest bisector intersection in c above  must be the “next bisector event” b associated with a generator in W (), which can be found in O (log n) time using the tree T (). We advance to the y-coordinate of b by removing the generator α associated with the event b.Finally,we recompute the next bisector events for the two neighbors of α in W (). Specifically, let α and α be the left and right neighboring generators of α in W (), respectively. We need to compute the intersection of the two bounding bisectors of α and update the bisector event of α to this l l intersection. Similarly, we need to compute the intersection of the bounding bisectors of α and update the bisector event of α to this intersection. Lemma 3.11 shows that each of these bisector intersections can be computed in O (log n) time by a bisector-bisector intersection operation, using the tentative prune-and-search technique of Kirkpatrick and Snoeyink [33]. Note that if α is the leftmost generator, then α becomes the leftmost after α is deleted, in which case we compute the left bounding ray of α as its left bounding generator. If α is the rightmost generator, the process is symmetric. Lemma 3.11 (Bisector-Bisector Intersection Operation). Each bisector-bisector intersection operation can be performed in O (log n) time. Proof. We are given a horizontal line  and three generators α , α ,and α below  such that 1 2 3 they claim points on  in this order. The goal is to compute the intersection of the two bisectors B(α , α ) and B(α , α ) above , or determine that such an intersection does not exist. Using the 1 2 2 3 tentative prune-and-search technique of Kirkpatrick and Snoeyink [33], we present an O (log n) time algorithm. To avoid the lengthy background explanation, we follow the notation in the work of Kirkpatrick and Snoeyink [33] without definition. We will rely on Theorem 3.9 in their work [ 33]. To this end, we need to define three continuous and decreasing functions f , д,and h. We define them in a way similar to Theorem 4.10 in their work [33] for finding a point equidistant to three convex polygons. Indeed, our problem may be considered as a weighted case of their problem because each point in the underlying chains of the generators has a weight that is equal to its weighted distance from its generator. Let A, B,and C be the underlying chains of α , α ,and α , respectively. 1 2 3 We parameterize over [0, 1] each of the three convex chains A, B,and C from one end to the other in clockwise order—that is, each value of [0, 1] corresponds to a slope of a tangent at a point on the chains. For each point a of A,wedefine f (a) to be the parameter of the point b ∈ B such that the tangent ray of A at a (following the designated direction) and the tangent ray of B at b intersect at a point on the bisector B(α , α ) (e.g., see Figure 17, left); if the tangent ray at a does 1 2 not intersect B(α , α ),thendefine f (a) = 1. In a similar manner, we define д(b) for b ∈ B with 1 2 respect to C and define h(c) for c ∈ C with respect to A. One can verify that all three functions are continuous and decreasing (the tangent at an obstacle vertex of the chains is not unique, but the issue can be handled [33]). The fixed-point of the composition of the three functions h · д · f corresponds to the intersection of B(α , α ) and B(α , α ), which can be computed by applying the 1 2 2 3 tentative prune-and-search algorithm of Theorem 3.9 [33]. To guarantee that the algorithm can be implemented in O (log n) time, since each of the chains A, B,and C is represented by an array, we need to show that given any a ∈ A and any b ∈ B,we can determine whether f (a) ≥ b in O (1) time. This can be done in the same way as in the proof of Lemma 3.10. Similarly, given any b ∈ B and c ∈ C, we can determine whether д(b) ≥ c in O (1) Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:24 H. Wang time, and given any c ∈ C and a ∈ A, we can determine whether h(c) ≥ a in O (1) time. Therefore, applying Theorem 3.9 [33] can compute the intersection of B(α , α ) and B(α , α ) in O (log n) time. 1 2 2 3 The preceding algorithm is based on the assumption that the intersection of the two bisectors exists. However, we do not know whether that is true or not. To determine it, we finally validate the solution as follows. Let q be the point returned by the algorithm. We compute the distances d(α ,q) for i = 1, 2, 3. The point q is a true bisector intersection if and only if the three distances are equal. Finally, we return q if and only if q is above. The algorithm finishes once  is at the top side of c. At this moment, no bisector events of W () are in c. Finally, we run the following wavefront splitting step to split W () to obtain W (e,д) for all edges д on the left, right, and top sides of c. Our algorithm relies on the following observation. Let ζ be the union of the left, top, and right sides of c. Lemma 3.12. The list of generators of W () are exactly those in W () claiming ζ in order. Proof. It suffices to show that during the sweeping algorithm whenever a bisector B(α , α ) of 1 2 two generators α and α intersects ζ , it will never intersect∂c again. Let q be such an intersection. 1 2 Let ζ , ζ ,and ζ be the left, top, and right sides of c, respectively. l t r If q is on ζ , then since both α and α are below e,theyare also below ζ . By Lemma 3.7, B(α , α ) t 1 2 t 1 2 will not intersect the supporting line of ζ again and thus will not intersect ∂c again. If q is on ζ , then we claim that both generators α and α are to the right of the supporting l 1 2 line  of ζ . Indeed, since both generators claim q, the bounding rays (i.e., the left bounding ray l l of the leftmost generator of W () and the right bounding ray of the rightmost generator of W () during the sweeping algorithm) guarantee the propagation property: the tangents from q to the two generators must cross e. Therefore, both generators must be to the right of . By Lemma 3.7, B(α , α ) will not intersect the supporting line of ζ again and thus will not intersect ∂c again. 1 2 l If q is on ζ , the analysis is similar to the preceding second case. In light of the preceding lemma, our wavefront splitting step algorithm for computing W (e,д) of all edges д ∈ ζ works as follows. Consider an edge д ∈ ζ . Without loss of generality, we assume that the points of ζ are clockwise around c so that we can talk about their relative order. Let p and p be the front and rear endpoints of д, respectively. Let α and α be the generators r r l l of W () claiming p and p , respectively. Then all generators of W () to the left of α including l r l α form the wavefront for all edges of ζ in the front of д; all generators of W () to the right of α including α form the wavefront for all edges of ζ after д; and all generators of W () between r r α and α including α and α form W (e,д). Hence, once α and α are known, W (e,д) can be l r l r l r obtained by splitting W () in O (log n) time. It remains to compute α and α . In the following, we l r only discuss how to compute the generator α since α can be computed analogously. l r Starting from the root v ofT (), we determine the intersection q between B(α , α ) and ζ,where 1 2 α is the rightmost generator in the left subtree of v and α is the leftmost generator of the right 1 2 subtree of v.If q is in the front of д on ζ , then we proceed to the right subtree of v; otherwise, we proceed to the left subtree of v. It is easy to see that the runtime of the algorithm is bounded by O (η · log n) time, where η is the time for computing q. In the HSY algorithm, each bisector is of constant size and an oracle is assumed to exist that can compute q in O (1) time. In our problem, since a bisector may not be of constant size, it is not clear how to bound η by O (1).But η can be bounded by O (log n) using the bisector-line intersection operation in Lemma 3.10.Thus, α can be computed in O (log n) time. However, this is not sufficient for our purpose, as this would lead to an overall O (n+h log h) time algorithm. We instead use the following binary search plus bisector tracing approach. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:25 During the wavefront expansion algorithm, for each pair of neighboring generators α = (A, a) and α = (A , a ) in a wavefront (e.g., W (e)), we maintain a special point z(α, α ) on the bisector B(α, α ). For example, in the preceding sweeping algorithm, whenever a generator α is deleted from W () at a bisector event b = B(α , α ) ∩ B(α, α ), its two neighbors α and α now become l r l r neighboring in W (). Then, we initialize z(α , α ) to b (the tangent points from b to α and α are l r l r also associated with b). During the algorithm, the point z(α , α ) will move on B(α, α ) further l r away from the two defining generators α and α and the movement will trace out the hyperbolic- arcs of the bisector. We call z(α, α ) the tracing-point of B(α, α ). Our algorithm maintains a variant that the tracing-point of each bisector of W () is below the sweeping line  (initially, the tracing- point of each bisector of W (e) is below e). With the help of the preceding z-points, we compute the generator α as follows. Like the preced- ing algorithm, starting from the root v of T (),let α and α be the two generators as defined pre- 1 2 viously. To compute the intersection q between B(α , α ) and ζ , we trace out the bisector B(α , α ) 1 2 1 2 by moving its tracing-point z(α , α ) upward (each time trace out a hyperbolic-arc of B(α , α )) 1 2 1 2 until the current tracing hyperbolic-arc intersects ζ at q.If q is in the front of e on ζ,thenwe proceed to the right subtree of v; otherwise, we proceed to the left subtree of v. AfterW (e,д) is obtained, we computeW (e,д ) for other edges д on ζ using the same algorithm as earlier. For the time analysis, observe that each bisector hyperbolic-arc will be traced out at most once in the wavefront splitting step for all edges of ζ because the tracing-point of each bisector will never move “backward.” This finishes the algorithm for propagating W (e) through the cell c. Except for the final wave- front splitting step, the algorithm runs in O((1+h ) log n) time, where h is the number of bisector c c events in c.Because c has O (1) edges, the wavefront splitting step takes O (log n+ n ) time, where n is the number of hyperbolic-arcs of bisectors that are traced out. 3.5.2 c Is Not an Empty Rectangle. We now discuss the case in which the cell c is not an empty rectangle. In this case, c has a square hole inside or/and the boundary of c contains obstacle edges. Without loss of generality, we assume that e is on the bottom side of c. If c contains a square hole, then we partition c into four subcells by cutting c with two lines par- allel to e, each passing through an edge of the hole. If c has obstacle edges on its boundary, recall that these obstacles edges belong to O (1) convex chains (each of which is a fragment of an elemen- tary chain); we further partition c by additional edges parallel to e so that each resulting subcell contains at most two convex chains, one on the left side and the other on the right side. Since ∂c has O (1) convex chains, O (1) additional edges are sufficient to partition c into O (1) subcells as earlier. Then, we propagate e through the subcells of c, one by one. In the following, we describe the algorithm for one such subcell. By slightly abusing the notation, we still use c to denote the subcell with e on its bottom side. Since ∂c has obstacle edges, the propagation algorithm becomes more complicated. As in the HSY algorithm, comparing with the algorithm for the previous case, there are two new bisector events: • First, a bisector may intersect a convex chain (and thus intersect an obstacle). The HSY al- gorithm does not explicitly compute these bisector events because such an oracle is not assumed to exist. In our algorithm, however, because the obstacles in our problem are polyg- onal, we can explicitly determine these events without any special assumption. This is also a reason that the high-level idea of our algorithm is simpler than the HSY algorithm. • Second, new generators may be created at the convex chains. We still sweep a horizontal line from e upward. Let W () be the current wavefront at some moment during the algorithm. Consider two neighboring generators α and α in W () with α on the left of α .Weuse 1 2 1 2 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:26 H. Wang Fig. 18. Illustrating the creation of a new generator at q . ζ to denote the convex chain on the left side of c.Let q be the tangent point on ζ of the l l common tangent between ζ and α , and let q be the tangent point on α (Figure 18). If l 1 1 d(α ,q ) < d(α ,q ), then a new generator α on ζ with initial vertex q and weight equal 1 2 l to d(α ,q ) is created (designated counterclockwise direction) and inserted into W () right before α . The bisector B(α, α ) is the ray emanating from q and extending away from q . 1 1 The region to the left of the ray has α as its predecessor. When the sweeping line  is at q , all wavelets in W () to the left of α have already collided with ζ and thus the first three 1 l generators of W () are α, α ,and α . 1 2 In what follows, we describe our sweeping algorithm to propagate W (e) through c.Webegin with an easier case where only the left side of c is a convex chain, denoted by ζ (and the right side is a vertical transparent edge, denoted by ζ ). We use ζ to denote the top side of c,which is r t a transparent edge. As in the previous case, we sweep a line from e upward until the top side ζ . During the algorithm, we maintain a list W () of generators by a balanced binary search tree T (). Initially, W () = W (e) and T () = T (e). We compute the intersection q of the convex chain ζ and the bisector B(α , α ), for the leftmost l 1 2 bisectors of α and α of W ().Wecallitthe bisector-chain intersection operation. The following 1 2 lemma shows that this operation can be performed in O (log n) time, by using the tentative prune- and-search technique of Kirkpatrick and Snoeyink [33]. Lemma 3.13 (Bisector-Chain Intersection Operation). Each bisector-chain intersection op- eration can be performed in O (log n) time. Proof. We are given a convex chain ζ above a horizontal line and two generators α = (A , a ) l 1 1 1 and α = (A , a ) below such that they claim points on in this order. The goal is to compute the 2 2 2 intersection of B(α , α ) and ζ , or determine that they do not intersect. In the following, using the 1 2 l tentative prune-and-search technique of Kirkpatrick and Snoeyink [33], we present an O (log n) time algorithm. To avoid the lengthy background explanation, we follow the notation in the work of Kirkpatrick and Snoeyink [33] without definition. We will rely on Theorem 3.9 in their work [ 33]. To this end, we need to define three continuous and decreasing functions f , д,and h. Suppose q is the intersection of B(α , α ) and ζ .Let p and p be the tangent points from q to A 1 2 l 1 2 1 and A , respectively. Then, qp (respectively, qp ) does not intersect ζ other than q. We determine 2 1 2 l the portion C of ζ such that for each point p ∈ C, its tangent to A does not intersect ζ other l 1 l than p. Hence, q ∈ C. C can be determined by computing the common tangents between ζ and A , which can be done in O (log n) time [21, 41]. In addition, we determine the portion B of A 1 2 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:27 Fig. 19. Illustrating the definitions of д(b) and h(c). such that the tangent ray at any point of B must intersect C. This can be done by computing the common tangents between C and A in O (log n) time [21, 41]. Let A = A . 2 1 We parameterize over [0, 1] each of the three convex chains A, B,and C from one end to the other in clockwise order—that is, each value of [0, 1] corresponds to a slope of a tangent at a point on the chains A and B, whereas each value of [0, 1] corresponds to a point of C. For each point a of A,wedefine f (a) to be the parameter of the point b ∈ B such that the tangent ray of A at a (following the designated direction of α ) and the tangent ray of B at b intersect at a point on the bisector B(α , α ) (e.g., see Figure 17, left); if the tangent ray at a does not intersect B(α , α ), 1 2 1 2 then define f (a) = 1. For each point b of B,define д(b) to be the parameter of the point c ∈ C such that cb is tangent to B at b (Figure 19, left); note that by the definition of B, the tangent ray from any point of B must intersect C and thus such a point c ∈ C must exist. For each point c ∈ C, define h(c) to be the parameter of the point of a ∈ A such that ac is tangent to A at a (e.g., see Figure 19, right); note that by the definition of C, such a point a ∈ A must exist and ac does not intersect C other than c. One can verify that all three functions are continuous and decreasing (the tangent at an obstacle vertex of the chains is not unique, but the issue can be handled [33]). The fixed-point of the composition of the three functions h · д · f corresponds to the intersection q of B(α , α ) and ζ , which can be computed by applying the tentative prune-and-search algorithm of 1 2 l Theorem 3.9 [33]. To make sure that the algorithm can be implemented in O (log n) time, since each convex chain is part of an elementary chain and thus is represented by an array, it suffices to show the following: (1) given any a ∈ A and any b ∈ B, whether f (a) ≥ b can be determined in O (1) time; (2) given any b ∈ B and any c ∈ C, whether д(b) ≥ c can be determined in O (1) time; and (3) given any c ∈ C and any a ∈ A, whether h(c) ≥ a can be determined in O (1) time. We prove them in the following. Indeed, for (1), it can be done in the same way as in the proof of Lemma 3.10. For (2), д(b) ≥ c if and only if c is to the right of the tangent ray of B at b, which can be easily determined in O (1) time. For (3), h(c) ≥ a if and only c is to the right of the tangent ray of A at a, which can be easily determined in O (1) time. Therefore, applying the tentative prune-and-search technique in Theorem 3.9 [33] can compute q in O (log n) time. Note that the preceding algorithm is based on the assumption that the intersec- tion of B(α , α ) and ζ exists. However, we do not know whether this is true or not. To determine 1 2 l that, we finally validate the solution as follows. Let q be the point returned by the algorithm. We first determine whether q ∈ ζ . If not, then the intersection does not exist. Otherwise, we further compute the two distances d(α ,q) for i = 1,2in O (log n) time. If the distances are equal, then q is the true intersection; otherwise, the intersection does not exist. If the intersection q of ζ and B(α , α ) does not exist, then we compute the tangent between l 1 2 ζ and α , which can be done in O (log n) time [41]; let q be the tangent point at ζ . Regardless of l 1 l Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:28 H. Wang whether q exists or not, we compute the lowest bisector intersection b in c above in the same way as in the algorithm for the previous case where c is an empty rectangle. Depending on whether q exists or not, we proceed as follows. For any point p in the plane, let y(p) denote the y-coordinate of p: (1) If q exists, then depending on whether y(q) ≤ y(b), there are two subcases. If y(q) ≤ y(b), then we process the bisector event q:remove α from W () and then recompute q, q ,and b. Otherwise, we process the bisector event at b in the same way as in the previous case and then recompute q, q ,and b. (2) If q does not exist, then depending on whether y(b) ≤ y(q ), there are two subcases. If y(b) ≤ y(q ), then we process the bisector event at b in the same way as before and then recompute q, q ,and b. Otherwise, we insert a new generator α = (A,q ) to W () as the leftmost generator, where A is the fragment of the elementary chain containing ζ from q counterclockwise to the end of the chain, and α is designated the counterclockwise direction of A and the weight of q is d(α ,q ) (e.g., see Figure 18). The ray from q in the direction from q to q is the bisector of α and α ,where q is the tangent point on α of the common 1 1 tangent between α and ζ . We initialize the tracing-point z(α, α ) of B(α, α ) to q . Finally, 1 l 1 1 we recompute q, q ,and b. Once the sweep line reaches the top side ζ of c, the algorithm stops. Finally, as in the previous case, we run a wavefront splitting step. Because the left side ζ consists of obstacle edges, we split W () to compute W (e,д) for all transparent edges д on the top side ζ and the right side ζ of c. t r The algorithm is the same as the previous case. The preceding discusses the case where only the left side ζ of c is a convex chain. For the general case where both the left and right sides of c are convex chains, the algorithm is similar. The difference is that we have to compute a point p corresponding to q and a pointp corresponding to q on the right side ζ of c. More specifically, p is the intersection of B(α , α ) with ζ ,where α r r 2 1 2 and α are the two rightmost generators of W.If p does not exist, then we compute the common tangent between ζ and α ,and p is the tangent point on ζ . r r In the following, if q does not exist, we let y(q) be ∞; otherwise, q is not needed and we let y(q ) be ∞. We apply the same convention to p and p .Wedefine b as the bisector event in the same way as before. In each step, we process the lowest point r of {q,q ,b,p,p }.If r is q or p,we process it in the same way as before for q.If r is q or p , we process it in the same way as before for q .If r is b, we process it in the same way as before. After processing r, we recompute the five points. Each step takes O (log n) time. After the sweep line  reaches the top side ζ of c, W () is W (e, ζ ) for the top side ζ of c because both the left and right sides of c are obstacle edges. Finally, t t we run the wavefront splitting step onW () to compute the wavefrontsW (e,д) for all transparent edges д on ζ . In summary, propagatingW (e) through c takes O((1+h )·log n+n ) time, where h is the num- c c c ber of bisector events (including both the bisector-bisector intersection events and the bisector- obstacle intersection events) and n is the number of hyperbolic-arcs of bisectors that are traced out in the wavefront splitting step. We use the following lemma to summarize the algorithm for both cases (i.e., regardless of whether c is an empty rectangle or not). Lemma 3.14. Suppose W (e) is a wavefront on a transparent edge of a cell c of the subdivision S . Then, W (e) can be propagated through c to all other transparent edges of c in O((1+ h ) log n + n ) c c time, where h is the number of bisector events (including both the bisector-bisector intersection events and bisector-obstacle intersection events) and n is the number of hyperbolic-arcs of bisectors that are traced out in the wavefront splitting step. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:29 3.6 Time Analysis In this section, we show that the running time of our wavefront expansion algorithm described previously is bounded by O (n + h logh). For this and also for the purpose of constructing the shortest path map SPM (s) later in Section 3.8, as in the HS algorithm, we mark generators in the way that if a generator α is involved in a true bisector event of SPM (s) (either a bisector- bisector intersection or a bisector-obstacle intersection) in a cell c of the subdivisionS ,then α is guaranteed to be in a set of marked generators for c (but a marked generator for c may not actually participate in a true bisector event in c). The generator marking rules are presented next, which are consistent with those in the HS algorithm: Generator marking rules: (1) For any generator α = (A, a), if its initial vertex a lies in a cell c,thenmark α in c. (2) Let e be a transparent edge and let W (e) be a wavefront coming from some generator α’s side of e. (a) If α claims an endpoint b of e inW (e), or if it would do so except for an artificial wavefront, then mark α in all cells c incident to b. (b) If α’s claim in W (e) is shortened or eliminated by an artificial wavelet, then mark α for c, where c is the cell having e as an edge and on α’s side of e. (3) Let e and д be two transparent edges with д ∈ output (e). Mark a generator α ofW (e) in both cells having e as an edge if one of the following cases happens: (a) α claims an endpoint of д in W (e,д). (b) α participates in a bisector event either during the wavefront propagation procedure for computing W (e,д) from W (e), or during the wavefront merging procedure for computing W (д).Notethat α is also considered to participate in a bisector event if its claim on д is shortened or eliminated by an artificial wavelet. (4) If a generator α of W (e) claims part of an obstacle edge during the wavefront propagation procedure for propagating W (e) toward output (e) (this includes the case in which α partic- ipates in a bisector-obstacle intersection event), then mark α in both cells having e as an edge. Note that each generator may be marked multiple times, and each mark applies to one instance of the generator. As such, when we say “the number of marked generators,” we mean the number of instances of the marked generators. Lemma 3.15. The total number of marked generators during the algorithm is at most O (h). Because the proof of Lemma 3.15 is quite technical and lengthy, we devote the entirety of Sec- tion 3.7 to it. In the rest of this section, we use Lemma 3.15 to show that the running time of our wavefront expansion algorithm is bounded by O (n + h logh). Our goal is to prove the following lemma. Lemma 3.16. The wavefront expansion algorithm runs in O(n + h logh) time and space. First of all, by Lemma 3.1, constructing the conforming subdivision S can be done in O (n + h logh) time and O (n) space. The wavefront expansion algorithm has two main subroutines: the wavefront merging proce- dure and the wavefront propagation procedure. The wavefront merging procedure is to construct W (e) based on W (f, e) for the edges f ∈ input (e). By Lemma 3.9, this step takes O((1+k) log n) time, where k is the total number of genera- tors in all wavefrontsW (f, e) that are absent fromW (e). According to the algorithm, if a generator α is absent from W (e), it must be deleted at a bisector event. Thus, α must be marked by Rule 3(b). Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:30 H. Wang Fig. 20. Illustrating the definitions of u, v, q,and o. Due to Lemma 3.15, the total sum of k in the entire algorithm is O (h). As such, the wavefront merging procedure in the entire algorithm takes O (h log n) time in total. The wavefront propagation procedure is to compute W (e,д) by propagating W (e) to all edges д ∈ output (e) either through U (д) or U (e). By Lemma 3.14, the running time of the proce- dure is O((1 + h ) log n + n ) time, where h is the number of bisector events (including both c c c the bisector-bisector intersection events and bisector-obstacle intersection events) and n is the number of hyperbolic-arcs of bisectors that are traced out in the wavefront splitting step. For each bisector-bisector intersection event, at least one involved generator is marked by Rule 3(b). For each bisector-obstacle intersection event, at least one involved generator is marked by Rule 4. Hence, by Lemma 3.15, the total sum of h in the entire algorithm is O (h). In addition, Lemma 3.17 shows that the total sum of n in the entire algorithm is O (n). Therefore, the wavefront propagation procedure in the entire algorithm takes O (n + h log n) time in total. Lemma 3.17. The total number of traced hyperbolic-arcs of the bisectors in the entire algorithm is O (n). Proof. First of all, notice that each extension bisector consists of a single hyperbolic-arc, which is on a straight line. As each generator is marked by Rule 1, by Lemma 3.15, the total number of generators created in the algorithm is O (h). Since each generator can define at most one extension bisector, the number of hyperbolic-arcs on extension bisectors is at most O (h). In the following, we focus on hyperbolic-arcs of non-extension bisectors. Instead of counting the number of traced hyperbolic-arcs, we will count the number of their endpoints. Consider a hyperbolic-arc endpoint o that is traced out. According to our algorithm, o is traced out during the wavefront propagation procedure for propagating W (e) to compute W (e,д) for some transparent edge e and д ∈ output (e).Suppose o belongs to a non-extension bisector B(α, α ) of two generators α and α in W (e).Then, o must be defined by an obstacle edge uv of either α or α —thatis, theray ρ(u,v) emanating from v along the direction from u to v (which is consis- tent with the designated direction of the generator that contains uv) hits B(α, α ) at o (Figure 20). Without loss of generality, we assume that uv belongs to α. In the following, we argue that uv can define O (1) hyperbolic-arc endpoints that are traced out during the entire algorithm (a hyperbolic- arc endpoint defined by uv is counted twice as it is traced out twice), which will prove Lemma 3.17, as there are O (n) obstacle edges in total. We first discuss some properties. Since o ∈ B(α, α ),both α and α claim o. As both generators are inW (e),the ray ρ(u,v) must cross e, say, at a point q (e.g., see Figure 20). Because o is traced out when we propagateW (e) to computeW (e,д), oq must be in eitherU (д) orU (e) (i.e., oq ⊆U (e)∪ U (д)). We call (e,д) the defining pair of o for uv. According to our algorithm, during the propaga- tion fromW (e) toд,uv defines only one hyperbolic-arc endpoint, because it is uniquely determined by the wavefront W (e). As such, to prove that uv can define O (1) hyperbolic-arc endpoints that Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:31 Fig. 21. Illustrating the definitions of u, v, q,and o. Fig. 22. The dashed (red) path is π (s,v), which W (e) crosses e at b. are traced out during the entire algorithm, it suffices to show that there are at most O (1) defining pairs for uv.Let Π denote the set of all such defining pairs. We prove |Π| = O (1) in the following. For each pair (e ,д ) ∈ Π, according to the preceding discussion, uv and (e ,д ) define a hyperbolic-arc endpoint o such that o is on the ray ρ(u,v) and vo crosses e at a point q . Without loss of generality, we assume that (e,д) is a pair that minimizes the length |vq |.Let W (e ) refer to the wavefront at e whose propagation to д traces out o . We partition Π into two subsets Π and Π ,where Π consists of all pairs (e ,д ) of Π such that 1 2 1 qo intersects e and Π = Π \ Π . Since oq ⊆U (e)∪U (д), each well-covering region contains 2 1 O (1) cells, and |output (e )| = O (1) for each transparent edge e ,the size of Π is O (1). For Π , we further partition it into two subsets Π and Π ,where Π consists of all pairs 2 21 22 21 (e ,д ) of Π such that e is in the well-covering region U (e ) of e or e ∈U (e) ∪U (д),and Π = Π \ Π . Since e is in U (e ) for a constant number of transparent edges e ,eachof U (e) 22 2 21 and U (д) contains O (1) cells, and |output (e )| = O (1) for each e , it holds that |Π | = O (1).In the following, we argue that Π = ∅, which will prove |Π| = O (1). Assume to the contrary that |Π |  ∅ and let (e ,д ) beapairof Π . Since (e ,д ) ∈ Π ,by 22 22 2 the definition of Π , e does not intersect oq. By the definition of e, vq\{q} does not intersect e . Recall that q is the intersection of e and ρ(u,v). Therefore, the points v, q, o, q ,and o appear on the ray ρ(u,v) in this order (Figure 21). Further, since (e ,д ) ∈ Π , by the definition of Π , 22 22 e is not inU (e ) and e is not inU (e)∪U (д). Without loss of generality, we assume that e is horizontal and the wavefront W (e ) is from below e (thus, v is below e while o is above e ). Let F be the modified free space by replacing e with an opaque edge of open endpoints. Since the generator in W (e ) that contains v claims q , π (s,q ) is a shortest path from s to q in F ,where π (s,q ) is the path following the wavefront W (e ). Since v is in the generator of W (e ) that claims q , v is the anchor of q in π (s,q )—that is, the edge of the path incident to q is vq .Let π (s,v) be the subpath of π (s,q ) between s and v.Then, π (s,v) is a shortest path from s to v in F . Recall that v is in the generator α of W (e).Let π (s,v) be the path from s to v following W (e) W (e).Weclaim that |π (s,v)| = |π (s,v)| (Figure 22). Assume to the contrary this is not true. W (e) Then, either |π (s,v)| < |π (s,v)| or |π (s,v)| < |π (s,v)|: W (e) W (e) • If |π (s,v)| < |π (s,v)|, then since π (s,v) is a shortest path from s to v in the W (e) W (e) modified free space by considering e as an opaque edge of open endpoints, π (s,v) must cross the interior of e. This means that π (s,q ) = π (s,v) ∪ vq crosses e twice. Because π (s,q ) is a shortest path in F and e ∈F , it cannot cross e twice, a contradiction. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:32 H. Wang Fig. 23. The dashed (red) path is π (s,v ), which crosses e at b. W (e) • If |π (s,v)| < |π (s,v)|, then since π (s,v) is a shortest path from s to v in F , the path W (e) π (s,v) cannotbein F and thus must cross the interior of e , say, at a point b (e.g., see W (e) Figure 21). Let π (s,b) be the subpath of π (s,v) between s and b.Let π (b,q ) W (e) W (e) W (e) be a shortest path from b to q along e by considering it as an opaque edge with open endpoints. Note that if b and q are on different sides of e ,then π (b,q ) must be through W (e) an open endpoint of e . It is not difficult to see that |π (b,q )|≤|e |.Let π (s,q ) be W (e) W (e) the concatenation of π (s,b) and π (b,q ). Hence, π (s,q ) is a path in F . Since W (e) W (e) W (e) π (s,q ) is a shortest path from s to q in F , it holds that |π (s,q )|≤|π (s,q )|. W (e) Notice that |π (s,q )| = |π (s,b)| + |π (b,q )|≤|π (s,v)| + |e | < W (e) W (e) W (e) W (e) |π (s,v)| + |e |. However,|π (s,q )| = |π (s,v)|+|vq |≥|π (s,v)|+|qq |.Weclaim that|qq |≥ 2|e |. Indeed, since e is outsideU (e ), q ∈ e,and q ∈ e , qq must cross ∂U (e ) at a point b .Bythe prop- erty of well-covering regions ofS ,|b q |≥ 2|e |. Since|qq |≥|b q |,weobtain|qq |≥ 2|e |. In light of the claim, we have |π (s,q )|≥|π (s,v)|+ 2|e | > |π (s,v)|+|e | > |π (s,q )|. W (e) But this incurs contradiction since |π (s,q )|≤|π (s,q )|. W (e) Therefore, |π (s,v)| = |π (s,v)| holds. W (e) As q  qo,wedefine p as a point on oq \{o} infinitely close to o (Figure 23). Hence, p ∈ vq . Since π (s,q ) = π (s,v)∪vq is a shortest path from s to q in F , π (s,v)∪vp is a shortest path from s to p to F . Recall that o is on the non-extension bisector B(α, α ) of two generators α and α in W (e) and v is on α.Let v be the anchor of o in α (e.g., see Figure 23). Since |π (s,v)| = |π (s,v)|,wehave W (e) |π (s,v)|+|vo| = |π (s,v)|+|vo| = |π (s,v )|+|v o|,where π (s,v ) is the path from s to W (e) W (e) W (e) v following W (e). By the definition of p and because B(α, α ) is a non-extension bisector, it holds that |π (s,v)| + |vp| > |π (s,v )| + |v p|.As |π (s,v)| = |π (s,v)|,wehave |π (s,v)| + W (e) W (e) W (e) |vp| > |π (s,v )|+|v p|. Since π (s,v)∪vp is a shortest path from s to p inF , π (s,v )∪v p W (e) W (e) cannotbeapath from s to p in F . Therefore, π (s,v ) ∪ v p must intersect the interior of e . W (e) We claim that v p cannot intersect e . Indeed, since v p is covered by the wavefront W (e) when W (e) propagates to д in either U (e) or U (д), v p is in U (e)∪U (д). Since (e ,д ) ∈ Π and by the definition of Π , e is not in U (e)∪U (д). Therefore, v p cannot intersect e . The preceding claim implies that π (s,v ) must intersect the interior of e at a point, W (e) say, b (e.g., see Figure 23). Let π (s,b) be the subpath of π (s,v ) between s and b.Let W (e) W (e) π (b,q ) be a path from b to q along e by considering e as an opaque edge of open W (e) endpoints. As discussed earlier, |π (b,q )|≤|e |. Hence, π (s,b) ∪ π (b,q ) is a W (e) W (e) W (e) Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:33 path in F , whose length is at most |π (s,b)| + |e|≤|π (s,v )| + |e |.However, W (e) W (e) |π (s,v )| + |v o| + |oq | = |π (s,v)| + |vo| + |oq | = |π (s,v)| + |vq |. Since (e ,д ) ∈ Π and W (e) 22 by the definition of Π , e is outsideU (e ).Because q ∈ e and ov crosses e at a point q ,bythe property of well-covering regions ofS , |q o| + |oq |≥ 2|e |. Therefore, we obtain |π (s,v)| + |vq | = |π (s,v )| + |v o| + |oq | W (e) ≥|π (s,v )| + |q o| + |oq | W (e) ≥|π (s,v )| + 2|e |≥|π (s,b)| + 2|e | W (e) W (e) > |π (s,b)| + |e |≥|π (s,b)| + |π (b,q )|. W (e) W (e) W (e) This means that π (s,b)∪ π (b,q ) is a path from s to q in F that is shorter than the path W (e) W (e) π (s,v)∪vq . But this incurs a contradiction, as π (s,v)∪vq is a shortest path from s to q in F . This completes the proof of the lemma. In summary, the total time of the wavefront expansion algorithm is O (n + h log n),whichis O (n + h logh). For the space complexity of the algorithm, since each wavefront W (e) is maintained by a persis- tent binary tree, each bisector event costs additional O (logh) space. As discussed earlier, the total sum of k+h in the entire algorithm, which is the total number of bisector events, is O (h).Thus,the space cost by persistent binary trees is O (h logh). The space used by other parts of the algorithm is O (n). Hence, the space complexity of the algorithm is O (n + h logh). This proves Lemma 3.16. 3.7 Proving Lemma 3.15 In this section, we prove Lemma 3.15. The proof follows the same strategy in the high level as that in the HS algorithm, although many details are different. We start with the following lemma. Lemma 3.18. Suppose Π is the set of pairs (e, B) of transparent edges e and bisectors B such that B crosses e in the wavefront W (e) of e during our wavefront expansion algorithm but the same crossing does not occur in SPM (s).Then, |Π| = O (h). Proof. Let α = (A , a ) and α = (A , a ) be the two generators of B. Recall that the well- 1 1 1 2 2 2 covering region U (e) of e is the union of O (1) cells of S and each cell has O (1) elementary chain fragments on its boundary. Hence,U (e) has O (1) convex chains on its boundary. Recall also that W (e) is computed by merging all contributing wavefronts W (f, e) for f ∈ input (e) in the wavefront merging procedure, and W (f, e) is computed by propagating W (f ) to e through U (e) in the wavefront propagation procedure. We first argue that the number of pairs (e, B) of Π in the case where at least one of α and α is 1 2 in U (e) is O (h). Indeed, according to our wavefront propagation procedure, if a subcell c ∈U (e) is an empty rectangle, then no new generators will be created when W (f ) is propagating through c; otherwise, although multiple generators may be created, at most two (one on each side of c)are in the wavefront existing c.As U (e) has O (1) cells and each cell may be partitioned into O (1) subcells during the wavefront propagation procedure, only O (1) generators of W (e) are inside U (e). Since each generator ofW (e) may define at most two bisectors in W (e) and the total number of transparent edges ofS is O (h), the number of pairs (e, B) of Π such that at least one generator of B is inU (e) is at most O (h). In the following, we assume that both α and α are outside U (e)—that is, their initial vertices 1 2 a and a are outside U (e).Let q be the intersection of B and e.Let π (a ,q) denote the path 1 2 1 from q to a following the tangent from q to A and then to a along A ;define π (a ,q) similarly. 1 1 1 1 2 Clearly, both α and α claim q in W (e). Since α is outside U (e), α must be in W (f ) for some 1 2 1 1 1 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:34 H. Wang Fig. 24. Illustrating q and q . Fig. 25. Illustrating the psuedo-triangle (q,q ,q ) 1 1 2 (the shaded region). transparent edge f of∂U (e) so that α ofW (e) is fromW (f , e). Since α is outsideU (e), π (a ,q) 1 1 1 1 1 must intersects f ,say,atpoint q (Figure 24), and π (q ,q) is inside U (e),where π (q ,q) is the 1 1 1 1 subpath of π (a ,q) between q and q. In addition, f is processed (for the wavefront propagation 1 1 1 procedure) earlier than e because W (f ) contributes to W (e). We claim that q is claimed by α in SPM (s). Assume to the contrary that this is not true. Then, 1 1 let π (s,q ) be a shortest path from s to q in the free space F : 1 1 • If π (s,q ) does not intersect e,then π (s,q ) is in the modified free space F by replacing e 1 1 with an opaque edge of open endpoints. Since α claims q on e, π = π (s, a )∪π (a ,q) is 1 W (e) 1 1 a shortest path from s to q in the modified free space F ,where π (s, a ) is the path from W (e) 1 s to a following the wavefront W (e). Since q is in π and q is not claimed by α in SPM (s), 1 1 1 1 if we replace the portion between s and q in π by π (s,q ), we obtain a shorter path from s 1 1 to q in F than π. But this incurs a contradiction since π is a shortest path from s to q in F . • If π (s,q ) intersects e,say,atapoint b, then since f ∈ ∂U (e) and thus 1 1 d(f , e) ≥ 2 · max{|f |,|e|} by the properties of the well-covering regions of S ,we 1 1 show in the following that e must be processed earlier than f , which incurs a contradiction because f is processed earlier than e. 1 3 Indeed, covertime(e) = d(s, e) + |e|≤ d(s,b) + ·|e| + |e| = d(s,b) + ·|e|.However, 2 2 1 1 covertime(f ) = d(s, f ) + |f |≥ d(s,q ) − ·|f | + |f | = d(s,b) + d(b,q ) + ·|f |. 1 1 1 1 1 1 1 1 2 2 Since f ∈ ∂U (e), b ∈ e,and q ∈ f , d(b,q ) ≥ d(f , e) ≥ 2·|e|. Hence, we obtain 1 1 1 1 1 covertime(f ) > covertime(e) and thus e must be processed earlier than f . 1 1 Therefore, q must be claimed by α in SPM (s). 1 1 We define f , q ,and π (q,q ) analogously with respect to α . Similarly, we can show that q is 2 2 2 2 2 claimed by α in SPM (s). For each f ∈ ∂U (e), the generators of W (f ) that are also in W (e) may not form a single subsequence of the generator list of W (e), but they must form a constant number of (maximal) subsequences. Indeed, sinceU (e) is the union of O (1) cells ofS , the number of islands inU (e) is O (1). Thus, the number of topologically different paths from f to e inU (e) is O (1); each such path will introduce at most one subsequence of generators of W (e) that are also from W (f ). Therefore, the generators ofW (f ) that are also inW (e) form O (1) subsequences of the generator list ofW (e). Since ∂U (e) has O (1) transparent edges, the generator list of W (e) can be partitioned into O (1) subsequences each of which is from W (f ) following topologically the same path for a single transparent edge f of∂U (e). Due to this property, we have the following observation: the number of pairs of adjacent generators of W (e) that are from different subsequences is O (1). Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:35 Due to the preceding observation, the number of pairs of edges f and f on ∂U (e) in the case 1 2 where f  f ,or f = f but π (q,q ) and π (q,q ) are topologically different in U (e) is only O (1). 1 2 1 2 1 2 Therefore, the total number of pairs (e, B) of Π in that case is O (h). In the following, it suffices to consider the case where f = f ,and π (q,q ) and π (q,q ) are topologically the same inU (e);for 1 2 1 2 reference purpose, we use Π to denote the subset of pairs (e, B) of Π with the preceding property. In the following, we prove |Π | = O (h). Let f = f = f . Since π (q,q ) and π (q,q ) are topologically the same in U (e),the region 1 2 1 2 bounded by π (q,q ), π (q,q ),and q q must be in U (e);wecallthe preceding region a pseudo- 1 2 1 2 triangle,for both π (q,q ) and π (q,q ) are convex chains, and we use (q,q ,q ) to denote it 1 2 1 2 (Figure 25). Because (e, B) is not an incident pair in SPM (s), the point q must be claimed by a different generator α in SPM (s), which must be from the side of e different than α and α .We 1 2 proved earlier that q is claimed by α and q is claimed by α in SPM (s). Hence, there must be at 1 1 2 2 least one bisector event in SPM (s) that lies in the interior of the pseudo-triangle (q,q ,q ). We 1 2 charge the early demise of B to any one of these bisector events in (p,q ,q ). 1 2 Note that the path π (q,q ) (respectively, π (q,q )) is in a shortest path from s to q following the 1 2 wavefront W (e) in the modified free space by replacing e with an opaque edge of open endpoints. Hence, if Π has other pairs (e, B ) whose first element is e, then the corresponding paths π (q,q ) and π (q,q ) of all these pairs are disjoint, and thus the corresponding pseudo-triangles (q,q ,q ) 2 1 2 are also disjoint in U (e). Hence, each bisector event of SPM (s) inside (q,q ,q ) is charged at 1 2 most once for all pairs of Π that have e as the first element. Since each cell of S belongs to the well-covering region U (e) of O (1) transparent edges e,eachbisectorevent of SPM (s) is charged O (1) times for all pairs of Π .Because SPM (s) has O (h) bisector events by Corollary 3.5,the number of pairs of Π is at most O (h). This completes the proof of the lemma. Armed with Lemma 3.18, we prove the subsequent five lemmas, which together lead to Lemma 3.15. Lemma 3.19. The total number of marked generators by Rule 2(a) and Rule 3 is O (h). Proof. Suppose α is a generator marked by Rule 2(a) for a transparent edge e.Then, α must be the first or last non-artificial generator of W (e). Hence, at most two generators of W (e) can be marked by Rule 2(a). AsS has O (h) transparent edges, the total number of generators marked by Rule 2(a) is O (h). Suppose α is a generator marked by Rule 3(a) for the two transparent edges (e,д) with д ∈ output (e). Since α claims an endpoint of д, α must be the first or last generator of W (e,д). Hence, at most two generators of W (e,д) can be marked by Rule 3(a). Since |output (e)| = O (1),atmost O (1) generators can be marked for the pairs of transparent edges with e as the first edge. Since S has O (h) transparent edges, the total number of generators marked by Rule 3(a) is O (h). Suppose α is a generator marked by Rule 3(b) for the two transparent edges (e,д) with д ∈ output (e).Notethat α is a generator inW (e). We assume that α is not the first or last non-artificial generators ofW (e); the first and last non-artificial generators of W (e), countered separately, sum to O (h) for all transparent edges e ofS .Let α and α be the two neighboring generators of α inW (e). 1 2 Thus, both α and α are non-artificial. We assume that the bisectors B(α , α ) and B(α, α ) intersect 1 2 1 2 e in SPM (s); by Lemma 3.18, there are only O (h) bisector and transparent edge intersections that appear in some wavefront but not in SPM (s). This is also due to that for any point p ∈ q q , the shortest path π (s, p) cannot intersect e; this can be proved by a similar 1 2 argument to the preceding for proving that q is claimed by α in SPM (s). This observation implies that α cannot claim 1 1 any points on q q in SPM (s). 1 2 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:36 H. Wang Since α is marked by Rule 3(b), at least one of B(α , α ) and B(α, α ) fails to reach the boundary of 1 2 D(e) during the algorithm, where D(e) is the union of cells through which W (e) is propagated to all edges д ∈ output (e).Notethat D(e) ⊆U (e) ∪  U (д ), which contains O (1) cells д ∈output (e) of S as |output (e)| = O (1) and the well-covering region of each transparent edge is the union of O (1) cells ofS ; in addition, each cell of D(e) is within a constant number of cells of e.Without loss of generality, we assume that B(α , α ) does not reach the boundary of D(e) and a bisector event on B(α , α ) is detected during the algorithm. The detected bisector event on B(α , α ) also implies that 1 1 an actual bisector event in SPM (s) happens to B(α , α ) no later than the detected event; we charge the marking of α to that bisector actual endpoint (i.e., a vertex) in SPM (s), and the endpoint is in D(e) because B(α , α ) intersects e in SPM (s). Since each cell of D(e) is within a constant number of cells of e, each cell of S belongs to D(e ) for a constant number of transparent edges e of S . Therefore, each vertex of SPM (s) is charged O (1) times. Since SPM (s) has O (h) vertices by Lemma 3.4, the total number of generators marked by Rule 3(b) is O (h). Lemma 3.20. The total number of marked generators by Rule 1 is O (h). Proof. According to our algorithm, generators are only created during the wavefront prop- agation procedure, which is to propagate W (e) to compute W (e,д) for all edges д ∈ output (e) through U,where U is U (e) or U (д). The procedure has two cases depending on whether a cell c of U is an empty rectangle. If c is an empty rectangle, then no generators will be created in c. Otherwise, c may be partitioned into O (1) subcells, each of which may have a convex chain on its left side and/or its right side. Let c be such a subcell. Without loss of generality, we assume that the current wavefront W is propagating in c from bottom to top. We consider the generators created on the left side ζ of c. According to our algorithm, a generator on ζ is created by the leftmost generator of the current wavefront W . As such, if the leftmost wavelet of W does not create a generator, then no generator on ζ will be created. Otherwise, let α be a generator created on ζ , which becomes the leftmost l l generator ofW at the point of creation. Let α be the right neighbor of α inW . According to our al- gorithm, if α does not involve in any bisector event in c—that is, the bisector B(α, α ) does not inter- sect any other bisector in c during the propagation of W in c, then no more new generators will be created on ζ . Otherwise, we charge the creation of α to the bisector event involving B(α, α );each such event can be charged at most twice (one for a generator on ζ and the other for a generator created on the right side of c). Recall that for each bisector event, a generator is marked by Rule 3(b). In light of the preceding discussion, since each cell of S belongs to the well-covering region U (e ) of O (1) transparent edges e , the total number of generators marked by Rule 1 is O (h)+O (k), where k is the total number of generators marked by Rule 3(b), which is O (h) by Lemma 3.19.The lemma thus follows. Lemma 3.21. The total number of marked generators by Rule 4 is O (h). Proof. Let α be the generator and e be the transparent edge specified in the rule statement. According to Rule 4, α is marked because it claims part of an obstacle edge during the wavefront propagation procedure for propagating W (e) to compute W (e,д) for edges д ∈ output (e).Asin the proof of Lemma 3.19,define D(e) as the union of cells through which W (e) is propagated to all edges д ∈ output (e).Recallthat D(e) contains O (1) cells of S , and each cell of D(e) is within a constant number of cells of e, which implies that each cell of S belongs to D(e ) for a constant number of transparent edges e of S . First of all, for the case where α is a generator created during the wavefront propagation pro- cedure, the total number of such marked generators is no more than the total number of marked generators by Rule 1, which is O (h) by Lemma 3.20. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:37 Second, for the case where α is the first or last generator in W (e), the total number of such generators is clearly O (h) sinceS has O (h) transparent edges e. Third, for the case where α claims a rectilinear extreme vertex, the total number of such marked generators is O (h). To see this, since D(e) has O (1) cells of S and each cell contains at most one rectilinear extreme vertex, D(e) contains O (1) rectilinear extreme vertices. Therefore, at most O (1) generators will be marked in D(e). Since each cell ofS belongs to D(e ) for O (1) transparent edges e of S and S contains O (h) transparent edges e, the total number of marked generators in this case is O (h). Finally, any Rule 4 marked generator α that does not belong to any of the preceding cases has the following property: α does not claim a rectilinear extreme vertex, and is not the first or last non-artificial generator in W (e), and is not a generator created in D(e).Let α beaneighborof α in W (e). Due to the preceding property, α is a non-artificial generator. We can assume that B(α , α ) intersects e in SPM (s); by Lemma 3.18, there are only O (h) bisector and transparent edge intersec- tions that appear in some wavefront but not in SPM (s). Hence, in SPM (s), B(α , α ) terminates in D(e), either on an obstacle edge or in a bisector event before reaching an obstacle edge. In either case, we charge the mark of α at e to this endpoint of B(α , α ) in SPM (s), which is vertex of SPM (s). Because each cell ofS belongs to D(e ) for a constant number of transparent edges e ofS ,each vertex of SPM (s) is charged at most O (1) times. As SPM (s) has O (h) vertices by Lemma 3.4,the total number of marked generators by Rule 4 is O (h). Lemma 3.22. The total number of marked generators by Rule 2(b) is O (h). Proof. Let α be the generator and e be the transparent edge specified in the rule statement. First of all, the total number of marked generators in the case where α is inU (e) is O (h),because the number of Rule 1 marked generators is O (h) by Lemma 3.20 and U (e) has O (1) cells. In the following, we consider the other case where α is outsideU (e). Since α is outside U (e), there is a transparent edge f on ∂U (e) (i.e., f ∈ input (e)) such that α is in W (f ) and it is in W (e) because W (f ) is propagated to e through U (e). Since α’s claim is shortened or eliminated by an artificial wavefront, there must be a bisector event involving α during the computation of W (f, e) from W (f ). Hence, α is also marked by Rule 3(b). We charge α to this Rule 3(b) mark for f . Since there are O (h) generators marked by Rule 3(b) by Lemma 3.19, the total number of marked generators of Rule 2(b) is O (h). 3.8 Computing the Shortest Path Map SPM(s) In this section, we compute the shortest path map SPM (s). To this end, we need to mark genera- tors following our rules during our wavefront merging and propagation procedures. As the total number of all marked generators is O (h), marking these generators does not change the running time of our algorithm asymptotically. In the following, we show that SPM (s) can be constructed in O (n + h logh) time with the help of the marked generators. In light of Lemma 3.6, we will focus on constructing SPM (s). We first show in Section 3.8.1 that the marked generators are sufficient in the sense that if a generator participates in a true bisector event of SPM (s) in a cell c of S ,then α must be marked in c. Then, we present the algorithm for constructing SPM (s), which consists of two main steps. The first main step is to identify all vertices of SPM (s) and the second one is to compute the edges of SPM (s) and assemble them to obtain SPM (s). The first main step is described in Section 3.8.2, whereas the second one is discussed in Section 3.8.3. 3.8.1 Correctness of the Marked Generators. In this section, we show that if a generator partic- ipates in a bisector event of SPM (s) in a cell c of S ,then α must be marked in c. Our algorithm Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:38 H. Wang in the next section for computing SPM (s) relies on this property. Our proof strategy again follows the high-level structure of the HS algorithm. We first prove the following lemma. Lemma 3.23. Let α be a generator in an approximate wavefront W (e) for some transparent edge e. Suppose there is a point p ∈ e that is claimed by α inW (e) but not in SPM (s) (because the approximate wavefront from the other side of e reaches p first). Then, α is marked in the cell c on α’s side of e. Proof. Assume to the contrary that α is not marked in c.Then, α must have two neighboring non-artificial generators α and α inW (e) since otherwise Rule 2 would apply. In addition, because 1 2 all transparent edges of∂U (e) are in output (e), the two bisectors B(α , α ) and B(α, α ) must exist 1 2 the well-covering regionU (e) of e through the same transparent edge д ∈ ∂U (e), since otherwise Rule 3 or 4 would apply. Further, the region R bounded by B(α , α ), B(α, α ), e,and д must be a 1 2 subset of U (e).Indeed,if R contains an island not in U (e),then α would claim an endpoint of a boundary edge of the island, in which case Rule 3 would apply. Let α = (A, a) be the true predecessor of p in SPM (s). Without loss of generality, we assume that e is horizontal and α is below e and thus α is above e.Let π (a,p) be the path from p along its tangent to A and then following A to a. We first consider the case where α is not in the interior of the well-covering regionU (e)—that is, the initial vertex a is not in the interior of U (e). Since R is a subset of of U (e) without non- U (e) islands, a is not in the interior of R and thus π (a,p) intersects ∂R,say,atapoint q.Inthe following, we argue that α has been involved in a bisector event detected by our algorithm and thus marked in c.Let д be the portion of д between its intersections with B(α , α ) and B(α, α ). 1 2 Depending on whether q ∈ д , there are two subcases: • If q ∈ д (Figure 26), then d(s,д) ≤ d(s, a) + |π (a,q)| + |д|/2, where π (a,q) is the subpath of π (a,p) between a and q. Hence, the time τ when artificial wavefronts originating from the endpoints of д cover д is no later than d(s,д)+|д|≤ d(s, a)+|π (a,q)|+ 3|д|/2. Because д ∈ ∂U (e), |pq|≥ 2 · max{|д|,|e|}. Hence, τ ≤ d(s, a) + |π (a,q)| + 3|д|/2 < d(s, a) + |π (a,q)|+|qp| = d(s, a)+|π (a,p)| < d (s,p),where d (s,p) is the length of the path W (e) W (e) from s to p following the wavefront W (e); the last inequality holds because α is the true predecessor of p while α is not. However, the time τ when the wavefront W (e) reaches an endpoint of e cannotbeearlier than d (s,p)−|e|. Hence, the wavelet from α cannot reach д earlier than d (s,p) − W (e) W (e) |e| + d(e,д) ≥ d (s,p) −|e| + 2|e|≥ d (s,p) + |e|, which is larger than τ since W (e) W (e) д τ < d (s,p) as proved previously. Therefore, by the time the wavelet from α reaches д W (e) д, the artificial wavelets of д have already covered д, eliminating the wavelet from α from reaching д.Thus, α must be marked by Rule 3(b). • If q  д ,then q is on one of the bisectors B(α , α ) and B(α, α ).Let π (s, a) be a shortest path 1 2 from s to a and let π (s,p) = π (s, a) ∪ π (a,p), which is a shortest path from s to p.If π (s,p) intersects д, then we can use the same analysis as earlier to show that the wavelet from α will be eliminated from reaching д by the artificial wavelets of д and thus α must be marked by Rule 3(b). In the following, we assume that π (s,p) does not intersect д. Without of loss of generality, we assume that q ∈ B(α , α ) (Figure 27). Since π (a,p) is a subpath of the shortest path π (s,p), every point of π (a,p) has α as its predecessor. As q ∈ π (a,p), the predecessor of q is α .Let π (s,q) be the subpath of π (s,p) between s and q, which is a shortest s-q path. Since π (s,p) does not intersect д, π (s,q) does not intersect д. Hence, π (s,q) is a shortest s-q path in the modified free space F by replacing д with an opaque edge of open endpoints. Therefore, during the wavefront propagation procedure for computing W (e,д) or during the wavefront merging procedure for computing W (д),the Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:39 Fig. 26. Illustrating the case where q ∈ д . Fig. 27. Illustrating the case where q ∈ B(α , α ). point q, which is on the bisector B(α , α ),mustbeclaimed by α . Hence, a bisector event must be detected for B(α , α ) during the computation of W (e,д) or W (д).Ineithercase, α must be marked by Rule 3(b). We next consider the case where α lies inside U (e)—that is, its initial vertex a is inside U (e). If a is not between the two bisectors B(α , α ) and B(α, α ),then π (a,p) must intersect one of the 1 2 bisectors and thus we can use a similar argument as in the preceding second case to show that α must be marked. Otherwise, a is in the region R. This implies that not all points in R are claimed by α when W (e) is propagating to д, and therefore a bisector event involving α must happen during the wavefront propagation procedure to propagate W (e) to compute W (e,д) and thus α is marked by Rule 3(b). With the help of the preceding lemma, we prove the following lemma. Lemma 3.24. If a generator α participates in a bisector event of SPM (s) in a cell c of S ,then α must be marked in c. Proof. If a bisector has an endpoint on an obstacle edge of c, it either emanates from an obstacle vertex a on the edge (i.e., the bisector is an extension bisector) or is defined by two generators that claim part of the opaque edge. In the first case, a is the initial vertex of a new created generator in c and thus the generator is marked by Rule 1. In the second case, both generators are marked by Rule 4. Let α be a generator that participates in a bisector event of SPM (s) in a cell c of S . Assume to the contrary that α is not marked for c. Then, by Rule 2(a), there must be transparent edges e and f on the boundary of c such that both W (e) and W (f ) contain the three consecutive generators α , α,and α . Without loss of generality, we assume thatW (e) enters c andW (f ) leaves c.Let R be 1 2 the region of c bounded by e, f , and the two bisectors B(α , α ) and B(α, α ) (Figure 28). The region 1 2 R must be a subset of c. Indeed, if R contains an island not in c,then α would claim an endpoint of a boundary edge of the island, in which case Rule 3 would apply. Since α participates in a bisector event of SPM (s) in c,atleast onepoint p in R is not claimed by α in SPM (s).Let α = (A, a) be the true predecessor of p. Note that the initial vertex a must be outside R since otherwise a bisector event involving α must happen when W (e) is propagating through c and thus α would be marked by Rule 3(b). Let π (a,p) be the path from p along its tangent to A and then following A to a. Since a is outside R and p is inside R, π (a,p) must intersect the boundary of R. Because α , α,and α are three consecutive generators of W (e), no generator other than α on 1 2 thesamesideof e as α claims any point of R.Thus, π (a,p) does not cross e.Let b and b be 1 2 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:40 H. Wang Fig. 28. Illustrating the proof of Lemma 3.24. the intersections of f with B(α , α ) and B(α, α ), respectively. Then, if α claims both b and b in 1 2 1 2 SPM (s),then π (a,p) cannot cross either bisector on∂R, and thus it must cross b b , say, at a point 1 2 q (e.g., see Figure 28). Note that q satisfies the hypothesis of Lemma 3.23, and thus α is marked for c.If α does not claim either b or b , then that point satisfies the hypothesis of Lemma 3.23 and 1 2 thus α is marked for c. 3.8.2 Computing the Vertices of SPM (s). In this section, we compute the vertices of SPM (s). The next section will compute the edges of SPM (s) and assemble them to obtain SPM (s). Computing Active Regions. Because the wavefronts are represented by persistent trees, after the preceding wavefront expansion algorithm finishes, the wavefronts W (e) for all transparent edges e of S are still available. In addition, for each cell c and each transparent edge e of c,asetof marked generators in W (e) are known. Using these marked generators, we first break c into active and inactive regions such that no vertices of SPM (s) lie in the inactive regions. Note that each unmarked generator does not participate in a bisector event in SPM (s) by Lemma 3.24.If α and α are neighboring generators on∂c such that one of them is marked while the other is unmarked, their bisector belongs to SPM (s). Therefore, all such generators are disjoint and they together partition c into regions such that each region is claimed only by marked generators or only by unmarked generators; the former regions are active while the latter are inactive. We can compute these active regions as follows. Since the wavefronts W (e) for all transparent edges e of c are available, the list of all generators ordered along the boundary of c is also available. For each pair of adjacent generators α and α ,if 1 2 one of them is marked and the other is unmarked, then we explicitly compute the portion of their bisector B(α , α ) in c. We describe the details of this step in the following. 1 2 First of all, observe that α and α must be from W (e) for the same transparent edge e of c, since 1 2 otherwise each generator must claim an endpoint of their own transparent edge and thus must have been marked by Rule 2(a). Without loss of generality, we assume that e is horizontal and both α and α are below e. Note that we cannot afford computing the entire bisector B(α , α ) 1 2 1 2 and then determining its portion in c because the running time would be proportional to the size of B(α , α )—that is, the number of hyperbolic-arcs of B(α , α ). Instead, we first compute 1 2 1 2 the intersection b of B(α , α ) and e, which can be done in O (log n) time by the bisection-line 1 2 intersection operation in Lemma 3.10.Notethat b is one endpoint of the portion of B(α , α ) in c. 1 2 To determine the other endpoint b , we do the following. Our goal is to compute b in O (|B |+log n) time, with B = B(α , α ) ∩ c. To this end, we could trace B in c from b, and for each hyperbolic- c 1 2 c arc of B , we determine whether it intersects ∂c.Recallthat ∂c consists of O (1) transparent edges Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:41 and at most O (1) convex chains. To achieve the desired runtime, we need to determine whether each hyperbolic-arc of B intersects ∂c in O (1) time. However, it is not clear to us whether this is possible as the size of each convex chain may not be of O (1) size. To circumvent the issue, we use the following strategy. Before tracing B , we first compute the intersection between B(α , α ) and c 1 2 each convex chain on ∂c, which can be done in O (log n) time by the bisector-chain intersection operation in Lemma 3.13. Among all intersections, let b be the closest one to α. Then, we start to trace B from b, for each hyperbolic-arc e , we determine whether e intersects each of the transparent edges of ∂c. If not, we further check whether e contains b .If b  e ,then e is in c and we continue the tracing; otherwise, b is b and we stop the algorithm. If e intersects at least one of the transparent edges of ∂c, then among all such intersections as well as b , b is the one closest to α, which can be determined in O (log n) time by computing their tangents to α.In this way, computing the portion of B(α , α ) in c can be done in O (log n+ n (α , α )) time, where 1 2 c 1 2 n (α , α ) is the number of hyperbolic-arcs of B(α , α ) in c. c 1 2 1 2 In this way, all active regions of c can be computed in O (h log n+n ) time, where h is the total c c c number of marked generators in the wavefronts W (e) of all transparent edges e of c and n is the total number of hyperbolic-arcs of the bisector boundaries of these active regions. Computing the Vertices of SPM (s) in Each Active Region. In what follows, we compute the vertices of SPM (s) in each active region R of c. The boundary ∂R consists of O (1) pieces, each of which is a transparent edge fragment, an elementary chain fragment, or a bisector in SPM (s). Unlike the HS algorithm, where each of these pieces is of O (1) size, in our problem both an elementary chain fragment and a bisector may not be of constant size. Let e be a transparent edge of R. Without loss of generality, we assume that e is horizontal and R is locally above e. Without considering other wavefronts, we use W (e) to partition R into subregions, called Voronoi faces, such that each face has a unique predecessor in W (e).Weuse Vor (e) to denote the partition of R.Notethatif α is the predecessor of a Voronoi face, then for each point p in the face, its tangent to α must cross e and we assign p a weight that is equal to d(α,p). In addition, it is possible that these faces together may not cover the entire R; for those points outside these faces, their weights are ∞. We now discuss how to compute the partition Vor (e). To this end, we can use our wavefront propagation procedure to propagate W (e) inside R.Toapply thealgorithm,oneissueisthatthe boundary of R may contain bisectors, which consists of hyperbolic-arcs instead of polygonal seg- ments. To circumvent the issue, an observation is that the bisectors of W (e) do not intersect the bisectors on ∂R. Indeed, for each bisector B of ∂R, one of its defining generators is unmarked and thus does not participate in any bisector event in c, and therefore B does not intersect any bisec- tor in c. In light of the observation, we can simply apply the wavefront propagation procedure to propagate W (e) to c instead of R to partition c into Voronoi faces, denoted by Vor (e).The pre- ceding observation implies that each bisector on the boundary of R must lie in a single face of Vor (e). Hence, we can simply cutVor (e) to obtainVor (e) using the bisectors on the boundary of c c R. When we apply the wavefront propagation procedure to propagate W (e) to c,hereweadd an initial step to compute the intersection of e and B(α, α ) for each pair of neighboring generators α and α of W (e) and use it as the initial tracing-point z(α, α ). Since each such intersection can be computed in O (log n) time by the bisector-line intersection operation in Lemma 3.10, this initial step takes O (h log n) time, where h is the number of generators of W (e). Hence, the total time e e for propagating W (e) into c to obtain Vor (e) is O (h log n+ n (e)),where n (e) is the number of c e B B hyperbolic-arcs of the bisectors of W (e) in c. After having Vor (e), cutting it to obtain Vor (e) can be easily done in O (h +n (e)+n ) time, where n is the number of hyperbolic-arcs on the bisec- e B R R tors of ∂R. Therefore, the total time for computing the partition Vor (e) is O (h log n+ n (e)+ n ) e B R Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:42 H. Wang time. Note that since the bisectors of∂R do not intersect any bisectors involving the generators of W (e), all bisector events of W (e) in c are actually in R. After having the partition Vor (e) for all transparent edges e of R, we can now compute vertices of SPM (s) in R. Consider a transparent edge e of∂R. We process it as follows. For each transparent edge f of ∂R other than e, we merge the two partitions Vor (e) and Vor (f ) by using the merge step from the standard divide-and-conquer Voronoi diagram algorithm to compute the subregion of R closer to W (e) than to W (f ). This can be done in O (h + n (e) + n + h + n (f )) time by e B R f B finding a finding a curve γ in R that consists of points equal to W (e) and W (f ), and the algorithm is similar to the HS algorithm. Intersecting the results for all such f produces the region R(e) claimed byW (e) in R. Intersecting R(e) with Vor (e) gives the vertices of SPM (s) in R that W (e) contributes. Repeating the preceding for all transparent edges e of ∂R gives the vertices of SPM (s) in R. Since ∂R has O (1) transparent edges, the total time is O (h log n + n (R) + n ),where h is the number of generators in all R B R R wavefronts of all transparent edges of∂R and n (R) is the total number of hyperbolic-arcs in R on the bisectors of all wavefronts of all transparent edges of ∂R. We do the preceding for all active regions R of c, then all vertices of SPM (s) in c can be computed. The total time is O (h log n+n (c)+n (c)),where h is the total number of marked generators in c R B c the wavefronts W (e) of all transparent edges e of c, n (c) is the total number of hyperbolic-arcs of the bisector boundaries of the active regions of c,and n (c) is the total number of hyperbolic-arcs in c on the bisectors of the wavefronts of all transparent edges of c. Processing all cells c of S as earlier gives all vertices of SPM (s). For the running time, the total sum of n (c) among all cells c ∈S is O (n) because each hyperbolic-arc of a bisector on the boundary of any active region also appears in SPM (s), whose total size is O (n) by Corollary 3.3. The total sum of h among all cells c is O (h) by Lemma 3.15. For n (c), Lemma 3.17 is essentially a proof that the total sum of n (c) over all B B cells c is O (n). To see this, since c is a cell incident to e, the wavefrontW (e) will be propagated into c during the wavefront propagation procedure to propagateW (e) to edges of output (e), and thus the hyperbolic-arcs of the bisectors of W (e) are counted in the proof analysis of Lemma 3.17.Insum- mary, the total time for computing all vertices of SPM (s) is O (n+ h log n),which is O (n+ h logh). 3.8.3 Constructing SPM (s). With all vertices of SPM (s) computed previously, as in the HS algo- rithm, we next compute the edges of SPM (s) separately and then assemble them to obtain SPM (s). One difference is that the HS algorithm uses a standard plane sweep algorithm to assemble all edges to obtain SPM (s), which takes O (n log n) time as there are O (n) edges in SPM (s).Toachieve the desired O (n + h logh) time bound, here instead we propose a different algorithm. We first discuss how to compute the edges of SPM (s), given the vertices of SPM (s).Recallthat each vertex v of SPM (s) is either an intersection between a bisector and an obstacle edge, or an intersection of bisectors. By our general position assumption, in the former case, v is in the interior of an obstacle edge; in the latter case, v is the intersection of three bisectors (i.e., a triple point). During our preceding algorithm for computing vertices of SPM (s), we associate each vertex v with the two generators of the bisector that contains v (more specifically, we associate v with the initial vertices of the generators). We create a list of all vertices of SPM (s), each identified by a key consisting of its two generators. If a vertex v is a triple point, then we put it in the list for three times (each time with a different pair of generators); if v is a bisector-obstacle intersection, then it is put in the list once. We now sort all vertices of SPM (s) with their keys; by traversing the sorted list, we can group together all vertices belong to the same bisector. This sorting takes O (h log n) time, as there are O (h) vertices in SPM (s). We take all SPM (s) vertices in the same bisector and sort them along the bisector determined by their weighted distances from the generators of the bisector (each of these distances can be computed in additional O (log n) time by computing the tangents from the vertex to the generators). Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:43 Fig. 29. Illustrating v, u, u , v , b ,and b. These sorting takes O (h log n) time altogether. The preceding computes the bisector edges e of SPM (s) that connect two adjacent vertices. In fact, each edge e is only implicitly determined in the sense that the hyperbolic-arcs of e are not explicitly computed. In addition, for each obstacle P, we sort all vertices of SPM (s) on ∂P to compute the convex chain edges of SPM (s) connecting adjacent vertices of SPM (s) on ∂P. This sorting can be easily done in O (n + h log n) time for all obstacles. For each vertex v of SPM (s), the preceding computes its adjacent vertices. As discussed earlier, due to the general position assumption, v has at most three adjacent vertices. We next define a set E(v) of at most three points for v. For each adjacent vertex u of v in SPM (s),let e(v,u) be the edge of SPM (s) connecting them. e(v,u) is either a bisector edge or a convex chain edge. In the former case, we refer to each hyperbolic-arc of e(v,u) as a piece of e(v,u); in the latter case, we refer to each obstacle edge of e(v,u) as a piece. If we traverse e(v,u) from v to u, the endpoint u of the first piece (incident to v) is added to E(v);wedefine h(u ) to be u. Since v is adjacenttoatmost three vertices in SPM (s), |E(v)|≤ 3. In fact, E(v) is exactly the set of vertices adjacent to v in the shortest path map SPM (s). With all edges of SPM (s) and the sets E(v) of all vertices v of SPM (s) computed previously, we construct the Doubly-Connected-Edge-List (DCEL) of SPM (s), as follows. For convenience, we assume that there is a bounding box that contains all obstacles so that no bisector edge of SPM (s) will go to infinity and thus each face of SPM (s) is bounded. For each vertex v of SPM (s), we store its coordinate in the DCEL data structure. As |E(v)|≤ 3, there are at most three faces in SPM (s) incident to v, and we construct them one by one. For each point u in E(v), we construct the face F clockwise (with respect to v) incident to the edge e(v,u) of SPM (s) connecting v and u = ϕ(u ), as follows (Figure 29). We first trace out the edge e(v,u), which is either a bisector edge or a convex chain edge. In the former case, we compute the hyperbolic-arcs of e(v,u), one at a time, until we reach u, and add them to the DCEL data structure. Each hyperbolic-arc can be computed in constant time using the two generators of the bisector. In the latter case, we trace out the obstacle edges of e(v,u), one at a time and add them to the DCEL data structure. Let v be the last endpoint of the piece of e(v,u) containing u (e.g., see Figure 29). Note that v is in the set E(u).Let b be the first point of E(u) counterclockwise around u after v (e.g., see Figure 29). Let b = ϕ(b ), which is a vertex of SPM (s) adjacent to u. Hence, the edge e(u,b) of SPM (s) connecting u to b is incident to the face F. We trace out the edge e(u,b) in the same way as earlier. When we reach b, we continue to trace the next edge of F.Sinceeachfaceof SPM (s) is bounded, eventually we will arrive back to the vertex v again. This finishes the construction of the face F. We do the same for all other faces of SPM (s), after which the DCEL data structure for We could lift the assumption that each face of SPM (s) is bounded in the following way. During the preceding algorithm for constructing F,if F is unbounded, then we will reach a bisector edge that extends to the infinity. If that happens, then we construct other edges of F from the other direction of v. More specifically, starting from the first point of E (v ) Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:44 H. Wang SPM (s) is constructed. For the running time, since each edge of SPM (s) is traced at most twice, by Corollary 3.3, the total time of the preceding procedure for constructing the DCEL data structure is O (n). In summary, SPM (s) can be computed in O (n + h logh) time. By Lemma 3.6, the shortest path map SPM (s) can be built in additional O (n) time. 3.9 Reducing the Space to O(n) The preceding provides an algorithm for computing SPM (s) in O (n+h logh) time and O (n+h logh) space. In this section, we reduce the space to O (n), using the technique given in prior work [48]. The reason that the preceding algorithm needs O (n+h logh) space is twofold. First, it uses fully persistent binary trees (with the path-copying method) to represent wavefronts W (e).Because there are O (h) bisector events in the wavefront expansion algorithm and each event costs O (log n) additional space on a persistent tree, the total space of the algorithm is O (n + h log n).Second, to construct SPM(s) after the wavefront expansion algorithm, the wavefronts W (e) of all transparent edges e of S are needed, which are maintained in those persistent trees. We resolve these two issues in the following way. 3.9.1 Reducing the Space of the Wavefront Expansion Algorithm. We still use persistent trees to represent wavefronts. However, as there are O (h) bisector events in total in the algorithm, we divide the algorithm into O (logh) phases so that each phase has no more than h/ logh events. The total additional space for processing the events using persistent trees in each phase is O (h). At the end of each phase, we “reset” the space of the algorithm by only storing a “snapshot” of the algorithm (and discarding all other used space) so that (1) the snapshot contains sufficient information for the subsequent algorithm to proceed as usual and (2) the total space of the snapshot is O (h). Specifically, we make the following changes to the wavefront propagation procedure, which is to compute the wavefronts W (e,д) for all edges д ∈ output (e) using the wavefront W (e).We now maintain a counter count to record the number of bisector events that have been processed so far since the last space reset; count = 0 initially. Consider a wavefront propagation procedure on the wavefront W (e) of a transparent edge e. The algorithm will compute W (e,д) for all edges д ∈ output (e), by propagating W (e). We apply the same algorithm as before. For each bisector event, we first do the same as before. Then, we increment count by 1. If count < h/ logh,we proceed as before (i.e., process the next event). Otherwise, we have reached the end of the current phase and will start a new phase. To do so, we first reset count = 0 and then reset the space by constructing and storing a snapshot of the algorithm (other space occupied by the algorithm is discarded), as follows: (1) Let д refer to the edge of output (e) whose W (e,д) is currently being computed in the al- gorithm. We store the tree that is currently being used to compute W (e,д) right after the preceding event. To do so, we can make a new tree by copying the newest version of the current persistent tree the algorithm is operating on. The size of the tree is bounded by O (h). We will usethistreeto“resume”computing W (e,д) in the subsequent algorithm. (2) For eachд ∈ output (e)\{д} whoseW (e,д ) has been computed, we store the tree forW (e,д ). We will use the tree to compute the wavefronts W (д ) of д in the subsequent algorithm. (3) We store the tree for the wavefront W (e). Note that the tree may have many versions due to processing the events and we only keep its original version for W (e). Hence, the size of clockwise around v after u ,wetraceouttheedges of F in the same way as earlier, until we reach a bisector edge that extends to the infinity, at which moment all edges of F are constructed. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:45 the tree is O (h). This tree will be used in the subsequent algorithm to compute W (e,д ) for those edges д ∈ output (e)\{д} whose W (e,д ) have not been computed yet. (4) We check every transparent edge e ofS with e  e.If e has been processed (i.e., the wave- front propagation procedure has been called on W (e )) and there is an edge д ∈ output (e ) that has not been processed, we know that W (e ,д ) has been computed and is available; we store the tree for W (e ,д ). We will use the tree to compute the wavefronts W (д ) of д in the subsequent algorithm. We refer to the wavefronts stored in the algorithm as the snapshot; intuitively, the snapshot contains all wavelets in the forefront of the wavelet expansion. By analysis similar to that in previ- ous work [48], we can show that the snapshot contains sufficient information for the subsequent algorithm to proceed as usual and the total space of the snapshot is O (h). For completeness, we pro- vide the details in the following. Before doing so, we give a remark about the wavefront merging procedure. The preceding discusses our changes to the wavefront propagation procedure. For the wavefront merging procedure, which is to constructW (e) fromW (f, e) for the edges f ∈ input (e), notice that we do not need the old versions of W (f, e) anymore after W (e) is constructed. There- fore, it is not necessary to use the path-copying method to process each event in the procedure. Hence, the total space needed in the wavefront merging procedure in the entire algorithm is O (n). The following lemma shows that if we discard all persistent trees currently used in the algorithm and instead store the snapshot, then the algorithm will proceed without any issues. The proof is literally the same as that in prior work [48] because it only relies on the high-level algorithm scheme not the implementation details. Lemma 3.25. The snapshot stores sufficient information for the subsequent algorithm to proceed as usual. Proof. Let ξ be the moment of the algorithm when the snapshot construction algorithm starts. Let ξ be any moment of the algorithm after the snapshot is constructed. We show in the follow- ing that if the algorithm needs any information that was computed before ξ to perform certain operation at ξ , then that information is guaranteed to be stored at the snapshot. This will prove the lemma. At ξ , the transparent edges of S excluding e can be classified into two categories: those that have already been processed at ξ and those that have not been processed. Let E and E denote the 1 2 sets of the edges in these two categories, respectively. The edge e is special in the sense that it is currently being processed at ξ . Hence, it does not belong to either set. At ξ , depending on whether the algorithm is in the wavefront merging procedure or in the wavefront propagation procedure, there are two cases, which are presented next. The Algorithm Is in the Wavefront Merging Procedure. Suppose the algorithm is in the wavefront merging procedure at ξ , which is to compute W (e ) for some edge e by merging all wavefronts W (f , e ) for f ∈ input (e ). Because at ξ we need some information that was computed before ξ , that information must be the wavefront W (f , e ) for some edge f ∈ input (e ). Depending on whether f = e, there are two subcases: • If f = e, then since W (e, e ) was computed before ξ , W (e, e ) is stored in the snapshot by Step (2) of the snapshot construction algorithm. • If f  e, then since W (f , e ) was computed before ξ,the edge f must have been pro- cessed at ξ . Because the algorithm is computing W (e ) at ξ , e has not been processed at ξ . Therefore, W (f , e ) is stored in the snapshot by Step (4) of the snapshot construction algorithm. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:46 H. Wang Hence, in either subcase, the information needed by the algorithm at ξ is stored at the snapshot. The Algorithm Is in the Wavefront Propagation Procedure. Suppose the algorithm is in the wave- front propagation procedure at ξ , which is to process a transparent edge e —that is, compute W (e ,д ) for some д ∈ output (e ). Because at ξ the algorithm needs some information that was computed before ξ to computeW (e ,д ),W (e ) must have been computed before ξ (sinceW (e ,д ) relies on W (e )). We claim that e must be e. Indeed, if e ∈ E ,then e has been processed before ξ and thus the wavefront propagation procedure cannot happen to e at ξ , a contradiction. If e ∈ E ,then e has not been processed at ξ . According to our algorithm, for any transparent edge e , W (e ) is computed during the wavefront merging procedure for e , which is immediately followed by the wavefront propagation procedure to process e . Since at ξ the algorithm is in the wavefront propagation procedure to process e, the wavefront merging procedure for e must have not been invoked at ξ , and thus W (e ) must have not been computed at ξ . This contradicts with the fact that W (e ) has been computed at ξ . Therefore, e must be e. Depending on whether д is д, there are two subcases: • If д = д, then the tree at the moment ξ during the propagation for computing W (e,д) from W (e) is stored in the snapshot by Step (1) of the snapshot construction algorithm, and thus we can use the tree to “resume” computing W (e,д) at ξ . • If д  д, then to compute W (e,д ) at ξ , we need the wavefront W (e), which is stored in the snapshot by Step (3) of the snapshot construction algorithm. Hence, in either subcase, the information needed by the algorithm at ξ is stored at the snapshot. The lemma thus follows. Bounding the space of the snapshot is more challenging, which is established in the following lemma. As the proof is lengthy and technical, we devote the next section to it. Lemma 3.26. The total space of the snapshot is O (h). Since each phase has no more than h/ logh wavefront propagation operations, the total ex- tra space introduced by the persistent trees in each phase is O (h). Due to the space-reset and Lemma 3.26, the total space of the algorithm is O (n). For the running time of our new algorithm, comparing with the original HS algorithm, we spend extra time on constructing the snapshot at the end of each phase. In light of Lemma 3.26,as S has O (h) transparent edges, each call of the snapshot construction algorithm takes O (h) time. As there are O (logh) phases, the total time on constructing the snapshots in the entire algorithm is O (h logh). Hence, the running time of our new algorithm is still bounded by O (n + h logh). 3.9.2 Proof of Lemma 3.26. We now prove Lemma 3.26—that is, the space introduced by the four steps of the snapshot construction algorithm is O (h). For the first step, as each wavefront has O (h) generators (and representing each generator takes O (1) space), the size of the tree representing the wavefront is O (h). For the second step, since |output (e)| = O (1) and the size of each W (e,д ) is O (h), the total space is O (h). For the third step, since |W (e)| = O (h),the spaceis O (h). In the following, we focus on the fourth step. Let Π denote the collection of pairs (e,д) whose wavefront W (e,д) is stored in the fourth step of the snapshot construction algorithm. Our goal is to show that |W (e,д)| = O (h). (e,д)∈Π For an edge e, Π may have multiple pairs with e as the first element and the second elements of all these pairs are in output (e); among all those pairs, we only keep the pair (e,д) such that |W (e,д)| is the largest in Π and remove all other pairs from Π. Since |output (e)| = O (1), it suffices to show that the total sum of|W (e,д)| for all pairs (e,д) in the new Π is O (h).Now in thenew Π,no Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:47 two pairs have the same first element. However, for an edge д, it is possible that there are multiple pairs in Π whose second elements are all д and their first elements are all from input (д); among all those pairs, we only keep the pair (e,д) such that |W (e,д)| is the largest in Π and remove all other pairs from Π. Since |input (д)| = O (1), it suffices to show that the total sum of |W (e,д)| for all pairs (e,д) in the new Π is O (h). Now in the new Π, no two pairs have the same first element and no two pairs have the same second element. As S has O (h) transparent edges, the size of Π is O (h). For each pair (e,д) ∈ Π,recallthat W (e,д) may have up to two artificial generators (i.e., the endpoints of e). Since |Π| = O (h), there are a total of O (h) artificial generators in W (e,д) for all pairs (e,д) ∈ Π. In the following discussion, we ignore these artificial generators, and by slightly abusing the notation, we use W (e,д) to refer to the remaining wavefront without the artificial generators. Hence, each generator of W (e,д) is on an elementary chain. It suffices to prove |W (e,д)| = O (h). (e,д)∈Π For any three adjacent generators α = (A , a ), α = (A , a ),and α = (A , a ) in a wavefront, 1 1 1 2 2 2 3 3 3 we call (α , α , α ) an adjacent-generator-triple. For two generators α = (A, a) and α = (A , a ),we 1 2 3 say that α  α if A  A , a  a , or the designated directions of A and A are not the same in the case A = A and a = a . Two adjacent-generator-triples (α , α , α ) and (α , α , α ) are distinct if 1 2 3 1 2 3 α  α from some i ∈{1, 2, 3}. We have the following observation. Observation 2. The number of distinct adjacent-generator-triples in all wavefronts involved in the entire wavefront expansion step of the algorithm is O (h). Proof. Initially, the algorithm starts a wavefront from s with only one generator s. Whenever a distinct adjacent-generator-triple is produced during the algorithm, either a bisector event hap- pens or a new generator is created. In either case, a generator will be marked according to our generator marking rules. As the total number of marked generators during the algorithm is O (h) by Lemma 3.15, the observation follows. Lemma 3.26 is almost an immediate consequence of the following lemma. Lemma 3.27. Any adjacent-generator-triple (α , α , α ) can appear in the wavefront W (e,д) for at 1 2 3 most O (1) pairs (e,д) of Π. Before proving Lemma 3.27, we prove Lemma 3.26 with the help of Lemma 3.27. Indeed, there are O (h) distinct adjacent-generator-triples in the entire algorithm by Observation 2.Now that each such triple can only appear in a constant number of wavefronts W (e,д) for all (e,д) ∈ Π,the total number of generators in all wavefronts W (e,д) for all (e,д) ∈ Π is bounded by O (h).This leads to Lemma 3.26. Proving Lemma 3.27. We prove Lemma 3.27 in the rest of this section. Assume to the contrary that an adjacent-generator-triple (α , α , α ) appears in the wavefront W (e,д) formorethan O (1) 1 2 3 pairs (e,д) of Π; let Π denote the set of all such pairs. Consider a pair (e,д) ∈ Π .Recallthat W (e,д) is obtained by propagating W (e) from e to д through the well-covering region U (д) if e ∈ input (д) and through U (e) otherwise. If one of the generator initial vertices a , a ,and a is in U (д) ∪U (e),thenwecall (e,д) a special pair. 1 2 3 The properties of the subdivision S guarantee that each cell of S is in U (f ) for at most O (1) transparent edges f of S , implying that each vertex a ,1 ≤ i ≤ 3, is in U (f ) for at most O (1) transparent edges f ofS , and thus Π has at most O (1) special pairs. We remove all special pairs from Π , after which Π still has more than O (1) pairs and for each pair (e,д) ∈ Π the initial By “more than O (1) pairs,” we intend to say “more than c pairs for a constant c to be fixed later.” To simplify the discussion, we use “more than O (1) pairs” instead with the understanding that such a constant c can be fixed. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:48 H. Wang vertices of the three generators α , α ,and α are all outside U (д)∪U (e). Therefore, α , α ,and 1 2 3 1 2 α are also generators in W (e) in this order (although they may not be adjacent in W (e)). Because (α , α , α ) is an adjacent-generator-triple in W (e,д), B(α , α ) (respectively, B(α , α )) intersects 1 2 3 1 2 2 3 д.Inaddition,notethat α , α ,and α are on the same side of the supporting line of e; since they 1 2 3 are generators of both W (e) and W (e,д), the bisector B(α , α ) (respectively, B(α , α )) intersects 1 2 2 3 e (although the intersection may not appear in W (e), i.e., the intersection may be claimed by a different generator in W (e)). Further, α is closer to the intersection of B(α , α ) (respectively, 2 1 2 B(α , α )) with e than with д.Let (e ,д ) be the pair in Π such that the intersection of B(α , α ) 2 3 1 1 1 2 with its first element is closest to α among the intersections of B(α , α ) with the first elements 2 1 2 of all pairs of Π . By the property ofS ,U (д )∪U (e ) contains O (1) transparent edges. Because |Π | is not O (1), 1 1 Π must have a pair, denoted by (e ,д ), such that e is outsideU (д )∪U (e ).RecallthatW (e ,д ) 2 2 2 1 1 1 1 is obtained by propagating W (e ) from e to д inside U (д ) or U (e ). Hence, if we move along 1 1 1 1 1 the bisector B(α , α ) from its intersection with e to its intersection with д , all encountered edges 1 2 1 1 ofS are inU (д )∪U (e ). Therefore, by the definitions of e and e , B(α , α ) intersects e , д , e , 1 1 1 2 1 2 1 1 2 and д in this order following their distances from α (Figure 30). 2 2 By definition (i.e., the fourth step of our snapshot construction algorithm), e has been processed but д has not. According to the wavefront expansion algorithm, covertime(e ) ≤ covertime(д ). 1 2 1 In the following, we will obtain covertime(e ) > covertime(д ), which leads to a contradiction. 2 1 Let b be the intersection between the bisector B(α , α ) and д (e.g., see Figure 30). Let π (b, a ) 1 2 2 2 be the path from b to a following the tangent from b to A and then following A to a (e.g., the 2 2 2 2 dashed segment in Figure 30). Since α and α are two adjacent generators in W (e ,д ), π (b, a ) 1 2 2 2 2 is in the free space F .As W (e ,д ) is obtained from W (e ) and α is also a generator in W (e ), 2 2 2 2 2 π (b, a ) must intersect e , say, at a point q (e.g., see Figure 30). Further, we have the following 2 2 observation. Observation 3. π (b, a ) intersects д (e.g., see Figure 30). 2 1 Proof. Since (α , α , α ) is an adjacent-generator-triple in both wavefronts W (e ,д ) and 1 2 3 1 1 W (e ,д ), each of the bisectors B(α , α ) and B(α , α ) intersects both д and д .Let z and z 2 2 1 2 2 3 1 2 1 2 be the intersections of д with B(α , α ) and B(α , α ), respectively. Let b be the intersection of 1 1 2 2 3 д and B(α , α ).Then, z z , which is a subsegment of д ,isclaimed by α in W (e ,д ). Similarly, 2 2 3 1 2 1 2 1 1 bb , which is a subsegment of д ,isclaimed by α in W (e ,д ).Recallthat α is closer to z than 2 2 2 2 2 1 to b. Hence, for any point p ∈ bb , π (p, α ) must intersect z z ,where π (p, α ) is defined in a way 2 1 2 2 similar to π (b, α ). This leads to the observation, for z z ⊆ д and b ∈ bb . 2 1 2 1 In light of the preceding observation, let z be an intersection point of π (b, a ) and д (e.g., see 2 1 Figure 30). For any two points p and p of π (b, a ),weuse π (p,p ) to refer to the subpath of π (b, a ) between p and p . Using the properties of the well-covering regions of S ,wehavethe following observation. Observation 4. |π (q, z)|≥ 2·|д |. Proof. Since q ∈ e is outside the well-covering region U (д ) of д , z ∈ д ,and π (q, z) is in 2 1 1 1 the free space F , π (q, z) must cross the boundary of U (д ), say, at a point p. By the property of the conforming subdivision S , |π (p, z)|≥ 2·|д |.As |π (q, z)|≥|π (p, z)|, the observation follows. The following lemma, which is a consequence of Observation 4, leads to a contradiction, for covertime(д ) ≥ covertime(e ), and thus Lemma 3.27 is proved. 1 2 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:49 Fig. 30. Illustrating the two bisectors B(α , α ) and Fig. 31. Illustrating the proof of Lemma 3.28. 1 2 B(α , α ) as well as the four transparent edges e , д , 2 3 1 1 e ,and д (each of these edges may also be vertical). 2 2 Lemma 3.28. covertime(д ) < covertime(e ). 1 2 Proof. Let x and y be the two endpoints of д , respectively. Let x and y be the two endpoints 1 1 1 2 2 of e , respectively. Refer to Figure 31.As π (z, a ) ⊆ π (b, a ) is in the free space F ,wehavethe 2 2 2 following for covertime(д ): covertime(д ) = min{d(s, x ),d(s,y )} + |д | 1 1 1 1 ≤ d(s, a ) + |π (a , z)| + |д |/2+ |д | 2 2 1 1 = d(s, a ) + |π (a , z)| + 3|д |/2. 2 2 1 However, because α claims b in W (e ,д ) (as explained in the proof of Observation 3), α 2 2 2 2 is also a generator in W (e ),and π (b, a ) intersects e at q, α must claim q in W (e ). Hence, 2 2 2 2 2 min{d(s, x ),d(s,y )}+|e |≥ d(s, a )+|π (a ,q)| must hold, since otherwise the artificial wavelets 2 2 2 2 2 at the endpoints of e would have prevented α from claiming q. Therefore, we have the following 2 2 for covertime(e ): covertime(e ) = min{d(s, x ),d(s,y )} + |e | 2 2 2 2 ≥ d(s, a ) + |π (a ,q)| 2 2 = d(s, a ) + |π (a , z)| + |π (z,q)| 2 2 ≥ d(s, a ) + |π (a , z)| + 2·|д |. 2 2 1 The last inequality is due to Observation 4.As |д | > 0, we obtain covertime(д ) < covertime(e ). 1 1 2 3.9.3 Reducing the Space of Constructing SPM (s). For the second issue of constructing SPM (s), our original algorithm relies on the wavefronts W (e) for all transparent edges e, which are main- tained by persistent trees. Due to the space-reset, our new algorithm does not maintain the wave- fronts anymore, and thus we need to somehow restore these wavefronts to construct SPM (s).To this end, a key observation is that by marking a total of O (h) additional wavelet generators, it is possible to restore all historical wavefronts that are needed for constructing SPM (s). In this way, SPM (s) can be constructed in O (n + h logh) time and O (n) space. More specifically, our algorithm considers each cell c of S individually. For each cell c,the algorithm has two steps. First, compute the active regions of c. Second, for each active region R, compute the vertices of SPM (s) in R. For both steps, our algorithm utilizes the wavefronts W (e) Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:50 H. Wang of the transparent edges e on the boundary of c. Due to the space-reset, the wavefronts W (e) are not available anymore in our new algorithm. We use the following strategy to resolve the issue. First, to compute the active regions in c, we need to know the bisectors B(α, α ) defined by an unmarked generator α and a marked generator α in the wavefrontsW (e) of the transparent edges e of c. Consider such a bisector B(α, α ). Observe that α and α must be from the same wavefront W (e) of a transparent edge e of c. Indeed, assume to the contrary that α is from W (e ) and α is from W (e ) of two different transparent edges e and e of c. Then, because α and α are adjacent 2 1 2 generators along the boundary of c, the wavelet of α inW (e ) must claim an endpoint of e and the 1 1 wavelet of α in W (e ) must claim an endpoint of e . Hence, both α and α are marked by Rule 2(a) 2 2 of the generator marking rules. But this incurs a contradiction, as α is unmarked. Therefore, α and α must be from the same wavefront W (e) and they are actually neighboring in W (e). Based on the preceding observation, we slightly modify our wavefront expansion algorithm as follows. In addition to our original marking rules, we add the following new rule: If a generator α in a wavefront W (e) is marked for a cell by the original rules during the algorithm, we also mark both neighboring generators of α in W (e). We call the generators marked by the new rule newly marked generators, whereas the generators marked by the original rules are called originally marked generators. If a generator is both newly marked and originally marked, we consider it as originally marked. As each generator has two neighbors in a wavefront, the total number of marked generators is still O (h). The newly marked generators and the originally marked generators are sufficient for computing all active regions of each cell c as before. Indeed, the active regions are decomposition of c by the bisectors of adjacent generators with one originally marked and the other newly marked in W (e) of the transparent edges e of c. Second, to compute the vertices of SPM (s) in each active region R of c, we need to restore the wavefronts W (e) of the transparent edges e on the boundary of R.Tothisend,the algorithmin the preceding first step determines a list L(e) of originally marked generators that claim e. It turns out that L(e) is exactly W (e), as shown next. Observation 5. L(e) = W (e). Proof. Since each generator of L(e) is marked for e and c, L(e) is a subset ofW (e). However, be- cause R is an active region, R is claimed by originally marked generators only. Since each generator of W (e) claims at least one point of e and e ⊆ R, all generators are originally marked. Therefore, all generators of W (e) are in L(e). The observation thus follows. In light of the preceding observation, the wavefronts W (e) for all transparent edges e of all active regions R of c can be restored once all active regions of c are computed in the first step. Subsequently, the same algorithm as before can be applied to compute the vertices of SPM (s) in R. When computing the partition Vor (e) of R,wepropagate W (e) using the wavefront propagation procedure, which uses persistent trees to representW (e). Since here we do not need to keep the old versions of W (e) anymore, we can use an ordinary balanced binary search tree (without the path- copying method) to represent W (e). In this way, processing each bisector event only introduces O (1) additional space. In summary, SPM (s) can now be constructed in O (n + h logh) time and O (n) space. 4 THE GENERAL CASE In this section, we extend our algorithm for the convex case in Section 3 to the general case where obstacles of P may not be convex. To this end, we resort to an extended corridor structure of P, which has been used to solve various problems in polygonal domains [4, 7–9, 29–31, 39]. The structure decomposes the free space F into three types of regions: an ocean M, O (h) canals,and O (n) bays. The details are given in the following. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:51 Fig. 32. Illustrating a triangulation of P with two obstacles. There are two junction triangles indicated by the large dots inside them, connected by three solid (red) curves. Removing the two junction triangles results in three corridors. 4.1 The Extended Corridor Structure Let Tri(P) denote an arbitrary triangulation of P.Let G(P) be the (planar) dual graph of Tri(P)— that is, each node of G(F ) corresponds to a triangle in Tri(P) and each edge connects two nodes of G(P) corresponding to two triangles sharing a triangulation diagonal of Tri(P). We compute a corridor graph G as follows. First, repeatedly remove every degree-1 node from G(P) until no such node remains. Second, repeatedly remove every degree-2 node from G(P) and replace its two incident edges by a single edge until no such node remains. The resulting graph is G (Figure 32), which has O (h) faces, nodes, and edges [31]. Each node of G corresponds to a triangle in Tri(P), which is called a junction triangle (e.g., see Figure 32). The removal of all junction triangles results in O (h) corridors (defined in the following), and each corridor corresponds to an edge of G. The boundary of a corridor C consists of four parts (Figure 33): (1) a boundary portion of an obstacle, from an obstacle vertex a to an obstacle vertex b; (2) a triangulation diagonal of a junction triangle from b to an obstacle vertex e; (3) a boundary portion of an obstacle from e to an obstacle vertex f ; and (4) a diagonal of a junction triangle from f to a. The two diagonals be and af are called the doors of C, and the other two parts of the boundary of C are the two sides of C.Note that C is a simple polygon. A point is in the interior of C if it is in C excluding the two doors. Let π (a,b) (respectively, π (e, f )) be the shortest path from a to b (respectively, e to f )in C. C C The region H bounded by π (a,b), π (e, f ), be,and fa is called an hourglass,whichis open if C C C π (a,b) ∩ π (e, f ) = ∅ and closed otherwise (see Figure 33). If H is open, then both π (a,b) and C C C C π (e, f ) are convex chains and called the sides of H ; otherwise, H consists of two “funnels” and C C C apath π = π (a,b)∩ π (e, f ) joining the two apices of the funnels, called the corridor path of C. C C C Each side of a funnel is also convex. LetM be the union of all O (h) junction triangles, open hourglasses, and funnels. We callM the ocean,whose boundary∂M consists of O (h) convex chains that are sides of open hourglasses and funnels. The other space of P (i.e.,P\M) is further partitioned into two types of regions—bays and canals—defined as follows. Consider the hourglass H of a corridor C. If H is open (see Figure 33), then H has two sides. Let S be a side of H . The obstacle vertices C C 1 C on S all lie on the same side of C.Let c and d be any two consecutive vertices on S such that cd 1 1 is not an obstacle edge of P (e.g., see Figure 33, left). The region enclosed by cd and the boundary portion of C between c and d is called a bay, denoted by bay(cd).Wecall cd the gate of bay(cd). If H is closed, let x and y be the two apices of the two funnels. Consider two consecutive vertices c and d on a side of a funnel such that cd is not an obstacle edge of P.If c and d are on the same side of the corridor C,then cd also defines a bay. Otherwise, either c or d is a funnel apex, say, c = x,and we call xd a canal gate at x = c (e.g., see Figure 33, right). Similarly, there is also a Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:52 H. Wang Fig. 33. Illustrating an open hourglass (left) and a closed one (right) with a corridor path connecting the apices x and y of the two funnels. The dashed segments are diagonals. The paths π (a,b) and π (e, f ) are C C marked by thick solid curves. A bay bay(cd) with gate cd (left) and a canal canal (x,y) with gates xd and yz (right) are also shown. canal gate at the other funnel apex y,say yz. The region of C between the two canal gates xd and yz is the canal of H , denoted by canal (x,y). Each bay or canal is a simple polygon. All bays and canals together constitute the spaceP\M. Each vertex of ∂M is a vertex of P and each edge of ∂M is either an edge of P or a gate of a bay/canal. Gates are common boundaries betweenM and bays/canals. AfterP is triangulated,M and all bays and canals can be obtained in O (n) time [31]. The reason that the extended corridor structure can help find a shortest path is the following. Suppose we want to find a shortest s-t path for two points s and t.Weconsider s and t as two special obstacles and build the extended corridor structure. If a shortest s-t path π (s, t) contains a point in the interior of a corridor C,then π (s, t) must cross both doors of C andstayinthe hourglasses of C, and further, if the hourglass is closed, then its corridor path must be contained in π (s, t). In fact, π (s, t) must be in the union of the oceanM and all corridor paths [31]. In light of the preceding properties, we propose the following algorithm. Let s be a given source point. By considering s as a special obstacle of P, we construct the extended corridor structure of P. Consider any query point t, which may be in the oceanM,abay bay(cd), or a canal canal (x,y): • If t ∈M, then the union ofM and all corridor paths contains a shortest s-t path. To handle this case, we will build a shortest path map SPM (M) inM with respecttothe unionofM and all corridor paths. In fact, SPM (M) is exactly the portion of SPM (s) inM (i.e., SPM (s)∩M). To build SPM (M), a key observation is that the boundary ∂M consists of O (h) convex chains. Therefore, we can easily adapt our previous algorithm for the convex case. However, the algorithm needs to be modified so that the corridor paths should be taken into consideration. Intuitively, corridor paths provide certain kind of “shortcuts” for wavefronts to propagate. • If t is in a bay bay(cd), then any shortest s-t path must cross its gate cd. To handle this case, we will extend SPM (M) into bay(cd) through the gate cd to construct the shortest path map in bay(cd)—that is, the portion of SPM (s) in bay(cd), SPM (s) ∩ bay(cd). • If t is in a canal canal (x,y), then any shortest s-t path must cross one of the two gates of the canal. To handle this case, we will extend SPM (M) into canal (x,y) through the two gates to construct the shortest path map in canal (x,y)—that is, the portion of SPM (s) in canal (x,y), SPM (s) ∩ canal (x,y). In the following, we first describe our algorithm for constructing SPM (M) in Section 4.2.We then expand SPM (M) into all bays in Section 4.3 and expand SPM (M) into all canals in Section 4.4. The algorithm for the canal case utilizes the bay case algorithm as a subroutine. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:53 4.2 Constructing the Shortest Path Map in the Ocean SPM (M) As the boundary of M consists of O (h) convex chains, we can apply and slightly modify our algorithm for the convex case. To do so, for each convex chain of ∂M, we define its rectilinear extreme vertices in the same way as before. Let V be the set of the rectilinear extreme vertices of all convex chains. Hence, |V| = O (h). In addition, to incorporate the corridor paths into the algorithm, we include the endpoints of each corridor path inV.Asthere are O (h) corridor paths, thesizeof V is still bounded by O (h). Note that each corridor path endpoint is also an endpoint of a convex chain of ∂M. We construct the conforming subdivision S based on the points of V and then insert the convex chains ofM intoS to obtainS . The algorithm is essentially the same as before. In addition, we make the following changes toS , which is mainly for incorporating the corridor paths into our wavefront expansion algorithm, as will be clear later. Let v be an endpoint of a corridor path π. Since v is in V, v is incident to O (1) transparent edges in S . For each such transparent edge e,if |π| < 2·|e|, then we divide e into two subedges such that the length of the one incident to v is equal to |π|/2; for each subedge, we set its well- covering region the same asU (e). Note that this does not affect the properties of S . In particular, each transparent edge e is still well-covered. This change guarantees the following property: for each corridor path π, |π|≥ 2·|e | holds, where e is any transparent edge ofS incident to either endpoint of π. For reference purposes, we refer to it as the corridor path length property. Next we apply the wavefront expansion algorithm. Here we need to incorporate the corridor paths into the algorithm. Intuitively, each corridor path provides a “shortcut” for the wavefront— that is, if a wavelet hits an endpoint of a corridor path, then the wavelet will come out of the corridor path from its other endpoint but with a delay of distance equal to the length of the corridor path. More details are given in the following. Since all corridor path endpoints are inV, they are vertices of transparent edges ofS .Consider an endpoint v of a corridor path π.Let u be the other endpoint of π. Recall that the wavefront prop- agation procedure forW (e) is to propagateW (e) to computeW (e,д) for all edges д ∈ output (e).In addition to the previous algorithm for the procedure, we also propagateW (e) through the corridor path π to u. This is done as follows. Recall that when e is processed, since v is an endpoint of e,the weighted distance of v through W (e) is equal to d(s,v). Hence, the wavefront W (e) hits u through π at time d(s,v) + |π|.Wethenupdate covertime(д) = min{covertime(д),d(s,v) + |π| + |д|},for each transparent edge д incident to u. We also set the wavefront W (e,д) consisting of the only wavelet with u as the generator with weight equal to d(s,v)+|π|. Since there are O (1) transparent edges д incident to u, the preceding additional step takes O (1) time, which does not change the time complexity of the overall algorithm asymptotically. The corridor path length property assures that if W (e) contributes to a wavefront W (д) at д,then e must be processed earlier than д.This guarantees the correctness of the algorithm. In this way, we can first construct a decomposition SPM (M) ofM in O (n+h logh) time and O (n) space, where SPM (M) is defined similarly as SPM (s) in Section 3. Then, by a similar algorithm as that for Lemma 3.6, SPM (M) can be obtained in additional O (n) time. 4.3 Expanding SPM (M) into All Bays We now expand SPM (M) into all bays in O (n + h logh) time and O (n) space. In fact, we expand SPM (M) to the bays. We process each bay individually. Consider a bay bay(cd) with gate cd. Without loss of generality, we assume that cd is horizontal, c is to the left of d,and bay(cd) is locally above cd. Let v ,v ,...,v be the vertices of SPM (M) on cd ordered from left to right (Figure 34). Let c = 1 2 m v and d = v . Hence, each v v is claimed by a generator α = (A , a ) for all i = 0, 1,...,m. 0 m+1 i i+1 i i i Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:54 H. Wang Fig. 34. Illustrating bay(cd) and the generators. The thick segments on obstacles are A , i = 0, 1,...,m. Let b and c be the tangent points on A and A fromv , respectively, for each i = 1, 2,...,m (e.g., i i i−1 i i see Figure 34). For v , only c is defined; for v , only b is defined. Observe that for any point 0 0 m+1 m+1 p ∈ v v , which is claimed by α , its tangent point on A must be on the portion of A between i i+1 i i i c and b and we use A to denote that portion. So with respect to bay(cd),weuse α = (A , a ) i i+1 i i i i to refer to the generator, where a refers to the one of c and b that is closer to a . Hence, for i i+1 i any point t ∈ bay(cd), any shortest path π (s, t) from s to t must be via one of the generators α for i = 0, 1,...,m. Consider the region R bounded by A for all i ∈ [0,m], the tangents from v to their generators for all i ∈ [0,m+ 1], and the boundary of the bay excluding its gate. Notice that R is a simple polygon. For any point t ∈ bay(cd), the preceding observation implies any shortest s-t path π (s, t) is the concatenation of a shortest path from s to a generator initial vertex a and the shortest path from a to t in R. According to the preceding discussion, expanding SPM (M) into bay(cd) is equivalent to the following weighted geodesic Voronoi diagram problem in a simple polygon: Partition R into cells with respect to the point sites a , a ,..., a (with weights equal to their geodesic distances to s) 0 1 such that all points in the same cell have the same closest site. Let n be the number of vertices in bay(cd) (the subscript “b” represents “bay”). Let n be the total number of obstacle vertices in A for all i ∈ [0,m] (the subscript “g” represents “generator”). Note that v for all i = 1,...,m are also vertices of R. Hence, the number of vertices of R is n + n + m. The preceding problem can b д be solved in O (m logm + n + n ) time by the techniques of Oh [40]. Indeed, given m point sites b д in a simple polygon P of n vertices, Oh [40] gave an algorithm that can compute the geodesic Voronoi diagram of the sites in P in O (n + m logm ) time and O (n + m ) space. Although the point sites in Oh’s problem do not have weights, our problem is essentially an intermediate step of Oh’s algorithm because all weighted point sites in our problem are on one side of cd. Therefore, we can run Oh’s algorithm from “the middle” and solve our problem in O (m logm + n + n ) b д and O (n + n ) space. In fact, our problem is a special case of Oh’s problem because there are no b д sites in bay(cd). For this reason, we propose our own algorithm to solve this special case and the algorithm is much simpler than Oh’s algorithm; our algorithm also runs in O (m logm + n + n ) b д and O (n + n + m) space. This also makes our work more self-contained. b д Before presenting the algorithm, we analyze the total time for processing all bays. Since SPM (M) has O (h) vertices, the total sum of m for all bays is O (h). The total sum of n for all bays is at most n. Notice that the obstacle edges on A are disjoint for different bays, and thus the Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:55 total sum of n for all bays is O (n). Hence, expanding SPM (M) to all bays takes O (n + h logh) time and O (n) space in total. The preceding actually only considers the case where the gate cd contains at least one vertex of SPM (M). It is possible that no vertex of SPM (M) is on cd, in which case the entire gate is claimed by one generator α of SPM (M). We can still define the region R in the same way. But now, R has only one weighted site and thus the geodesic Voronoi diagram problem becomes computing a shortest path map in the simple polygon R for a single source point. This problem can be solved in O (n + n ) time [20]; note that m = 0 in this case. Hence, the total time for processing all bays b д in this special case is O (n). 4.3.1 Solving the Special Weighted Geodesic Voronoi Diagram Problem. We present an algorithm for the preceding special case of the weighted geodesic Voronoi diagram problem, and the algo- rithm runs in O (m logm + n + n ) and O (n + n + m) space. b д b д If we consider all generators α for i = 0, 1,...,m as a wavefront at cd, denoted by W (cd),then our algorithm is essentially to propagate W (cd) inside bay(cd). To this end, we first triangulate bay(cd) and will use the triangulation to guide the wavefront propagation. Each time, we propa- gate the wavefront through a triangle. In the following, we first discuss how to propagate W (cd) through the triangle cda with cd as an edge and a as the third vertex. This is a somewhat special case, as cda is the first triangle the wavefront will propagate through, but the general case is quite similar. Recall that each convex chain A is represented by an array, and the generator list W (cd) is represented by a balanced binary search tree T (W (cd)). We build a point location data structure on the triangulation of bay(cd) in O (n ) time [16, 32] so that given any query point p,wecan determine the triangle that contains p in O (log n ) time. An an initialization step, we compute the intersection of the adjacent bisectors B(α , α ) and i−1 i B(α , α ) for all i = 1, 2,...,m − 1. Each intersection can be computed in O (log n ) time by i i+1 д the bisector-bisector intersection operation in Lemma 3.11. Computing all intersections takes O (m log n ) time. For each intersection q, called a bisector event, we use the point location data structure to find the triangle of the triangulation that contains q and store q in the triangle. Since all generators are outsidebay(cd), by Corollary 3.8, all bisectors are monotone with respect to the direction orthogonal to cd. Our algorithm for propagating the wavefront through cda is based on this property. We sort all bisector events in cda according to their perpendicular distances to the supporting line of cd. Then, we process these events in the same way as in our wavefront propagation procedure. Specifically, for each bisector event q of two bisectors B(α , α ) and B(α, α ), we process it as follows. Let α be the other neighboring generator of α than α,and let α be the other neighbor of α than α.Weremove α from the generator list. In addition, we remove the intersection of B(α , α ) and B(α , α ) from the triangle of bay(cd) that contains it; we do the same for the intersection of B(α , α ) and B(α , α ). Finally, we compute the intersection q of B(α , α ) with B(α , α ), and we use the point location data structure to find the triangle of bay(cd) that contains q and store q in the triangle. If q ∈ cda, then we insert it into the bisector event sorted list of cda.Wedothe same for B(α , α ) and B(α , α ). After all events in cda are processed, we split the current wavefront W at the vertex a.To this end, we first find the generator α of W that claims a. For this, we use the same algorithm as before—that is, binary search plus bisector tracing. So we need to maintain a tracing-point for each bisector as before (initially, we can set v as the tracing-point for B(α , α ), i = 1, 2,...,m). i i−1 i The correctness of the preceding algorithm for finding the generator α relies on the property of the following lemma. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:56 H. Wang Fig. 35. Illustrating the proof of Lemma 4.1. Lemma 4.1. The bisector B(α, α ) intersects ad ∪ ac at most once for any two bisectors of α and α of W (cd). Proof. Notethatwecannotapplythe result of Lemma 3.7 sincetodosoweneed to have ad and ac parallel to cd. But the proof is somewhat similar to that for Lemma 3.7. Assume to the contrary that B(α, α ) intersects ad∪ ac at two points, q and q .Let A and A be 1 2 the underlying arcs of α and α , respectively. Let v and u be the tangents points of q on A and 1 1 1 A , respectively (Figure 35). Let v and u be the tangents points of q on A and A , respectively. 2 2 2 Since both A and A are on one side of cd while ad ∪ ac is on the other side, if we move a point q from q to q on ad ∪ ac, the tangent from q to A will continuously change from q v to q v 1 2 1 1 2 2 and the tangent from q to A will continuously change from q u to q u . Therefore, either q u 1 1 2 2 1 1 intersects q v in their interiors or q v intersects q u in their interiors; without loss of generality, 2 2 1 1 2 2 we assume that it is the former case. Let p be the intersection of q u and q v (e.g., see Figure 35). 1 1 2 2 Since q ∈ B(α, α ), points of q u other than q have only one predecessor, which is α .As p ∈ q u 1 1 1 1 1 1 and p  q , p has only one predecessor α . Similarly, since q ∈ B(α, α ) and p ∈ q v , α is also p’s 1 2 2 2 predecessor. We thus obtain a contradiction. ∗ ∗ After α is found, depending on whether α is the first or last generator of W , there are three cases: (1) If α is not the first or last generator of W , then we split W into two wavefronts, one for ca and the other for ad.Todoso, we first splitthe binary tree T (W ) that represents the current ∗ ∗ wavefront W at α . Then, we do binary search on A to find the tangent point from a,where ∗ ∗ ∗ ∗ A is the underlying chain of α .Wealsosplit α into two at the tangent point of A —that is, split A into two chains that form two generators, one for ac and the other for ad (Figure 36). ∗ ∗ As A is represented by an array, splitting α can be performed in O (1) time by resetting the end indices of the chains in the array. This finishes the propagation algorithm in acd.The preceding splits W into two wavefronts, one for ac and the other for ad; we then propagate the wavefronts through ac and ad recursively. ∗ ∗ (2) If α is the first generator of W ,then α must be α —that is, the leftmost generator of W (cd). In this case, we do not need to split W . But we still need to split the generator α at the tangent point p of α from a. To find the tangent point p ,however,thistimewedonot 0 0 0 use binary search, as it is possible that we will need to do this for Ω(n ) vertices of bay(cd), which would take Ω(n log n ) time in total. Instead, we use the following approach. Recall b д that the vertex c = v connects to α by a tangent with tangent point c (e.g., see Figure 34), 0 0 0 and c is an endpoint of A . We traverse A from c to b —that is, the other endpoint of A ; 0 0 0 0 0 0 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:57 ∗ ∗ Fig. 36. Splitting the generator α . Assume that A is the convex chain from p to p with p as the initial 2 3 2 vertex of the generator. ap is tangent to A at p . After the split, the chain from p to p becomes a generator 1 1 3 1 withp as the initial vertex and the chain fromp top becomes another generator withp as the initial vertex. 1 1 2 2 Fig. 37. Illustrating the case for propagating the one-generator wavefront to R(ac). for each vertex, we check whether it is the tangent from a. In this way, p can be found in time linear in the number of vertices of A between c and the tangent point p (Figure 37). 0 0 After that, we still split α into two generators at p ; one is the only generator for ac and the 0 0 other becomes the first generator of the wavefront for ad. For ad, we propagate its wavefront through ad recursively. For ac, to propagate its wave- front through ac, since the wavefront has only one generator, we can simply apply the lin- ear time shortest path map algorithm for simple polygons [20]; we refer to this as the one- generator case. Indeed, ac partitions bay(cd) into two subpolygons and let R(ac) denote the one that does not contain cda (e.g., see Figure 37). Hence, all points of R(ac) are claimed by the only generator for ac, whose underlying chain A is the subchain of A from c to p and 0 0 whose initial vertex is p . Consider the region R (ac) bounded by cc , A , p a, and the bound- 0 0 0 ary of R(ac) excluding ac. It is a simple polygon with a single weighted source p . Therefore, our problem is equivalent to computing the shortest path map in R (ac) with respect to the source point p , which can be done in O (|R(ac)|+|A |) time [20], where |R(ac)| and |A | are the numbers of vertices of R(ac) and |A |, respectively. (3) If α is the last generator of W , the algorithm is symmetric to the preceding second case. The preceding describes our algorithm for propagating the wavefront W (cd) through the first triangle cda. Next, we discuss the general case where we propagate a wavefront W of more than one generator through an arbitrary triangle of the triangulation of bay(cd). For the sake of nota- tional convenience, we consider the problem of propagating the wavefront W (ad) at ad through ad into the region R(ad),where R(ad) is the one of the two subpolygons of bay(cd) partitioned by ad that does not contain cda.Let adb be the triangle in R(ad) with ad with as an edge—that is, b is the third vertex of the triangle. The algorithm for propagating W (ad) through adb is quite similar to the preceding. We first sort all bisector events in adb, following their perpendicular Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:58 H. Wang distances to the supporting line of ad. Then we process these events in the same way as before. After all events are processed, the wavefront is finally split at the vertex b. The preceding algorithm is for the case where ad is a triangulation diagonal. If ad is an obstacle edge, then the wavefront W (ad) stops at ad. Notice that each bisector of the wavefront W (ad) must intersect ad. For each bisector of the wavefront, starting from its current tracing-point, we trace it out until the current traced hyperbolic-arc intersects ad. The algorithm stops once all triangles are processed as previously. Time Analysis. We now analyze the time complexity. As discussed before, the initial step for computing the intersections of adjacent bisectors of the wavefrontW (cd) and locating the triangles containing them together takes O (m log(n + n )) time. During the entire algorithm, each traced д b bisector hyperbolic-arc belongs to the shortest path map in bay(cd) (i.e., the portion of SPM (s) in bay(cd)), whose size is O (n + n + m). Hence, the total time on the bisector tracing in the entire b д algorithm is O (n +n +m). For the one-generator case where only one generator is available for ac, b д the time for processing the subpolygon R(ac) is O (|R(ac)|+|A |). Notice that all such subpolygons R(ac) in the one-generator case are interior disjoint. Hence, the total sum of their sizes is O (n ).In addition, all such generator underlying chains A are also interior disjoint, and thus the total sum of their sizes is O (n ). Therefore, the overall time for processing the one-generator case subpolygons is O (n + n ). д b For the general case of processing a triangle of the triangulation, the total time for processing all events is O (m log(n + n )), where m is the number of events in , both valid and invalid. д b Each event is computed either in the initial step or after a generator is deleted. The total number of bisector events in the former case in the entire algorithm is at most m− 1. The total number in the latter case in the entire algorithm is no more than the number of generators that are deleted in the algorithm, which is at most m because once a generator is deleted it will never appear in any wavefront again. Hence, the total time for processing events in the entire algorithm is O (m log(n + n )). Once all events in are processed, we need to find the generator α of the current wavefront W that claims the third vertex b of the triangle, by binary search plus bisector tracing. The time is O (logm) plus the time for tracing the bisector hyperbolic-arcs. Hence, excluding the time for tracing the bisector hyperbolic-arcs, which has been counted previously, the total time for this operation in the entire algorithm is O (m logm),where m is the number of triangles the algorithm processed for the case where α is not the first or last generator. We will show later in Lemma 4.2 that m = O (m). ∗ ∗ After α is found, depending on whether α is the first or last generator of W , there are three ∗ ∗ cases. If α is not the first or last generator of W,thenwefind thetangent from b to α by binary search in O (log n ) time and split both W and α; otherwise, we find the tangent by a linear scan ∗ ∗ on α andonlyneed to split α . Splitting W takes O (logm) time while splitting a generator only takes O (1) time as discussed before. Therefore, the total time for splitting generators in the entire algorithm is O (n ),asthere are O (n ) triangles in the triangulation. If α is either the first or last b b generator of W , then a one-generator case subproblem will be produced and the time of the linear scan for finding the tangent is O (|A |),where A is the subchain of α that belongs to the one- generator case subproblem. As discussed earlier, all such A in all one-generator case subproblems are interior disjoint, and thus the total time on the linear scan in the entire algorithm is O (n ). Therefore, the total time for finding the tangent point and splitting W is O (m log n + n ) as д b m ≤ n . More specifically, sorting all events takes O (m logm ) time and processing each event takes O (log(n + n )) time. д b Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:59 Lemma 4.2. m ≤ m − 1. Proof. Initially W = W (cd), which consists of m generators. Each split operation splits a wave- frontW at a generator α into two wavefronts, each of which has at least two generators (such that both wavefronts contain α ). More specifically, if a wavefront of size k is split, then one wavefront has k generators and the other has k−k + 1 generators with k ≥ 2and k−k + 1 ≥ 2. The value m is equal to the number of all split operations in the algorithm. We use a tree structure T to characterize the split operations. The root of T corresponds to the initial generator sequence W (cd). Each split on a wavefront W corresponds to an internal node of T with two children corresponding to the two subsequences ofW after the split. Hence, m is equal to the number of internal nodes of T.Inthe worstcase, T has m leaves, each corresponding to two generators α and α for i = 0, 1,...,m. Since each internal node of T has two children and T has i i+1 at most m leaves, the number of internal nodes of T is at most m − 1. Therefore, m ≤ m − 1. With the preceding lemma, the total time of the algorithm is O (m log(n +n )+n +n ),which д b д b is O (m logm + n + n ) by similar analysis as Observation 1.The spaceis O (n + n + m), as no д b д b persistent data structures are used. 4.4 Expanding SPM (M) into All Canals Consider a canal canal (x,y) with two gates xd and yz. The goal is to expand the map SPM (M) into canal (x,y) through the two gates to obtain the shortest path map in the canal, denoted by SPM (canal (x,y)). The high-level scheme of the algorithm is similar in spirit to that for the L problem [9]. The algorithm has three main steps. First, we expand SPM (M) into canal (x,y) through the gate xd, by applying our algorithm for bays. Let SPM (canal (x,y)) denote the map of canal (x,y) obtained by the algorithm. Second, we expand SPM (M) into canal (x,y) through the gate yz by a similar algorithm as earlier; let SPM (canal (x,y)) denote the map of canal (x,y) obtained by the algorithm. Third, we merge the two maps SPM (canal (x,y)) and SPM (canal (x,y)) to obtain SPM (canal (x,y)). 1 2 This is done by using the merge step from the standard divide-and-conquer Voronoi diagram al- gorithm to compute the region closer to the generators at xd than those at yz. We will provide more details for this step in the following, and we will show that this step can be done in time linear in the total size of the two maps SPM (canal (x,y)) and SPM (canal (x,y)). Before doing so, 1 2 we analyze the complexities of the algorithm. The first step takes O (n + h logh) time for all canals. So does the second step. The third step takes linear time in the total size of SPM (canal (x,y)) and SPM (canal (x,y)). Since the total size 1 2 of the two maps over all canals is O (n), the total time of the third step for all canals is O (n).In summary, the time for computing the shortest path maps in all canals is O (n + h logh) and the space is O (n). In the following, we provide more details for the third step of the algorithm. Recall that x and y are the two endpoints of the corridor path π in canal (x,y).Itispossiblethat the shortest s-x path π (s, x) contains y or the shortest s-y path π (s,y) contains x. To determine that, we can simply check whether d(s, x) +|π| = d(s,y) and whether d(s,y) +|π| = d(s, x).Note that both d(s, x) and d(s,y) are available once SPM (M) is computed. We first consider the case where neither π (s, x) contains y nor π (s,y) contains x.Inthiscase, ∗ ∗ ∗ ∗ there must be a point p in π such that d(s, x)+|π (x,p )| = d(s,y)+|π (y,p )|,where π (x,p ) (re- ∗ ∗ spectively, π (y,p )) is the subpath of π between x (respectively, y)and p . We can easily find p in O (|π|) time. To merge the two maps SPM (canal (x,y)) and SPM (canal (x,y)) to obtain 1 2 SPM (canal (x,y)), we find a dividing curve Γ in canal (x,y) such that W (xd) claims all points of Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:60 H. Wang canal (x,y) on one side of Γ while W (yz) claims all points of canal (x,y) on the other side of Γ, where W (xd) is the set of generators of SPM (M) claiming xd (one may consider W (xd) is a wave- front) and W (yz) is the set of generators of SPM (M) claiming yz. The curve Γ consists of all points in canal (x,y) that have equal weighted distances toW (xd) andW (yz). Therefore, the point ∗ ∗ p must be on Γ. Starting from p , we can trace Γ out by walking simultaneously in the cells of the two maps SPM (canal (x,y)) and SPM (canal (x,y)). The running time is thus linear in the total 1 2 size of the two maps. We then consider the case where either π (s, x) contains y or π (s,y) contains x.Without loss of generality, we assume the latter case. We first check whether π (s,p) contains x for all points p on the gate yz. To do so, according to the definitions of corridor paths and gates of canals, for any point p ∈ yz, its shortest path to x in canal (x,y) is the concatenation of the corridor path π and yp. Hence, it suffices to check whether d(s, z) = d(s,y) + |yz|: • If yes, then all points of yz are claimed by the generators of W (xd) (in fact, they are claimed by x because for any point q ∈ xd and any point p ∈ yz, their shortest path in canal (x,y) is the concatenation of qx, π,and yp). Hence, all points in canal (x,y) are claimed by W (xd) and SPM (canal (x,y)) is SPM (canal (x,y)). • Otherwise, some points of yz are claimed by W (xd) while others are claimed by W (yz). As in the preceding case, we need to find a dividing curve Γ consisting of all points with equal weighted distances to W (xd) and W (yz). To this end, we again first find a point p in Γ. For this, since π (s,y) contains x, y is claimed by W (xd). However, since d(s, z) d(s,y)+|yz|, z is claimed byW (yz). Therefore, yz must contains a point p ∈ Γ. Such a point p can be found by traversing yz simultaneously in the cells of both SPM (canal (x,y)) and SPM (canal (x,y)). After p is found, we can again trace Γ out by walking simultaneously in the cells of SPM (canal (x,y)) and SPM (canal (x,y)). The running time is also linear in the 1 2 total size of the two maps. 4.5 Wrapping Things Up The following theorem summarizes our result. Theorem 4.3. SupposeP is a set of h pairwise disjoint polygonal obstacles with a total of n vertices in the plane and s is a source point. Assume that a triangulation of the free space is given. The shortest path map SPM (s) with respect to s can be constructed in O (n + h logh) time and O (n) space. Proof. Using the triangulation, we decompose the free space F into an ocean M, canals, and bays in O (n) time [31]. Then, the shortest path map SPM (M) in the ocean M can be constructed in O (n + h logh) time and O (n) space. Next, SPM (M) can be expanded into all bays and canals in additional O (n+ h logh) time and O (n) space. The shortest path map SPM (s) is thus obtained. The current best algorithms can compute a triangulation of the free space in O (n log n) time or 1+ϵ in O (n + h log h) time for any small ϵ > 0[2]. After SPM (s) is computed, by building a point location data structure [16, 32]on SPM (s) in ad- ditional O (n) time, given a query point t, the shortest path length from s to t can be computed in O (log n) time and a shortest s-t path can be produced in time linear in the number of edges of the path. Corollary 4.4. Suppose P is a set of h pairwise disjoint polygonal obstacles with a total of n vertices in the plane and s is a source point. Assume that a triangulation of the free space is given. A data structure of O (n) space can be constructed in O (n + h logh) time and O (n) space so that given Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. A New Algorithm for Euclidean Shortest Paths in the Plane 11:61 any query point t, the shortest path length from s to t can be computed in O (log n) time and a shortest s-t path can be produced in time linear in the number of edges of the path. REFERENCES [1] S. W. Bae and H. Wang. 2019. L shortest path queries in simple polygons. Theoretical Computer Science 790 (2019), 105–116. [2] R. Bar-Yehuda and B. Chazelle. 1994. Triangulating disjoint Jordan chains. International Journal of Computational Geometry and Applications 4, 4 (1994), 475–481. [3] D. Z. Chen, J. Hershberger, and H. Wang. 2013. Computing shortest paths amid convex pseudodisks. SIAM Journal on Computing 42, 3 (2013), 1158–1184. [4] D. Z. Chen, R. Inkulu, and H. Wang. 2016. Two-point L shortest path queries in the plane. Journal of Computational Geometry 1 (2016), 473–519. [5] D. Z. Chen, K. S. Klenk, and H.-Y. T. Tu. 2000. Shortest path queries among weighted obstacles in the rectilinear plane. SIAM Journal on Computing 29, 4 (2000), 1223–1246. [6] D. Z. Chen and H. Wang. 2015. Computing shortest paths among curved obstacles in the plane. ACM Transactions on Algorithms 11 (2015), Article 26. [7] D. Z. Chen and H. Wang. 2015. A new algorithm for computing visibility graphs of polygonal obstacles in the plane. Journal of Computational Geometry 6 (2015), 316–345. [8] D. Z. Chen and H. Wang. 2017. Computing the visibility polygon of an island in a polygonal domain. Algorithmica 77 (2017), 40–64. [9] D. Z. Chen and H. Wang. 2019. Computing L shortest paths among polygonal obstacles in the plane. Algorithmica 81 (2019), 2430–2483. [10] Y.-J. Chiang and J. S. B. Mitchell. 1999. Two-point Euclidean shortest path queries in the plane. In Proceedings of the Annual ACM-SIAM Symposium on Discrete Algorithms (SODA’99). 215–224. [11] K. L. Clarkson, R. Cole, and R. E. Tarjan. 1992. Randomized parallel algorithms for trapezoidal diagrams. International Journal of Computational Geometry and Application 2 (1992), 117–133. [12] K. Clarkson, S. Kapoor, and P. Vaidya. 1987. Rectilinear shortest paths through polygonal obstacles in O (n log n) time. In Proceedings of the 3rd Annual Symposium on Computational Geometry (SoCG’87). 251–257. 2/3 [13] K. Clarkson, S. Kapoor, and P. Vaidya. 1988. Rectilinear shortest paths through polygonal obstacles in O (n log n) time. Manuscript. [14] P. J. de Rezende, D. T. Lee, and Y. F. Wu. 1989. Rectilinear shortest paths in the presence of rectangular barriers. Discrete and Computational Geometry 4 (1989), 41–53. [15] E. D. Demaine, J. S. B. Mitchell, and J. O’Rourke. 2020. The Open Problems Project. Retrieved January 23, 2023 from https://topp.openproblem.net/. [16] H. Edelsbrunner, L. Guibas, and J. Stolfi. 1986. Optimal point location in a monotone subdivision. SIAM Journal on Computing 15, 2 (1986), 317–340. [17] S. D. Eriksson-Bique, J. Hershberger, V. Polishchuk, B. Speckmann, S. Suri, T. Talvitie, K. Verbeek, and H. Yıldız. 2015. Geometric k shortest paths. In Proceedings of the 26th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA’15). 1616–1625. [18] S. K. Ghosh and D. M. Mount. 1991. An output-sensitive algorithm for computing visibility graphs. SIAM Journal on Computing 20, 5 (1991), 888–910. [19] L. J. Guibas and J. Hershberger. 1989. Optimal shortest path queries in a simple polygon. Journal of Computer and System Sciences 39, 2 (1989), 126–152. [20] L. J. Guibas, J. Hershberger, D. Leven, M. Sharir, and R. E. Tarjan. 1987. Linear-time algorithms for visibility and shortest path problems inside triangulated simple polygons. Algorithmica 2, 1-4 (1987), 209–233. [21] L. Guibas, J. Hershberger, and J. Snoeyink. 1991. Compact interval trees: A data structure for convex hulls. Interna- tional Journal of Computational Geometry and Applications 1, 1 (1991), 1–22. [22] J. Hershberger. 1991. A new data structure for shortest path queries in a simple polygon. Information Processing Letters 38, 5 (1991), 231–235. [23] J. Hershberger, V. Polishchuk, B. Speckmann, and T. Talvitie. 2014. Geometric kth shortest paths. In Proceedings of the 30th Annual Symposium on Computational Geometry (SoCG’14). Article 96, 2 pages. http://www.computational- geometry.org/SoCG-videos/socg14video/ksp/applet/index.html. [24] J. Hershberger and J. Snoeyink. 1994. Computing minimum length paths of a given homotopy class. Computational Geometry: Theory and Applications 4 (1994), 63–97. [25] J. Hershberger and S. Suri. 1999. An optimal algorithm for Euclidean shortest paths in the plane. SIAM Journal on Computing 28 (1999), 2215–2256. Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023. 11:62 H. Wang [26] J. Hershberger, S. Suri, and H. Yıldız. 2013. A near-optimal algorithm for shortest paths among curved obstacles in the plane. In Proceedings of the 29th Annual Symposium on Computational Geometry (SoCG’13). 359–368. [27] S. Hertel and K. Mehlhorn. 1985. Fast triangulation of the plane with respect to simple polygons. Information and Control 64 (1985), 52–76. [28] R. Inkulu, S. Kapoor, and S. N. Maheshwari. 2010. A near optimal algorithm for finding Euclidean shortest path in polygonal domain. arXiv:1011.6481v1 (2010). [29] S. Kapoor and S. N. Maheshwari. 1988. Efficient algorithms for Euclidean shortest path and visibility problems with polygonal obstacles. In Proceedings of the 4th Annual ACM Symposium on Computational Geometry (SoCG’88). 172–182. [30] S. Kapoor and S. N. Maheshwari. 2000. Efficiently constructing the visibility graph of a simple polygon with obstacles. SIAM Journal on Computing 30, 3 (2000), 847–871. [31] S. Kapoor, S. N. Maheshwari, and J. S. B. Mitchell. 1997. An efficient algorithm for Euclidean shortest paths among polygonal obstacles in the plane. Discrete and Computational Geometry 18 (1997), 377–383. [32] D. Kirkpatrick. 1983. Optimal search in planar subdivisions. SIAM Journal on Computing 12 (1983), 28–35. [33] D. Kirkpatrick and J. Snoeyink. 1995. Tentative prune-and-search for computing fixed-points with applications to geometric computation. Fundamenta Informaticae 22 (1995), 353–370. [34] D. T. Lee and F. P. Preparata. 1984. Euclidean shortest paths in the presence of rectilinear barriers. Networks 14 (1984), 393–410. [35] J. S. B. Mitchell. 1989. An optimal algorithm for shortest rectilinear paths among obstacles. In Abstracts of the 1st Canadian Conference on Computational Geometry. [36] J. S. B. Mitchell. 1991. A new algorithm for shortest paths among obstacles in the plane. Annals of Mathematics and Artificial Intelligence 3 (1991), 83–105. [37] J. S. B. Mitchell. 1992. L shortest paths among polygonal obstacles in the plane. Algorithmica 8 (1992), 55–88. [38] J. S. B. Mitchell. 1996. Shortest paths among obstacles in the plane. International Journal of Computational Geometry and Applications 6 (1996), 309–332. [39] J. S. B. Mitchell and S. Suri. 1995. Separation and approximation of polyhedral objects. Computational Geometry: Theory and Applications 5 (1995), 95–114. [40] E. Oh. 2019. Optimal algorithm for geodesic nearest-point Voronoi diagrams in simple polygons. In Proceedings of the 20th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA’19). 391–409. [41] M. Overmars and J. van Leeuwen. 1981. Maintenance of configurations in the plane. Journal of Computer and System Sciences 23 (1981), 166–204. [42] H. Rohnert. 1986. Shortest paths in the plane with convex polygonal obstacles. Information Processing Letters 23 (1986), 71–76. [43] N. Sarnak and R. E. Tarjan. 1986. Planar point location using persistent search trees. Communications of the ACM 29 (1986), 669–679. [44] M. Sharir and A. Schorr. 1986. On shortest paths in polyhedral spaces. SIAM Journal on Computing 15 (1986), 193–215. [45] J. A. Storer and J. H. Reif. 1994. Shortest paths in the plane with polygonal obstacles. Journal of the ACM 41 (1994), 982–1012. [46] H. Wang. 2019. Quickest visibility queries in polygonal domains. Discrete and Computational Geometry 62 (2019), 374–432. [47] H. Wang. 2020. A divide-and-conquer algorithm for two-point L shortest path queries in polygonal domains. Journal of Computational Geometry 11 (2020), 235–282. [48] H. Wang. 2021. Shortest paths among obstacles in the plane revisited. In Proceedings of the 32nd Annual ACM-SIAM Symposium on Discrete Algorithms (SODA’21). 810–821. Received 30 June 2021; revised 21 October 2022; accepted 10 January 2023 Journal of the ACM, Vol. 70, No. 2, Article 11. Publication date: March 2023.

Journal

Journal of the ACM (JACM)Association for Computing Machinery

Published: Mar 21, 2023

Keywords: Shortest path

References