Abstract 1 Introduction 2 Preliminaries 3 The algorithm References

An Optimal Algorithm for Shortest Paths in Unweighted Disk Graphs

Bruce W. Brewer ORCID Kahlert School of Computing, University of Utah, Salt Lake City, UT, USA Haitao Wang ORCID Kahlert School of Computing, University of Utah, Salt Lake City, UT, USA
Abstract

Given in the plane a set S of n points and a set of disks centered at these points, the disk graph G(S) induced by these disks has vertex set S and an edge between two vertices if their disks intersect. Note that the disks may have different radii. We consider the problem of computing shortest paths from a source point sS to all vertices in G(S) where the length of a path in G(S) is defined as the number of edges in the path. The previously best algorithm solves the problem in O(nlog2n) time. A lower bound of Ω(nlogn) is also known for this problem under the algebraic decision tree model. In this paper, we present an O(nlogn) time algorithm, which matches the lower bound and thus is optimal. Another virtue of our algorithm is that it is quite simple.

Keywords and phrases:
disk graphs, weighted Voronoi diagrams, shortest paths
Copyright and License:
[Uncaptioned image] © Bruce W. Brewer and Haitao Wang; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Computational geometry
; Theory of computation Design and analysis of algorithms
Editors:
Anne Benoit, Haim Kaplan, Sebastian Wild, and Grzegorz Herman

1 Introduction

Let S be a set of n points in the plane. Each point of S is associated with a disk centered at the point. Note that the disks may have different radii. The disk graph G(S) induced by these disks has vertex set S and an edge between two vertices if their disks intersect. We consider the single-source-shortest-path (SSSP) problem of computing shortest paths from a source point sS to all vertices in G(S) where the length of a path in G(S) is defined as the number of edges in the path.

The problem was studied previously. A straightforward solution is to first construct G(S) explicitly and then run a breadth-first-search algorithm, which takes Ω(n2) time since G(S) may have Ω(n2) edges in the worst case. Kaplan, Katz, Saban, and Sharir [15] proposed the first subquadratic time algorithm, and their algorithm runs in O(nlog4n) time. Later Klost [18] gave an O(nlog2n) time improved solution. On the other hand, it is known that the problem has an Ω(nlogn) time lower bound under the algebraic decision tree model even if all disks have the same radius [6].

In this paper, we present a new algorithm whose runtime is O(nlogn), which matches the Ω(nlogn) lower bound and thus is optimal. Another virtue of the algorithm is that it is quite simple. Indeed, the most complex step of our algorithm is constructing a static additively-weighted Voronoi diagram, which can be easily done using Fortune’s sweeping algorithm [14]. Aside from that, the algorithm’s description in the paper is self-contained.

Concurrently with our work, de Berg and Cabello have also achieved an O(nlogn) time algorithm using a different approach [4].

Related work.

Disk graphs are among the most well-studied topics in computational geometry due to their applications and geometric properties, e.g., [1, 10, 8, 20, 3, 13, 7, 24]. The SSSP problem we consider is actually an unweighted case because the length of each edge of G(S) is defined to be one. In the weighted case, the length of each edge is defined to be the Euclidean distance between the two disk centers corresponding to the two vertices of the edge. Kaplan, Katz, Saban, and Sharir [15] also gave an algorithm for the weighted case, and the algorithm runs in O(nlog6n) time. An, Oh, and Xue [2] very recently derived an improved algorithm of O(nlog4n) time.

The SSSP problem on unit-disk graphs (in which all disks have the same radius) has also been extensively studied. Cabello and Jejčič [6] first solved the unweighted case in O(nlogn) time, matching the Ω(nlogn) lower bound [6]. If the points are presorted by x- and y-coordinates, Chan and Skrepetos [9] showed that it can be solved in O(n) additional time. The weighted case was first solved by Roditty and Segal [22] in O(n4/3+ϵ) time for any ϵ>0. Later, Cabello and Jejčič [6] solved it in O(n1+ϵ) time. The algorithm by Cabello and Jejčič [6] is bottlenecked by a dynamic bicromatic closest pair data structure, which has since seen improvements by Kaplan, Mulzer, Roditty, Seiferth, and Sharir [16] and also by Liu [19]. Recently, Wang and Xue [25] gave a new algorithm of O(nlog2n) time. This has been slightly reduced to O(nlog2n/loglogn) by Brewer and Wang [5]. Furthermore, Brewer and Wang [5] proved that the problem can be solved using O(nlogn) comparisons under the algebraic decision tree model, matching an Ω(nlogn) lower bound in the same model [6].

