Diameter Computation on (Random) Geometric Graphs

We present an algorithm that computes the diameter of random geometric graphs (RGGs) with expected average degree $Θ(n^δ)$ for constant $δ\in(0,1)$ in $\tilde{O}(n^{\frac{3}{2}(1+δ)} +n^{2 - \frac{5}{3}δ})$ time, asymptotically almost surely. This br…

Authors: Thomas Bläsius, Annemarie Schaub, Marcus Wilhelm

Diameter Computation on (Random) Geometric Graphs
Diameter Computation on (Random) Geometric Graphs Thomas Bläsius # Ñ Karlsruhe Institute of T ec hnology , Germany Annemarie Sc haub # Karlsruhe Institute of T ec hnology , Germany Marcus Wilhelm # Ñ Karlsruhe Institute of T ec hnology , Germany Abstract W e present an algorithm that computes the diameter of random geometric graphs (R GGs) with exp ected a v erage degree Θ( n δ ) for constan t δ ∈ (0 , 1) in ˜ O ( n 3 2 (1+ δ ) + n 2 − 5 3 δ ) time, asymptotically almost surely . This brings the running time do wn to ˜ O ( n 33 19 ) ≈ ˜ O ( n 1 . 737 ) for a v erage degree Θ( n 3 19 ) . T o the best of our knowledge, this constitutes the first suc h bound for RGGs and for a substan tial range of av erage degrees, it is notably smaller than the recent b ound of O ∗ ( n 2 − 1 18 ) ≈ O ∗ ( n 1 . 944 ) by Chan, Chang, Gao, Kisfaludi-Bak, Le, and Zheng (F OCS 2025) for the more general class of all unit disk graphs. Our algorithm also works on RGGs with the flat torus as ground space, with a running time in ˜ O ( n 3 2 (1+ δ ) + n 2 − 1 3 δ ) . While our b ounds on random geometric graphs are interesting in their own right, they are only an application of our main contribution: A general framew ork of deterministic graph prop erties that enable efficient diameter computation. Our prop erties are based on the existence of balanced separators that are in a certain sense well-behav ed regarding the metric space defined by the graph. These prop erties can b e seen as a distillation of the combinatorial features a graph gets from ha ving an underlying geometry . As a by-product of verifying that R GGs fit in to our framew ork, we also deriv e running time b ounds for iFUB, a diameter algorithm by Crescenzi, Grossi, Habib, Lanzi, and Marino (TCS 2013) that is highly efficient on real-world graphs. W e sho w that a.a.s. iFUB achiev es a sp eedup in ˜ Ω ( n δ/ 3 ) o v er the naive O ( nm ) algorithm, but runs in Ω( nm ) time on torus RGGs. This constitutes the first theoretical analysis in a geometric setting and confirms prior empirical evidence, thus suggesting geometry as a reasonable mo del for certain real-world inputs. 2012 ACM Subject Classification Theory of computation → Shortest paths; Theory of computation → Computational geometry; Theory of computation → Random netw ork mo dels Keyw o rds and phrases random geometric graphs, graph diameter F unding Mar cus Wilhelm : funded by the Deutsc he F orsch ungsgemeinschaft (DFG, German Researc h F oundation) – 524989715 A ckno wledgements The authors thank Tillmann Bühler for helpful discussions. 2 Diameter Computation on (Random) Geometric Graphs 1 Intro duction The diameter , i.e., the maxim um distance b et w een any pair of vertices, is one of the most fundamen tal graph parameters. It is relev ant for numerous applications for example in net w ork design [ 9 , 17 , 20 ], distributed systems [ 2 , 7 , 15 ] and graph clustering [ 18 ]. A simple algorithm to compute the diameter of a graph is to perform a breadth-first searc h (BFS) from every vertex, taking O ( nm ) time on a graph with n v ertices and m edges. The iFUB algorithm (short for iterative fringe upp er b ound) [ 10 ] constitutes a notable improv ement o v er this approac h in practice. Despite a Θ( nm ) worst-case running time, it is often muc h faster on real-world inputs, esp ecially on complex scale-free netw orks [ 6 ] and graphs with underlying geometry [5]. The core intuition b ehind iFUB is that on many real-world netw orks there is a meaningful notion of center and p eriphery (or fringe). More precisely , vertices in the cen ter hav e smaller distances to most other v ertices than vertices in the p eriphery . Moreo ver, distant pairs of v ertices alwa ys lie in the periphery and their shortest paths are (roughly) bisected by the cen ter. The iFUB algorithm exploits this structure by heuristically choosing a vertex in the cen ter and then restricting the searc h for diametric vertices to vertices that are sufficien tly far from this center. As a result, the algorithm only executes a constant num b er of breadth-first searc hes in order to select a central v ertex and afterwards only p erforms a BFS for v ertices that hav e distance at least half the diameter from this cen tral v ertex. On graphs with a strong center–periphery structure, where diametric paths are indeed appro ximately halv ed, this results in a low num b er of BFS runs. An extensiv e empirical study confirms that many real-world netw orks exhibit a sufficiently pronounced center–periphery structure for iFUB to ac hieve sublinear running times in practice [ 5 ]. In particular, the study identifies tw o regimes of such netw orks. The first consists of graphs with a strongly heterogeneous degree distribution, i.e., scale-free netw orks. F or this setting Borassi, Crescenzi, and T revisan [ 6 ] pro ve running time bounds for iFUB under the assumption of a p o wer-la w degree distribution together with indep endently sampled edges. The second regime are graphs with a homogeneous degree distribution and high lo calit y , i.e., with an underlying geometric structure. While it migh t seem intuitiv e that suc h graphs are b enign for iFUB, the authors of [ 5 ] also identify some notable exceptions. These are graphs with a clearly apparent geometric structure, but a perio dic geometric ground space, where distances “wrap around” like on a flat torus or a spherical surface. Intu itiv ely , suc h graphs hav e neither center nor p eriphery , thus any chosen central vertex splits some diametric paths v ery unevenly , and iFUB needs to explore a large portion of the graph in order to find the diameter. T o the b est of our knowledge, the p erformance of iFUB on geometric graphs has not yet b een formally analyzed. In particular, the conjecture that it b enefits from ap erio dic geometry but deteriorates on p erio dic geometry has not b een studied from a rigorous theoretical p erspective. In this w ork, we provide the first theoretical explanation of this b eha vior b y analyzing iFUB’s p erformance on random geometric graphs (RGGs). W e show that on RGGs with a square ground space, iFUB achiev es an asymptotic sp eed-up when choosing a central v ertex using the so-called 2-sw eep heuristic and that this is not the case on RGGs with a flat torus as ground space. W e say an even t o ccurs asymptotic al ly almost sur ely (a.a.s.) if its probabilit y is at least 1 − o (1) and with high pr ob ability if its probabilit y is at least 1 − O ( 1 n ) . ▶ Theo rem 1. L et G ∼ G ( S , n, r ) b e a squar e r andom ge ometric gr aph with exp e cte d aver age de gr e e d ∈ Ω( log 3 2 n ) . Then, a.a.s., 2-swe ep iFUB has running time in O (( nd − 2 3 + log n ) m ) . If G ∼ G ( T , n, r ) is a torus R GG with exp e cte d aver age de gr e e in Ω( log 3 2 n ) , then a.a.s. for J. Op en A ccess and J. R. Public 3 0 0 . 2 0 . 4 0 . 6 0 . 8 1 1 1 . 5 2 2 . 5 3 δ exp onen t x of running time ˜ O ( n x ) Naiv e Seidel’s algorithm [19] UDG (no co ords.) [8] UDG (co ordinates) [8] Theorem 2 (torus) Theorem 2 (square) Figure 1 R unning times on torus/square RGGs with exp ected av erage degree in Θ( n δ ) for constan t δ ∈ (0 , 1) . Our algorithm is compared with the naive O ( nm ) running time, Seidel’s matrix-m ultiplication based ˜ O ( n ω ) approach, and the unit-disk graph algorithms from [ 8 ] in b oth v ariants with a geometric represen tation and without. every choic e of the c entr al vertex, the running time of iFUB is in Ω( nm ) . This raises the question of whether the resulting running time in Ω( nm ) is inheren t to graphs with a torus-like geometry or whether better algorithmic approac hes are p ossible. In the follo wing theorem, we give a p ositive answer by showing that a polynomial improv ement to this is possible. Still, for square RGGs we ac hiev e an ev en b etter running time exp onen t. 1 ▶ Theo rem 2. On R GGs with exp e c te d aver age de gr e e Θ( n δ ) for c onstant δ ∈ (0 , 1) , asymp- totic al ly almost sur ely the diameter c an b e c ompute d in ˜ O ( n 3 2 (1+ δ ) + n 2 − 1 3 δ ) time for torus R GGs, r esp e ctively ˜ O ( n 3 2 (1+ δ ) + n 2 − 5 3 δ ) time for squar e R GGs. W e note that in the ab ov e theorem the probabilistic statement only concerns dra wing the random geometric graph; the algorithm itself is fully deterministic and alwa ys computes the diameter correctly . T o the b est of our kno wledge these are the first running time b ounds for the diameter problem sp ecifically on random geometric graphs. F or an ov erview of ho w they compare to kno wn running times for diameter computation on related graph classes, see Figure 1. Note that sp ecifically the class of unit disk graphs makes for a suitable comparison as it can be seen as a deterministic worst-case v ariant of (square) random geometric graphs. Here, the fastest known running time is in O ∗ ( n 2 − 1 / 18 ) as shown recently b y Chan, Chang, Gao, Kisfaludi-Bak, Le, and Zheng [ 8 ]. Our running time on square R GGs giv es a p olynomial impro vemen t upon this for av erage degrees Θ( n δ ) with constant δ strictly b et w een 1 / 30 ≈ 0 . 033 and 8 / 27 ≈ 0 . 296 . Ev en our running time on torus R GGs gives a p olynomial impro vemen t for d strictly betw een 1 / 6 ≈ 0 . 167 and 8 / 27 ≈ 0 . 296 . A dditionally , w e note that the O ∗ ( n 2 − 1 / 18 ) algorithm dep ends on a co ordinate representation of the graphs, whic h is ∃ R -hard to obtain [ 14 ]. A v ariant of their algorithm that only requires the graph as input runs in ˜ O ( mn 1 − 1 / 8 ) time [ 8 ]. Compared to this, our algorithm on degree Θ( n δ ) random 1 W e use ˜ O -notation to hide p oly-logarithmic factors in the running time and O ∗ for n o (1) factors. 4 Diameter Computation on (Random) Geometric Graphs √ 2 √ 2 − x P (a) P (b) P ′ √ 2 − x ′ (c) (d) Figure 2 Visualization of the observ ations. Regarding Observ ation 1, P art (a) shows a p oint P on the unit square, its unique diametric partner at distance √ 2 (blac k square); the blue region of all x -diametric partners of P for x = √ 2 / 5 is clearly not muc h larger than x . Part (b) shows an analogous situation on the torus; note that here, any p oint has a diametric partner. P art (c) visualizes the second part of Observ ation 2: a p oint P ′ sufficien tly far from any corner of the unit-square has no x -diametric partners for x = √ 2 / 5 ; still, for a larger x ′ > x the region of x ′ -diametric partners is non-empty . Regarding Observ ations 3–5, P art (d) shows a hierarchical sub division of the square/torus ground space and tw o differen tly sized blue disks that in tersect only few cells with similar diameter (marked in yello w). geometric graphs is faster for δ ≥ 3 64 ≈ 0 . 047 (square R GGs), resp ectively δ ≥ 3 32 ≈ 0 . 094 (torus RGGs). Concerning the requirements on the input, w e note that our algorithm lies b et w een these tw o v ariants. W e only use the coordinates implicitly in the sense that we require a hierarch y of separators that is straigh tforward to compute giv en co ordinates. But in principle, the separator hierarch y could b e computed in a different w a y without ha ving the co ordinates as an intermediate step. While the algorithms stated in Theorem 2 are interesting con tributions on their own, they are only an application of a more general framework. Our main contribution is to distill a set of deterministic graph prop erties and to pro ve that they enable efficient diameter computation. The running times on random geometric graphs then follo w, b y proving that these graphs a.a.s. fit into our framework. T o introduce our framework and motiv ate the prop erties it is based on, we start b y making a few ob vious observ ations about geometric ground spaces (specifically square and flat torus) and distances therein; also see Figure 2. Observ ations 1 and 2 are related to J. Op en A ccess and J. R. Public 5 diametric p airs , where a pair of p oin ts is diametric if the distance b etw een them is the diameter of the ground space. Moreov er, a pair is x -diametric if their distance is at most x smaller than the diameter. If t wo p oints p and q form a ( x )-diametric pair, we say that p is a ( x )-diametric p artner of q and vice versa. Observ ations 3–5 are based on partitioning the ground space like with a quad-tree into a hierarc hy of cells. Observ e the follo wing. 1. F or ev ery p oint on a torus or square and x > 0 , the x -diametric partners lie within a disk of radius O ( x ) . (lo cal diametric partners) 2. In a square, only the four corners ha ve a diametric partner. Moreov er, for every x > 0 all p oin ts with x -diametric partners lie inside 4 disks of radius O ( x ) . (few corners) 3. The b oundary of eac h cell is small compared to its area. (small separators) 4. Cells with smaller area hav e smaller diameter and vice v ersa. (size-dep endent diameters) 5. Ev ery disk in the ground space intersects only few cells that hav e diameter similar to the disk. (lo w fragmentation) W e now translate these geometric observ ations in to graph properties. F or this, the c hallenge is to strik e a balance b et ween introducing enough flexibility in order to include a meaningful class of graphs and b eing strong enough to allow algorithmic impro vemen ts. In the follo wing, notions related to distances refer to graph distances, e.g., a ball of radius r is the set of vertices with graph distance at most r from some central vertex. T o translate the hierarc hical partitioning of the geometric ground space, we introduce r e cursive p artitions of a graph in to blo cks . W e assume that recursiv e partitions ha v e constan t br anching factor , i.e., eac h blo c k has only a constant num b er of children. W e first state the five prop erties and discuss them b elow. 1. d lo cal -lo cal diametric partners: F or every vertex v and x > 0 , the x -diametric partners of v can b e cov ered with O (1) balls of radius O ( x + d local ) . 2. d corner -few corners: F or every x > 0 , all vertices with an x -diametric partner can b e co v ered with O (1) balls of radius O ( x + d corner ) . 3. ( α, β ) -small separators: The separator of each blo ck with k v ertices has size O ( k α n β ) . 4. size-dep enden t diameters: F or all blo cks A and B with diameters D A and D B , | A | ∈ O ( | B | ) implies D A ∈ O ( D B ) , and vice v ersa. 2 5. lo w fragmentation: Every ball of radius r in tersects a constant num b er of blo cks of diameter Θ( r ) . Eac h property directly corresp onds to the observ ation with the same num b er, but differs in a few key wa ys. In Prop erty 1 and Observ ation 1 we allow O (1) balls and keep the linear dep endency of their radius on x . Additionally we in tro duce tw o parameters d local and d corner that allow slack for small x . Prop erty 3 uses t w o parameters to sp ecify the size of separators dep ending not only on the blo ck size, but also on the size of the whole graph. This is imp ortant to also capture intersection graphs of ob jects with size growing in n . Finally , Prop erties 4 and 5 are the same as Observ ations 4 and 5, except that w e require the b ounds to only hold up to constant factors. W e call a recursive partition ( α, β ) -wel l-sp ac e d , if Prop erties 3–5 hold and it is b alanc e d , i.e., if for each blo ck the size of any tw o children 2 W e note that the intuitiv e in terpretation of asymptotics is correct here: O -notation hides universal constants that do not dep end on individual instances. F or Prop erties 3 and 4 it is also imp ortant that the blo cks are only compared p er instance and not across instances. How ev er, as this makes the formal definitions slightly tricky , we provide a full explanation in App endix A. 6 Diameter Computation on (Random) Geometric Graphs differs only by a constant factor. In tuitiv ely , a w ell-spaced recursive partition uses balanced sublinear separators that divide the graph in to roughly ball-shap ed subgraphs. W e are almost ready to state our main theorem. W e sa y that a recursiv e partition has leaf-blo c k size at most k leaf if every leaf-blo ck has at most k leaf v ertices. ▶ Theo rem 3. L et G b e a n -vertex gr aph with de gener acy d satisfying Pr op erty 1. L et P b e a ( α, β ) -wel l-sp ac e d r e cursive p artition with le af-blo ck size k leaf . F or every k ≥ k leaf such that k ∈ o ( n ) and blo cks of size Θ( k ) have diameter Ω( d local ) , our algorithm c omputes the diameter of G in time ˜ O  n 1+ α + β · d + min  nk d + k 2 α n 1+2 β + k 2 α − 1 n 1+ α +3 β , k n 1+ α + β  . If also Pr op erty 2 holds and blo cks of size Θ( k ) have diameter Ω( d corner ) , it runs in time ˜ O  n 1+ α + β · d + min  k 2 d + k 1+2 α n 2 β + k 2 α n α +3 β , k 2 n α + β  . W e note that the ab o ve b ounds on the running time of our algorithm hold for every k satisfying the requirements, i.e., our algorithm implicitly chooses k suc h that the running time is minimized. Note that, unless α < 1 / 2 , the running time is monotone in k . It thus mak es sense to think of k as small as p ossible such that the diameter of size Θ( k ) blo ck is still in Ω( d corner ) . Outline. The remainder of this pap er is structured as follo ws. W e introduce imp ortant definitions and notation in Section 2. Section 3 then presen ts our algorithm, while Section 4 con tains our analysis on random geometric graphs. W e finally discuss generalizations of our parameters and directions for future work in Section 5. 2 Prelimina ries W e use [ n ] = { 1 , . . . , n } . Let G = ( V , E ) be a (simple, undirected) gr aph . W e also use V ( G ) and E ( G ) to refer to the vertex and edge set of G . The distanc e d G ( v , w ) b etw een tw o v ertices v and w in G is the minim um length (i.e., num b er of edges) on a (simple) path from v to w . If there is no path b etw een v and w , then d G ( v , w ) = ∞ . Otherwise, v and w are c onne cte d . A set of v ertices (and b y extension a (sub-)graph) is connected if every pair of vertices is connected. The e c c entricity of a v ertex v , written ecc G ( v ) , is the maxim um distance b etw een v and any other vertex of G . The diameter of G , written diam G is the largest eccen tricity of any vertex. W e write maxdist G ( A, B ) = max { d G ( a, b ) | a ∈ A, b ∈ B } for the maxim um distance b etw een tw o vertex sets A, B ⊆ V ( G ) . W e call tw o vertices (resp ectiv ely , a path) diametric if their distance (respectively , its length) is diam G . W e also extend the notions of eccen tricity and diameter to metric sp ac es in general. F or a metric space M consisting of a set of elements X and a distance function d M , w e define the M -b al l of radius r around an element e ∈ X as the set of elements e ′ ∈ X with d M ( e, e ′ ) ≤ r . W e say that a set of elements Y ⊆ X can b e c over e d by a ball of radius r , if there is an elemen t e ∈ X suc h that Y is contained in the ball of radius r around e . W e omit the subscripts M and G from the notation for eccentricit y , diameter, or balls/neighborho o ds if the graph or metric is clear from con text. W e write N ( v ) for the (op en) neighborho o d of v and N G ( v , k ) = { w ∈ V ( G ) | d G ( v , w ) = k } for the k -neigh b orho o d of v , i.e., the set of v ertices with distance exactly k . Let G b e connected. W e define a r e cursive p artition P = ( T , { B v } v ∈ V ( T ) ) of G as a ro oted tree T where each no de v ∈ V ( T ) is asso ciated with a connected set of vertices B v ⊆ V ( G ) . J. Op en A ccess and J. R. Public 7 Note that we call the vertices of T no des to distinguish them from vertic es of G . The v ertex sets { B v } v ∈ V ( T ) are called blo cks , i.e., B v is the blo ck of v . W e require the blo cks of the lea v es of T to form a partition of V ( G ) . Moreo ver, for eac h non-leaf node u of T the blo ck B u is equal to the union of the blo c ks of leaf nodes in the subtree b elow u . Note that this implies B r = V ( G ) for the ro ot no de r of T . W e further require eac h non-leaf node has at least tw o children and at most a constan t num b er of children (constant branching factor). Note that the tree T is uniquely defined by the set of blo c ks and we thu s often use P as a set of blocks and write B ∈ P for a block B . W e call a block B v ∈ P a parent of a blo c k B w , if v is a parent of w in T . This lets us also use the relations of parent, descendant, ancestor, and leaf for blo cks of P . In particular, w e write paren t ( B w ) = B v and paren t ( w ) = v . W e define the b oundary S u of a blo ck B u as the subset of B u that has neighbors in V ( G ) \ B u in the graph G . The sep ar ator of a blo ck is the union of the b oundaries of its children. Note that leaf blo cks hav e empty separators and the ro ot blo ck has an empty b oundary . W e call P ε -b alanc e d , for ε ≥ 0 if, for every node u ∈ V ( T ) and c hildren v and w of u , we ha ve | B v | ≤ (1 + ε ) | B w | . W e call P b alanc e d if it is ε -balanced for ε ∈ O (1) . 3 Diameter Algo rithm Let G = ( V , E ) b e a graph and let P b e a recursive partition of G . Our algorithm roughly w orks as follows. W e c ho ose a flat p artition , a set of similarly sized blo cks B ⊂ P that together form a partition of V . This can be easily achiev ed by choosing some parameter k ≥ k leaf and including a block B ∈ P in B if it has size at most k while its parent has size larger than k , i.e., B = { B ∈ P | | B | ≤ k and | parent( B ) | > k } . As B is a partition of V , computing maxdist G ( A, B ) for ev ery pair of blo cks A, B ∈ B (including A = B ) yields the diameter of the graph. T o sav e time, w e ignore a pair of blo cks A, B ∈ B if maxdist G ( A, B ) is obviously to o small to b e relev ant for the diameter. F or this, w e use an upper b ound u ( A, B ) on maxdist G ( A, B ) and a global lo w er bound ℓ on the diameter. If u ( A, B ) < ℓ , we can safely skip the pair ( A, B ) . Otherwise, we call ( A, B ) a c andidate p air and A a c andidate p artner for B (and vice v ersa). With this, it remains to solv e the following problems. 1. Efficien tly compute the maxdist for eac h candidate pair. 2. Bound the num b er of candidate pairs and compute them efficien tly . 3. Obtain a low er bound ℓ . Regarding P oint 1, w e discuss in Section 3.1 how to efficiently compute maxdist ( A, B ) for a candidate pair ( A, B ) . F or this, we introduce a pre-pro cessing step in whic h we construct a data structure that acts as an exact distance oracle and lets us quickly compute the distance b et w een arbitrary vertices. F or Poin t 2, the num b er of candidate pairs depends on the upp er b ound u ( A, B ) . W e define u ( A, B ) in Section 3.2 and show how it can b e efficien tly ev aluated using the distance oracle from Section 3.1. Assuming that G has d local -lo cal diametric partners (Property 1) (and optionally also d corner -few corners, Prop erty 2) and that P is ( α, β ) -w ell-spaced (Prop erties 3– 5) we then show that our definition of u ( A, B ) leads to a small num b er of candidate pairs. In fact, there can be m uc h fewer candidate pairs than pairs of blo cks. In Section 3.4 we provide a wa y of computing all candidate pairs that do es not need to consider all pairs of blo c ks. Finally , w e address Poin t 3, b y essentially performing a binary search on the solution. F or this, w e treat ℓ not as a low er bound on the diameter, but simply as a guess for the diameter. Then, using the approac h outlined abov e, w e can decide whether ℓ is smaller, 8 Diameter Computation on (Random) Geometric Graphs equal or larger than the diameter. Assuming ℓ ≥ diam G , there are only few candidate pairs and the algorithm terminates quickly (see also the discussion of P oint 2 ab ov e). Equiv alently , if the algorithm do es not terminate quickly , this means that ℓ < diam G . This allows us to determine diam G in a binary search. In Section 3.5 w e discuss the details for this, including an additional exp onential search in order to choose k optimally . 3.1 Distance Oracle and Maxdist Computation In the pre-pro cessing step, we conduct breadth-first searc hes from separator vertices in the blo c ks of the recursive partition. This allows us to construct an exact distance oracle and compute vertex eccentricities in each blo ck. The rough idea for the distance oracle is very simple. If a v ertex set S separates tw o v ertices v and w , then shortest paths b etw een v and w cross S . Th us there exists a v ertex s ∈ S suc h that the distance b etw een v and w is d G ( v , s ) + d G ( s, w ) and the distance b etw een v and w can b e found by chec king the distances to v and w from each s ∈ S . W e note that this is a standard approach and has already b een used for distance oracles and (directed) reac habilit y oracles in other settings [13, 3, 11]. ▶ Lemma 4. L et G b e a gr aph with de gener acy d and a b alanc e d r e cursive p artition P with ( α, β ) -smal l sep ar ators (Pr op erty 3). Then, in O ( n 1+ α + β · d ) time, we c an c onstruct a data-structur e D r e quiring O ( n 1+ α + β ) sp ac e that c an (i) for any two vertic es v , w c ompute d G ( v , w ) in O ( n α + β ) time, unless v and w ar e b oth non-b oundary vertic es of the same l e af-blo ck of P , (ii) for e ach blo ck B ∈ P r eturn a vertex b ∈ B and ecc G [ B ] ( b ) in O (1) time. Pro of. F or each blo ck B of P w e p erform a BFS restricted to G [ B ] from each vertex s in the separator of B . W e store the distances from s to eac h vertex b ∈ G [ B ] in an array D B ,s . F or the running time, note that a blo ck B with k v ertices has k · d edges and an separator of size s k ∈ O ( k α · n β ) . Th us, the cost for the s k BFS runs on G [ B ] is in O ( s k · k d ) . W e write T ( k ) for the running time of these BFS runs plus the running time in all descendan t blocks of B . Eac h blo ck B has c ∈ O (1) children that form a partition of B , so this results in the recurrence T ( k ) = k α · n β · k · d + c X i =1 T ( b i k ) , where the b i ∈ (0 , 1) are constants summing up to 1 , P c i =1 b i = 1 . Then, T ( n ) ∈ O ( n 1+ α + β · d ) follo ws via induction ov er n or b y applying the theorem of Akra and Bazzi [ 1 ]. Similarly , for eac h size k blo c k we need to store O ( k ) distances, so total space needed is in O ( n 1+ α + β ) . Note that these BFS runs allo w us to store, for each blo ck B , the eccentricit y of a v ertex of G [ B ] without incurring any additional asymptotic o verhead. This implies statemen t (ii). It remains to discuss the distance queries. Let v and w b e tw o vertices and let P b e a shortest path b etw een them in G . Consider the smallest block B that contains P . If B is a leaf-blo ck, then b oth v and w are contained in B . Then, if without loss of generality v is a b oundary vertex of B , w e hav e d G [ B ] ( v , w ) = d G ( v , w ) . F urthermore, v is a separator v ertex of the parent B ′ of B and the distance b etw een v and w can be lo oked up in the pre-computed distance arra y D B ′ ,v . If v and w are b oth non-b oundary v ertices of B , it P ma y not contain any separator v ertices, so w e ignore this case. If otherwise B is not a leaf-blo ck, w e claim that P con tains a separator of B . T o see this consider tw o cases. If v and w lie in different c hild blocks of B , then a path from v to w J. Op en A ccess and J. R. Public 9 clearly needs to cross the separator of B . Otherwise, if v and w lie in the same child blo ck B ′ of B , then by the c hoice of B the path P is not contained in B ′ . This means that P crosses a b oundary vertex b of B ′ , whic h is a separator vertex of B . Then, as P is con tained in B w e hav e d G ( v , w ) = d G [ B ] ( v , b ) + d G [ B ] ( b, w ) . Again, these distances can b e lo ok ed up in a pre-computed distance array D B ,b . T o summarize both cases, there exists a blo ck B that is a common ancestor of the leaf blo c ks con taining v and w and a separator v ertex s of B suc h that d G ( v , w ) = d G [ B ] ( v , s ) + d G [ B ] ( s, w ) . Thus, in order to answ er distance queries, w e can proceed as follo ws. F or a giv en pair of vertices v , w ∈ V ( G ) we first identify the leaf blo cks B v and B w with v ∈ B v and w ∈ B w . This can b e done in O (1) time, assuming that as an additional prepro cessing step w e iterate o ver all leav es of P in O ( n ) time. Next, we find the low est common ancestor B ∗ of B v and B w in P in O (1) time assuming some additional O ( n ) time prepro cessing [ 4 ]. Let B 1 = B ∗ , . . . , B ℓ b e the sequence of ancestor blo cks from B ∗ to the ro ot. F or eac h blo ck B i with separator S i (for i ∈ [ ℓ ] ) we iterate ov er each separator vertex s ∈ S i and return the minim um v alue of d G [ B i ] ( s, v ) + d G [ B i ] ( s, w ) . By the considerations ab ov e, this correctly giv es the distance of v and w in G unless b oth v and w are non-b oundary vertices of the same leaf-blo c k. T o analyze the running time recall that distances d G [ B i ] ( s, v ) and d G [ B i ] ( s, v ) can b e lo ok ed up in D B ,s in O (1) time. Consequen tly , we need to b ound the num b er of the separator v ertices S 1 ∪ . . . ∪ S ℓ of B ∗ and its ancestors. Each blo ck with k v ertices has a separator of size O ( k α n β ) and, for a constan t c < 1 , eac h child blo ck has size at most c times the size of its parent. Using ℓ ∈ O (log n ) , w e hav e ℓ X i =1 | S i | ∈ log n X i =0 O  ( n · c i ) α n β  = O ( n α n β ) log n X i =0 ( c α ) i = O ( n α n β ) , so the oracle query can b e answ ered in O ( n α n β ) time. ◀ In addition to accelerating the upp er b ound ev aluation (see Section 3.2), this distance oracle allo ws us to efficien tly compute the maxim um distance b et w een any tw o blo cks A and B of P . W e present t w o metho ds for doing so. The first one simply computes maxdist ( A, B ) using | A | · | B | oracle calls. ▶ Lemma 5. L et G b e a gr aph with de gener acy d and let P b e a b alanc e d r e cursive p artition with ( α, β ) -smal l sep ar ators (Pr op erty 3). After a pr e-pr o c essing step taking O ( n 1+ α + β d ) time, for any two distinct blo cks A, B ∈ P we c an c ompute maxdist G ( A, B ) in O ( | A | · | B | · n α + β ) time. Pro of. The running time follo ws directly from Lemma 4, by calling the distance oracle for eac h pair of v ertices in A × B . ◀ F or the second method, we construct small auxiliary graphs on which distance computa- tions are faster than on the whole graph. This impro v es up on the simple approach in some settings, esp ecially on graphs with small separators. Let A, B ⊆ V ( G ) b e t w o sets of vertices. W e define the overlay gr aph H ( A,B ) of A and B as follows. Let S A and S B b e the b oundary of A and B . Then, we construct H ( A,B ) b y taking G [ A ∪ B ] and inserting weigh ted edges betw een all v ertices S A ∪ S B . F or s, s ′ ∈ S A ∪ S B the edge { s, s ′ } ∈ E ( H ( A,B ) ) has weigh t equal to the distance of s and s ′ in G , i.e., d G ( s, s ′ ) . The following lemma shows that distances in the o verla y graph are equal to distances in G . 10 Diameter Computation on (Random) Geometric Graphs ▶ Lemma 6. L et A, B ⊆ V ( G ) b e vertex subsets and let H = H ( A,B ) b e the overlay gr aph of A and B . Then for any two vertic es u, v ∈ A ∪ B their distanc e in G is e qual to their distanc e in H , i.e., d G ( u, v ) = d H ( u, v ) . Pro of. W e first sho w d H ( A,B ) ( u, v ) ≤ dG ( u, v ) . F or this, let P b e a shortest path from u to v in G . If P con tains no vertices of V ( G ) \ V ( H ( A,B ) ) , then P is also a path in H ( A,B ) . F or the other case, we first note that only b oundary v ertices of A or B can ha ve neighbors in V ( G ) \ V ( H ( A,B ) ) . No w consider an inclusion-maximal subpath P s of P that con tains only v ertices of V ( G ) \ V ( H ( A,B ) ) . Then, in H ( A,B ) the tw o vertices that come b efore and after P s on P are connected by a w eighted edge of length | P s | . Thus, by removing all maximal subpaths con taining only vertices of V ( G ) \ V ( H ( A,B ) ) from P w e obtain an equally long path in H ( A,B ) . Next, we show d G ( u, v ) ≤ d H ( A,B ) ( u, v ) . Suppose P is a shortest path b etw een u and v in H ( A,B ) . Then, an equally long path in G can b e obtained by replacing an y weigh ted shortcut edge of P with the shortest path b etw een the endp oints of that edge in G . ◀ T o compute the maxim um distance of t wo blo c ks A and B of P , w e can th us compute it on H ( A,B ) instead. The running time then consists of the time for the construction of H ( A,B ) plus the time for running Dijkstra’s algorithm | A | times. W e summarize this in the following lemma. ▶ Lemma 7. L et G b e a gr aph with de gener acy d and let P b e a b alanc e d r e cursive p artition with ( α, β ) -smal l sep ar ators (Pr op erty 3). After a pr e-pr o c essing step taking O ( n 1+ α + β d ) time, for any blo cks A, B ⊆ P (including A = B ) with k = | A ∪ B | we c an c ompute maxdist G ( A, B ) in time O ( k 2 log k + k 2 d + k 1+2 α n 2 β + k 2 α n α +3 β ) . Pro of. W e rely on the pre-pro cessing and distance oracle given in Lemma 4 and construct the o verla y graph H ( A,B ) . F or this, w e construct the subgraph G [ A ∪ B ] in O ( k d ) time and then lo ok up all distances b etw een b oundary vertices using the distance oracle. Eac h distance lo okup takes O ( n α + β ) time. As the blo cks hav e O ( k α n β ) b oundary vertices, this results in a total running time in O ( k d + ( k α n β ) 2 n α + β ) = O ( k d + k 2 α n α +3 β ) for the construction of H ( A,B ) . By Lemma 6, we can determine maxdist G ( A, B ) b y running Dijkstra’s algorithm from ev ery vertex a of A to find the v ertex b ∈ B most distant from a . The ov erlay graph has O ( k ) vertices and O ( k d + k 2 α n 2 α ) edges, so Dijkstra’s algorithm runs in O ( k log k + k d + k 2 α n 2 β ) time and O ( k ) such queries tak e O ( k 2 log k + k 2 d + k 1+2 α n 2 β ) time. T ogether with the construction of H ( B ,C ) , this yields the running time claimed in the lemma statement. ◀ J. Op en A ccess and J. R. Public 11 3.2 Upp er Bound Recall that we wan t to a void computing the maxdist of pairs of blo c ks that are to o close to p ossibly con tain diametric v ertex pairs. In this section w e give the upp er b ound used for this purp ose and sho w that it can b e ev aluated efficiently . ▶ Lemma 8. L et G b e a gr aph with de gener acy d and a b alanc e d r e cursive p artition P with ( α, β ) -smal l sep ar ators. After an O ( n 1+ α + β d ) time pr e-pr o c essing, we c an for any given blo cks A, B ∈ P (including A = B ) c ompute a value u ( A, B ) in time O ( n α + β ) , such that maxdist G ( A, B ) ≤ u ( A, B ) ≤ maxdist G ( A, B ) + 2 diam G [ A ] +2 diam G [ B ] . Pro of. As a pre-pro cessing, we rely on the distance oracle from Lemma 4, which is constructed in O ( n 1+ α + β d ) time. W e consider blocks A, B ∈ P . If A = B w e compute u ( A, B ) b y selecting an arbitrary v ertex a ∈ A and lo oking up the eccentricit y ecc G [ A ] ( a ) in O (1) time. Setting u ( A, B ) = 2 · ecc G [ A ] ( a ) , w e hav e maxdist G ( A, B ) = diam G [ A ] ≤ u ( A, B ) ≤ 2 diam G [ A ] . It remains to consider the case A  = B . W e set u ( A, B ) = 2 ecc G [ A ] ( a ) + 2 ecc G [ B ] ( b ) + d G ( a, b ) , where a ∈ A and b ∈ B are c hosen such that, using the distance oracle, we can lo ok up their eccen tricities in O (1) time and compute d G ( a, b ) in O ( n α + β ) time (see also Lemma 4). Regarding the claimed inequalities, w e first show maxdist G ( A, B ) ≤ u ( A, B ) . Consider maximally distan t vertices a ∗ ∈ A and b ∗ ∈ B , i.e., d G ( a ∗ , b ∗ ) = maxdist G ( A ) , and let P b e a shortest path b etw een a ∗ and b ∗ . Then, an y other path from a ∗ to b ∗ is at least as long as P . W e thus consider the path P ′ obtained by concatenating a shortest a ∗ a path in G [ A ] , a shortest ab path and a shortest bb ∗ path in G [ B ] . Then we hav e | P | = maxdist G ( A, B ) = d G ( a ∗ , b ∗ ) ≤ d G [ A ] ( a ∗ , a ) + d G ( a, b ) + d G [ B ] ( b, b ∗ ) = | P ′ | . W e hav e d G ( a ∗ , a ) ≤ diam G [ A ] ≤ 2 ecc G [ A ] ( a ) . With an analogous estimate on d G ( b ∗ , b ) , we th us obtain maxdist G ( A, B ) ≤ 2 ecc G [ A ] ( a ) + d G ( a ′ , b ′ ) + 2 ecc G [ B ] ( b ) = u ( A, B ) . F or the other claimed inequality , u ( A, B ) ≤ maxdist G ( A, B ) + 2 diam G [ A ] +2 diam G [ B ] , note that d G ( a, b ) ≤ maxdist G ( A, B ) and additionally that an y eccentricit y in a graph is at most the diameter. ◀ This means that the u ( A, B ) o vershoots maxdist G ( A, B ) b y at most a constant multiple of the diameters of G [ A ] and G [ B ] . This helps us to analyze the effectiv eness of the pruning based on this upp er bound in the next section. 3.3 Numb er of Candidate Pairs Recall from the b eginning of Section 3, that we consider a flat partition B ⊂ P , i.e., a set of similarly sized blo cks of P that partitions V . Moreov er, we denote B ∈ B as a candidate partner for A under ℓ , if u ( A, B ) ≥ ℓ . In the follo wing, w e giv e upp er bounds for the n umber of candidate pairs in B on graphs with lo cal diametric partners and, optionally , few corners. W e b egin b y formalizing the intuition that candidate pairs are located far from each other in the graph. 12 Diameter Computation on (Random) Geometric Graphs ▶ Lemma 9. F or ℓ ≥ diam G , let A and B b e two c andidate p airs under ℓ , i.e., u ( A, B ) ≥ ℓ . Then for every p air of vertic es a ∈ A and b ∈ B we have d G ( a, b ) ≥ diam G − 3 diam G [ A ] − 3 diam G [ B ] . Pro of. Consider A and B with u ( A, B ) ≥ ℓ . Using ℓ ≥ diam G and the maximum v alue of u ( A, B ) from Lemma 8, this implies maxdist( A, B ) + 2 diam G [ A ] +2 diam G [ B ] ≥ u ( A, B ) ≥ ℓ ≥ diam G . This means there are vertices a ∗ ∈ A and b ∗ ∈ B with d G ( a ∗ , b ∗ ) ≥ diam G − 2 diam G [ A ] − 2 diam G [ B ] . F or a pair of vertices a ∈ A and b ∈ B , we hav e d G ( a ∗ , b ∗ ) ≤ d G ( a ∗ , a ) + d G ( a, b ) + d G ( b, b ∗ ) ≤ diam G [ A ] + d G ( a, b ) + diam G [ B ] T ogether, this implies d G ( a, b ) ≥ diam G − 3 diam G [ A ] − 3 diam G [ B ] . ◀ Assume that G has d local -lo cal diametric partners (Prop erty 1) and P is ( α, β ) -w ell-spaced. W e show that among the similarly sized blo cks B eac h blo ck has only few candidates. The idea for this is roughly as follo ws. By Lemma 9, v ertices of a candidate pair are almost diametrical. Ho wev er, b y Property 1 the almost diametrical partners of any vertex are co v ered by few balls of b ounded radius and by Prop erty 5 only few blo cks with relev ant diameters intersect any such ball. This giv es a bound on the num b er of candidates. ▶ Lemma 10. L et G b e a gr aph with d local -lo c al diametric p artners and a ( α, β ) -wel l-sp ac e d r e cursive p artition P . L et further ℓ ≥ diam G , and let B ⊂ P b e a flat p artition with similarly size d blo cks of diameter in Ω( d local ) . Then e ach blo ck A ∈ B has only O (1) c andidates in B . Pro of. Let A ∈ B b e a blo ck that has a candidate B ∈ B under ℓ , i.e., u ( A, B ) ≥ ℓ . Then, for any pair of vertices a ∈ A and b ∈ B w e hav e d G ( a, b ) ≥ diam G − 3 diam G [ A ] − 3 diam G [ B ] b y Lemma 9. All blo cks of B ha v e roughly the same size and by Prop ert y 4 also roughly the same diameters, so this means d G ( a, b ) ≥ diam G − x for x ∈ Θ( diam G [ A ] ) . Recall that w e call vertices satisfying the abov e inequalit y x -diametric. W e hav e thus shown that the v ertices of any candidate block B of A are among the x -diametric partners of a ∈ A . Prop ert y 1 guarantees that all x -diametric partners of a lie in O (1) balls of radius O ( x + d local ) = O ( x ) . Moreo ver, due to Prop erty 5, only a constant num b er of blo cks with diameter Θ( diam G [ A ] ) = Θ( diam G [ B ] ) intersect any ball of radius O ( x ) = O ( diam G [ A ] ) , i.e., the x -diametric partners of a lie in a constant num b er of blocks with diameter Θ( diam G [ A ] ) . Th us, A has only a constant num b er of candidates in B . ◀ No w assume that G also has d corner -few corners (Property 2). W e sho w that in a flat partition with blo cks of sufficien tly large diameter only few blo c ks hav e candidates. ▶ Lemma 11. L et G b e a gr aph with d corner -few c orners, let P b e a ( α, β ) -wel l-sp ac e d r e cursive p artition, let ℓ ≥ diam G , and let B ⊂ P b e a flat p artition with blo cks of diameter in Ω( d corner ) . Then, only O (1) blo cks of B have c andidates in B . Pro of. Let A ∈ B b e a blo ck that has a candidate B in B , i.e., u ( A, B ) ≥ ℓ . By Lemma 9, for any vertices a ∈ A and b ∈ B we ha v e d G ( a, b ) ≥ diam G − 3 diam G [ A ] − 3 diam G [ B ] . This means that b is in the x = (3 diam G [ A ] +3 diam G [ B ] ) -diametric set of a . Note that diam G [ A ] ∈ Ω( d corner ) and thus x ∈ Ω( d corner ) . W e hav e thus shown that for some J. Op en A ccess and J. R. Public 13 x ∈ Ω( d corner ) ev ery blo ck A with a candidate in B has at least one x -diametric partner. By Prop ert y 2, the set of vertices that ha ve x -diametric partners can b e co vered by O (1) balls of radius O ( x + d corner ) = O ( x ) in G . By Prop erty 5, any suc h ball is intersected by only O (1) blocks with diameter in Θ( x ) = Θ( diam G [ A ] ) . This implies that only O (1) blocks of B con tain vertices with x -diametric partners. ◀ Assuming that the diameter of blo cks in B i is in Ω( min { d local , d corner } ) this impro ves the b ound on the n umber of candidate pairs given by Lemma 10. W e get that only O (1) blo c ks of B i ha v e candidates and eac h only has O (1) candidates. Thus, the total n um b er of candidate pairs is also in O (1) . 3.4 Efficient Candidate Enumeration W e ha v e shown that within a flat partition B with blo cks of sufficien tly large diameter, every blo c k has only O (1) candidates (see Section 3.3). Additionally , for eac h pair of blo cks we can quic kly test whether they form a candidate pair (see Lemma 8). Ho wev er, if the blo c ks of B consist of Θ( k ) vertices, there are Θ( n/k ) many blo cks and thus testing each of the O ( n 2 /k 2 ) pairs is pretty exp ensive, esp ecially for small k . T o improv e up on this, the following observ ation is helpful. Consider t wo blo cks A and B that do not form a candidate pair, i.e., u ( A, B ) < ℓ . Then w e hav e maxdist G ( A, B ) < ℓ and w e can ignore all v ertices a ∈ A and b ∈ B on the searc h for the diameter. More generally , let A ′ ⊂ A and B ′ ⊂ B b e descendan ts of A and B , respectively . If A and B do not form a candidate pair, then maxdist G ( A, B ) < ℓ and hence also maxdist G ( A ′ , B ′ ) < ℓ . In this case w e consider ( A ′ , B ′ ) to not b e a candidate pair regardless of the actual v alue of u ( A ′ , B ′ ) . W e thus go through the recursive partition in a top-do wn fashion, i.e., instead of directly considering pairs of blo c ks in B , w e first ev aluate the upp er b ounds for their ancestors in P , starting at the ro ot. This wa y w e can already exclude pairs of blocks in B that ha ve ancestors that do not form candidate pairs. T o mak e the approac h more precise, w e main tain an interme diate flat p artition B i . Initially , B 0 consists of the ro ot blo ck of P . Afterw ards, in step i ≥ 1 , we obtain B i from B i − 1 b y replacing the largest block of B i − 1 with its children in P . A t each step, w e k eep track of all candidate pairs in B i . This means that when replacing a blo ck B ∈ B i − 1 with its c hildren B ′ 1 , . . . , B ′ b ∈ B i , w e compute the upper b ound b etw een each child and eac h candidate for B in B i − 1 . W e stop this pro cess with a final flat partition B j = B . In Section 3.5 we discuss ho w j is chosen in order to minimize the running time. Before that, we summarize imp ortant prop erties of the in termediate flat partitions. Clearly , the balance and b ounded branching factor of P implies that after each step i , the blo c ks B i are similarly sized, i.e., for any A, B ∈ B i w e hav e | A | ∈ Θ( | B | ) . With Prop erty 4 (size-dep enden t diameters), this implies diam G [ A ] ∈ Θ( diam G [ B ] ) . As B i forms a partition of V , it consists of Θ( n/ | A | ) blo cks for A ∈ B i . By Lemma 10, each blo ck A ∈ B i has only O (1) candidates in B i under low er b ound ℓ ≥ diam G , pro vided that diam G [ A ] ∈ Ω( d local ) (see Prop ert y 1). This allows us to bound the running time needed to compute the candidate pairs in B j . ▶ Lemma 12. A ssume that the flat p artition B j has blo cks with diameter in Ω( d local ) and ℓ ≥ diam G . Then, in O ( n 1+ α + β ) time, we c an c ompute B 0 , . . . , B j and enumerate al l c andidate p airs in B i for al l i ∈ [0 , j ] . Pro of. A t each step i ≤ j a blo ck B from an intermediate flat partition B i − 1 is replaced with its c hildren and upper b ounds are ev aluated in order to maintain the set of candidate pairs. 14 Diameter Computation on (Random) Geometric Graphs Ho w ever by Prop erty 4, for i < j the diameters of blo cks in B i are asymptotically at least as large as the diameters of blocks in B j and thus by Lemma 10 the replaced block B only has O (1) candidate blo cks in B i − 1 . As each blo ck of a well-spaced recursive partition only has O (1) c hildren, this means that the splitting step leads to O (1) upper b ound ev aluations, whic h take O ( n α + β ) time (see Lemma 8). It th us remains to b ound the num b er of blo cks across all considered flat partitions B 0 , . . . , B j . Assume the blo cks in B j ha v e size Θ( k ) . Then it consists of O ( n k ) blocks. All other blo cks that are part of an intermediate flat partition B i with i < j are ancestors of a blo ck of B j . F urther, every blo ck in P has at least 2 children. Th us, the total n umber of unique blocks in any of the considered partitions is also in O ( n k ) . This means that the total running time for all upp er b ound ev aluations is in O  n k · n α + β  . In particular this is dominated b y the running time O ( n 1+ α + β ) for the construction the distance oracle (see Lemmas 4 and 8). ◀ 3.5 Putting Everything T ogether In this section w e combine the components laid out abov e and complete the algorithm. T o recap the different steps, the fundamental approach exp ects a graph G , a recursive partition P and a b ound ℓ and proceeds as follo ws. First, construct the distance oracle, then enumerate all candidate pairs in intermediate flat partitions B i and, for the final flat partition B j , compute the maxdist of each candidate pair. This then yields the diameter of G or, if B j con tains no candidate pair, that diam G < ℓ . T o analyze the algorithm, w e assume that G has n v ertices, degeneracy d , satisfies Prop ert y 1, and that P is ( α, β ) -w ell-spaced. W e first consider the setting where B j is c hosen suc h that the blo cks hav e some sp ecified size Θ( k ) . By Lemma 4 the time needed to construct the distance oracle is in O ( n 1+ α + β · d ) . (1) Assuming the blo cks in B j ha v e diameter in Ω( d local ) and ℓ ≥ diam G , enumerating all candidates in B j causes no asymptotic ov erhead (Lemma 12). Next, by Lemma 7 the running time for one maxdist computation is in ˜ O ( k 2 d + k 1+2 α n 2 β + k 2 α n α +3 β ) . (2) Alternativ ely , by Lemma 5 the maxdist of a pair of distinct blo c ks can also b e computed in time ˜ O ( k 2 n α + β ) . (3) T o guaran tee that all candidate pairs consist of distinct blo cks, it suffices to assume k ∈ o ( n ) . Then, the diameters of the blo c ks in B j are in o ( diam G ) and th us the upp er b ound of any blo c k with itself is in o (diam G ) . As B j forms a partition of the vertices, it consists of O ( n/k ) blo cks. Recall that w e assume that G has d local -lo cal diametric partners and that the blo cks in B j ha v e diameter in Ω( d local ) . Consequently , by Lemma 10, each blo ck has O (1) candidate partners under ℓ ≥ diam G . Thus, there are O ( n/k ) candidate pairs. If G has d corner -few corners and the blo c ks of B j ha v e diameters in Ω( d corner ) , then only O (1) blocks hav e candidate partners, b y Lemma 11. This means that there are only O (1) candidate pairs. The total running time is th us given by the prepro cessing (Equation (1)) and the maxdist computations for each candidate pair (Equation (2), resp ectively Equation (3)). W e summarize the algorithm as follo ws. J. Op en A ccess and J. R. Public 15 ▶ Lemma 13 (Size-based algorithm) . F or G and P as ab ove, ℓ ∈ [ n ] , and k ∈ o ( n ) , ther e is an algorithm A ( G, P , ℓ, k ) that de cides how diam G c omp ar es to ℓ . If ℓ ≥ diam G and P admits a flat p artition into blo cks of size Θ( k ) and diameter Ω( d local ) the running time of A ( G, P , ℓ, k ) is in ˜ O  n 1+ α + β · d + min  nk d + k 2 α n 1+2 β + k 2 α − 1 n 1+ α +3 β , k n 1+ α + β  . If additional ly G has d corner -few c orners and the diameter of the blo cks is in Ω( d corner ) the running time is in ˜ O  n 1+ α + β · d + min  k 2 d + k 1+2 α n 2 β + k 2 α n α +3 β , k 2 n α + β  . Assume that for ℓ ≥ n the ab ov e algorithm terminates T ( n, k ) time steps. Then, by executing the algorithm for T ( n, k ) steps, one can use a binary search to determine diam G . In fact, this strategy can b e extended to also find an optimal v alue for the parameter k , such that the final algorithm only depends on G and P . With the follo wing lemma we describ e this strategy in a generic wa y . ▶ Lemma 14. L et A ( I , ℓ, k ) b e an algorithm that takes as input some instanc e I along with two inte ger p ar ameters ℓ, k ∈ [ n ] and that de cides how ℓ c omp ar es to a numeric al quantity D ( I ) with D ( I ) ∈ [ n ] . A ssume that (a) for ℓ ≥ D ( I ) , the algorithm runs in T ( n, k ) time, and further that (b) ther e is a value k ∗ ∈ [ n ] such that every k ∈ Θ( k ∗ ) minimizes T ( n, k ) for every n up to c onstant factors. Then, ther e is an algorithm A ′ ( I ) that taking an instanc e I that c omputes D ( I ) in time O ( T ( n, k ∗ ) · log 2 n ) . Pro of. The core idea is that if k ∗ and T ( n, k ∗ ) are known, then a binary search on ℓ can b e used to compute D ( I ) using O ( log n ) executions of A ( I , ℓ, k ∗ ) . T o see this, note that b y assumption D ( s ) takes a v alue betw een 1 and n and if A ( I , ℓ, k ∗ ) terminates, it decides whether ℓ < D ( I ) , ℓ = D ( I ) , or ℓ > D ( I ) . Otherwise, if A ( I , ℓ, k ∗ ) do es not terminate within T ( n, k ∗ ) time, then this implies ℓ < D ( I ) and A can b e halted. It remains to find k ∗ and T ( n, k ∗ ) . F or this, we use an exp onential search, i.e., we find (up to a constan t factor) the smallest time limit T and (up to a constant factor) the smallest v alue for k , such that the binary search outlined ab ov e succeeds in O ( T ) time. T o b e more precise, we start with a constant time limit T ∈ O (1) and iteratively increase it by a constant factor until a subroutine succeeds. In that subroutine, we start with k = 1 and iterativ ely increase k b y a constant factor until either k > n or a second subroutine succeeds. The second subroutine tries to determine D ( I ) using a binary search on ℓ , by executing A ( I , ℓ, k ) with a time limit T . If k ∈ O ( k ∗ ) and T ≥ T ( n, k ∗ ) , the binary search finds D ( I ) in O ( T log n ) steps as discussed ab ov e. If otherwise k or T are too small, then the binary search may wrongly conclude that a probed v alue of ℓ is smaller than D ( I ) . In this case the binary searc h fails and larger v alues for k are tested un til either D ( I ) is found or k > n . In the latter case, T is increased and the exp onential search on k starts again. This means that for eac h v alue of T , the subroutine tests O ( log n ) v alues for k in O ( T log n ) time each. A t some p oin t, T reac hes T ( n, k ∗ ) . Then, the exp onen tial searc h on k succeeds and the binary searc h iden tifies D ( I ) . As T is increased by a constan t factor eac h time, the total running time is dominated by the last round and thus in O ( T ( n, k ∗ ) log 2 n ) . ◀ W e apply this to the size-based algorithm from Lemma 13 and obtain the following. 16 Diameter Computation on (Random) Geometric Graphs ▶ Theo rem 3. L et G b e a n -vertex gr aph with de gener acy d satisfying Pr op erty 1. L et P b e a ( α, β ) -wel l-sp ac e d r e cursive p artition with le af-blo ck size k leaf . F or every k ≥ k leaf such that k ∈ o ( n ) and blo cks of size Θ( k ) have diameter Ω( d local ) , our algorithm c omputes the diameter of G in time ˜ O  n 1+ α + β · d + min  nk d + k 2 α n 1+2 β + k 2 α − 1 n 1+ α +3 β , k n 1+ α + β  . If also Pr op erty 2 holds and blo cks of size Θ( k ) have diameter Ω( d corner ) , it runs in time ˜ O  n 1+ α + β · d + min  k 2 d + k 1+2 α n 2 β + k 2 α n α +3 β , k 2 n α + β  . W e note that in our case, the second logarithmic factor of Lemma 14 can b e a voided. T o see how, note that the running time for the maxdist computations only dep ends on a few quan tities kno wn to the algorithm, such as the num b er of candidate pairs, the size of the blo c ks, and the size of their b oundaries. This means that for eac h intermediate flat partition B i the algorithm can mak e an (up to constant factors) tigh t estimate for the time needed to compute the maxdist of all candidate pairs in B i . Th us, the algorithm can keep track of the elapsed time until eac h step i and calculate the cost for computing the maxdist ov er all candidate pairs of B i . If this estimate for the total running time is below the giv en time limit t the algorithm computes the maxdists on B i = B j . Otherwise it con tinues by considering the next flat partition B i +1 . This contin ues until either the time limit is up or un til a flat partition is found for whic h the time limit is sufficient. If there is some size k and a flat partition B i with blocks of size roughly k suc h that the size-based algorithm A ( G, P , ℓ, k ) from Lemma 13 runs in time t ∗ , then for any given time limit t ≥ t ∗ the abov e algorithm also finds a flat partition for whic h it can calculate the maxdist in time t . This w ay only one logarithmic factor is added by the binary searc h. 4 Analysis on Random Geometric Graphs In order to apply the algorithm from Theorem 3 on random geometric graphs, w e sho w that Prop erties 1–5 hold asymptotically almost surely . W e start with an o verview of the general pro of ideas and also giv e the main intuitions for our analysis of the iFUB algorithm. Prop erties 1 and 2. Recall from the introduction that Properties 1 and 2 are based on simple geometric observ ations (Observ ations 1 and 2) that intuitiv ely hold for the ground spaces of torus/square R GGs on a purely geometric lev el. Consequently , the main task is to transfer these geometric intuitions to the graph setting, i.e., it remains to show that the deriv ed prop erties hold a.a.s. on the graphs. As our main to ol we extend kno wn results on the graph–geometry stretc h, i.e., the relation b etw een geometric distance and graph distance [ 12 ]. Roughly speaking, we use that for v ertices with known geometric distance d on a RGG with connection radius r , the graph distance likely lies within a narrow range around d/r . This allo ws us to sho w that the almost diametric partners of a v ertex v ha v e geometric distance close to the geometric diameter. They are th us con tained in a small geometric ball and therefore also in a small ball in the graph. Prop erties 3, 4, and 5. Showing that the properties related to recursive partitions lik ely hold on RGGs works similarly . Recall that these prop erties are derived from Observ ations 3–5 whic h describe intuitiv e geometric prop erties. W e thus formally define a recursive partition based on the quadtree-like sub division used for these observ ations, see also Figure 2d. Then, geometrically each cell with side length s has p erimeter 4 s , area s 2 , and diameter √ 2 s . As J. Op en A ccess and J. R. Public 17 v w w ′ c (a) c D / 2 (b) c c c c D / 2 c ′ (c) Figure 3 Visualization for the analysis of the iFUB algorithm. Part (a) concerns the 2-sweep heuristic on square RGGs: for any chosen vertex v , the highly distant vertex w lies in a small region (blue) around a corner of the ground space and the central vertex c lies in a small lens (also blue, not to scale) in the center. Only few vertices lie in the small regions with distance at least half the diameter D from c (P art (b), orange), giving an upper b ound on the running time on square RGGs. P art (c) shows the torus, a p oint c , and its antipo dal partner c ′ ; it can b e seen that most p oints (orange) hav e distance at least half the diameter D from c . the num b er of v ertices within an y polynomially sized region is highly concen trated, this giv es us that the recursive partition of the graph is balanced and has small separators. With the b ound on the graph–geometry stretc h this also gives the claimed size-dependent diameters. Here, we need sligh tly stronger guaran tees than already shown [ 12 ], b ecause we need short paths that do not only exist in the whole graph, but also in the subgraphs induced b y the recursiv e partition. Finally , it is easy to formally pro ve a v ariant of Observ ation 5, which directly implies Prop erty 5 via the concentration of the vertices. R unning Time of iFUB. F or our analysis of the iFUB algorithm on random geometric graphs, we consider the v ariant of iFUB that chooses a central vertex c using the 2-swe ep heuristic as follows. First, the algorithm performs a BFS from an arbitrary vertex v and pic ks a vertex w in the last lay er, i.e., with maximum distance from v . Then, a second BFS is p erformed from w and the vertex c is chosen half the wa y on a shortest path b etw een w and a v ertex w ′ with maximum distance from w . Subsequen tly , iFUB p erforms exactly one BFS from every vertex whose distance to c is more than half the diameter of G . In the settings we consider, these vertices also accoun t for prett y muc h all BFS runs and thus directly determine the total running time. F or the upper b ound on square R GGs, we b egin b y sho wing that the vertex w selected b y the first BFS is lik ely lo cated close to a corner of the square ground space. Afterwards, w e show that c is lo cated in a small lens close to the geometric center of the ground space, see also Figure 3a. Both of these steps use basic geometric arguments and rely on the graph–geometry stretch, how ever b ounding the size of the lens in the second step is somewhat tec hnical. Conditional on c b eing lo cated close to the geometric cen ter, it is then easy to sho w that there are not man y vertices whose distance to c is at least half the diameter of G . This then gives the running time in the first part of Theorem 1. F or the torus, an y chosen center c results in more than half of all p oints having distance more than half the diameter of G from c , see also Figure 3c. Combined with the graph– geometry stretc h this directly sho ws that iFUB performs a BFS from Ω( n ) v ertices, cov ering the second part of Theorem 1. 18 Diameter Computation on (Random) Geometric Graphs Outline. In the remainder of this section we start with our definition of random geometric graphs and afterwards show the stretc h b ounds. In order to apply the algorithmic framew ork from Section 3, we then first define the recursiv e partition and sho w that Prop erties 3–5 are lik ely to hold, b efore considering Prop erties 1 and 2, and finally combining these results and apply Theorem 3 to get running times for the algorithm. Afterwards, in Section 4.6 we analyze the running time of iFUB. 4.1 Definitions F or a side length s ∈ R , we define S s as the square [0 , s ) 2 ⊆ R 2 . W e write d E ( u, v ) for the Euclidean distance betw een t w o p oints u, v ∈ R 2 . F urther, we define the (flat) torus T s = R 2 / ( s · Z ) 2 with side length s as the equiv alence classes of p oints in [0 , s ) 2 , i.e., w e write v as a shorthand for [ v ] = { v + m | m ∈ ( s · Z ) 2 } for an y v ∈ R 2 . The tor oidal distanc e b et w een tw o equiv alence classes is defined as the minimum Euclidean distance b etw een p oin ts in the equiv alence classes, i.e., d T s ( u, v ) := min { d E ( z , w ) | z ∈ [ u ] , w ∈ [ v ] } . In the con text of random geometric graphs w e write S (resp ectively T ) for S √ n (resp ectiv ely T √ n ). Then for a ground space X ∈ {T , S } w e define the r andom ge ometric gr aph G ∈ G ( X, n, r ) as follows. Throughout this pap er w e assume r < n ρ for a constan t ρ < 1 2 . The vertex set V ( G ) is obtained by dra wing n p oin ts independently and uniformly in X . W e identify each v ertex v with its geometric p osition ( v x , v y ) ∈ R 2 . Then, t wo vertices are adjacent exactly if their distance in X is at most r , i.e., E ( G ) = {{ v , w } ∈  V ( G ) 2  | d X ( v , w ) ≤ r } . Here, w e let d X refer to the Euclidean distance for G ( S , n, r ) and to the toroidal distance for G ( T , n, r ) . W e call G ∈ G ( S , n, r ) a squar e random geometric graph and G ∈ G ( T , n, r ) a torus random geometric graph. W e write ˜ G ( X, n, r ) for the related mo del of Poisson RGGs . Here, we first dra w a Poisson random v ariable N with mean n and then draw G ∼ ˜ G ( X, n, r ) as a random geometric graph with N v ertices. Note that this is equiv alent to setting V ( G ) as the result of a Poisson p oint pro cess with intensit y 1 on X . The adv an tage of ˜ G ( X, n, r ) ov er G ( X, n, r ) is that the num b er of v ertices in any region A ⊆ X with area measure a follo ws a Poisson random v ariable with mean a and is indep enden t from the num b er of vertices in a disjoin t region A ′ ⊆ X \ A . 4.2 Graph-Geometry Stretch on RGGs There is a tight relationship b et ween the geometric distance and the graph distance of vertices in a random geometric graph. F or a low er b ound on the graph distance, note that in a random geometric graph with connection radius r , eac h edge connects vertices of distance at most r . Th us, regardless of the underlying geometry X ∈ {S , T } for any pair of v ertices u , v w e hav e d G ( u, v ) ≥  d X ( u, v ) r  . (4) In terestingly , on random geometric graphs we also get upp er b ounds for the graph distance conditional on the geometric distance of vertices. Belo w, w e slightly adapt results by Díaz, Mitsc he, Perarnau, and Pérez-Giménez [ 12 ] to also give upp er b ounds for the graph distance within subgraphs induced b y axis aligned squares. ▶ Lemma 15 ([ 12 ], Theorem 1.1) . L et G ∼ G ( S , n, r ) b e a squar e RGG with c onne ction r adius r ∈ ω ( log 3 / 4 n ) . A symptotic al ly almost sur ely, for every p air of vertic es u, v ∈ V ( G ) J. Op en A ccess and J. R. Public 19 with d E ( u, v ) > r , we have d G ( u, v ) ≤  d E ( u, v ) r  1 + s   with s = s ( d E ( u, v ) , r ) ∈ ( O  r − 4 / 3 log n  if d E ( u, v ) ≤ r log n , O  r − 4 / 3  if d E ( u, v ) > r log n. F urthermor e, every axis-aligne d squar e c ontaining u and v c ontains a ( u, v ) -p ath of such length. F or G ∈ ˜ G ( S , n, r ) , the same event holds with pr ob ability 1 − o ( n − 5 / 2 ) . Pro of. The upp er b ound on the graph distance b etw een u and v is given in statemen t (ii) of Theorem 1.1 in [12] as s = s ( d E ( u, v ) , r ) ∈ O  log n r 2 + r · d E ( u, v )  2 / 3 +  √ log n r  4 + r − 4 / 3 ! . F or r > log 3 / 4 n w e hav e  √ log n r  4 < r − 4 / 3 . Thus, the second summand is dominated b y the third one. F or the first summand w e ha v e  log n r 2 + r · d E ( u, v )  2 / 3 <  log n r 2  2 / 3 = r − 4 / 3 log 2 / 3 n. A dditionally , for d E ( u, v ) ≥ r log n the first summand is smaller than r − 4 / 3 . It remains to sho w that one ( u, v ) path of suc h length is contained in a square bounding b ox of u and v . F or this w e need to consider some details made in the pro of of Corollary 2.1 [ 12 ]. This corollary considers a disk intersection graph of a P oisson p oint process in the plane, where vertex u is planted at the origin and vertex v at ( t, 0) . The authors then consider the rectangle R = [1 . 01 α, t − 1 . 01 α ] × [0 , α ] for α ∈ Θ( r ) with α < 0 . 004 r . Relying on further lemmas that we do not need to discuss here, the authors show that with probabilit y 1 − o ( n − 5 / 2 ) there exists a path of the desired length from u to v that only uses vertices in R . The theorem then follo ws with a de-Poissonization, reducing the probability to 1 − o ( n − 2 ) , follo w ed by a union b ound o ver all pairs of v ertices in the random geometric graph G , reducing the probability to 1 − o (1) . In order for the union b ound to w ork, the authors show that the path within the rectangle R implies a path within the [0 , √ n ] × [0 , √ n ] ground space of G , even if u and v lie on the b oundary of the ground space. The union b ound afterwards do es not distinguish b etw een v ertices close to the b oundary and the many more vertices far from the boundary . Thus, the pro of given in [ 12 ] also implies that for an y pair of vertices u and v in G there is a path of the desired length that do es not lea ve any axis aligned square containing u and v . ◀ W e use a coupling argument to sho w that Lemma 15 holds analogously on the torus. ▶ Lemma 16. L et G ∼ G ( T , n, r ) b e a torus-RGG with c onne ction r adius r ∈ ω ( log 3 / 4 n ) . A symptotic al ly almost sur ely, for every p air of vertic es v , w ∈ V ( G ) with d T ( v , w ) > r , we have d G ( v , w ) ≤ l d T ( v ,w ) r (1 + s ( v , w , r )) m with the err or term s ( d T ( v , w ) , r ) as in L emma 15, and further, every minimal 3 axis-aligne d squar e c ontaining v and w c ontains a ( v , w ) -p ath of such length. 3 Requiring minimal squares is the main difference to the statemen t of Lemma 15. This difference is necessary , b ecause on the torus there are squares containing u and v that do not contain the geo desic between u and v . 20 Diameter Computation on (Random) Geometric Graphs | {z } | {z } √ n √ n S 2 S 3 S 4 S 3 S 2 S 1 S 2 S 3 S 2 S 1 S 4 S 3 S 3 S 4 S 1 S 2 V A V B V D V C S 1 S 1 S 1 S 2 S 3 v v w S 1 S 4 S 1 S 4 S v v Figure 4 Sketc h of the coupling argument. The square S consists of four smaller squares and v ertex sets V A to V D are formed b y rearranging the p oints of a Poisson p oint process on S as depicted. This wa y the torus distance b etw een p oints v and w in S is realized as the Euclidean distance in one of the rearrangements. Pro of. Consider the torus-RGG G . Then, for any pair of v ertices ( v , w ) the torus T can be mapp ed in to the square S suc h that the distance b etw een v and w is preserved, i.e. suc h that the toroidal distance betw een v and w is equal to their Euclidean distance in the mapping. In fact, four differen t mappings are sufficien t for all pairs of v ertices, see also Figure 4. More formally , we introduce a coupling betw een ˜ G ( T , n, s ) and ˜ G ( S , n, s ) as follo ws. The rough idea is to define four coupled R GGs by suitably re-sh uffling the points sampled from a Poisson p oint pro cess, suc h that the T orus distance b etw een v ertices is realized b y the minim um Euclidean distance in one of the four coupled R GGs. By Lemma 15, in each of the four square RGGs graph distances are a.a.s. not m uc h longer than implied by the geometry , so the same holds on the torus RGGs. By restricting the Poisson p oint pro cess Π on R 2 to S = [0 , √ n ) 2 w e obtain the vertex set V A of a Poisson random geometric graph G A . W e define vertex sets V B , V C , and V D , b y translating the p oints sampled by Π ∩ S as indicated in Figure 4. Let S 1 , S 2 , S 3 , and S 4 b e the four half-op en squares of side length s = √ n 2 that tile S . F or i ∈ [1 , 4] denote Π ∩ S i as Π i and for a p oin t p ∈ R 2 write τ p : R 2 → R 2 , q 7→ q + p for the translation that maps the origin to p . W e define V B = τ ( s, 0) (Π 1 ∪ Π 3 ) ∪ τ ( − s, 0) (Π 2 ∪ Π 4 ) V C = τ (0 ,s ) (Π 3 ∪ Π 4 ) ∪ τ (0 , − s ) (Π 1 ∪ Π 2 ) V D = τ − s,s (Π 4 ) ∪ τ ( s,s ) (Π 3 ) ∪ τ ( − s, − s ) (Π 2 ) ∪ τ ( s, − s ) (Π 1 ); see also Figure 4. Note that these vertex sets follow the distribution of the Poisson p oint pro cess Π restricted to S . Com bining these vertex sets with the threshold radius r w e obtain geometric graphs G B , G C , G D that are each uniform Poisson random geometric graphs sampled from ˜ G ( S , n, s ) . A dditionally , we define G T ∼ ˜ G ( S , n, s ) by connecting the v ertices of V A according to the torus metric. F or simplicity , w e refer to vertices of the differen t graphs as v i ∈ V i , suc h that, for instance each v A ∈ V A has a copy v B ∈ V B that is shifted along the x -axis b y √ n 2 either to the left or to the righ t. Then for any pair of vertices v A , w A ∈ V A w e hav e d T ( v A , w A ) = min i ∈{ A,B ,C,D } d E ( v i − w i ) , and d G T ( v A , w A ) = min i ∈{ A,B ,C,D } d G i ( v i , w i ) , J. Op en A ccess and J. R. Public 21 | {z } | {z } √ n √ n p 1 p 2 p 4 p 3 Figure 5 F our child parts p 1 , p 2 , p 3 , and p 4 of the ro ot part p ε of P . i.e., the torus distance of v A and v B is the minimum Euclidean distance of any of their copies in V A , V B , V C , and V D . Asymptotically almost surely , the stretch even t E stretch of Lemma 15 holds on all four graphs. Thus a.a.s. for an y tw o v ertices v T , w T of G T w e hav e d G T ( v T , w T ) = min i ∈{ A,B ,C,D } d G i ( v i , w i ) ≤ min i ∈{ A,B ,C,D }  d E ( v i , w i ) r (1 + s ( v i , w i , r ))  , =  d T ( v T , w T ) r (1 + s ( v T , w T , r ))  , where s ( v i , w i , r ) is the error term from Lemma 15. W e also get that at least one such path is contained in the smallest axis-aligned square con taining u and v . ◀ W e refer to ev en ts from Lemma 15, resp ectively Lemma 16, as the str etch event and denote it with E stretch . Note in particular that conditioning on E stretch giv es an upp er b ound on the graph distance of al l pairs of v ertices. 4.3 Recursive pa rtition W e now giv e a formal definition for our recursiv e partition and show that with high probability it is balanced and Prop erties 3–5 hold. W e first define the infinite quadtr e e p artition P as a recursiv e subdivision of the of the square S = [0 , √ n ) × [0 , √ n ) . W e index parts using w ords σ ∈ { 1 , 2 , 3 , 4 } ∗ . The ro ot of P is p ε = S , where ε stands for the empt y word. F or an y p σ = [ x 1 , x 2 ) × [ y 1 , y 2 ) , let x ′ = x 1 + x 2 2 and y ′ = y 1 + y 2 2 . Then, the children of p σ (n um b ered from 1 to 4) are p σ 1 = [ x 1 , x ′ ) × [ y ′ , y 2 ) , p σ 2 = [ x ′ , x 2 ) × [ y ′ , y 2 ) , p σ 3 = [ x 1 , x ′ ) × [ y 1 , y ′ ) , p σ 4 = [ x ′ , x 2 ) × [ y 1 , y ′ ) . Figure 5 shows p ε and its children. Clearly , P has constan t branching factor. W e define the lev el ℓ of a part as the length of its index, e.g., p ε is on level 0 and p 13 on lev el 2. Note that P con tains 4 ℓ lev el ℓ parts and each level ℓ part p ∈ P has side length √ n 2 ℓ and area n 4 ℓ . F or our algorithm we only need a finite subset of P . F or this, we define P ℓ as P restricted to parts of level at most ℓ . W e call P ℓ the ℓ -layer e d quadtree partition. 22 Diameter Computation on (Random) Geometric Graphs F or a geometric graph G with V ( G ) ⊆ [0 , √ n ) × [0 , √ n ) the partition P ℓ induces a recursiv e partition G [ P ℓ ] of the vertices, via the in tersection of V ( G ) with the parts of P ℓ . In the following, w e show that for a (square or torus) random geometric graph G the recursiv e partition G [ P ℓ ] a.a.s. is balanced, has small separators, size-dep endent diameters, and b ounded fragmentation. 4.3.1 Balance and Separato r Sizes With resp ect to the area measures of its parts, the infinite quadtree partition P already is balanced and has small separators, so it remains to show the same for the induced recursive partition G [ P ℓ ] . W e use concentration b ounds for the n umber of vertices in regions of sufficien t area to show that the induced recursive partition of G is also balanced and has small separators. ▶ Lemma 17. L et G ∼ G ( X, n, r ) b e a r andom ge ometric gr aph with gr ound sp ac e X ∈ {S , T } and let R ⊆ X b e a me asur able subset of X with ar e a A ( R ) ∈ ω ( log n ) . Then, for any c onstant c the pr ob ability that the numb er of vertic es of G that lie in R is b etwe en A ( R ) ·  1 − q 3 c log n A ( R )  and A ( R ) ·  1 + q 3 c log n A ( R )  is at le ast 1 − O ( n − c ) . Pro of. Let n R = | V ( G ) ∩ R | b e the n um b er of vertices in R . Using V ( G ) = v 1 , . . . , v n , we define X i as a Bernoulli random v ariable that indicates whether the i th vertex of G lies in R . Then we hav e n R = P n i =0 X i and E [ n R ] = A ( R ) . Applying Chernoff b ounds (e.g., see Theorem 4.4 and 4.5 in [16]), for 0 < δ < 1 w e hav e Pr[ n R > E[ n R ](1 + δ )] ≤ e − δ 2 3 E[ n R ] and Pr[ n R > E[ n R ](1 − δ )] ≤ e − δ 2 2 E[ n R ] . W e set δ = q 3 c log n E[ n R ] . Then, we hav e δ < 1 as by assumption E [ n p ] = A ( r ) ∈ ω ( log n ) and th us δ ∈ o (1) . The abov e probabilities simplify to Pr[ n R > E[ n R ](1 + δ )] ≤ e − c log n ∈ O ( n − c ) and Pr[ n R > E[ n R ](1 − δ )] ≤ e − 3 2 c log n ≤ e − c log n ⊆ O ( n − c ) . ◀ W e apply this to derive b ounds for the size of an individual block induced by P ℓ . ▶ Lemma 18. L et G ∼ G ( X, n, r ) b e a r andom ge ometric gr aph with gr ound sp ac e X ∈ {S , T } and c onne ction r adius r . F or c onstant α ∈ [0 , 1] let ℓ = α log 4 n . F or every p art P of the ℓ -layer e d quadtr e e p artition P ℓ with side length s at le ast 2 r it holds w.h.p. that the sub gr aph G [ V ( G ) ∩ P ] induc e d by P c ontains s 2 (1 ± o (1)) vertic es and at most 4( s − r ) r (1 + o (1)) sep ar ator vertic es. Pro of. Let P b e a part of P ℓ with side length s ≥ 2 r . Let G ′ = G [ V ( G ) ∩ P ] b e the subgraph of G induced b y P and let S b e the set of its separator v ertices, i.e., the subset of V ( G ′ ) with neighbors in G \ G ′ . The separator vertices are con tained in a strip of width r around the b oundary of the square defined b y P . With a side length s the area J. Op en A ccess and J. R. Public 23 of P is s 2 and the separator vertices are con tained in a region of area 4 r ( s − r ) . W e hav e s ≥ √ n 2 ℓ = n 1 2 − α 2 , thus b oth areas are in ω ( log n ) . Thus, b y Lemma 17 for any constant c w e ha v e | V ( G ′ ) | = s 2 (1 ± o ( c log n s 2 )) and | S | ≤ 4 r ( s − r )(1 + o ( c log n 4 r ( s − r ) )) with probabilit y 1 − O ( n − c ) . The recursiv e partition P ℓ con tains O (4 ℓ ) = O ( n α ) parts. Thus we can apply the union b ound for the considered even t ov er all P ∈ P ℓ . W e obtain that the probability of the resp ectiv e vertex sets b eing within the desired in terv al is at least 1 − O ( n α n − c ) . F or c ≥ 1 + α the desired even t o ccurs with high probabilit y . ◀ T o sho w that P ℓ induces a balanced recursive partition with has small separators, w e apply the ab ov e lemma to every part. ▶ Lemma 19. L et G ∼ G ( X, n, r ) b e a r andom ge ometric gr aph with gr ound sp ac e X ∈ {S , T } and c onne ction r adius r . F urther, let α ∈ (0 , 1) b e a c onstant such that r ∈ o ( n 1 / 2 − α/ 2 ) , and let ℓ = α log 4 ( n ) . Then, with high pr ob ability, the p artition G [ P ℓ ] of G induc e d by P ℓ is b alanc e d, has (1 / 2 , ρ ) -smal l sep ar ators, and the le af blo cks have Θ( n 1 − α ) vertic es. Pro of. W e condition on the ev en t of Lemma 18 that holds with high probability and sho w the claims one b y one. Balance. Let G σ b e a subgraph induced by a level j = | σ | part P σ ∈ P ℓ , with j < ℓ . Let G σ ′ and G σ ′′ b e children of G σ induced by P ℓ . By Lemma 18 G σ has n 4 j (1 ± o (1)) vertices and G σ ′ and G σ ′′ ha v e n 4 j +1 (1 ± o (1)) vertices. This means that the relativ e size difference of G σ ′ and G σ ′′ tends to 1 and th us the en tire induced recursiv e partition in ε -balanced for arbitrarily small constan t ε > 0 . Small separato rs. Let G ′ b e a subgraph induced by a lev el i part P ∈ P ℓ with side length s = n 1 / 2 2 − i and let S b e the separator of G ′ . Then by Lemma 18, | V ( G ′ ) | = s 2 (1 ± o (1)) and | S | ≤ 4( s − r ) r (1 + o (1)) . W e ha ve i ≤ ℓ = α log 4 n and thus s ≥ n 1 / 2 2 − α log 4 n = n 1 / 2 − α/ 2 . By assumption r ∈ o ( n 1 / 2 − α/ 2 ) , so | S | ∈ O ( r p | V ( G ′ ) | ) . Leaf size. Let G ′ b e a subgraph induced b y a leaf part P σ ∈ P ℓ . Then by Lemma 18 | V ( G ′ ) | ≤ n 4 α log 4 n (1 + o (1)) = n 1 − α (1 + o (1)) . ◀ 4.3.2 Diameters in the Recursive P artition Next, w e w an t to show that the recursive partition a.a.s. has size-dep endent diameters, i.e., that similarly sized blo c ks ha ve similar diameters and these are smaller for smaller blocks. Clearly this holds for the geometric diameters of squares, so it remains to apply the stretch b ounds from Section 4.2. Imp ortantly , we that for ev ery blo ck b ounds on the diameter hold with sufficien tly high probability , such that they a.a.s. hold for all blo cks of the recursiv e partition. Conditional on the stretch ev ent, for every pair of vertices the graph distance is not m uc h larger than necessary based on the geometric distance. With an upper b ound for the geometric diameter of eac h blo ck, this directly translates to an upp er bound for the graph diameter. T o also get a lo wer b ound, we need to sho w that each blo ck also contains vertices with almost diametric geometric distance, i.e., there are vertices close to tw o opp osite corners of the blo c k. T o this end, w e introduce the following lemma, whic h sho ws that any region with sufficiently large area is likely to contain at least one v ertex. ▶ Lemma 20. L et G ∈ G ( X, n, r ) b e a r andom ge ometric gr aph with n vertic es and c onne ction r adius r on the gr ound sp ac e X ∈ {S , T } . L et R ⊆ S b e a r e gion with ar e a a . W e have Pr[ | V ( G ) ∩ R | > 0] ≥ 1 − e − a . 24 Diameter Computation on (Random) Geometric Graphs Pro of. Let X b e a random v ariable for the num b er of v ertices in R . W e hav e Pr[ X > 0] = 1 − Pr[ X = 0] = 1 − Pr " \ v ∈ V v / ∈ R # . These even ts are indep enden t and for each v ∈ V w e hav e Pr[ v / ∈ R ] = 1 − a n . Th us we get Pr[ X > 0] = 1 −  1 − a n  n . F or any x w e ha ve 1 + x ≤ e x and th us 1 − a n ≤ e − a/n and (1 − a n ) n ≤ e − a , whic h concludes the pro of. ◀ Note that in particular a region with area c · log n is non-empt y with probability at least 1 − n − c . W e use this to show b ounds on the diameter of individual blocks, first considering square-R GGs. ▶ Lemma 21. L et G ∼ G ( S , n, r ) b e a r andom ge ometric gr aph with c onne ction r adius r ∈ ω ( log 3 / 4 n ) . F urther, let S ⊆ S b e an axis-aligne d squar e of side length s > r log n . Then, c onditional on the str etch event, we have diam G [ V ( G ) ∩ S ] ≤  √ 2 s r (1 + Θ( r − 4 / 3 ))  . F urther, for any c onstant C > 0 we have with pr ob ability at le ast 1 − n − C diam G [ V ( G ) ∩ S ] ≥ √ 2 s r − 1 . Pro of. The upper b ound directly follo ws via Lemma 15. Note that this is one of the places where w e need our sligh tly strengthened v ersion of the lemma, as we need a path using only v ertices in S . F or the lo wer b ound let x = √ C · log n + log 2 . W e consider tw o squares C 1 , C 2 of side length x lo cated at tw o opposite corners of S . The area of these squares is x 2 = C · log n + log 2 . Th us, b y Lemma 20 the probabilit y that b oth C 1 and C 2 are non-empt y is at least 1 − 2 e − C · log n − log 2 = 1 − n − C . In this case, let v 1 ∈ V ( G ) ∩ C 1 and v 2 ∈ V ( G ) ∩ C 2 b e suc h vertices. Then the distance betw een these vertices is at least d E ( v 1 , v 2 ) ≥ √ 2 s − 2 x . With Equation (4) this means that diam G [ V ( G ) ∩ S ] ≥ d G [ V ( G ) ∩ S ] ( v 1 , v 2 ) ≥ √ 2 s r − 2 x r . By assumption r ∈ ω ( √ log n ) . Hence, 2 x r ∈ o (1) , which concludes the pro of. ◀ W e obtain analogous b ounds on the diameter of (square regions of ) torus R GGs. ▶ Lemma 22. L et G ∼ G ( T , n, r ) b e a torus r andom ge ometric gr aph with r ∈ ω ( log 3 / 4 n ) . F urther, let S ⊆ T b e an axis aligne d squar e of side length s such that r log n < s < √ n . Then, c onditional on the str etch event, we have diam G ≤  √ n √ 2 r (1 + Θ( r − 4 / 3 ))  and diam G [ V ( G ) ∩ S ] ≤  √ 2 s r (1 + Θ( r − 4 / 3 ))  . J. Op en A ccess and J. R. Public 25 F urther, for any c onstant C > 0 we have with pr ob ability at le ast 1 − n − C diam G ≥ √ n √ 2 r − 1 . and diam G [ V ( G ) ∩ S ] ≥ √ 2 s r − 1 . Pro of. The geometric diameter of T is √ 2 n 2 = √ n √ 2 and with the stretc h b ounds on torus R GGs from Lemma 16, the b ounds for diam G follo w analogously to Lemma 21. The subgraph G ′ = G [ V ( G ) ∩ S ] is equal in distribution an analogous subgraph of a square random geometric graph, as with a side length s < √ n w e a void paths or geo desics that wrap around the torus T . Th us, the claimed b ounds follow directly from Lemma 21. ◀ It remains to apply a union bound to show that the ev ents from Lemma 21, respectively Lemma 22, likely hold for each blo ck. In the following lemma, w e summarize the result for b oth the square and torus setting. Note that the geometric diameter of a side length s part P of a quadtree partition is √ 2 s unless s = √ n and the setting is on the torus. In that case the geometric diameter is 2 s √ 2 . ▶ Lemma 23. L et G ∼ G ( X, n, r ) b e a r andom ge ometric gr aph with gr ound sp ac e X ∈ {S , T } and c onne ction r adius r ∈ ω ( log 3 / 4 n ) . F urther, let α ∈ (0 , 1) b e a c onstant such that r ∈ o ( n 1 / 2 − α/ 2 ) , and let ℓ = α log 4 ( n ) . Then, asymptotic al ly almost sur ely, for e ach sub gr aph G ′ induc e d by a p art P of the r e cursive p artition G [ P ℓ ] we have d r − 1 ≤ diam G ′ ≤ d r · (1 + s ) , wher e d is the ge ometric diameter of P in X and s ∈ O ( r − 4 / 3 ) . In p articular, we get that diam G ′ ∈ Θ( | V ( G ′ ) | 1 / 2 r − 1 ) , G [ P ℓ ] has size-dep endent diameters, and le af-blo cks of G [ P ℓ ] have diameter in Θ( n 1 / 2 − α/ 2 r − 1 ) . Pro of. The stretch even t holds asymptotically almost surely on square and torus random geometric graphs, by Lemma 15 and Lemma 16. Th us, by Lemma 21, resp ectively Lemma 22, the diameter of the subgraph induced by a part P of P ℓ has diameter as claimed with probabilit y 1 − n − C for any constant C > 0 . As there are only 4 ℓ = n α suc h parts, a union bound gives that all diameters fall within the claimed range with high probability . T o conclude, recall that w.h.p. every blo ck with side length x induced by a square has x 2 (1 + o (1)) v ertices (Lemma 18). Th us, the diameter of a blo ck with k v ertices is in Θ( k 1 / 2 r − 1 ) . F urther with r ∈ o ( n 1 / 2 − α/ 2 ) leaf blo cks w.h.p. hav e O ( n 1 − α ) vertices, b y Lemma 19. Thus their diameter is in Θ( n 1 / 2 − α/ 2 r − 1 ) . ◀ 4.3.3 F ragmentation W e sho w that the recursive partition G [ P ℓ ] has bounded fragmentation. Again, we start with the purely geometric setting and pro ve that a disk does not intersect to o man y squares of a grid. ▶ Lemma 24. Consider an axis aligne d grid tiling of R 2 with squar es of side length s > 0 and a disk D of r adius r > 0 . Then the numb er of squar es interse cte d by D is at most O  r 2 s 2 + 1  . 26 Diameter Computation on (Random) Geometric Graphs a ≤ 2 √ 2 x p x | {z } p ′ (a) p √ 2 − x 1 − a 1 x (b) p x p p p (c) Figure 6 Part (a): visualization of p oin t P in corner of the unit square S , with the set of p oints Q ⊆ S with distance at least √ 2 − x from P sho wn in blue. Part (b): right triangle used in the pro of of Lemma 26. Part (c): analogous situation on the torus, see also Lemma 27. Pro of. Without loss of generality assume that D is centered at the origin. If a square Q = [ x 1 , x 1 + s ] × [ y 1 , y 1 + 1] intersects D , then it must be contained in the square Q ⋆ = [ − ( r + s ) , r + s ] × [ − ( r + s ) , r + s ] . The area of Q ⋆ is (2 r + 2 s ) 2 , while each square only has area s 2 . This means that (2 r +2 s ) 2 s 2 ∈ O  r 2 s 2 + 1  non-in tersecting squares of the tiling can lie inside Q ⋆ . ◀ W e translate this to the setting of the recursive partition of a random geometric graph and obtain the follo wing theorem ab out its fragmen tation. ▶ Lemma 25. L et G ∼ G ( X, n, r ) b e a r andom ge ometric gr aph with gr ound sp ac e X ∈ {S , T } and c onne ction r adius r ∈ ω ( log 3 / 4 n ) . F urther, for a c onstant α ∈ (0 , 1) such that r ∈ o ( n 1 / 2 − α/ 2 ) , let ℓ = α log 4 ( n ) . Then, asymptotic al ly almost sur ely, the r e cursive p artition G [ P ℓ ] has b ounde d-fr agmentation. Pro of. W e consider a set of vertices A that is contained in a ball of radius k in G . F urther, let c 1 > 1 be a constant and denote b y B k the blocks of P ℓ with diameter b et ween k /c 1 and k c 1 . W e need to show that only a b ounded n um b er of blo cks of B k in tersect A . W e condition on the stretch even t, which holds asymptotically almost surely (Lemmas 15 and 16). Then, A is con tained in a geometric ball B of radius O ( k r ) . By Lemma 24, B in tersects only O  ( kr ) 2 s 2  squares of side length s in an y grid tiling of R 2 . This upper b ound also applies to the num b er of blo c ks intersecting B in each level of P ℓ , as these can b e extended into a tiling of R 2 . The blo cks of B k come from O ( log c 1 ) many different levels in P ℓ . As they hav e diameter in Θ( k ) , the geometric diameter and th us also the side length of these blocks is a.a.s. in Θ( k r ) (Lemma 23). Th us, the num b er of blo cks of B k in tersecting B is in O  ( kr ) 2 ( kr ) 2 log c 1  = O (1) , whic h concludes the pro of. ◀ 4.4 Lo cal Diametric P a rtners and F ew Co rners In this section w e sho w that Prop erty 1 holds a.a.s. on b oth square and torus RGGs while Prop ert y 2 additionally holds on square RGGs. W e b egin by considering the purely geometric setting and give a proof for Observ ation 1 on the unit square. ▶ Lemma 26. L et S b e the unit squar e and p a p oint on S . F or every x > 0 , the set of p oints with distanc e at le ast √ 2 − x fr om p c an b e c over e d by a disk of r adius O ( x ) . J. Op en A ccess and J. R. Public 27 Pro of. Denote the set of p oints with distance at least √ 2 − x from p b y Q and let r = √ 2 − x . Without loss of generalit y , we assume that p is in the left and lo wer quadran t of S . Note that moving p to w ards the b ottom left corner only increases Q inclusion-wise, so we can ev en assume that p is lo cated in the corner. Then, Q forms a region around the opp osite corner p ′ of p , see Figure 6a. T o show that Q is con tained in a disk of radius O ( x ) , w e make a case distinction on x . W e first consider large x . F or x ≥ √ 2 − 1 , any p oint on the square S has distance at most √ 2 ≤ x · √ 2 √ 2 − 1 ∈ O ( x ) from p ′ . Otherwise, we hav e x < √ 2 − 1 . Then, the b oundary of Q consists of tw o line segments and a circular arc, see also Figure 6a. Denote the length of these line segmen ts by a . Ev ery p oin t q ∈ Q is at distance at most a from the corner p ′ of S opp osite to p , so it remains to find an upp er b ound on a . Applying the Pythagorean theorem (see Figure 6b), w e obtain (1 − a ) 2 + 1 2 = ( √ 2 − x ) 2 and thus a 2 − 2 a = x 2 − 2 √ 2 x. This quadratic equation has tw o solutions, a = 1 − q x 2 − 2 √ 2 x + 1 or a = 1 + q x 2 − 2 √ 2 x + 1 . W e hav e a ≤ 1 as S is a unit square, so only the first solution is relev ant. W e derive an upp er b ound as follows. Let t = x 2 − 2 √ 2 x + 1 . Then a = 1 − √ t = (1 − √ t )(1 + √ t ) 1 + √ t = 1 − t 1 + √ t = x (2 √ 2 − x ) 1 + √ t ≤ 2 √ 2 x. T o summarize, either x ≥ √ 2 − 1 and any p oint on the square S has distance at most O ( x ) from p ′ , or x < √ 2 − 1 and by the deriv ation ab ov e, the distance b etw een Q and p ′ is at most 2 √ 2 x ∈ O ( x ) . In b oth cases, Q is con tained in a disk of radius O ( x ) . ◀ The same argument works analogously on the torus, yielding the following. ▶ Lemma 27. L et T b e the unit torus and P ∈ T a p oint. F or x > 0 , the set of p oints with distanc e at le ast √ 2 2 − x fr om P is c ontaine d in a disk of r adius O ( x ) Pro of. On the torus, the set of p oints with distance √ 2 2 is shap ed like four mirrored and scaled do wn copies of the analogous set on a square, see also Figure 6c. The statemen t thus follo ws from Lemma 26. ◀ W e can scale the distances considered in Lemma 26 b y a factor of √ n and obtain statemen ts ab out the geometric ground space of square and torus RGGs. W e get that for any v ertex v and x > 0 , the set of p oints with distance from v at least the geometric diameter min us x is contained in a geometric disk of radius O ( x ) . By the results of Section 4.2 the graph distance of v ertices with geometric distance d is betw een  d r  and  d r  (1 + O ( r − 4 / 3 )) . T ogether, this allo ws us to show the following. ▶ Lemma 28. A symptotic al ly almost sur ely, a squar e or torus r andom ge ometric gr aph G ∼ G ( X, n, r ) with X ∈ {S , T } and c onne ction r adius r ∈ ω ( log 3 / 4 n ) has d local -lo c al diametric p artners with d local ∈ O ( n 1 / 2 r − 7 / 3 + 1) . 28 Diameter Computation on (Random) Geometric Graphs Pro of. Let v ∈ V ( G ) b e a v ertex and for x ∈ N let w b e a x -diametric partner of v , i.e., d G ( v , w ) ≥ diam G − x . If x ∈ Ω( diam G ) , all vertic es V ( G ) ha ve distance O ( x ) from v and are thus con tained in a ball of radius O ( x ) . Otherwise, d G ( v , w ) ∈ Ω( diam G ) . By Lemmas 21 and 22, the diameter of G is at least diam G ≥ D r − 1 , where D ∈ Θ( √ n ) is the geometric diameter of the ground space of G . This means that a.a.s. d G ( v , w ) ∈ Ω( n 1 / 2 r − 1 ) and in particular the geometric distance d b et w een v and w is at least r log n . Th us b y Lemmas 15 and 16 we hav e d G ( v , w ) ≤ d r (1 + s ) for s ∈ O ( r − 4 / 3 ) . W e thus get d r (1 + s ) ≥ D r − 1 − x d (1 + s ) ≥ D − r − xr d ≥ ( D − r − xr ) 1 1 + s . With s G ≥ 0 we hav e 1 1+ s G ≥ 1 − s G . Hence, d ≥ ( D − r − xr )(1 − s ) ≥ D − r − xr − D s + sr + sxr ≥ D − r − xr − D s. This means that the v ertex w has distance from v at least the geometric diameter of S , resp ectively T , minus ( r + xr + D s ) . By Lemma 26, resp ectively Lemma 27, p oints at this distance from v are con tained in a geometric disk of radius O ( r + xr + D s ) = O ( r + xr + n 1 / 2 r − 4 / 3 ) . By Lemma 20, G w.h.p. contains a vertex v c within distance O ( √ log n ) of the cen ter of this disk. Any vertex within the disk then has graph distance at most O (1 + x + n 1 / 2 r − 4 / 3 ) from v c . This means that all x -diametric partners of v are con tained in a G -ball of radius O ( x + n 1 / 2 r − 4 / 3 + 1) . ◀ W e also sho w that square RGGs hav e few corners (Prop erty 2). ▶ Lemma 29. Ther e exists d corner ∈ Θ( n 1 / 2 − 7 / 3 r + 1) such that a squar e r andom ge omet- ric gr aph G ∼ G ( S , n, r ) with c onne ction r adius r ∈ ω ( log 3 / 4 n ) has d corner -few c orners, asymptotic al ly almost sur ely. Pro of. W e consider four small regions around the corners of S that we call c orner squar es . W e sho w that for x ≥ 0 all vertices outside these regions hav e no x -diametric partners. Then, b y contraposition an y vertex with at least one x -diametric partner lies in a corner square. Lik e b efore, we show this b y first making a purely geometric argumen t and then applying the stretch b ounds. Afterwards, it remains to show that eac h corner square can b e co v ered b y a ball of radius O ( x + d corner ) . F or the geometric argumen t, let ℓ > 0 be a length parameter to b e determined later. W e define the corner squares with side length ℓ as follows, see also Figure 7. Let c 1 , . . . , c 4 b e the four corners of S . Then, for i ∈ [4] we define the corner square C i as the subset of S that lies within the axis aligned square of side length 2 ℓ and cen ter c i , i.e., C i = { p ∈ S | ∃ d x , d y with − ℓ < d x , d y < ℓ such that p = c i + ( d x , d y ) } . Without loss of generality let C b e the corner square in the b ottom left corner. W e consider a p oint p ∈ S \ and give an upp er bound for the maximum distance from p to any other p oint q ∈ S . W e can p essimistically assume that p lies at (0 , ℓ ) and q lies at the top righ t corner of S , see also Figure 7. Cho osing p ′ = ( ℓ, ℓ ) as the top right corner of C , we ha v e d E ( p, q ) < d E ( p, p ′ ) + d E ( p ′ , q ) = ℓ + √ 2 n − √ 2 ℓ < √ 2 n − 0 . 4 ℓ, J. Op en A ccess and J. R. Public 29 p | {z } x p ′ q Figure 7 Visualization of square S with the four corner squares in gray; the p oints p and q maximize the distance b etw een a point in the low er left quadrant and any other point and an upp er b ound for their distance is easily found by considering the detour via p ′ . whic h concludes the geometric argument. W e condition on the stretch even t of Lemma 15, whic h holds asymptotically almost surely . This means that for any pair of vertices with geometric distance at least d ≥ r log n , the graph distance is at most ⌈ d/r · (1 + s ) ⌉ for some s ∈ O ( r − 4 / 3 ) . Th us for an y vertex v ∈ V ( G ) ∩ S \ ( C 1 ∪ C 2 ∪ C 3 ∪ C 4 ) located outside the corner squares and any other vertex w ∈ V ( G ) w e hav e d G ( v , w ) ≤  d E ( v , w ) r (1 + s )  < d E ( p, q ) r (1 + s ) + 1 < √ 2 n − 0 . 4 ℓ r (1 + s ) + 1 < √ 2 n + √ 2 ns − 0 . 4 ℓ r + 1 . By Lemma 21, w e hav e w.h.p. diam G ≥ √ 2 n r − 1 . Setting ℓ = √ 2 ns + xr +2 r 0 . 4 , we thus hav e d G ( v , w ) < √ 2 n r − x − 1 ≤ diam G − x. In other w ords, no vertex of G has distance diam G − x or more from v , hence v has no x -diametric partner. Note that w e hav e ℓ ∈ O ( xr + n 1 / 2 s + r ) = O ( xr + n 1 / 2 − 4 / 3 r + r ) . This means that for some d corner ∈ Θ( n 1 / 2 − 7 / 3 r + 1) ⊆ Ω( √ nsr − 1 ) and any x ≥ 0 we can c ho ose ℓ ∈ O ( xr + d corner r ) suc h that an y vertex outside the corner squares of side length ℓ do es not hav e x -diametric partners. This means that any vertex with at least one x -diametric partner lies inside one of four squares of side length ℓ . It remains to show that each of these squares can b e cov ered b y O (1) G -balls of radius O ( x + d corner ) . T o this end, consider without loss of generalit y the corner square C in the b ottom left corner. By Lemma 20, G w.h.p. contains a vertex v C within geometric distance O ( √ log n ) of the geometric center of C . An y other vertex w C ∈ V ( G ) ∩ C then has geometric distance O ( ℓ ) = O ( xr + d corner r ) and thus also graph distance at most O ( ℓ/r ) = O ( x + d corner ) from v C . Th us, V ( G ) ∩ C is con tained in the closed O ( x + d corner ) neighborho od of some vertex of G . T o conclude, we hav e shown that there is a d corner ∈ Θ( n 1 / 2 r − 7 / 3 + 1) and such that for any x ≥ 0 the set of vertices with at least one x -diametric partner can b e cov ered by a constan t num b er of G -balls of radius O ( x + d corner ) . ◀ 30 Diameter Computation on (Random) Geometric Graphs 4.5 Computing the Diameter W e are now ready to apply the diameter algorithm from Section 3. F or a better ov erview we first giv e a summary of the prop erties w e hav e sho wn ab ov e. Let G b e a random geometric graph with connection radius r = n ρ for constan t ρ ∈ (0 , 1) . Then, asymptotically almost surely G has d local -lo cal diametric partners for d local ∈ O ( n 1 2 − 7 3 ρ + 1) (see Lemma 28). A dditionally , if G has a square ground space, it a.a.s. has d corner -few corners with d corner ∈ Θ( n 1 2 − 7 3 ρ + 1) (see Lemma 29). Moreo v er, for a constant x ∈ (0 , 1) with x > 2 ρ , let ℓ = (1 − x ) log 4 n . Then, the recursive partition G [ P ℓ ] a.a.s. is balanced (Lemma 19) and has ( 1 2 , ρ ) -small separators (see Lemma 19), size-dep enden t diameters (see Lemma 23), and b ounded fragmentation (see Lemma 25). Moreo v er, the leaf blocks of G [ P ℓ ] ha ve Θ( n x ) v ertices and eac h blo ck of size k has diameter Θ( k 1 2 n − ρ ) (see Lemma 23) and thus leaf blo cks hav e diameter Θ( n ε ) for some constant ε > 0 . T o apply Theorem 3, w e additionally need an upp er b ound on the degeneracy of G . This is easily obtained using the concentration b ounds on the num b er of vertices inside a sufficien tly large region. ▶ Lemma 30. A r andom ge ometric gr aph G ∼ G ( X, n, r ) with gr ound sp ac e X ∈ {S , T } and c onne ction r adius r = n x for c onstant x ∈ (0 , 1) has an exp e cte d aver age de gr e e in O ( n 2 x ) and a maximum de gr e e in O ( n 2 x ) with high pr ob ability. Pro of. Let v ∈ V ( G ) b e a vertex. Then the degree of v is equal to the n um b er of vertices falling into a region of radius r and hence area A x ∈ O ( n 2 x ) around v , i.e., the expected a v erage degree is in O ( n 2 x ) . With Lemma 17, this also means that the degree of v is at most A x ·  1 + q 3 c log n A x  with probability at least 1 − O ( n − c ) for any constan t c . F or a sufficiently high constant c , a union b ound o ver all vertices shows that all v ertices ha ve degree in O ( n 2 x ) with high probability . ◀ Applying Theorem 3, we thus get the following running times, dep ending on the exp onent of the connection radius ρ . ▶ Lemma 31. L et G b e a torus or a squar e r andom ge ometric gr aph with c onne ction r adius r = n ρ for c onstant ρ ∈ (0 , 1 2 ) . Then, G admits a r e cursive p artition P such that asymptotic al ly almost sur ely the algorithm fr om The or em 3 c omputes the diameter of G in time ˜ O  n max( 3 2 +3 ρ, 2 − 2 3 ρ )  . If the gr ound sp ac e of G is the squar e S , the running time is in ˜ O  n max( 3 2 +3 ρ, 2 − 10 3 ρ )  . Pro of. Asymptotically almost surely , we can rely on the prop erties summarized abov e. The running time guarantee from Theorem 3 dep ends on a parameter k suc h that the recursiv e partition con tains a flat partition with blo cks of size k and diameter in Ω( d local ) and optionally in Ω( d corner ) . W e ha v e Ω( d local ) = Ω( d corner ) = Ω( n 1 2 − 7 3 ρ + 1) . This means that there is a phase transition at ρ = 3 14 , ab o v e whic h d local and d corner are no longer growing in n . W e th us consider the t wo cases ρ < 3 14 and ρ ≥ 3 14 separately . F or the first case, w e use the recursive partition G [ P ℓ ] with ℓ = (1 − x ) log 4 n for x = 6 14 , i.e., leav es of P ha v e size n 6 14 and diameter n 3 14 − ρ . Then, for k = n 1 − 8 3 ρ blo c ks of size k ha v e diameter n 1 2 − 7 3 ρ ∈ Ω( d local ) = Ω( d corner ) . Also, we hav e 1 − 8 3 ρ > 1 − 8 3 · 3 14 = 6 14 , and thus k ∈ Ω( n x ) , i.e., P contains flat partitions of size Θ( k ) . With this choice for the parameters, the running time for torus RGGs given by Theorem 3 is in ˜ O  n 1+ α + β · d + min  nk d + k 2 α n 1+2 β + k 2 α − 1 n 1+ α +3 β , k n 1+ α + β  , J. Op en A ccess and J. R. Public 31 with α = 1 2 , β = ρ , d = n 2 ρ . Considering each term separately , we hav e n 1+ α + β · d = n 1+ 1 2 + ρ · n 2 ρ = n 3 2 +3 ρ , nk d = n · n 1 − 8 3 ρ · n 2 ρ = n 2 − 2 3 ρ , k 2 α n 1+2 β = n 1 − 8 3 ρ · n 1+2 ρ = n 2 − 2 3 ρ , n 1+ α +3 β k 2 α − 1 = n 1+ 1 2 +3 ρ k 0 = n 3 2 +3 ρ , k n 1+ α + β = n 1 − 8 3 ρ · n 1+ 1 2 + ρ = n 5 2 − 5 3 ρ . F or 0 < ρ < 3 14 the term k n 1+ α + β = n 5 2 − 5 3 ρ is alwa ys larger than the other terms in the minim um. This means that the running time is in ˜ O  n max ( 3 2 +3 ρ, 2 − 2 3 ρ )  . Square RGGs additionally hav e d corner -few corners, so Theorem 3 gives a running time in ˜ O  n 1+ α + β · d + min  k 2 d + k 1+2 α n 2 β + k 2 α n α +3 β , k 2 n α + β  , with α = 1 2 , β = ρ , d = n 2 ρ , and k = n 1 − 8 3 ρ . W e again consider each term separately . W e ha v e n 1+ α + β · d = n 3 2 +3 ρ , k 2 d = n 2(1 − 8 3 ρ ) d = n 2 − 16 3 ρ d = n 2 − 10 3 ρ , k 1+2 α n 2 β = n 2(1 − 8 3 ρ ) · n 2 ρ = n 2 − 10 3 ρ , n α +3 β k 2 α = n 1 2 +3 ρ · n 1 − 8 3 ρ = n 3 2 + 1 3 ρ , k 2 n α + β = n 2(1 − 8 3 ρ ) · n 1 2 + ρ = n 5 2 − 13 3 ρ . Similar to the torus case, for 0 < ρ < 3 14 the term n 5 2 − 5 3 ρ is alwa ys larger than the other terms in the minim um. This means that the running time is in ˜ O  n max(2 − 10 3 ρ, 3 2 +3 ρ )  . F or the case ρ ≥ 3 14 , let ε < 1 2 − ρ b e a p ositive constant. 4 Then, ρ + ε < 1 2 and 2( ρ + ε ) < 1 . W e use a recursiv e partition G [ P ℓ ] with leaf size n 2 ρ + ε 2 and subgraph sizes k = n 2 ρ + ε . Then, the diameter of size k blo c ks is d k ∈ Θ( n 2 ρ + ε 2 − ρ ) = Θ( n ε/ 2 ) and th us we ha v e d k ∈ Ω( min { d local , d corner } ) = Ω(1) . Again, considering eac h term of the running time separately , we hav e n 1+ α + β · d = n 3 2 +3 ρ , nk d = n · n 2 ρ + ε · n 2 ρ = n 1+4 ρ + ε , k 2 α n 1+2 β = n 2 ρ + ε · n 1+2 ρ = n 1+4 ρ + ε , n 1+ α +3 β k 2 α − 1 = n 1+ 1 2 +3 ρ k 0 = n 3 2 +3 ρ , k 2 n α + β = n 2(2 ρ + ε ) · n 1 2 + ρ = n 1 2 +5 ρ +2 ε 4 F or the p ositivity , recall that we generally assume ρ < 1 2 , see Section 4.1. 32 Diameter Computation on (Random) Geometric Graphs for torus RGGs. How ever, we hav e ρ + ε < 1 2 th us n 3 2 +3 ρ dominates n 1+4 ρ + ε and n 1 2 +5 ρ +2 ε . T ogether with the running time analysis for the case ρ < 3 14 , this means that for an y v alue of ρ ∈ (0 , 1 2 ) , the running time on torus R GGs is in ˜ O  n max ( 3 2 +3 ρ, 2 − 2 3 ρ )  . F or square R GGs we hav e n 1+ α + β · d = n 1+ 1 2 + ρ · n 2 ρ = n 3 2 +3 ρ , k 2 d = n 2(2 ρ + ε ) d = n 4 ρ +2 ε n 2 ρ = n 6 ρ +2 ε , k 1+2 α n 2 β = k 2 n 2 ρ = n 6 ρ +2 ε , n α +3 β k 2 α = n 1 2 +3 ρ · n 2 ρ + ε = n 1 2 +5 ρ + ε , k 2 n α + β = n 1 2 +5 ρ +2 ε . Again, with ρ + ε < 0 . 5 we hav e 1 2 + 5 ρ + ε < 3 2 + 3 ρ and 1 2 + 5 ρ + 2 ε < 3 2 + 3 ρ . T ogether with the running time analysis for the case ρ < 3 14 , this means that for any v alue of ρ ∈ (0 , 1 2 ) , the running time on square RGGs is in ˜ O  n max ( 3 2 +3 ρ, 2 − 10 3 ρ )  . ◀ Equiv alently the running times can be written as ˜ O  n max( 1 2 + ρ, 1 − 8 3 ρ ) m  (torus) and ˜ O  n max( 1 2 + ρ, 1 − 16 3 ρ ) m  (square). The following theorem follo ws directly , as R GGs with connection radius r = n ρ ha v e exp ected a v erage degree Θ( n 2 ρ ) (see Lemma 30). ▶ Theo rem 2. On R GGs with exp e cte d aver age de gr e e Θ( n δ ) for c onstant δ ∈ (0 , 1) , asymp- totic al ly almost sur ely the diameter c an b e c ompute d in ˜ O ( n 3 2 (1+ δ ) + n 2 − 1 3 δ ) time for torus R GGs, r esp e ctively ˜ O ( n 3 2 (1+ δ ) + n 2 − 5 3 δ ) time for squar e R GGs. 4.6 Analysis of iFUB In this section we rely on the stretch b ounds and the concen tration of the v ertices to analyze the running time of the iFUB algorithm on random geometric graphs. W e consider iFUB with the 2-swe ep heuristic , i.e., the algorithm chooses a central vertex as follows. First, the algorithm performs a BFS from an arbitrary v ertex v and pic ks a v ertex w in the last lay er, i.e., with maximum distance from v . Then, a second BFS is p erformed from w and the vertex c is c hosen half the w ay on a shortest path betw een w and a vertex with maximum distance from w . In the follo wing, w e b egin by showing that the vertex w selected by the first BFS is lik ely lo cated close to a corner of the square ground space. Analysis of 2-sweep. W e b egin with a geometric argument sho wing that for any point there is a corner that is further aw ay than a second p oint not close to any corner. See also Figure 8 for a visualization. ▶ Lemma 32. L et S b e a squar e and let p and q b e p oints on S , such that q has distanc e at le ast x fr om every c orner of S . Then, ther e is a c orner c ∗ of S such that d E ( p, q ) + 0 . 23 x ≤ d E ( p, c ∗ ) , i.e., the distanc e fr om p to c ∗ is at le ast 0 . 23 x longer than the distanc e fr om p to q . J. Op en A ccess and J. R. Public 33 p c ∗ q | {z } x | {z } ≥ 0 . 23 x q ∗ Figure 8 Visualization of the setting in Lemma 32. Without loss of generality we assume that p is lo cated in the blue triangle. If q lies far from every corner, it is closer to p than the furthest corner c ∗ , additionally q ∗ marks the p osition of q that maximizes the distance to p . Without loss of generalit y w e assume that p is lo cated in the blue triangle. Pro of. Without loss of generality w e assume that S is the unit square [0 , 1) × [0 , 1) . F urther, w e can assume that p = ( p x , p y ) lies in the upp er left diagonal half of the upp er righ t quadrant of S , i.e., p x ≥ 1 2 and p y ≥ p x . See also Figure 8. W e c ho ose c ∗ as the b ottom left corner. The p ermissive region for q is obtained from S b y removing quarter circles of radius x cen tered at the corners of S . W e first consider the case x ≤ 1 2 . Then, with p in the upp er left diagonal half of the upp er right quadran t of S , the furthest position q ∗ of q is at the in tersection of the b ottom side of S and the b ottom left quarter circle. W e hav e | pq | ≤ | pq ∗ | = q ( p x − x ) 2 + p 2 y and | pc ∗ | = q p 2 x + p 2 y . Th us we hav e | pc ∗ | − | pq | ≥ q p 2 x + p 2 y − q ( p x − x ) 2 + p 2 y . This difference is increasing in p x and decreasing in p y . Therefore, it is minimized at p = ( 1 2 , 1) , giving us | pc ∗ | − | pq | ≥ √ 5 2 − q ( 1 2 − x ) 2 + 1 . W e consider  √ 5 2 − q ( 1 2 − x ) 2 + 1  /x and find that it is decreasing in x . This means that the expression has its minimum of √ 5 − 2 at x = 1 2 . W e hav e th us sho wn ( | pc ∗ | − | pq ∗ | ) /x ≥ √ 5 − 2 > 0 . 23 , whic h implies | pq | + 0 . 23 x ≤ | pc ∗ | as claimed. F or x > 0 . 5 the w orst-case p osition of q is at q ∗ = ( 1 2 , q x 2 − 1 2 2 ) and the w orst-case p osition of p is still ( 1 2 , 1) . W e ha ve | pc ∗ | − | pq ∗ | x ≥ √ 5 2 −  1 − q x 2 − 1 4  x = √ 5 2 − 1 + q x 2 − 1 4 x . This is at least √ 5 − 2 for all x > 1 2 , which concludes the proof. ◀ W e apply this to sho w that in a square R GG the furthest neighbor of every vertex lies close to a corner of the square. ▶ Lemma 33. L et G ∼ G ( S , n, r ) b e a squar e r andom ge ometric gr aph with r ∈ ω ( log 3 / 4 n ) . Consider a vertex v ∈ V ( G ) ∩ S and a maximal ly distant w ∈ N ( v , ecc ( v )) of v . Then, 34 Diameter Computation on (Random) Geometric Graphs asymptotic al ly almost sur ely, the ge ometric distanc e of w to some c orner of S is in O ( n 1 2 r − 4 3 + √ log n ) . Pro of. Without loss of generality , we assume v to b e in the upp er right quadrant of S and we sho w that w ∈ N ( v , ecc ( v )) has geometric distance in O ( n 1 2 r − 4 3 ) from the lo wer left corner c ∗ of S lo cated at the origin. W e condition on the stretch even t of Lemma 15, which holds asymptotically almost surely . Then every pair of vertices with geometric distance at least d ≥ r log n has graph distance at most  d r · (1 + s )  for some s ∈ O ( r − 4 3 ) . Assume tow ards a contradiction that w has distance more than ε = 5 √ 2 ns + 5 √ log n from all corners of S . W e show that then there is another vertex with higher graph distance than w from v . By Lemma 20, there is a vertex w ′ in G with distance from the origin at most √ log n asymptotically almost surely . It remains to sho w that w ′ has higher distance from v than w in the graph. By Lemma 32 w e hav e d E ( v , w ) ≤ d E ( v , c ∗ ) − 0 . 23 ε. F urther, by the triangle inequality , d E ( v , c ∗ ) ≤ d E ( v , w ′ ) + d E ( w ′ , c ∗ ) ≤ d E ( v , w ′ ) + p log n. Com bining these tw o inequalities we derive d E ( v , w ) ≤ d E ( v , w ′ ) + p log n − 0 . 23 ε = d E ( v , w ′ ) + p log n − 0 . 23 · (5 √ 2 ns + 5 p log n ) < d E ( v , w ′ ) − 1 . 15 √ 2 ns. As d E ( v , w ′ ) is at most the diagonal of S , √ 2 n , we further hav e d E ( v , w ) < d E ( v , w ′ ) − 1 . 15 d E ( v , w ′ ) s = d E ( v , w ′ )(1 − 1 . 15 s ) . W e now compare the graph theoretic distance from v to w and to w ′ . By Equation (4) w e get a lo wer b ound d G ( v , w ′ ) ≥  d E ( v , w ′ ) r  . Applying the stretch b ounds, w e further get d G ( v , w ) ≤  d E ( v , w ) r (1 + s )  ≤  d E ( v , w ′ ) r (1 − 1 . 15 s )(1 + s )  <  d E ( v , w ′ ) r  . This means that d G ( v , w ′ ) > d G ( v , w ) , contradicting the assumption that no other vertex has higher distance from v as w . W e conclude that asymptotically almost surely for every vertex v , ev ery vertex w ∈ N ( v, ecc( v )) has distance at most ε = 5 √ 2 ns + 5 √ log n from c ∗ . ◀ This means that a 2-sweep giv es a go o d lo wer b ound for the diameter of square R GGs. A dditionally , we show that on square R GGs a cen tral v ertex chosen this w a y is lo cated close to the geometric cen ter of the square. J. Op en A ccess and J. R. Public 35 w w ′ | {z } D 2 | {z } D 2 + O ( D r − 4 / 3 ) Figure 9 Visualization of lens and right triangle in pro of of Lemma 34. ▶ Lemma 34. L et G ∼ G ( S , n, r ) b e a squar e r andom ge ometric gr aph with r ∈ ω ( log 3 / 4 n ) and let v c b e the c entr al vertex chosen after a 2-swe ep. Then, asymptotic al ly almost sur ely, v c lies within a ge ometric distanc e of O ( n 1 2 r − 2 3 + √ log n ) fr om the ge ometric c enter of S . Pro of. Let v ∈ V ( G ) be an arbitrary starting vertex, let w ∈ N G ( v , ecc ( v )) be a maximally distan t v ertex from v , and let w ′ ∈ N G ( w , ecc ( w )) be maximally distant from w . F urther let v c with | d G ( w , v c ) − d G ( w ′ , v c ) | ≤ 1 and d G ( w , v c ) + d G ( w ′ , v c ) = d G ( w , w ′ ) the cen tral v ertex c hosen with the 2-sw eep. W e condition on the stretc h even t, i.e., in the following for every pair of v ertices u , v with geometric distance d in ω ( r log n ) w e can assume d G ( u, v ) ≤ d r (1 + s ) , with s ∈ O ( r − 4 3 ) . By Lemma 33, w and w ′ eac h lie within geometric distance of O ( n 1 2 r − 4 3 + √ log n ) from some corner of S . As the opp osite corners hav e geometric distance √ 2 n and all other corners hav e distance at most √ n it follows that w and w ′ lie within geometric distance of O ( n 1 2 r − 4 3 + √ log n ) from opp osite corners of S . With the approximate location of w and w ′ kno wn it remains to lo cate v c . Denote the Euclidean midp oint of the segment w w ′ b y m and its length d E ( w , w ′ ) as D . F or x ∈ { w , w ′ } , w e hav e d G ( x, v c ) ≤ l dist G ( w,w ′ ) 2 m ≤ D 2 r (1 + s ) + 1 . Using Equation (4) this implies d E ( x, v c ) ≤ D 2 (1 + s ) + 2 = D 2 + O ( D r − 4 3 ) . Th us v c lies in the lens formed b y the in tersection of circles of radius D 2 + O ( D r − 4 3 ) cen tered at w and w ′ . Along the line through w and w ′ , the lens has length O ( D r − 4 / 3 ) . T o b ound the width h in the orthogonal direction, w e need the distance from m to either of in tersection p oint of the circles, see also Figure 9. Observ e that x , m , and either intersection p oint form a right triangle. By the Pythagorean theorem,  D 2 + O ( D r − 4 3 )  2 =  D 2  2 + h 2 . T o b ound h from ab ov e, set a = D 2 and b = O ( D r − 4 3 ) . Then h = p ( a + b ) 2 − a 2 = p 2 ab + b 2 = r 2 ab  1 + b 2 a  = √ 2 ab r 1 + b 2 a , and thus, using that √ 1 + x ≤ 1 + x 2 holds for x > 0 , h ≤ √ 2 ab  1 + b 4 a  . 36 Diameter Computation on (Random) Geometric Graphs W e hav e √ 2 ab ∈ O ( D · r − 2 3 ) , b 4 a ∈ O ( r − 4 3 ) and hence h ≤ D · r − 2 3 (1 + O ( r − 4 3 )) With D ∈ O ( √ n ) , it follo ws that v c lies within a Euclidean distance of O ( D · r − 2 3 ) from m . As w and w ′ are within O ( n 1 2 · r − 4 3 + √ log n ) from the corners, m is also within O ( n 1 2 · r − 4 3 + √ log n ) from the geometric cen ter of S . Com bining these b ounds, we conclude that v c is lo cated within O ( n 1 2 · r − 2 3 + √ log n ) from the geometric cen ter. ◀ Analysis of iFUB. W e briefly explain ho w the algorithm pro ceeds after selecting a central v ertex c , see also [ 10 ]. Let v 1 , . . . , v n = c b e an ordering of the v ertices sorted in descending order of their distance to c . Such an ordering is easily obtained after running a BFS from c . T o find the diameter, the algorithm computes ecc ( v i ) for each vertex v i in this sequence and maintains the largest found eccen tricity as a low er b ound, i.e., L i = max 0 ≤ j ≤ i ecc ( v j ) . The algorithm stops and rep orts L i as the diameter, once 2 · d ( c, v i ) ≤ L i . T o see why this is correct, note that there exists a diametrical vertex s with d ( c, s ) ≥ ⌈ diam G 2 ⌉ and that the stopping criterion ensures that such a vertex has been pro cessed. As discussed in the introduction of this pap er, the running time of iFUB dep ends on the c hoice of the central vertex and the metric structure of the graph. T o b e exact, the running time dep ends on the num b er of vertic es with distance at least half the diameter from c . This has already b een observed and used in the literature [ 6 ], but to the b est of our knowledge not formally prov ed. W e consequently give a complete argumen t b elow. ▶ Lemma 35. L et G b e a gr aph with diameter D and let c b e the c entr al vertex for iFUB. Then, iFUB explor es every vertex with distanc e at le ast ⌈ D 2 ⌉ + 1 fr om c and every explor e d vertex has distanc e at le ast ⌈ D 2 ⌉ fr om c . Pro of. W e begin with the first direction, i.e., w e show that a v ertex v with d ( c, v ) ≥ ⌈ D 2 ⌉ + 1 is explored b y iFUB. Let L i ≤ D b e the v alue of the low er b ound at the time when iFUB decides whether to explore v . Then we hav e 2 d( w , c ) ≥ D 2 + 2 > L i , i.e., iFUB explores w . F or the other direction, let w b e a vertex that is explored b y iFUB. Then, at the time when iFUB explores w , we hav e 2 d ( c, w ) > L i . If L i = D , this concludes the pro of, as we ha v e d ( v , w ) ≥ ⌈ D / 2 ⌉ . If otherwise L i < D , then no diametrical v ertex has been explored y et. How ever, there is a diametrical vertex x with d ( c, x ) ≥ ⌈ D / 2 ⌉ . As x has not y et b een explored when w is explored, w e hav e d( c, w ) ≥ d( c, x ) and thus also d( c, w ) ≥ ⌈ D / 2 ⌉ . ◀ W e already analyzed the 2-sweep and show ed that the cen tral v ertex is likely to b e lo cated close to the geometric cen ter of the square. It remains to show that in this case iFUB do es not p erform to o man y BFS. ▶ Lemma 36. L et G ∼ G ( S , n, r ) b e a squar e r andom ge ometric gr aph with r ∈ ω ( log 3 / 4 n ) and let v c b e a vertex with ge ometric distanc e h ∈ o ( √ n ) fr om the ge ometric c enter of S . Then, with v c as c entr al vertex iFUB p erforms at most O ( h 2 + nr − 8 3 ) BFS runs, asymptotic al ly almost sur ely. Pro of. With v c c hosen as the central vertex, iFUB performs a BFS for every vertex w with d G ( v c , w ) ≥ diam G 2 . W e show that v ertices close to the geometric cen ter of S do not hav e graph distance at least diam G 2 . Conv ersely , the vertices from whic h a iFUB runs a BFS lie in regions far from the geometric center. W e show that these regions do not contain many v ertices. W e condition on the stretc h even t, which holds a.a.s. (Lemma 15). J. Op en A ccess and J. R. Public 37 W e choose d = √ n √ 2 − x for some x > 0 to b e sp ecified later and consider a v ertex u with geometric distance at most d from the cen ter of S . Then d E ( v c , u ) ≤ √ n √ 2 − x + h and thus d G ( v c , u ) ≤  √ n √ 2 − x + h  r − 1 (1 + s ) for s ∈ O ( r − 4 3 ) . By Lemma 21 w e hav e diam G ≥ √ 2 n r . Th us, we can choose x ∈ Θ( h + √ ns ) such that d G ( v c , u ) < diam G 2 . As iFUB only runs BFS from vertices with distance at least diam G 2 from v c (Lemma 35), this means that an y such vertex has distance at least √ n √ 2 − x from the geometric cen ter of S . Comparing this with Lemma 26, w e get that any suc h vertex has distance at most O ( h + √ ns ) from a corner of S and thus lies in a region with area O ( h 2 + n · s 2 ) . The n um b er of v ertices in this region is in O ( h 2 + n · s 2 ) with high probability b y Lemma 17, whic h concludes the pro of. ◀ T ogether with Lemma 36 this results in the following running time b ound, which is (truly) sub quadratic for (p olynomially) growing r . ▶ Lemma 37. L et G ∼ G ( S , n, r ) b e a squar e r andom ge ometric gr aph with r ∈ ω ( log 3 / 4 n ) . Then, asymptotic al ly almost sur ely 2-swe ep iFUB has running time in O (( nr − 4 3 + log n ) m ) . Pro of. By Lemma 34, the cen tral vertex v c c hosen after the 2-sweep has distance at most h ∈ O ( n 1 2 r − 2 3 + log 1 2 n ) from the geometric cen ter of S , asymptotically almost surely . Thus b y Lemma 36 iFUB p erforms only O ( h 2 + n · r − 8 3 ) = O ( nr − 4 3 + log n ) BFS runs, asymptotically almost surely . ◀ W e also w an t to show a low er b ound for the running time on torus RGGs. F or this, w e use that the iFUB algorithm p erforms a BFS for all v ertices with distance at least ⌈ diam G 2 ⌉ + 1 from the central vertex v c . By observing that on torus RGGs there are many vertices at suc h a distance from any chosen central vertex, this gives us a linear low er b ound for the n umber of BFS runs. ▶ Lemma 38. L et G ∼ G ( T , n, r ) b e a torus r andom ge ometric gr aph with r ∈ ω ( log 3 / 4 n ) . Then, asymptotic al ly almost sur ely, for every c entr al vertex, iFUB p erforms Ω( n ) BFS runs. Pro of. Let v c b e the cen tral vertex for iFUB. Then iFUB p erforms a BFS for an y vertex w with d G ( v c , w ) ≥ ⌈ diam G 2 ⌉ + 1 (Lemma 35). By Lemma 22, we hav e diam G ≤ √ n √ 2 r (1 + s ) with s ∈ O ( r − 4 3 ) , asymptotically almost surely . By Equation (4), for a v ertex w with d E ( v c , w ) ≥ √ n 2 √ 2 (1 + 1 . 1 s ) + 2 r w e hav e d G ( v c , w ) ≥ √ n 2 √ 2 r (1 + 1 . 1 s ) + 2 > ⌈ diam G 2 ⌉ + 1 . It remains to show that many vertices ha v e such a distance from v c . The geometric disk of radius √ n 2 √ 2 (1 + 1 . 1 s ) + 2 r around v c has area π n 8  1 + 2 . 2 s + 1 . 21 s 2 + 16 r √ 2 n (1 + 1 . 1 s ) + 32 r 2 n  , where s, s 2 , r n , and r 2 /n are all in o (1) . The entire torus T has area n and thus the region of T where v ertices are c hosen as BFS sources b y iFUB has area at least (1 − π 8 ) n (1 − o (1)) ≥ 0 . 6 n (1 − o (1)) . As the num b er of v ertices within suc h a region is sufficien tly concen trated b y Lemma 17, this means that iFUB performs Ω( n ) BFS runs and thus has a running time in Ω( nm ) . ◀ 38 Diameter Computation on (Random) Geometric Graphs T ogether, the abov e tw o lemmas give the following. ▶ Theo rem 1. L et G ∼ G ( S , n, r ) b e a squar e r andom ge ometric gr aph with exp e cte d aver age de gr e e d ∈ Ω( log 3 2 n ) . Then, a.a.s., 2-swe ep iFUB has running time in O (( nd − 2 3 + log n ) m ) . If G ∼ G ( T , n, r ) is a torus R GG with exp e cte d aver age de gr e e in Ω( log 3 2 n ) , then a.a.s. for every choic e of the c entr al vertex, the running time of iFUB is in Ω( nm ) . 5 Conclusion In this pap er we give a set of natural deterministic prop erties allowing for efficient diameter computation and demonstrate that these properties a.a.s. hold on square and torus RGGs. W e note that our formulation of the properties is not the only possible one, but represents a trade-off b etw een simplicity and generalit y . T o sho w this, we p oint out m ultiple p ossible generalizations for the assumptions used in our algorithm. In Property 1 we demand that for all x > 0 and every v ertex v , the x -diametric partners lie in O (1) balls of radius O ( x + d local ) . Here, the linear dep endence on x w as mostly chosen for its simplicit y . By considering ho w the prop ert y is used (e.g. Lemma 10) one can see that this dep endence can b e significan tly relaxed. F or instance, one could demand that the radius of the balls has some arbitrary non-decreasing dep endency f ( x ) on x , or even dep ends on n and x as f n ( x ) . Then in Theorem 3, the new requirement is that blo cks of size k need to ha v e diameter in Ω( f n ( x )) . Similarly , instead of requiring a constant num b er of balls, one could also sp ecify the n umber of balls as a parameter, which then app ears as an additional factor in the running time of Theorem 3. Both of these generalizations apply analogously to Prop ert y 2. Moreov er, for Property 5 one could allow a non-constan t parameter for the n um b er of in tersecting blo cks, which then app ears as an additional factor in the num b er of candidate pairs and th us the running time. W e also w ant to point out some directions for improv ement regarding the analysis on random geometric graphs. F or the application of our algorithm on R GGs we assumed that the algorithm receives the graph along with a suitable recursiv e partition, see Theorem 2. While Section 4 demonstrates that such a partition is obtained very easily b y sub dividing the graph along its geometry , it would b e in teresting to also giv e an algorithm that finds a suitable partition using only a combinatorial representation of the graph without co ordinates. W e b elieve that a simple approach based on graph V oronoi diagrams should already w ork, but it seems lik e sho wing tight b ounds for the size of (recursive) graph V oronoi separators in random geometric graphs is v ery chal lenging. Can this c hallenge b e o v ercome or is it ma yb e p ossible to find a differen t approach that is easier to analyze? Moreov er, m uch of our analysis hinges on the stretch bounds (Lemmas 15 and 16). It is not clear ho w tight these are and whether p olynomially gro wing av erage degree is really necessary . It w ould not b e to o surprising if RGGs with constan t a verage degree also hav e lo cal diametric partners (Prop ert y 1). Finally , our running time analysis for iFUB on square RGGs is likely p essimistic and b etter stretc h b ounds or more generally a better understanding of the distribution of graph distances can b e expected to impro ve this. References 1 Mohamad A. Akra and Louay Bazzi. On the solution of linear recurrence equations. Comput. Optim. Appl. , 10(2):195–210, 1998. 2 S.A. Aldosari and J.M.F. Moura. Distributed detection in sensor netw orks: Connectivit y graph and small w orld netw orks. In Conferenc e R e cor d of the Thirty-Ninth A silomar Confer enc e J. Op en A ccess and J. R. Public 39 onSignals, Systems and Computers, 2005. , pages 230–234, 2005. doi:10.1109/ACSSC.2005. 1599738 . 3 Sriniv asa Rao Arikati, Danny Z. Chen, L. Paul Chew, Gautam Das, Michiel H. M. Smid, and Christos D. Zaroliagis. Planar spanners and approximate shortest path queries among obstacles in the plane. In ESA , volume 1136 of L e ctur e Notes in Computer Scienc e , pages 514–528. Springer, 1996. 4 Mic hael A. Bender and Martin F arach-Colton. The LCA problem revisited. In LA TIN , v olume 1776 of Le ctur e Notes in Computer Scienc e , pages 88–94. Springer, 2000. 5 Thomas Bläsius and Philipp Fisch b eck. On the external v alidity of av erage-case analyses of graph algorithms. ACM T r ans. A lgorithms , 20(1):10:1–10:42, 2024. 6 Mic hele Borassi, Pierluigi Crescenzi, and Luca T revisan. An axiomatic and an av erage-case analysis of algorithms and heuristics for metric prop erties of graphs. In SODA , pages 920–939. SIAM, 2017. 7 A ugustin Chaintreau, Ab derrahmen Mtibaa, Laurent Massoulié, and Christophe Diot. The diameter of opp ortunistic mobile netw orks. In Jim Kurose and Henning Sch ulzrinne, editors, Pr o c e edings of the 2007 A CM Confer enc e on Emer ging Network Exp eriment and T echnolo gy, CoNEXT 2007, New Y ork, NY, USA, De c emb er 10-13, 2007 , page 12. ACM, 2007. doi: 10.1145/1364654.1364670 . 8 Timoth y M. Chan, Hsien-Chih Chang, Jie Gao, Sándor Kisfaludi-Bak, Hung Le, and Da W ei Zheng. T ruly sub quadratic time algorithms for diameter and related problems in graphs of b ounded v c-dimension, 2025. A ccepted at FOCS’25. URL: 16346 , arXiv:2510.16346 . 9 F. R. K. Chung. Diameters of communication netw orks. In Mathematics of information pr o c essing (Louisvil le, Ky., 1984) , volume 34 of Pr o c. Symp os. Appl. Math. , pages 1–18. Amer. Math. So c., Pro vidence, RI, 1986. doi:10.1090/psapm/034/846852 . 10 Pilu Crescenzi, Roberto Grossi, Michel Habib, Leonardo Lanzi, and Andrea Marino. On computing the diameter of real-world undirected graphs. The or. Comput. Sci. , 514:84–95, 2013. URL: https://doi.org/10.1016/j.tcs.2012.09.018 , doi:10.1016/J.TCS.2012.09.018 . 11 Mark de Berg. A note on reachabilit y and distance oracles for transmission graphs. Computing in Ge ometry and T op olo gy , 2(1):4:1–4:15, May 2023. URL: https://www.cgt- journal.org/ index.php/cgt/article/view/25 , doi:10.57717/cgt.v2i1.25 . 12 J. Díaz, D. Mitsche, G. Perarnau, and X. P érez-Giménez. On the relation b etw een graph distance and euclidean distance in random geometric graphs. A dvanc es in Applie d Pr ob ability , 48(3):848–864, 2016. doi:10.1017/apr.2016.31 . 13 Arash F arzan and Shahin Kamali. Compact navigation and distance oracles for graphs with small treewidth. Algorithmic a , 69(1):92–116, 2014. 14 Ross J. Kang and T obias Müller. Sphere and dot pro duct representations of graphs. Discr et. Comput. Ge om. , 47(3):548–568, 2012. URL: https://doi.org/10.1007/s00454- 012- 9394- 8 , doi:10.1007/S00454- 012- 9394- 8 . 15 Dmitri Loguinov, Anuj Kumar, Vivek Rai, and Sai Ganesh. Graph-theoretic analysis of structured p eer-to-p eer systems: routing distances and fault resilience. In Pro c e e dings of the 2003 Confer enc e on Applic ations, T echnolo gies, A r c hitectur es, and Pr oto c ols for Computer Communic ations , SIGCOMM ’03, page 395–406, New Y ork, NY, USA, 2003. Asso ciation for Computing Mac hinery . doi:10.1145/863955.863999 . 16 Mic hael Mitzenmacher and Eli Upfal. Pr ob ability and Computing: R andomization and Pr oba- bilistic T e chniques in Algorithms and Data A nalysis . Cambridge Universit y Press, USA, 2nd edition, 2017. 17 Behro oz Parhami and Chi-Hsiang Y eh. Why netw ork diameter is still imp ortant. In Pr o c. International Conf. Communic ations in Computing , pages 271–274, 2000. 18 Satu Elisa Schaeffer. Graph clustering. Computer Scienc e R eview , 1(1):27–64, 2007. URL: https://www.sciencedirect.com/science/article/pii/S1574013707000020 , doi: 10.1016/j.cosrev.2007.05.001 . 40 Diameter Computation on (Random) Geometric Graphs 19 R. Seidel. On the all-pairs-shortest-path problem in unw eigh ted undirected graphs. Journal of Computer and System Scienc es , 51(3):400–403, 1995. URL: https://www.sciencedirect. com/science/article/pii/S0022000085710781 , doi:10.1006/jcss.1995.1078 . 20 Jun (Jim) Xu, Abhishek Kumar, and Xingxing Y u. On the fundamental tradeoffs b etw een routing table size and net w ork diameter in p eer-to-p eer netw orks. IEEE J. Sel. A r e as Commun. , 22(1):151–163, 2004. doi:10.1109/JSAC.2003.818805 . A Asymptotics of Prop erties from Section 1 In order to talk about asymptotic running times of algorithms, one needs to consider infinite families of inputs. As the definitions of Properties 1–5 in Section 1 do not mak e their asymptotic in terpretations explicit, we provide formal definitions of the properties defined in Section 1 in this section. Let G = { G 1 , G 2 , . . . } b e an infinite family of graphs. F or the first property , lo cal diametric partners, the asymptotic interpretation is straigh t- forw ard. The only imp ortant detail is that the constants hidden b y the big O -notation ma y not dep end on individual graphs. ▶ Prop ert y 1 (local diametric partners) . W e say that G has d local -lo cal diametric partners , if ther e exist p ositive inte ger c onstants a, b, c such that for every gr aph G ∈ G , every vertex v ∈ V ( G ) , and every p ositive inte ger x , ther e exists at most a vertic es w 1 , . . . , w a ∈ V ( G ) such that the union of their close d b · ( x + d local ) + c neighb orho o ds c ontains every x -diametric p artner of v in G . The asymptotic interpretation of the second prop erty , few corners, is analogous. ▶ Prop ert y 2 (few co rners) . W e say that G has d corner -few corners , if ther e exist p ositive inte ger c onstants a, b, c such that for every gr aph G ∈ G and every p ositive inte ger x ther e exist up to a vertic es w 1 , . . . , w a ∈ V ( G ) such that the union of their close d b · ( x + d corner ) + c neighb orho o ds c ontains every vertex with at le ast one x -diametric p artner in G . The remaining prop erties also dep end on recursiv e partitions. F or eac h graph G i ∈ G , let P i b e a recursive partition. Then I = { ( G 1 , P 1 ) , ( G 2 , P 2 ) , . . . } forms an infinite family of graphs together with recursiv e partitions. With this the asymptotic in terpretation of the third property is again straigh tforward, again with the only imp ortan t detail being that the constan ts hidden in the big O -notation m ust b e universal for the family of instances. ▶ Prop ert y 3 (small sepa rators) . W e say that I has ( α, β ) -small separators , if ther e exist p ositive inte ger c onstants b, c such that for every ( G, P ) ∈ I and every blo ck B induc e d by P on G , the sep ar ator of B has size at most b ·  n α · | B | β  + c . F or the fourth prop erty it is imp ortant to only compare the sizes and diameters of blo cks of the same graph, as across graphs similarly sized blo cks are allo wed to ha ve differen t diameter. ▶ Prop ert y 4 (size-dep endent diameters) . W e say that I has size-dep endent diameters , if ther e exist c onstants b, c, d, e > 1 such that for every ( G, P ) ∈ I and every two blo cks A, B induc e d by P on G , we have | A | ≤ b · | B | + c if and only if diam G [ A ] ≤ d · diam G [ B ] + e . F or the fifth prop erty , the in terpretation is again straightforw ard. ▶ Prop ert y 5 (lo w fragmentation) . W e say that I has low fragmentation if ther e exist p ositive inte ger c onstants a, b such that for every ( G, P ) ∈ I , every vertex v ∈ V ( G ) and every inte ger x , the close d x neighb orho o d of v interse cts at most a blo cks B of P with diameter diam G [ B ] b etwe en 1 b x and bx .

Original Paper

Loading high-quality paper...

Comments & Academic Discussion

Loading comments...

Leave a Comment