Fast approximation of eccentricities and distances in hyperbolic graphs

. We show that the eccentricities (and thus the centrality indices) of all vertices of a δ - hyperbolic graph G = ( V, E ) can be computed in linear time with an additive one-sided error of at most cδ , i.e., after a linear time preprocessing, for every vertex v of G one can compute in O (1) time an estimate ˆ e ( v ) of its eccentricity ecc G ( v ) such that ecc G ( v ) ≤ ˆ e ( v ) ≤ ecc G ( v ) + cδ for a small constant c . We prove that every δ -hyperbolic graph G has a shortest path tree, constructible in linear time, such that for every vertex v of G , ecc G ( v ) ≤ ecc T ( v ) ≤ ecc G ( v ) + cδ . These results are based on an interesting monotonicity property of the eccentricity function of hyperbolic graphs: the closer a vertex is to the center of G , the smaller its eccentricity is. We also show that the distance matrix of G with an additive one-sided error of at most c ′ δ can be computed in O ( | V | 2 log 2 | V | ) time, where c ′ < c is a small constant. Recent empirical studies show that many real-world graphs (including Internet application networks, web networks, collaboration networks, social networks, biological networks, and others) have small hyperbolicity. So, we analyze the performance of our algorithms for approximating centrality and distance matrix on a number of real-world networks. Our experimental results show that the obtained estimates are even better than the theoretical bounds.


Introduction
The diameter diam(G) and the radius rad(G) of a graph G = (V, E) are two fundamental metric parameters that have many important practical applications in real world networks.The problem of finding the center C(G) of a graph G is often studied as a facility location problem for networks where one needs to select a single vertex to place a facility so that the maximum distance from any demand vertex in the network is minimized.In the analysis of social networks (e.g., citation networks or recommendation networks), biological systems (e.g., protein interaction networks), computer networks (e.g., the Internet or peer-to-peer networks), transportation networks (e.g., public transportation or road networks), etc., the eccentricity ecc(v) of a vertex v is used to measure the importance of v in the network: the centrality index of v [69] is defined as 1 ecc (v) .Being able to compute efficiently the diameter, center, radius, and vertex centralities of a given graph has become an increasingly important problem in the analysis of large networks.The algorithmic complexity of the diameter and radius problems is very well-studied.For some special classes of graphs there are efficient algorithms [8,18,25,30,33,38,42,53,56,62,79].However, for general graphs, the only known algorithms computing the diameter and the radius exactly compute the distance between every pair of vertices in the graph, thus solving the all-pairs shortest paths problem (APSP) and hence computing all eccentricities.In view of recent negative results [8,21,83], this seems to be the best what one can do since even for graphs with m = O(n) (where m is the number of edges and n is the number of vertices) the existence of a subquadratic time (that is, O(n 2−ǫ ) time for some ǫ > 0) algorithm for the diameter or the radius problem will refute the well known Strong Exponential Time Hypothesis (SETH).Furthermore, recent work [9] shows that if the radius of a possibly dense graph (m = O(n 2 )) can be computed in subcubic time (O(n 3−ǫ ) for some ǫ > 0), the smaller the hyperbolicity is, the closer its metric is to a tree-metric (trees are 0-hyperbolic and chordal graphs are 1-hyperbolic).
Recent empirical studies showed that many real-world graphs (including Internet application networks, web networks, collaboration networks, social networks, biological networks, and others) are tree-like from a metric point of view [10,11,20] or have small hyperbolicity [67,77,85].It has been suggested in [77], and recently formally proved in [39], that the property, observed in real-world networks, in which traffic between nodes tends to go through a relatively small core of the network, as if the shortest paths between them are curved inwards, is due to the hyperbolicity of the network.Bending property of the eccentricity function in hyperbolic graphs were used in [16,15] to identify core-periphery structures in biological networks.Small hyperbolicity in real-world graphs provides also many algorithmic advantages.Efficient approximate solutions are attainable for a number of optimization problems [35,36,37,39,40,44,57,92].
In [35] we initiated the investigation of diameter, center, and radius problems for δ-hyperbolic graphs and we showed that the existing approach for trees can be extended to this general framework.Namely, it is shown in [35] that if G is a δ-hyperbolic graph and {y, z} is the pair returned after two FP scans, then d(y, z) ≥ diam(G) − 2δ, diam(G) ≥ 2rad(G) − 4δ − 1, diam(C(G)) ≤ 4δ + 1, and C(G) is contained in a small ball centered at a middle vertex of any shortest (y, z)-path.Consequently, we obtained linear time algorithms for the diameter and radius problems with additive errors linearly depending on the input graph's hyperbolicity.
In this paper, we advance this line of research and provide a linear time algorithm for approximate computation of the eccentricities (and thus of centrality indices) of all vertices of a δ-hyperbolic graph G, i.e., we compute the approximate values of all eccentricities within the same time bounds as one computes the approximation of the largest or the smallest eccentricity (diam(G) or rad(G)).Namely, the algorithm outputs for every vertex v of G an estimate ê(v) of ecc G (v) such that ecc G (v) ≤ ê(v) ≤ ecc G (v) + cδ, where c > 0 is a small constant.In fact, we demonstrate that G has a shortest path tree, constructible in linear time, such that for every vertex v of G, ecc G (v) ≤ ecc T (v) ≤ ecc G (v)+cδ (a so-called eccentricity cδ-approximating spanning tree).This is our first main result of this paper and the main ingredient in proving it is the following interesting dependency between the eccentricities of vertices of G and their distances to the center C(G): up to an additive error linearly depending on δ, ecc G (v) is equal to d(v, C(G)) plus rad(G).To establish this new result, we have to revisit the results of [35] about diameters, radii, and centers, by simplifying their proofs and extending them to all eccentricities.
Eccentricity k-approximating spanning trees were introduced by Prisner in [81].A spanning tree T of a graph G is called an eccentricity k-approximating spanning tree if for every vertex v of G ecc T (v) ≤ ecc G (v)+k holds [81].Prisner observed that any graph admitting an additive tree k-spanner (that is, a spanning tree T such that d T (v, u) ≤ d G (v, u) + k for every pair u, v) admits also an eccentricity k-approximating spanning tree.Therefore, eccentricity k-approximating spanning trees exist in interval graphs for k = 2 [70,75,80], in asteroidal-triple-free graph [70], strongly chordal graphs [26] and dually chordal graphs [26] for k = 3.On the other hand, although for every k there is a chordal graph without an additive tree k-spanner [70,80], yet as Prisner demonstrated in [81], every chordal graph has an eccentricity 2-approximating spanning tree.Later this result was extended in [51] to a larger family of graphs which includes all chordal graphs and all plane triangulations with inner vertices of degree at least 7.Both those classes belong to the class of 1-hyperbolic graphs.Thus, our result extends the result of [81] to all δ-hyperbolic graphs.
As our second main result, we show that in every δ-hyperbolic graph G all distances with an additive one-sided error of at most c ′ δ can be found in O(|V | 2 log 2 |V |) time, where c ′ < c is a small constant.With a recent result in [32], this demonstrates an equivalence between approximating the hyperbolicity and approximating the distances in graphs.Note that every δ-hyperbolic graph G admits a distance approximating tree T [35,36,37], that is, a tree T (which is not necessarily a spanning tree) such that d T (v, u) ≤ d G (v, u) + O(δ log n) for every pair u, v.Such a tree can be used to compute all distances in G with an additive one-sided error of at most O(δ log n) in O(|V | 2 ) time.Our new result removes the dependency of the additive error from log n and has a much smaller constant in front of δ.Note also that the tree T may use edges not present in G (not a spanning tree of G) and thus cannot serve as an eccentricity O(δ log n)-approximating spanning tree.Furthermore, as chordal graphs are 1-hyperbolic, for every k there is a 1-hyperbolic graph without an additive tree k-spanner [70,80].
At the conclusion of this paper, we analyze the performance of our algorithms for approximating eccentricities and distances on a number of real-world networks.Our experimental results show that the estimates on eccentricities and distances obtained are even better than the theoretical bounds proved.