Kaplan, Katz, Saban, and Sharir [15] also studied a “reversed version” of the shortest path problem in disk graphs. Chan and Huang [8] very recently improved the algorithm of [15]. Both algorithms used the previous SSSP algorithm for disk graphs as a decision procedure. With our new SSSP algorithm, these algorithms can be slightly improved and also simplified.

In the following, after introducing some notation and concepts in Section 2, we present our algorithm in Section 3.

2 Preliminaries

We follow the notation already defined in Section 1, e.g., n, S, s, G(S).

We define Si for i=0,1,2, to be the set of vertices of G(S) whose distance from s in G(S) is equal to i. Note that S0={s}. For convenience, we define Si=jiSj.

For any two points p,q in the plane, let |pq| denote the (Euclidean) distance between p and q.

To differentiate from other points in the plane, we refer to points of S as sites. For any site vS, let Dv denote the input disk centered at v and rv the radius of Dv. Notice that two sites u,vS have an edge (u,v) in G(S) if and only if |uv|rurv0. We consider rv as the weight of v, and for any point p2, we define the (additively) weighted distance from p to v as dv(p)=|vp|rv. Note that if p is outside the disk Dv, then dv(p) is the smallest distance from p to any point of Dv.

For any subset SS and a point p2, we define a nearest neighbor of p to be a site in S whose weighted distance to p is minimal. Formally, we define βp(S)=argminvSdv(p) to be a nearest neighbor of p in S. In cases where p has more than one nearest neighbor in S, we let βp(S) refer to an arbitrary one. We also define dS(p)=minvSdv(p).

With respect to the weights rv of the sites v of S, we will make heavy use of the (additively) weighted Voronoi diagram of S, which is a partition of the plane into Voronoi regions, edges, and vertices [14, 23]. The Voronoi region Vor(u) of a site uS is usually defined as the set of points nearer to u than to any other site in S. For convenience, we will let Vor(u) also include its boundary, defining Vor(u) as the set of points at least as near to u than to any other site in S. Formally, Vor(u)={p2:vS{u},du(p)dv(p)}. This way, the plane is covered by the Voronoi regions. The Voronoi edge between two sites u,vS is defined by (u,v)={p:wS{u,v},du(p)=dv(p)<dw(p)}. Note that (u,v) may have multiple connected components, each of which is a straight line segment or a hyperbolic arc [14, 23]. Voronoi vertices are the points that are equidistant to at least three sites in S such that all other sites in S are farther than these. We use 𝒱𝒟(S) to denote the weighted Voronoi diagram of S.

Let 𝒟𝒯(S) denote the dual graph of 𝒱𝒟(S). Specifically, S is the vertex set of 𝒟𝒯(S), and the edge set of 𝒟𝒯(S) consists of all pairs of sites u,vS whose Voronoi regions share a Voronoi edge, i.e., (u,v). Note that if the sites of S all have the same weight (i.e., all disks have the same radius), then 𝒟𝒯(S) is the Delaunay triangulation of S. We define the neighborhood N𝒟𝒯(u) of a site uS to be the set of sites that share an edge with u in 𝒟𝒯(S). By extension, we define the neighborhood N𝒟𝒯(S) of a set SS by N𝒟𝒯(S)=uSN𝒟𝒯(u).

For ease of exposition, we make the general position assumption that no three sites of S lie on the same line. The assumption can be lifted without affecting the results, e.g., by standard perturbation techniques [12, 26].

3 The algorithm

In this section, we present our algorithm to compute the sets Si for i=0,1,2,. It is easy to extend our algorithm to also compute predecessor information for the shortest paths.

We follow the same algorithmic scheme of Cabello and Jejčič [6] for unit-disk graphs and manage to extend their algorithm to our general disk graph case. In what follows, we first describe the algorithm, then discuss the implementation and time analysis, and finally prove its correctness.

3.1 Algorithm description