Center, diameter, centrality
All graphs G = (V, E) occurring in this paper are finite, undirected, connected, without loops or multiple edges.We use n and |V | interchangeably to denote the number of vertices and m and |E| to denote the number of edges in G.The length of a path from a vertex v to a vertex u is the number of edges in the path.The distance d G (u, v) between vertices u and v is the length of a shortest path connecting u and v in G.The eccentricity of a vertex v, denoted by ecc G (v), is the largest distance from v to any other vertex, i.e., ecc a graph G is the set of vertices with minimum eccentricity.

Gromov hyperbolicity and thin geodesic triangles
Let (X, d) be a metric space.The Gromov product of y, z ∈ X with respect to w is defined to be A metric space (X, d) is said to be δ-hyperbolic [60] for δ ≥ 0 if (x|y) w ≥ min{(x|z) w , (y|z) w } − δ for all w, x, y, z ∈ X. Equivalently, (X, d) is δ-hyperbolic if for any four points u, v, x, y of X, the two largest of the three distance sums d(u, v) where d G is the standard shortest path metric defined on G. δ-Hyperbolic graphs generalize k-chordal graphs and graphs of bounded tree-length: each k-chordal graph has the tree-length at most ⌊ k 2 ⌋ [47] and each tree-length λ graph has hyperbolicity at most λ [35,36].Recall that a graph is k-chordal if its induced cycles are of length at most k, and it is of tree-length λ if it has a Robertson-Seymour tree-decomposition into bags of diameter at most λ [47].
For geodesic metric spaces and graphs there exist several equivalent definitions of δ-hyperbolicity involving different but comparable values of δ [14,28,59,60].In this paper, we will use the definition via thin geodesic triangles.Let (X, d) be a metric space.A geodesic joining two points x and y from X is a (continuous) d) is geodesic if every pair of points in X can be joined by a geodesic.Every unweighted graph G = (V, E) equipped with its standard distance d G can be transformed into a geodesic (network-like) space (X, d) by replacing every edge e = uv by a segment [u, v] of length 1; the segments may intersect only at common ends.Then (V, d G ) is isometrically embedded in a natural way in (X, d).The restrictions of geodesics of X to the vertices V of G are the shortest paths of G.
Let (X, d) be a geodesic metric space.A geodesic triangle ∆(x, y, z) with x, y, z ∈ X is the union [x, y] ∪ [x, z]∪[y, z] of three geodesic segments connecting these vertices.Let m x be the point of the geodesic segment [y, z] located at distance α y := (x|z) y = (d(y, x) + d(y, z) − d(x, z))/2 from y. Then m x is located at distance α z := (y|x) z = (d(z, y) + d(z, x) − d(y, x))/2 from z because α y + α z = d(y, z).Analogously, define the points m y ∈ [x, z] and m z ∈ [x, y] both located at distance α x := (y|z) x = (d(x, y) + d(x, z) − d(y, z))/2 from x; see Fig. 1 for an illustration.There exists a unique isometry ϕ which maps ∆(x, y, z) to a tripod T (x, y, z) consisting of three solid segments [x, m], [y, m], and [z, m] of lengths α x , α y , and α z , respectively.This isometry maps the vertices x, y, z of ∆(x, y, z) to the respective leaves of T (x, y, z) and the points m x , m y , and m z to the center m of this tripod.Any other point of T (x, y, z) is the image of exactly two points of ∆(x, y, z).A geodesic triangle ∆(x, y, z) is called δ-thin if for all points u, v ∈ ∆(x, y, z), ϕ(u) = ϕ(v) implies d(u, v) ≤ δ.A graph G = (V, E) whose all geodesic triangles ∆(u, v, w), u, v, w ∈ V , are δ-thin is called a graph with δ-thin triangles, and δ is called the thinness parameter of G.The following result shows that hyperbolicity of a geodesic space or a graph is equivalent to having thin geodesic triangles.
In what follows, we will need few more notions and notations.Let G = (V, E) be a graph.By [x, y] we denote a shortest path connecting vertices x and y in G; we call [x, y] a geodesic between x and y.A ball B(s, r) of G centered at vertex s ∈ V and with radius r is the set of all vertices with distance no more than r from s (i.e., B(s, r) set of all vertices of G that are most distant from x. Vertices x and y of G are called mutually distant if x ∈ F (y) and y ∈ F (x), i.e., ecc G (x) = ecc G (y) = d G (x, y).

Fast approximation of eccentricities
In this section, we give linear and almost linear time algorithms for sharp estimation of the diameters, the radii, the centers and the eccentricities of all vertices in graphs with δ-thin triangles.Before presenting those algorithms, we establish some conditional lower bounds on complexities of computing the diameters and the radii in those graphs.

Conditional lower bounds on complexities
Recent work has revealed convincing evidence that solving the diameter problem in subquadratic time might not be possible, even in very special classes of graphs.Roditty and Vassilevska W. [83] showed that an algorithm that can distinguish between diameter 2 and 3 in a sparse graph in subquadratic time refutes the following widely believed conjecture.

The Orthogonal Vectors Conjecture:
There is no ǫ > 0 such that for all c ≥ 1, there is an algorithm that given two lists of n binary vectors A, B ⊆ {0, 1} d where d = c log n can determine if there is an orthogonal pair Williams [95] showed that the Orthogonal Vectors (OV) Conjecture is implied by the well-known Strong Exponential Time Hypothesis (SETH) of Impagliazzo, Paturi, and Zane [64,63].Nowadays many papers base the hardness of problems on SETH and the OV conjecture (see, e.g., [8,21,91] and papers cited therein).
Since all geodesic triangles of a graph constructed in the reduction in [83] are 2-thin, we can rephrase the result from [83] as follows.
Statement 1 If for some ǫ > 0, there is an algorithm that can determine if a given graph with 2-thin triangles, n vertices and m = O(n) edges has diameter 2 or 3 in O(n 2−ǫ ) time, then the Orthogonal Vector Conjecture is false.
To prove a similar lower bound result for the radius problem, recently Abboud et al. [8] suggested to use the following natural and plausible variant of the OV conjecture.
The Hitting Set Conjecture: There is no ǫ > 0 such that for all c ≥ 1, there is an algorithm that given two lists A, B of n subsets of a universe U of size c log n, can decide in O(n 2−e ) time if there is a set in the first list that intersects every set in the second list, i.e. a hitting set.
Abboud et al. [8] showed that an algorithm that can distinguish between radius 2 and 3 in a sparse graph in subquadratic time refutes the Hitting Set Conjecture.Since all geodesic triangles of a graph constructed in the reduction in [8] are 2-thin, rephrasing that result from [8], we have.
Statement 2 If for some ǫ > 0, there is an algorithm that can determine if a given graph with 2-thin triangles, n vertices, and m = O(n) edges has radius 2 or 3 in O(n 2−ǫ ) time, then the Hitting Set Conjecture is false.

Fast additive approximations
In this subsection, we show that in a graph G with δ-thin triangles the eccentricities of all vertices can be computed in total linear time with an additive error depending on δ.We establish that the eccentricity of a vertex is determined (up-to a small error) by how far the vertex is from the center C(G) of G. Finally, we show how to construct a spanning tree T of G in which the eccentricity of any vertex is its eccentricity in G up to an additive error depending only on δ.For these purposes, we revisit and extend several results from our previous paper [35] concerning the linear time approximation of diameter, radius, and centers of δ-hyperbolic graphs.For these particular cases, we provide simplified proofs, leading to better additive errors due to the use of thinness of triangles instead of the four point condition and to the computation in O(δ|E|) time of a pair of mutually distant vertices.
Define the eccentricity layers of a graph G as follows: With this notation, the center of a graph is In what follows, it will be convenient to define also the eccentricity of the middle point m of any edge We start with a proposition showing that, in a graph G with δ-thin triangles, a middle vertex of any geodesic between two mutually distant vertices has the eccentricity close to rad(G) and is not too far from the center C(G) of G.
Proposition 2. Let G be a graph with δ-thin triangles, u, v be a pair of mutually distant vertices of G.
Proof.Let x be an arbitrary vertex of G and Since u and v are mutually distant, we can assume, without loss of generality, that c * is located on (a) By the triangle inequality and since Additionally to the proof of (a), one needs only to consider the case when d G (u, v) is odd.We know that the middle point c * sees all vertices of G within distance at most dG(u,v) 2 + δ.Hence, both ends of the edge of (u, v)-geodesic, containing the point c * in the middle, have eccentricities at most (c) Since a middle vertex c of any (u, v)-geodesic sees all vertices of G within distance at most which is impossible.(d) In the proof of (a), instead of an arbitrary vertex x, consider any vertex x from C k (G).By the triangle inequality and since

⊓ ⊔
As an easy consequence of Proposition 2(d), we get that the eccentricity ecc G (x) of any vertex x is equal, up to an additive one-sided error of at most 4δ + 2, to d G (x, C(G)) plus rad(G).
Corollary 1.For every vertex x of a graph G with δ-thin triangles,

Proof. Consider an arbitrary vertex x in G and assume that ecc
Combining both inequalities, we get Note also that, by the triangle inequality, ecc is, the right-hand inequality holds for all graphs).⊓ ⊔ It is interesting to note that the equality ecc G (x) = d G (x, C(G)) + rad(G) holds for every vertex of a graph G if and only if the eccentricity function ecc G (•) on G is unimodal (that is, every local minimum is a global minimum) [48].A slightly weaker condition holds for all chordal graphs [51]: for every vertex Proposition 3. Let G be a graph with δ-thin triangles and u, v be a pair of vertices of We distinguish between two cases: w is between u and m x or w is between v and m x in [u, v].
In the first case, by the triangle inequality and In the second case, by the triangle inequality and since Let m x be a point on [u, v] which is at distance (x|u By the triangle inequality, we get and let c * be the middle point of it, w be a vertex of [v, t] at distance rad(G) from t, and c be a vertex of [v, t] Since, in what follows, we will use only the fact that d G (v, t) ≥ 2rad(G) − 4δ − 1, we can assume, without loss of generality, that c * is located on By the triangle inequality and since Since ecc G (y) ≤ rad(G) + k, we have On the other hand, by the triangle inequality, we get

All eccentricities.
In what follows, we will show that all vertex eccentricities of a graph with δ-thin triangles can be also additively approximated in (almost) linear time.
Proposition 5. Let G be a graph with δ-thin triangles.
(a) If c is a middle vertex of any (u, v)-geodesic between a pair u, v of mutually distant vertices of G and T is a BF S(c)-tree of G, then, for every vertex Proof.(a) Let x be an arbitrary vertex of G and assume that ecc G (x) = rad(G) + k for some integer k ≥ 0. We know from Proposition 2(b) that ecc G (c) ≤ rad(G) + δ.Furthermore, by Proposition 2(d), As T is a spanning tree of G, evidently, also ecc G (x) ≤ ecc T (x) holds.(b) The proof is similar to the proof of (a); only, in this case, ecc G (c) ≤ rad(G)+3δ and d G (c, x) ≤ k+3δ+1 holds for every x ∈ C k (G) (by Proposition 3(d)).

⊓ ⊔
A spanning tree T of a graph G is called an eccentricity k-approximating spanning tree if for every vertex v of G ecc T (v) ≤ ecc G (v) + k holds [51,81].Thus, by Proposition 5, we get.
Theorem 1 generalizes recent results from [51,81] that chordal graphs and some of their generalizations admit eccentricity 2-approximating spanning trees.
Note that the eccentricities of all vertices in any tree T = (V, U ) can be computed in O(|V |) total time.As we noticed already, it is a folklore by now that for trees the following facts are true: (1) The center C(T ) of any tree T consists of one vertex or two adjacent vertices.
(2) The center C(T ) and the radius rad(T ) of any tree T can be found in linear time.
(3) For every vertex Hence, using BF S(C(T )) on T one can compute d T (v, C(T )) for all v ∈ V in total O(|V |) time.Adding now rad(T ) to d T (v, C(T )), one gets ecc T (v) for all v ∈ V .Consequently, by Theorem 1, we get the following additive approximations for the vertex eccentricities in graphs with δ-thin triangles.
(1) There is an algorithm which in total linear (O(|E|)) time outputs for every vertex v ∈ V an estimate ê(v) of its eccentricity ecc

Fast Additive Approximation of All Distances
Here, we will show that if the δth power G δ of a graph G with δ-thin triangles is known in advance, then the distances in G can be additively approximated (with an additive one-sided error of at most δ + 1) in O(|V | 2 ) time.If G δ is not known, then the distances can be additively approximated (with an additive one-sided error of at most 2δ + 2) in almost quadratic time.
Our method is a generalization of an unified approach used in [49] to estimate (or compute exactly) all pairs shortest paths in such special graph families as k-chordal graphs, chordal graphs, AT-free graphs and many others.For example: all distances in k-chordal graphs with an additive one-sided error of at most k − 1 can be found in O(|V | 2 ) time; all distances in chordal graphs with an additive one-sided error of at most 1 can be found in O(|V | 2 ) time and the all pairs shortest path problem on a chordal graph G can be solved in O(|V | 2 ) time if G 2 is known.Note that in chordal graph all geodesic triangles are 2-thin.
Let G = (V, E) be a graph with δ-thin triangles.Pick an arbitrary start vertex s ∈ V and construct a BF S(s)-tree T of G rooted at s. Denote by p T (x) the parent and by h T (x) = d T (x, s) = d G (x, s) the height of a vertex x in T .Since we will deal only with one tree T , we will often omit the subscript T .Let P T (x, s) := (x q , x q−1 , . . ., x 1 , s) and P T (y, s) := (y p , y p−1 , . . ., y 1 , s) be the paths of T connecting vertices x and y with the root s.By sl T (x, y; λ) we denote the largest index k such that d G (x k , y k ) ≤ λ (the λ separation level).Our method is based on the following simple fact.

Proposition 6. For every vertices x and y of a graph G with δ-thin triangles and any BF S-tree T of G, h
where k = sl T (x, y; δ).⊓ ⊔

Proof. By the triangle inequality, d
Note that we may regard BF S(s) as having produced a numbering from n to 1 in decreasing order of the vertices in V where vertex s is numbered n.As a vertex is placed in the queue by BF S(s), it is given the next available number.The last vertex visited is given the number 1. Let σ := [v 1 , v 2 , . . ., v n = s] be a BF S(s)-ordering of the vertices of G and T be a BF S(s)-tree of G produced by a BF S(s).Let σ(x) be the number assigned to a vertex x in this BF S(s)-ordering.For two vertices x and y, we write x < y whenever σ(x) < σ(y).
First, we will show that if G δ is known in advance (i.e., its adjacency matrix is given) for a graph G with δ-thin triangles, then the distances in G can be additively approximated (with an additive one-sided error of at most δ + 1) in O(|V | 2 ) time.We consider the vertices of G in the order σ from 1 to n.For each current vertex x we show that the values d(x, y) := h T (x) + h T (y) − 2sl T (x, y; δ) + δ for all vertices y with y > x can be computed in O(|V |) total time.By Proposition 6, The values d(x, y) for all y with y > x can be computed using the following simple procedure.We will omit the subscripts G and T if no ambiguities arise.Let also L i = {v ∈ V : d(v, s) = i}.In the procedure, S u represents vertices of a subtree of T rooted at u.
Thus, we have the following result.
Theorem 3. Let G = (V, E) be a graph with δ-thin triangles.Given G δ , all distances in G with an additive one-sided error of at most δ + 1 can be found in O(|V | 2 ) time.
To avoid the requirement that G δ is given in advance, we can use any known fast constant-factor approximation algorithm that in total T (|V |)-time computes for every pair of vertices x, y of G a value d(x, y) such that d G (x, y) ≤ d(x, y) ≤ αd G (x, y) + β.We can show that, using such an algorithm as a preprocessing step, the distances in a graph G with δ-thin triangles can be additively approximated with an additive one-sided error of at most αδ Although one can use any known fast constant-factor approximation algorithm in the preprocessing step, in what follows, we will demonstrate our idea using a fast approximation algorithm from [19].It computes in O(|V | 2 log 2 |V |) total time for every pair x, y a value d(x, y) such that Assume that the values d(x, y), x, y ∈ V , are precomputed.By sl T (x, y; λ) we denote now the largest index k such that d G (x k , y k ) ≤ λ.We have Proposition 7.For every vertices x and y of a graph G with δ-thin triangles, any integer ρ ≥ δ, and any BF S-tree T of G, where k = sl T (x, y; 2ρ + 1).
Proof.The proof is identical to the proof of Proposition 7. One needs only to notice the following.In a geodesic triangle ∆(x, y, s) Let ρ be any integer greater than or equal to δ.By replacing in our earlier procedure lines ( 06) and ( 08) with Thus, we have the following result: The second part of Theorem 4 says that if an approximation of the thinness parameter of a graph G is given then all distances in G can be additively approximated in O(|V |2 log 2 |V |) time.Recently, it was shown in [32] that the following converse is true.From an estimate of all distances in G with an additive one-sided error of at most k, it is possible to compute in O(|V | 2 ) time an estimation ρ * of the thinness of G such that δ ≤ ρ * ≤ 8δ + 12k + 4, proving a Õ(|V | 2 )-equivalence between approximating the thinness and approximating the distances in graphs.

Experimentation on Some Real-World Networks
In this section, we analyze the performance of our algorithms for approximating eccentricities and distances on a number of real-world networks.Our experimental results show that the estimates on eccentricities and distances obtained are even better than the theoretical bounds described in Corollary 2 and Theorems 2,4.
We apply our algorithms to six social networks, four email communication networks, four biological networks, six internet graphs, four peer-to-peer networks, three web networks, two product-co-purchasing networks, and four infrastructure networks.Most of the networks listed are part of the Stanford Large Network Dataset Collection (snap) and the Koblenz Network Collection (konect), and are available at [1] and [2].Characteristics of these networks, such as the number of vertices and edges, the average degree, the radius and the diameter, are given in Table 1.The numbers listed in Table 1 are based on the largest connected component of each network, when the entire network is disconnected.We ignore the directions of the edges and remove all self-loops from each network.Additionally, in Table 1, for each network we report the size (as the number of vertices) of its center C(G).We also analyze the diameter and the connectivity of the center of each network.The diameter of the center diam G (C(G)) is defined as the maximum distance between any two central vertices in the graph.In the last column of Table 1, we report the Gromov hyperbolicity δ of majority of networks 2 .Computing the hyperbolicity of a graph is computationally expensive; therefore, we provide the exact δ values for the smaller networks (those with |V | ≤ 30K) in our dataset (in some cases, the algorithm proposed in [41] was used).For some larger networks, the approximated δ-hyperbolicity values listed in Table 1 are as reported in [67] 3 .Most networks that we included in our dataset are hyperbolic.However, for comparison reasons, we included also a few infrastructure networks that are known to lack the hyperbolicity property.

Estimation of Eccentricities
Following Proposition 2, for each graph in our dataset, we found a pair u, v of mutually distant vertices.In column two of Table 2, we report on how many BF S sweeps of a graph were needed to locate u and v. Interestingly, for almost all graphs (28 out 33) only two sweeps were sufficient.For four other graphs (including road-pa network whose hyperbolicity is large) three sweeps were needed, and only for one graph (power-grid network) we needed four sweeps.

Network Type
Ref.In column four of Table 2, we report for each graph G the difference between 2rad(G) and d G (u, v).Proposition 2(c) says that the difference must be at most 2δ + 1, where δ is the thinness of geodesic triangles in G. Actually, for large number (27 out of 33) of graphs in our dataset, the difference is at most two.Five other graphs have the difference equal to 3, and only road-pa network has the difference equal to 10.We have d G (u, v) = diam(G) for 27 graphs in our dataset, including road-pa network whose geodesic triangles thinness is at least 196.For remaining six graphs d G (u, v) = diam(G) − 1 holds.

|V | |E| |C(G)| deg rad(G) diam(G) diamG(C(G)) connected? δ(G)
We also analyzed the quality of a middle vertex c of a randomly picked shortest path between mutually distant vertices u and v. Proposition 2 states that ecc G (c) is close to rad(G) and c is not too far from the graph's center C(G).Table 2 lists the properties of the selected middle vertex c.In almost all graphs, vertex c belongs to the center C(G) or is at distance one or two from C(G).Even in graphs with ecc G (c)− rad(G) > 2 (power-grid and road-pa), the value ecc G (c) − rad(G) is smaller than what is suggested by Proposition 2(b).It is also clear from Table 2 that c is not too far from any vertex in C(G) (look at the radius i of the ball B(c, i) required to include C(G)).In all graphs, i is much smaller than 2δ + 1 (indicated in Proposition 2(d)).
Following Theorem 1, for each graph G = (V, E) in our dataset, we constructed an arbitrary BF S(c)-tree T 1 = (V, E ′ ), rooted at vertex c, and analyzed how well T 1 preserves or approximates the eccentricities of vertices in G.By Theorem 1, ecc G (v) ≤ ecc T1 (v) ≤ ecc G (v)+3δ+1 holds for every v ∈ V .In our experiments, for each graph G and the constructed for it BF S(c)-tree T 1 , we computed k max := max v∈V {ecc T1 (v) − ecc G (v)} (maximum distortion) and k avg := 1 n v∈V ecc T1 (v)−ecc G (v) (average distortion).For most graphs (see Table 2), the value of k max is small: k max = 0 for one graph, k max = 2 for eight graphs, k max = 3 for nine graphs, k max = 4 for four graphs, k max = 5 for two graphs, and k max > 5 for nine graphs.Also, the average  distortion k avg is much smaller than k max for all graphs.In fact, k avg < 3 in all but five graphs (gnutella-30, gnutella-31, amazon-2, power-grid, and road-pa).In graphs with high k max , close inspection reveals that only small percent of vertices achieve this maximum.For example, in graph web-stanford, k max = 28 was only achieved by 17 vertices.The distributions of the values of k(v) := ecc T1 (v) − ecc G (v) of all graphs are listed in Table 6 (see Appendix).
Similar experiments were performed following Proposition 3.For each graph G in our dataset, we picked a random vertex u ∈ V and a random vertex v ∈ F (u).Then, we identified in a randomly picked (u, v)geodesic a vertex w at distance rad(G) from v. We did not consider a vertex c defined in Proposition 3(d) since, for majority of graphs in our dataset, c will be a middle vertex of a geodesic between two mutually distant vertices, and working with c we will duplicate previous experiments.Recall that for majority of our graphs (as found in our experiments) two BFS sweeps already identify a pair of mutually distant vertices.We know from Proposition 3 that ecc G (v) ≥ diam(G) − 2δ ≥ 2rad(G) − 4δ − 1 and ecc G (w) ≤ rad(G) + δ.Our experimental results are better than these theoretical bounds.In Table 3, we list eccentricities of v and w for each graph.In almost all graphs, the eccentricity of v is equal to the diameter diam(G).Only four graphs have ecc G (v) = diam(G) − 1 and one graph (road-pa) has ecc G (v) > diam(G) − 1. Vertex w is central for 21 graphs, has eccentricity equal to rad(G) + 1 for 10 graphs, has eccentricity equal to rad(G) + 2 for one graph, and only for one remaining graph (road-pa network, which has large hyperbolicity) its eccentricity is equal to rad(G) + 15.It turns out also (see columns five and six of Table 2) that vertex w either belongs to the center C(G) or is very close to the center.The only exception is again road-pa network where 2rad(G) − ecc G (w) = 32 and d(w, C(G)) = 21.For every graph G = (V, E) in our dataset, we constructed also an arbitrary BF S(w)-tree T 2 = (V, E ′ ), rooted at vertex w, and analyzed how well T 2 preserves or approximates the eccentricities of vertices in G.The value of k max is at most five for 23 graphs.The average distortion k avg is much smaller than k max in all graphs.The distributions of the values of k(x) for all graphs are presented in Table 7 (see Appendix).
In Table 4, we compare these two eccentricity approximating spanning trees T 1 and T 2 with each other and with a third BF S(c * )-tree T 3 which we have constructed starting from a randomly chosen central vertex c * ∈ C(G).
For each graph in the dataset, three values of k max (k T1 max , k T2 max and k T3 max ) and three values of k avg (k T1 avg , k T2 avg and k T3 avg ) are listed.We observe that the smallest k max (out of three) is achieved by tree T 3 in 28 graphs, by tree T 2 in 20 graphs and by tree T 1 in 20 graphs (in 14 graphs, the smallest k max is achieved by all three trees).The difference between the largest and the smallest k max of a graph is at most one for 26 graphs in the dataset.The largest difference is observed for road-pa network: the largest k max (98) is given by tree T 1 , the smallest k max (46) is given by tree T 3 .Two other graphs have the difference larger than three: for sc-ppi network, the largest k max (7) is given by tree T 2 , the smallest k max (3) is given by tree T 1 ; for power-grid network, the largest k max (13) is given by tree T 1 , the smallest k max (4) is shared by remaining trees T 2 , T 3 .Overall, we conclude that k max values for trees T 1 and T 2 are comparable and generally can be slightly worse than those for tree T 3 .Similar observations hold also for the average distortion k avg .Note, however, that for construction of trees T 2 and T 3 one needs to know rad(G) or a central vertex of G, which are unlikely to be computable in subquadratic time (see Statement 2).

Estimation of Distances
Following Theorem 3, we experimented also on how well our approach approximates the distances in graphs from our dataset.To analyze the quality of approximation provided by our method for a given graph G = (V, E), for every δ := 0, 1, 2, . . ., we computed an estimate d δ (x, y) on d G (x, y) and the error ∆ xy (δ) = d δ (x, y) − d G (x, y) for all x, y ∈ V .In Table 5, we report ∆ max (δ) = max x,y∈V ∆ xy (δ) and ∆ avg (δ) = x,y∈V ∆ xy (δ) for the smallest δ such that ∆ max (δ) ≤ δ + 1.We omitted some very large graphs in this experiment.For some other large graphs, we did only sampling; we calculated ∆ max (δ) and ∆ avg (δ) based only on a set of sampled vertices.We sampled vertices that are most distant from the root.The number of sampled vertices ranged from 10 to 100 in each network.For all networks investigated, the average error ∆ avg (δ) was very small, less that 1 even for infrastructure networks.That is, the maximum error ∆ max (δ) was realized on a very small number of vertex pairs.The maximum error ∆ max (δ) was 2 for three networks, was 3 for five networks, was 4 for ten networks (including infrastructure network openflight), and was at most 6 for all except one social network dutch-elite and two infrastructure networks: road-euro and power-grid.The largest ∆ max (δ) value had expectedly power-grid network whose hyperbolicity is 10.x,y∈V ∆ xy (δ); δ is defined as the smallest δ (0 ≤ δ ≤ diam(G)) such that ∆ max (δ) ≤ δ + 1. Due to large sizes of some networks, the values of ∆ max (δ) and ∆ avg (δ) for networks marked with * were computed only for some sampled vertices (we sampled vertices that are most distant from the root).The number of sampled vertices ranged from 10 to 100 in each network.

Fig. 1 .
Fig. 1.A geodesic triangle ∆(x, y, z), the points m x , m y , m z , and the tripod Υ (x, y, z) u] be a geodesic triangle, where [v, x], [x, u] are arbitrary geodesics connecting x with v and u.Let ∆(u, v, y) := [u, v] ∪ [v, y] ∪ [y, u] be a geodesic triangle, where [v, y], [y, u] are arbitrary geodesics connecting y with v and u.
Pick any (x, y)-geodesic and consider the middle point m of it.Let z be a vertex of G such that d G (m, z) = ecc G (m).Consider a geodesic triangle ∆(x, y, z) := [x, y] ∪ [y, z] ∪ [z, x], where [z, x], [y, z] are arbitrary geodesics connecting z with x and y.Let m z be a point on [x, y] which is at distance (x|z) y = 1 2 (d(x, y) + d(z, y) − d(x, z)) from y and hence at distance (y|z) x = 1 2 (d(x, y) + d(z, x) − d(y, z)) from x. Without loss of generality, we can assume that m is located on [x, y] between y and m z .
Hence, d G (x, y) ≤ 2k + 2δ + 1. ⊓ ⊔ Diameter and radius.For an arbitrary connected graph G = (V, E) and a given vertex u ∈ V , a most distant from u vertex v ∈ F (u) can be found in linear (O(|E|)) time by a breadth-first-search BF S(u) started at u.A pair of mutually distant vertices of a connected graph G = (V, E) with δ-thin triangles can be computed in O(δ|E|) total time as follows.By Proposition 3(c), if v is a most distant vertex from an arbitrary vertex u and t is a most distant vertex from v, then d(v, t) ≥ diam(G) − 2δ.Hence, using at most O(δ) breadth-first-searches, one can generate a sequence of vertices v := v 1 , t := v 2 , v 3 , . . .v k with k ≤ 2δ + 2 such that each v i is most distant from v i−1 (with, v 0 = u) and v k , v k−1 are mutually distant vertices (the initial value d(v, t) ≥ diam(G) − 2δ can be improved at most 2δ times).Thus, by Proposition 2 and Proposition 3, we get the following additive approximations for the radius and the diameter of a graph with δ-thin triangles.Corollary 2. Let G = (V, E) be a graph with δ-thin triangles.1.There is a linear (O(|E|)) time algorithm which finds in G a vertex c with eccentricity at most rad(G)+3δ and a vertex v with eccentricity at least diam(G) − 2δ.Furthermore, C(G) ⊆ B(c, 3δ + 1) holds.2. There is an almost linear (O(δ|E|)) time algorithm which finds in G a vertex c with eccentricity at most rad(G) + δ.Furthermore, C(G) ⊆ B(c, 2δ + 1) holds.