We begin with constructing the weighted Voronoi diagram 𝒱𝒟(S). Then the algorithm runs in iterations, and each i-th iteration will compute the set Si. Initially, we have S0={s}. In the i-th iteration for i1, we compute Si as follows, assuming that Si1 has already been computed. Let Q=N𝒟𝒯(Si1)Si1, i.e., the neighbors of Si1 in 𝒟𝒯(S) that are not in Si1. We remove a site vQ from Q and determine whether dSi1(v)rv. If it is, then we add v to Si and update Q=Q(N𝒟𝒯(v)Si), i.e., we add the neighbors of v in 𝒟𝒯(S) that are not in QSi to Q. We repeat this until Q=, at which point the i-th iteration is complete. After the i-th iteration, we check if Si=. If so, then we are done, and the algorithm stops. Otherwise, we continue to the i+1-th iteration. Algorithm 1 gives the pseudocode.

Algorithm 1 SSSP algorithm.

3.2 Algorithm implementation and time analysis

We now discuss how to implement the algorithm efficiently.

First of all, computing 𝒱𝒟(S) and thus 𝒟𝒯(S) can be done in O(nlogn) time [14]. Note that the combinatorial sizes of both 𝒱𝒟(S) and 𝒟𝒯(S) are O(n) [14, 23].

Next, notice that the number of vertices added to Q on Line 7 in iteration i is at most the sum of the degrees of the vertices of Si1 in the graph 𝒟𝒯(S). Because the sets Si are disjoint and 𝒟𝒯(S) has O(n) edges, this means that the number of vertices added to Q by Line 7 throughout the whole algorithm is O(n). By the same reasoning, we conclude that the number of vertices added to Q by Line 12 throughout the whole algorithm is also O(n). We can also know that the while loop on Line 8 has at most O(n) iterations throughout the whole algorithm because a vertex is removed from Q in each iteration.

It remains to determine the time complexity for the operation of checking whether dSi1(v)rv on Line 10. To this end, it suffices to find βv(Si1), i.e., the nearest neighbor of v in Si1. To find βv(Si1), in the beginning of the i-th iteration, we compute the weighted Voronoi diagram for Si1, denoted by 𝒱𝒟(Si1), which takes O(|Si1|log|Si1|) time [14], and then construct a point location data structure for 𝒱𝒟(Si1) in O(|Si1|) time [17, 11]. After that, βv(Si1) can be found in O(logn) time by a point location query with v on 𝒱𝒟(Si1). As such, the total time of Line 10 in the whole algorithm is O(nlogn). As i|Si1|=n, the overall time for constructing 𝒱𝒟(Si1) in the whole algorithm is O(nlogn).

We thus conclude that the time complexity of the whole algorithm is O(nlogn).

3.3 Algorithm correctness

We start with proving the following two observations that our algorithm’s correctness relies on.

Observation 1.

For any two sites u,vS, they are connected by an edge in G(S) if and only if dv(u)ru or du(v)rv.

Proof.

Recall that u and v have an edge if and only if |uv|rurv0. Notice that |uv|rurv0 holds if and only if dv(u)ru or du(v)rv.

Observation 2.

For any site vSSi1, v is in Si if and only if dSi1(v)rv.

Proof.

By definition, Si1 has a site u with du(v)=dSi1(v). If dSi1(v)rv, then du(v)rv. By Observation 1, G(S) has an edge connecting u and v. As uSi1 and vSSi1, we obtain that vSi.

If vSi, then there is an edge in G(S) connecting v to a site uSi1. By Observation 1, du(v)rv. It then follows that dSi1(v)du(v)rv.

We now prove that the algorithm is correct. Let Si be the set Si computed by our algorithm and let Si be the “correct” set of vertices at distance i from s in G(S). Then, our goal is to prove that Si=Si for all i. We do so by induction on i. Our base case is that S0=S0, which is obviously true because they are both {s}. Our inductive hypothesis is that Sj=Sj for all j<i. To prove that Si=Si, we will argue both SiSi and SiSi.

First of all, since Sj=Sj for all j<i, our algorithm guarantees that every site of Si is at distance i from s in G(S) and thus SiSi. To see this, a site v is added to Si in Line 11 because dSi1(v)rv. By Observation 2, vSi.

We next prove that SiSi. Consider a site vSi. Our goal is to show that v is also in Si. We will prove in Lemma 3 that there exists a vertex uSi1 and a u-v path π in 𝒟𝒯(S) such that all internal vertices of π are in Si (note that internal vertices refer to vertices of π excluding u and v). Let the vertices of π be u=w0,w1,,wk=v. We argue that all wj with 1jk are added to Si. To this end, because wjSi for all 1jk, it is sufficient to argue that wj is added to Q because when wj is popped from Q, it will pass the check on Line 10 by Observation 2 and then be added to Si. Indeed, w1 is added to Q on Line 7 because w1N𝒟𝒯(u). Since w2N𝒟𝒯(w1), w2 will be added to Q on Line 12 no later than right after w1 is added to Si on Line 11. Following the same argument, w3,w4,,wk=v will all be added to Q and thus added to Si as well. This proves that vSi. Therefore, SiSi.

In summary, we have proved Si=Si and thus the correctness of the algorithm.

Lemma 3.

For any i>0 and any site vSi, there exist a site uSi1 and a u-v path in 𝒟𝒯(S) such that all internal vertices of the path are in Si.

Proof.

We extend the proof of [6, Lemma 1] for the unit-disk graph case to our general disk graph problem.

Let u=βv(Si1), i.e., u is a nearest neighbor of v in Si1. Consider the line segment uv¯ and the sites whose Voronoi regions in 𝒱𝒟(S) intersect uv¯. Let w0,w1,,wk be these sites in the order that their Voronoi regions intersect uv¯ with w0=u and wk=v. Note that repetitions are possible, so it could be that wj=wj for jj. See Figure 1 for an example. For ease of discussion, we assume that uv¯ does not contain any Voronoi vertices of 𝒱𝒟(S) (otherwise, we could replace v by a point arbitrarily close to v and then follow the same argument). This implies that, for every 0jk1, uv¯ crosses the Voronoi edge between wj and wj+1. This further implies that wj and wj+1 are adjacent in 𝒟𝒯(S), so π=w0,w1,,wk is a u-v path in 𝒟𝒯(S).

Refer to caption
Figure 1: The segment uv¯ passes through Vor(u), Vor(w1), Vor(w2), Vor(w3), and Vor(v), where w1=w3.

Next, we need to show that all internal vertices wj (1jk1) of π are in Si. We will first prove that there is an edge (u,wj) in G(S) connecting u and wj, meaning that wjSi2Si1Si since uSi1. Then, we will show that wjSi2Si1, so wjSi must hold. This will complete the proof of the lemma.

Figure 2: The region bounded by the dashed curve is Vor(wj).

Proving 𝑮(𝑺) has an edge (𝒖,𝒘𝒋).

We first argue that G(S) has an edge (u,v). Indeed, since vSi, there is a vertex uSi1 connecting to v by an edge in G(S). By Observation 1, du(v)rv. Since u=βv(Si1), we have du(v)du(v)rv. By Observation 1, G(S) has an edge (u,v).

Consider any wj with 1jk1. We now argue that G(S) has an edge (u,wj). Recall that uv¯ intersects Vor(wj). Let p be a point of uv¯Vor(wj); see Figure 2. We can derive the following:

dwj(u)=|wju|rwj(1)|wjp|+|pu|rwj(2)|vp|+|pu|rv=(3)|vu|rv=dv(u)(4)ru,

where (1) is due to the triangle inequality, (2) is due to pVor(wj) (therefore, |wjp|rwj=dwj(p)dv(p)=|vp|rv), (3) is due to puv¯, and (4) is due to Observation 1 and the fact that G(S) has an edge (u,v). Consequently, by Observation 1, G(S) has an edge (u,wj).

Proving 𝒘𝒋𝑺𝒊𝟐𝑺𝒊𝟏.

To prove that wjSi2Si1, 1jk1, as before, we pick a point puv¯Vor(wj) and derive the following:

dwj(v)<(1)|wjp|+|pv|rwj(2)|up|+|pv|ru=(3)|uv|ru=du(v)(4)rv,