Theorem 4 .
Let G = (V, E) be a graph with δ-thin triangles.(a) If the value of δ is known, then all distances in G with an additive one-sided error of at most 2δ + 2 can be found in O(|V | 2 log 2 |V |) time.(b) If an approximation ρ of δ such that δ ≤ ρ ≤ aδ + b is known (where a and b are constants), then all distances in G with an additive one-sided error of at most 2(aδ + b + 1) can be found in O(|V | 2 log 2 |V |) time.

Table 2 .
Qualities of a pair of mutually distant vertices u and v, of a middle vertex c of a (u, v)-geodesic, and of a BF S(c)-tree T 1 rooted at vertex c. "No. of BFS iterations" indicates how many breadth-firstsearch iterations were needed to obtain a pair of mutually distant vertices u and v.For each vertex x ∈ V , k(x) := ecc T1 (x) − ecc G (x). Also, k max := max x∈V k(x) and k avg := 1 n x∈V k(x).

Table 3 .
Qualities of a vertex v most distant from a random vertex u, of a vertex w of a (u, v)-geodesic at distance rad(G) from v, and of a BF S(w)-tree T 2 rooted at vertex w.For each vertex x ∈ V , k(x) := ecc T2 (x) − ecc G (x). Also, k max := max x∈V k(x) and k avg := 1 n x∈V k(x).
2ρ + 1 and remove S u from F

Table 1 .
Statistics of the analyzed networks: |V | is the number of vertices, |E| is the number of edges; |C(G)| is the number of central vertices; deg is the average degree; rad(G) is the graph's radius; diam(G) is the graph's diameter; diam G (C(G)) is the diameter of the graph's center; "connected?" indicates whether or not the center of the graph is connected; δ(G) is the graph's hyperbolicity.Hyperbolicity values marked with asterisks are approximate.

Table 4 .
Comparison of three BFS-trees T 1 , T 2 and T 3 .T 3 is a BF S(c * )-tree rooted at a randomly picked central vertex c * ∈ C(G).