where (1) is due to the triangle inequality and our general position assumption (because puv¯, equality occurs only if u, v, and wj are collinear, violating our general position assumption), (2) is due to pVor(wj) (therefore, |wjp|rwj=dwj(p)du(p)=|up|ru), (3) is due to puv¯, and (4) is due to Observation 1 and the fact that G(S) has an edge (u,v), as proven above.

Notice that wjSi1 since otherwise dwj(v)<du(v) proved above would contradict with u=βv(Si1). Also, since G(S) has an edge (wj,v) and vSi, wj cannot be in Si2 (since otherwise v would be in Si1, contradicting with that vSi). This proves that wjSi2Si1.

The following theorem summarizes our result.

Theorem 4.

Given a set of n disks in the plane and a source disk, shortest paths from the source to all other vertices in the disk graph induced by all disks can be computed in O(nlogn) time.

Extension to the 𝑳 (resp., 𝑳𝟏) metric.

In the L metric, each disk becomes a square centered at a site of S. For this case, an O(nlogn)-time algorithm was given by Klost [18] to solve the SSSP problem, which uses the involved techniques in [3]. We can solve this problem in O(nlogn) time in a much simpler way by making the following changes to Algorithm 1. First, use the L metric to measure the distance |pq| of any two points p,q in the plane. Second, use additively-weighted Voronoi diagrams in the L metric instead. Note that constructing an additively-weighted Voronoi diagram for a set of n points in the L metric is equivalent to constructing a Voronoi diagram for a set of n squares in the L metric. This latter problem can be solved in O(nlogn) time, e.g., by the algorithm of Papadopoulou and Lee [21]. As such, Algorithm 1 can be modified to solve the L metric case in O(nlogn) time. The algorithm is much simpler than the one in [18]. The L1 case can be treated analogously.

References

  • [1] Shinwoo An, Kyungjin Cho, and Eunjin Oh. Faster algorithms for cycle hitting problems on disk graphs. In Proceedings of the 18th Algorithms and Data Structures Symposium (WADS), pages 29–42, 2023. doi:10.1007/978-3-031-38906-1_3.
  • [2] Shinwoo An, Eunjin Oh, and Jie Xue. Single-source shortest path problem in weighted disk graphs. In Proceedings of the 41st International Symposium on Computational Geometry (SoCG), pages 7:1–7:15, 2025. doi:10.4230/LIPIcs.SoCG.2025.7.
  • [3] Alexander Baumann, Haim Kaplan, Katharina Klost, Kristin Knorr, Wolfgang Mulzer, Liam Roditty, and Paul Seiferth. Dynamic connectivity in disk graphs. Discrete and Computational Geometry, 71:214–277, 2024. doi:10.1007/s00454-023-00621-x.
  • [4] Mark de Berg and Sergio Cabello. An O(nlogn) algorithm for single-source shortest paths in disk graphs. In Proceedings of the 33rd Annual European Symposium on Algorithms (ESA), page to appear, 2025. doi:10.48550/arXiv.2506.07571.
  • [5] Bruce W. Brewer and Haitao Wang. An improved algorithm for shortest paths in weighted unit-disk graphs. In Proceedings of the 36th Canadian Conference on Computational Geometry (CCCG), pages 57–64, 2024. arXiv:2407.03176.
  • [6] Sergio Cabello and Miha Jejčič. Shortest paths in intersection graphs of unit disks. Computational Geometry: Theory and Applications, 48:360–367, 2015. doi:10.1016/j.comgeo.2014.12.003.
  • [7] Sergio Cabello and Wolfgang Mulzer. Minimum cuts in geometric intersection graphs. Computational Geometry: Theory and Applications, 94(101720), 2021. doi:10.1016/j.comgeo.2020.101720.
  • [8] Timothy M. Chan and Zhengcheng Huang. Faster algorithms for reverse shortest path in unit-disk graphs and related geometric optimization problems: Improving the shrink-and-bifurcate technique. In Proceedings of the 41st International Symposium on Computational Geometry (SoCG), pages 32:1–32:14, 2025. doi:10.4230/LIPIcs.SoCG.2025.32.
  • [9] Timothy M. Chan and Dimitrios Skrepetos. All-pairs shortest paths in unit-disk graphs in slightly subquadratic time. In Proceedings of the 27th International Symposium on Algorithms and Computation (ISAAC), pages 24:1–24:13, 2016. doi:10.4230/LIPIcs.ISAAC.2016.24.
  • [10] Brent N. Clark, Charles J. Colbourn, and David S. Johnson. Unit disk graphs. Discrete Mathematics, 86:165–177, 1990. doi:10.1016/0012-365X(90)90358-O.
  • [11] Herbert Edelsbrunner, Leonidas J. Guibas, and Jorge Stolfi. Optimal point location in a monotone subdivision. SIAM Journal on Computing, 15(2):317–340, 1986. doi:10.1137/0215023.
  • [12] Herbert Edelsbrunner and Ernst P. Mücke. Simulation of simplicity: A technique to cope with degenerate cases in geometric algorithms. ACM Transactions on Graphics, 9:66–104, 1990. doi:10.1145/77635.77639.
  • [13] Jared Espenant, J. Mark Keil, and Debajyoti Mondal. Finding a maximum clique in a disk graph. In Proceedings of the 39th International Symposium on Computational Geometry (SoCG), pages 30:1–30:17, 2023. doi:10.4230/LIPIcs.SoCG.2022.49.
  • [14] Steven Fortune. A sweepline algorithm for Voronoi diagrams. Algorithmica, 2:153–174, 1987. doi:10.1007/BF01840357.
  • [15] Haim Kaplan, Matthew J. Katz, Rachel Saban, and Micha Sharir. The unweighted and weighted reverse shortest path problem for disk graphs. In Proceedings of the 31st Annual European Symposium on Algorithms (ESA), pages 67:1–67:14, 2023. doi:10.4230/LIPIcs.ESA.2023.67.
  • [16] Haim Kaplan, Wolfgang Mulzer, Liam Roditty, Paul Seiferth, and Micha Sharir. Dynamic planar Voronoi diagrams for general distance functions and their algorithmic applications. Discrete and Computational Geometry, 64:838–904, 2020. doi:10.1007/s00454-020-00243-7.
  • [17] David G. Kirkpatrick. Optimal search in planar subdivisions. SIAM Journal on Computing, 12:28–35, 1983. doi:10.1137/0212002.
  • [18] Katharina Klost. An algorithmic framework for the single source shortest path problem with applications to disk graphs. Computational Geometry: Theory and Applications, 111:101979, 2023. doi:10.1016/j.comgeo.2022.101979.
  • [19] Chih-Hung Liu. Nearly optimal planar k nearest neighbors queries under general distance functions. SIAM Journal on Computing, 51:723–765, 2022. doi:10.1137/20M1388371.
  • [20] Daniel Lokshtanov, Fahad Panolan, Saket Saurabh, Jie Xue, and Meirav Zehavi. Subexponential parameterized algorithms on disk graphs (extended abstract). In Proceedings of the 33rd Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 2005–2031, 2022. doi:10.1137/1.9781611977073.80.
  • [21] Evanthia Papadopoulou and D.T. Lee. The L-Voronoi diagram of segments and VLSI applications. International Journal of Computational Geometry and Application, 11(101720):503–528, 2001. doi:10.1142/S0218195901000626.
  • [22] Liam Roditty and Michael Segal. On bounded leg shortest paths problems. Algorithmica, 59:583–600, 2011. doi:10.1007/s00453-009-9322-3.
  • [23] Micha Sharir. Intersection and closest-pair problems for a set of planar discs. SIAM Journal on Computing, 14:448–468, 1985. doi:10.1137/0214034.
  • [24] Anastasiia Tkachenko and Haitao Wang. Dominating set, independent set, discrete k-center, dispersion, and related problems for planar points in convex position. In Proceedings of the 42nd International Symposium on Theoretical Aspects of Computer Science (STACS), pages 73:1–73:20, 2025. doi:10.4230/LIPIcs.STACS.2025.73.
  • [25] Haitao Wang and Jie Xue. Near-optimal algorithms for shortest paths in weighted unit-disk graphs. Discrete and Computational Geometry, 64:1141–1166, 2020. doi:10.1007/s00454-020-00219-7.
  • [26] C.-K. Yap. A geometric consistency theorem for a symbolic perturbation scheme. Journal of Computer and System Sciences, 40:2–18, 1990. doi:10.1016/0022-0000(90)90016-E.