1 Introduction

Euclidean spaces have the following nice property: if the geodesic between u and w contains v, and the geodesic between v and x contains w, then their union must be the geodesic between u and x. In 1991, Chepoi and Yushmanov introduced \(\alpha _i\)-metric properties (\(i \in {\mathcal {N}}\)), as a way to quantify by how much a graph is close to satisfy this above requirement [53] (see also [14, 15] for earlier use of \(\alpha _1\)-metric property). All graphs \(G=(V,E)\) occurring in this paper are connected, finite, unweighted, undirected, loopless and without multiple edges. The length of a path between two vertices u and v is the number of edges in the path. The distance \(d_G(u,v)\) is the length of a shortest path connecting u and v in G. The interval \(I_G(u,v)\) between u and v consists of all vertices on shortest (uv)-paths, that is, it consists of all vertices (metrically) between u and v: \(I_G(u,v)=\{x \in V : d_G(u,x) + d_G(x,v) = d_G(u,v)\}.\) Let also \(I_G^o(u,v)=I_G(u,v)\setminus \{u,v\}\). If no confusion arises, we will omit subindex G.

\(\alpha _i\)-metric property::

   if \(v \in I(u,w)\) and \(w\in I(v,x)\) are adjacent, then \(d(u,x)\ge d(u,v) + d(v,x)-i=d(u,v) + 1 + d(w,x)-i.\)

Roughly, gluing together any two shortest paths along a common terminal edge may not necessarily result in a shortest path (unlike in the Euclidean space) but yields a “near-shortest” path with defect at most i. A graph is called \(\alpha _i\)-metric if it satisfies the \(\alpha _i\)-metric property. \(\alpha _i\)-Metric graphs were investigated in [14, 15, 53]. In particular, it is known that \(\alpha _0\)-metric graphs are exactly the distance-hereditary chordal graphs, also known as ptolemaic graphs [45]. Furthermore, \(\alpha _1\)-metric graphs contain all chordal graphs [14] and all plane triangulations with inner vertices of degree at least 7 [32]. \(\alpha _2\)-Metric graphs contain all distance-hereditary graphs [53] and, even more strongly, all HHD-free graphs [18]. Evidently, every graph is an \(\alpha _i\)-metric graph for some i. Chepoi and Yushmanov in [53] also provided a characterization of all \(\alpha _1\)-metric graphs: They are exactly the graphs where all disks are convex and the graph \(W_6^{++}\) from Fig. 1 is forbidden as an isometric subgraph (see [53] or Theorem 5). This nice characterization was heavily used in [4] in order to characterize \(\delta \)-hyperbolic graphs with \(\delta \le 1/2\).

The eccentricity \(e_G(v)\) of a vertex v in G is defined by \(\max _{u \in V} d_G(u, v)\), i.e., it is the distance to a most distant vertex. The diameter of a graph is the maximum over the eccentricities of all vertices: \(diam(G) = \max _{u\in V} e_G(u)=\max _{u,v\in V} d_G(u,v)\). The radius of a graph is the minimum over the eccentricities of all vertices: \(rad(G) = \min _{u\in V}e_G(u)\). The center C(G) of a graph G is the set of its vertices with minimum eccentricity, i.e., \(C(G) = \{u\in V : e_G(u) =rad(G)\}\). Each vertex from C(G) is called a central vertex. In this paper, we investigate the radius, diameter, and all eccentricities computation problems in \(\alpha _i\)-metric graphs. Understanding the eccentricity function of a graph and being able to efficiently compute or estimate the diameter, the radius, and all vertex eccentricities is of great importance. For example, 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 of a vertex is used in order to measure its importance in the network: the eccentricity centrality index of v [46] is defined as \(\frac{1}{e(v)}\). Furthermore, the problem of finding a central vertex is one of the most famous facility location problems in Operation Research and in Location Science. In [53], the following nice relation between the diameter and the radius of an \(\alpha _i\)-metric graph G was established: \(diam(G)\ge 2rad(G)-i-1\). Recall that for every graph G, \(diam(G)\le 2rad(G)\) holds. Authors of [53] also raised a questionFootnote 1 whether the diameter of the center of an \(\alpha _i\)-metric graph can be bounded by a linear function of i. It is known that the diameters of the centers of chordal graphs or of distance-hereditary graphs are at most 3 [15, 53].

Related work on computing or estimating the radius, diameter, or all eccentricities. A naive algorithm which runs a BFS from each vertex to compute its eccentricity and then (in order to compute the radius, the diameter and a central vertex) picks the smallest and the largest eccentricities and a vertex with smallest eccentricity has running time O(nm) on an n-vertex m-edge graph. Interestingly, this naive algorithm is conditionally optimal for general graphs as well as for some restricted families of graphs [1, 6, 20, 49] since, under plausible complexity assumptions, neither the diameter nor the radius can be computed in truly subquadratic time (i.e., in \({O}(n^am^b)\) time, for some positive ab such that \(a+b <2\)) on those graphs. Already for split graphs (a subclass of chordal graphs), computing the diameter is roughly equivalent to Disjoint Sets, a.k.a., the monochromatic Orthogonal Vector problem [17]. Under the Strong Exponential-Time Hypothesis (SETH), we cannot solve Disjoint Sets in truly subquadratic time, and so neither we can compute the diameter of split graphs in truly subquadratic time [6].

In a quest to break this quadratic barrier (in the size \(n+m\) of the input), there has been a long line of work presenting more efficient algorithms for computing the diameter and/or the radius, or even better all eccentricities, on some special graph classes, by exploiting their geometric and tree-like representations and/or some forbidden pattern (e.g., excluding a minor [41], or a family of induced subgraphs). For example, faster algorithms for all eccentricities computation are known for distance-hereditary graphs [12, 23, 29, 33], outerplanar graphs [42], planar graphs [9, 43], graphs with bounded tree-width [1, 8, 41] and, more generally, graphs with bounded clique-width [12, 38]. Linear-time algorithms for computing all eccentricities are also known for interval graphs [34, 47]. Some recent works have further studied which properties of interval graphs could imply on their own faster algorithms for diameter and all eccentricities computation. Efficient algorithms for these problems have been found for AT-free graphs [36], directed path graphs [10], strongly chordal graphs [21], dually chordal graphs [7, 22], Helly graphs and graphs of bounded Helly number [28, 39, 40]. See also [37]. Chordal graphs are another well-known generalization of interval graphs. Although the diameter of a split graph can unlikely be computed in subquadratic time, there is an elegant linear-time algorithm for computing the radius and a central vertex of a chordal graph [16]. However, until this work there has been little insight about how to extend this nice result to larger graph classes (a notable exception being the work in [18]). This intriguing question is partly addressed in our paper.

Since the exact diameter or radius computation in subquadratic time is impossible (unless the SETH is false) even for simple families of graphs (in case of the diameter, even for split graphs), a large volume of work was also devoted to approximation algorithms. It is known [13] that the diameter of any graph with n vertices and m edges can be approximated within a multiplicative factor of 3/2 in \({\tilde{O}}(m^{3/2})\) time. Furthermore, unless the SETH is false, no \(O(n^{2-\epsilon })\) time algorithm can achieve an approximation factor better than 3/2 in sparse graphs [49] and no \(O(m^{3/2-\epsilon })\) time algorithm can achieve an approximation factor better than 5/3 [3]. The eccentricities of all vertices of any graph can be approximated within a factor of 5/3 in \({\tilde{O}}(m^{3/2})\) time [13] and, under the SETH, no \(O(n^{2-\epsilon })\) time algorithm can achieve better than 5/3 approximation in sparse graphs [1] and no \(O(m^{3/2-\epsilon })\) time algorithm can achieve an approximation factor better than 9/5 [3]. Authors of [3] also show that no near-linear time algorithm can achieve a better than 2 approximation for the eccentricities and provide an algorithm that approximates eccentricities within a \(2+\epsilon \) factor in \({\tilde{O}}(m/\epsilon )\) time for any \(0<\epsilon <1\). On planar graphs, there is an approximation scheme with near linear running time [51]. Authors of [13] additionally address a more challenging question of obtaining an additive c-approximation for the diameter diam(G) of a graph G, i.e., an estimate D such that \(diam(G)- c\le D \le diam(G)\). A simple \({\tilde{O}}(m n^{1-\epsilon })\) time algorithm achieves an additive \(n^{\epsilon }\)-approximation and, for any \(\epsilon > 0\), getting an additive \(n^{\epsilon }\)-approximation algorithm for the diameter running in \(O(n^{2-\epsilon '})\) time for any \(\epsilon ' > 2\epsilon \) would falsify the SETH.

Much better additive approximations can be achieved for graphs with bounded (metric) parameters, including chordal graphs, HHD-free graphs, k-chordal graphs, and more generally all \(\delta \)-hyperbolic graphs (see [10, 11, 16, 19, 20, 24, 25, 29,30,31, 34]). For example, a vertex furthest from an arbitrary vertex has eccentricity at least \(diam(G)-2\) for chordal graphs [16] and at least \(diam(G)-\lfloor k/2\rfloor \) for k-chordal graphs [11]. Hence, the diameter in those graphs can be approximated within a small additive error in linear time by a BFS. In fact, the last vertex visited by a LexBFS has eccentricity at least \(diam(G)-1\) for chordal graphs [34] as well as for HHD-free graphs [24]. Thus, although the existence of a subquadratic algorithm for computing the exact diameter of a chordal graph would falsify the SETH, a vertex with eccentricity at least \(diam(G)-1\) can be found in linear time by a LexBFS. Later, those results were generalized to all \(\delta \)-hyperbolic graphs [19, 20, 30, 31]. Note that chordal graphs and distance-hereditary graphs are 1-hyperbolic, while k-chordal graphs are \(\lfloor k/2\rfloor /2\)-hyperbolic [52]. Gromov [44] defines \(\delta \)-hyperbolic graphs via a simple 4-point condition: for any four vertices uvwx, the two largest of the three distance sums \(d(u,v) + d(w,x)\), \(d(u,w) + d(v,x)\), and \(d(u,x) + d(v,w)\) differ by at most \(2\delta \ge 0\). Such graphs have become of recent interest due to the empirically established presence of a small hyperbolicity in many real-world networks.

For every \(\delta \)-hyperbolic graph, a vertex furthest from an arbitrary vertex has eccentricity at least \(diam(G)-2\delta \) [19]. Furthermore, for any m-edge \(\delta \)-hyperbolic graph G, a vertex with eccentricity at most \(rad(G)+2\delta \) can be found in \(O(\delta m)\) time and a vertex with eccentricity at most \(rad(G)+3\delta \) can be found in O(m) time [19, 20, 30, 31]. Three approximation schemes for all eccentricities were presented in [30]: an approximate eccentricity function \({\hat{e}}\), constructible in \(O(\delta m)\) time, which satisfies \(e(v) - 2\delta \le {\hat{e}}(v) \le e(v)\), for all \(v \in V\), and two spanning trees T, one constructible in \(O(\delta m)\) time and the other in O(m) time, which satisfy \(e_G(v) \le e_T(v) \le e_G(v) + 4\delta + 1\) and \(e_G(v) \le e_T(v) \le e_G(v) + 6\delta \), for all \(v \in V\), respectively. Our results of Sect.  2 and Sect. 3 (and some results of [53]) show that \(\alpha _i\)-metric graphs behave like \(\delta \)-hyperbolic graphs. In a forthcoming paper [27], indeed we show that the hyperbolicity \(\delta \) of an \(\alpha _i\)-metric graph depends linearly on i. However, the constants in our Theorems 1-4 are better than those that can be obtained by combining the hyperbolicity result of [27] with the algorithmic results of [19, 20, 30] on radii, diameters and all eccentricities of \(\delta \)-hyperbolic graphs. In [27], we also introduce a natural generalization of an \(\alpha _i\)-metric, which we call a (\(\lambda ,\mu \))-bow metric: namely, if two shortest paths P(uw) and P(vx) share a common shortest subpath P(vw) of length more than \(\lambda \) (that is, they overlap by more than \(\lambda \)), then the distance between u and x is at least \(d(u,v)+d(v,w)+d(w,x)-\mu \). \(\delta \)-Hyperbolic graphs are (\(\delta , 2\delta \))-bow metric and \(\alpha _i\)-metric graphs are (0, i)-bow metric.

\((\alpha _1,\varDelta )\)-Metric graphs form an important subclass of both \(\alpha _1\)-metric graphs and weakly bridged graphs, and they contain all chordal graphs and all plane triangulations with inner vertices of degree at least 7. In [32], it was shown that every \((\alpha _1,\varDelta )\)-metric graph admits an eccentricity 2-approximating spanning tree, i.e., a spanning tree T such that \(e_T(v)-e_G(v)\le 2\) for every vertex v. As a result, for a chordal graph, an additive 2-approximation of all eccentricities can be computed in linear time [25]. Finding similar results for general \(\alpha _1\)-metric graphs was left as an open problem in [32].

Our Contribution. We prove several new results on metric intervals, eccentricity function, and centers in \(\alpha _i\)-metric graphs, and their algorithmic applications, thus answering open questions in the literature [25, 32, 53]. To list our contributions, we need to introduce on our way some additional notations and terminology.

Section 2 is devoted to general \(\alpha _i\)-metric graphs (\(i\ge 0\)). The set \(S_k(u, v) = \{x \in I(u, v) : d(u, x) = k\}\) is called a slice of the interval I(uv) where \(0 \le k \le d(u,v)\). An interval I(uv) is said to be \(\lambda \)-thin if \(d(x,y) \le \lambda \) for all \(x,y \in S_k(u,v)\), \(0<k< d(u,v)\). The smallest integer \(\lambda \) for which all intervals of G are \(\lambda \)-thin is called the interval thinness of G. We show first that, in \(\alpha _i\)-metric graphs G, the intervals are \((i+1)\)-thin.

The disk of radius r and center v is defined as \(\{ u \in V : d(u,v) \le r \}\), and denoted by D(vr). Sometimes, D(vr) is called the r-neighborhood of v. In particular, \(N[v] = D(v,1)\) and \(N(v) = N[v] \setminus \{v\}\) denote the closed and open neighbourhoods of a vertex v, respectively. More generally, for any vertex-subset S and a vertex u, we define \(d(u,S) = \min _{v \in S} d(u,v), \ D(S,r) = \bigcup _{v \in S}D(v,r), \ N[S] = D(S,1)\) and \(N(S) = N[S] \setminus S\). We say that a set of vertices \(S\subseteq V\) of a graph \(G=(V,E)\) is \(d^k\)-convex if for every two vertices \(x,y\in S\) with \(d(x,y)\ge k\ge 0\), the entire interval I(xy) is in S. For \(k\le 2\), this definition coincides with the usual definition of convex sets in graphs [5, 14, 50]: S is convex if for every \(x,y\in S\), the interval I(xy) is also in S. Clearly, the intersection of two \(d^k\)-convex sets is also \(d^k\)-convex. We show that, in \(\alpha _i\)-metric graphs G, the disks (and, hence, the centers C(G)) are \(d^{2i-1}\)-convex. The main result of Sect. 2.1 states that the diameter of the center C(G) of G is at most \(3i+2\), thus answering a question raised in [53].

Let \(F_G(v)\) be the set of all vertices of G that are most distant from v. A pair xy is called a pair of mutually distant vertices if \(e_G(x)=e_G(y)=d_G(x,y)\), i.e., \(x\in F_G(y), y\in F_G(x)\). In Sect. 2.2, we show that a vertex x that is most distant from an arbitrary vertex z has eccentricity at least \(diam(G)-3i-2\). Furthermore, a middle vertex c of any shortest path between x and \(y\in F(x)\) has eccentricity at most \(rad(G)+ 4i+(i+1)/2+2\), and a middle vertex \(c^*\) of any shortest path between any two mutually distant vertices has eccentricity at most \(rad(G)+2i+1\). Additionally, all central vertices of G are within a small distance from c and \(c^*\), namely, \(C(G)\subseteq D(c^*, 4i +3)\) and \(C(G)\subseteq D(c, 4i + (i+1)/2+2)\). Hence, an additive O(i)-approximation of the radius and of the diameter of an \(\alpha _i\)-metric graph G with m edges can be computed in O(m) time. In Sect. 2.3, we present three approximation algorithms for all eccentricities: an O(im) time eccentricity approximation \({\hat{e}}(v)\) based on the distances from any vertex to two mutually distant vertices, which satisfies \(e(v) - 3i-2 \le {\hat{e}}(v) \le e(v)\) for all \(v \in V\), and two spanning trees T, one constructible in O(im) time and the other in O(m) time, which satisfy \(e_G(v) \le e_T(v) \le e_G(v) + 4i + 3\) and \(e_G(v) \le e_T(v) \le e_G(v) + 7i+5\), respectively. Hence, an additive O(i)-approximation of all vertex eccentricities of an \(\alpha _i\)-metric graph G with m edges can be computed in O(m) time.

Section 3 is devoted to \(\alpha _1\)-metric graphs. The eccentricity function e(v) of a graph G is said to be unimodal, if for every non-central vertex v of G there is a neighbor \(u\in N(v)\) such that \(e(u)<e(v)\) (that is, every local minimum of the eccentricity function is a global minimum). We show in Sect. 3.1 that the eccentricity function on \(\alpha _1\)-metric graphs is almost unimodal in the sense that the only non-central vertices that violate the unimodality (that is, do not have a neighbor with smaller eccentricity) must have their eccentricity equal to \(rad(G)+1\) and their distance from C(G) must be 2. In other words, every local minimum of the eccentricity function on an \(\alpha _1\)-metric graph G is a global minimum or is at distance 2 from a global minimum. Such behavior of the eccentricity function was observed earlier in chordal graphs [32], in distance-hereditary graphs [29] and in all \((\alpha _1,\varDelta )\)-metric graphs [32] (note also that in Helly graphs the eccentricity function is unimodal [21]). This almost unimodality of the eccentricity function turns out to be very useful in locating a vertex with eccentricity at most \(rad(G)+1\) in a gradient descent fashion. In Sect. 3.2, using the convexity of the center C(G) of an \(\alpha _1\)-metric graph G, we show that the diameter of C(G) is at most 3. This generalizes known results for chordal graphs [15] and for \((\alpha _1,\varDelta )\)-metric graphs [32]. In Sect. 3.3, we present a local-search algorithm for finding a central vertex of an arbitrary \(\alpha _1\)-metric graph in subquadratic time. Our algorithm even achieves linear runtime on \((\alpha _1,\varDelta )\)-metric graphs, thus answering an open question from [32]. In Sect. 3.4, we show how to approximate efficiently all vertex eccentricities in \(\alpha _1\)-metric graphs.

2 General Case of \(\alpha _i\)-Metric Graphs for Arbitrary \(i\ge 0\)

First we present an auxiliary lemma.

Lemma 1

Let G be an \(\alpha _i\)-metric graph, and let uvxy be vertices such that \(x\in I(u,v)\), \(d(u,x)=d(u,y)\), and \(d(v,y)\le d(v,x)+k\). Then, \(d(x,y)\le k+i+2\).

Proof

Set \(\nu = i + k + 2\), and suppose for the sake of contradiction \(d(x,y) > \nu \). Without loss of generality, k is the minimum value for which a counter-example can be found. We may also assume, without loss of generality, that d(ux) is minimized. Let \(x' \in N(x) \cap I(x,u)\) and let \(y' \in N(y) \cap I(y,u)\). Observe that \(d(u,x') = d(u,y')\), \(x' \in I(u,v)\) and \(d(v,y') \le d(v,y) + 1 \le d(x,v) + 1 + k = d(x',v) + k\). Therefore, by minimality of d(ux), we have \(d(x',y') \le \nu \) (otherwise, we could replace xy with \(x',y'\)). Now, there are two cases to be considered:

  • Case \(d(y',x') < d(y',x)\). We also have \(d(v,x) < d(v,x')\). Since G is an \(\alpha _i\)-metric graph, it implies \(d(v,y') \ge d(v,x) + 1 + d(x',y') - i\). Then, \(d(x',y') \le i - 1 + d(v,y') - d(v,x) = i + d(v,y') - d(v,x') \le i + k\). However, \(\nu \le d(x,y) - 1 \le d(x',y') + 1 \le i + k +1 = \nu -1\).

  • Case \(d(y',x') \ge d(y',x)\). Then, \(d(x,y) \le 1 + d(x,y') \le 1 + d(x',y') \le \nu + 1\). It implies \(d(x,y) = \nu +1\), \(d(x,y') = d(x',y') = \nu \), and \(y' \in I(x,y) \cap N(y)\). In particular, \(d(x,y') < d(x,y)\). Furthermore, we claim that we have \(d(v,y) < d(v,y')\). Indeed, suppose for the sake of contradiction \(d(v,y') \le d(v,y)\). In this situation, \(d(v,y') \le d(u,y') + d(v,y') - d(u,y') \le d(u,y) - 1 + d(v,y) - d(u,y') \le d(u,x) - 1 + d(v,x) + k - d(u,x') = d(u,v) - d(u,x') + k - 1 = d(v,x') + k - 1\). By minimality of k, we obtain \(d(x',y') \le i + (k - 1) + 2 = i + k + 1 < \nu \), and a contradiction arises. Therefore, as claimed, \(d(v,y) < d(v,y')\). Since G is an \(\alpha _i\)-metric graph, it implies \(d(x,v) \ge d(x,y') + 1 + d(y,v) - i = d(x,y) + d(y,v) - i\). But then, \(\nu = d(x,y) -1 \le d(x,v) - d(y,v) + i -1 \le i -1\).

In both cases, we derive a contradiction. \(\square \)

Lemma 1 is helpful in proving that in \(\alpha _i\)-metric graphs the intervals are rather thin.

Lemma 2

If G is an \(\alpha _i\)-metric graph, then its interval thinness is at most \(i+1\).

Proof

Let \(u,v,x,y \in V\) be such that \(x,y \in I(u,v)\), and \(d(u,x) = d(u,y)\). Suppose for the sake of contradiction \(d(x,y) > i+1\). By Lemma 1 (applied for \(k=0\)), we have \(d(x,y) = i+2\). We further assume, without loss of generality, that d(ux) is minimized. In particular, let \(x' \in N(x) \cap I(u,x), \ y' \in N(y) \cap I(u,y)\). By minimality of d(ux) we have \(d(x',y') \le i+1\). We claim that \(d(x',y) \ge i+2\). Indeed, if it were not the case, then \(d(x',y) < d(x,y)\) and so, since we also have \(d(v,x) < d(v,x')\), we would obtain \(d(y,v) \ge d(y,x) + d(x,v) - i = d(x,v) +2 > d(x,v) = d(y,v)\), getting a contradiction. This proves as claimed that \(d(x',y) \ge i+2\). It implies \(d(x',y') \ge i+1\), and so \(d(x',y') = i+1\). However, in this situation, \(d(x',y') < d(x',y)\) and \(d(v,y) < d(v,y')\). As a result, \(d(v,x') \ge d(v,y') + d(x',y') - i = d(v,y') + 1 > d(v,y') = d(v,x')\), and a contradiction arises. \(\square \)

2.1 Centers of \(\alpha _i\)-Metric Graphs

In this subsection we show that the diameter of the center of an \(\alpha _i\)-metric graph is at most \(3i+2\), hereby providing an answer to a question raised in [53] whether the diameter of the center of an \(\alpha _i\)-metric graph can be bounded by a linear function of i. In [53], the following relation between the diameter and the radius of an \(\alpha _i\)-metric graph G was proven: \(2rad(G)\ge diam(G)\ge 2rad(G)-i-1\).

First we show that all disks (and hence the center C(G)) of an \(\alpha _i\)-metric graph G is \(d^{2i-1}\)-convex.

Lemma 3

Every disk of an \(\alpha _i\)-metric graph G is \(d^{2i-1}\)-convex. In particular, the center C(G) of an \(\alpha _i\)-metric graph G is \(d^{2i-1}\)-convex.

Proof

Since \(C(G) = \bigcap \{D(v,rad(G)) : v \in V\}\), it suffices to prove the \(d^{2i-1}\)-convexity of an arbitrary disk. Let \(v,x,y \in V\) be such that \(x,y \in D(v,r)\) for some \(r \ge 0\) but \(I(x,y) \not \subseteq D(v,r)\). Let \(a_x \in I(x,y) \setminus D(v,r)\) be such that \(d(x,a_x)\) is maximized, and let \(b_x \in N(a_x) \cap I(a_x,y)\) be arbitrary. Note that \(b_x \in D(x,r)\) by maximality of \(d(x,a_x)\). In particular, \(d(v,b_x) < d(v,a_x)\). We also have \(d(x,a_x) < d(x,b_x)\) because \(a_x,b_x \in I(x,y)\). Since G is an \(\alpha _i\)-metric graph, \(r \ge d(v,x) \ge d(v,a_x) + d(a_x,x) - i = r+1 + d(a_x,x) - i\). Therefore, \(d(a_x,x) \le i -1\). Now, let \(a_y \in I(x,y) \setminus D(v,r)\) be such that \(d(y,a_y)\) is maximized. We prove as before \(d(a_y,y) \le i-1\). Furthermore, \(d(a_y,y) \ge d(a_x,y)\) by maximality of \(d(a_y,y)\). As a result, \(d(x,y) = d(x,a_x)+d(a_x,y) \le d(x,a_x)+d(a_y,y) \le 2i-2\). \(\square \)

Next auxiliary lemma is crucial in obtaining many results of this section.

Lemma 4

Let G be an \(\alpha _i\)-metric graph. For any \(x,y,v \in V\) and any integer \(k\in \{0,\dots ,d(x,y)\}\), there is a vertex \(c \in S_k(x,y)\) such that \(d(v,c) \le \max \{d(v,x), d(v,y)\}-\min \{d(x,c), d(y,c)\}+ i\) and \(d(v,c) \le \max \{d(v,x),d(v,y)\} + i/2.\) For an arbitrary vertex \(z\in I(x,y)\), we have \(d(z,v)\le \max \{d(x,v), d(y,v)\}-\min \{d(x,z), d(y,z)\}+2i+1\) and \(d(z,v)\le \max \{d(x,v), d(y,v)\}+3i/2+1\). Furthermore, \(e(z) \le \max \{e(x), e(y)\}-\min \{d(x,z), d(y,z)\}+ 2i+1\) and \(e(z) \le \max \{e(x),e(y)\} + 3i/2+1\) when \(v\in F(z)\).

Proof

Let \(z\in S_k(x,y)\), for some \(k\in \{0,\dots ,d(x,y)\}\), and c be a vertex of \(S_k(x,y)\) closest to v. By Lemma 2, \(d(c,z)\le i+1\).

Consider a neighbor \(c'\) of c on a shortest path from c to v. We have \(d(x,c)<d(x,c')\) or \(d(y,c)<d(y,c')\) since otherwise, when \(d(x,c)\ge d(x,c')\) and \(d(y,c)\ge d(y,c')\), \(c'\) must belong to \(S_k(x,y)\) and a contradiction with the choice of c arises. Without loss of generality, assume \(d(x,c)<d(x,c')\). Then \(c\in I(x,c')\), and we can apply \(\alpha _i\)-metric property to \(x,c,c',v\) and get \(d(x,v)\ge d(x,c)+d(c,v)-i\), i.e., \(d(c,v)\le d(x,v)-d(x,c)+i\le \max \{d(x,v), d(y,v)\}-\min \{d(x,c), d(y,c)\}+i\). By adding also the triangle inequality \(d(c,v)\le d(v,x)+d(x,c)\) to \(d(c,v)\le d(x,v)-d(x,c)+i\), we get \(d(c,v)\le d(x,v)+i/2\le \max \{d(x,v), d(y,v)\}+i/2\).

For arbitrary \(z\in S_k(x,y)\), as \(d(z,c)\le i+1\), \(d(x,c)=d(x,z)\), \(d(y,c)=d(y,z)\), we get \(d(z,v)\le d(z,c)+d(c,v)\le i+1+d(x,v)-d(x,c)+i\le \max \{d(x,v), d(y,v)\}-\min \{d(x,z), d(y,z)\}+2i+1\) and \(d(z,v)\le d(z,c)+d(c,v)\le i+1+d(x,v)+i/2\le \max \{d(x,v), d(y,v)\}+i+i/2+1\). Applying both inequalities to the case in which v is furthest from z, we get \(e(z) = d(z,v) \le \max \{e(x), e(y)\}-\min \{d(x,z), d(y,z)\}+ 2i+1\) and \(e(z) \le \max \{e(x),e(y)\} + i+i/2+1\). \(\square \)

Lemma 4 has an immediate corollary.

Corollary 1

Let G be an \(\alpha _i\)-metric graph. Any vertices \(x,y \in V\) and \(c \in I(x,y)\) satisfy \(e(c) \le \max \{e(x), e(y)\} + 3i/2+1\). However, if \(d(x,y) \ge 4i+2\), then any vertex \(c' \in I(x,y)\) with \(d(x,c') \ge 2i+1\) and \(d(y,c') \ge 2i+1\) satisfies \(e(c') \le \max \{e(x), e(y)\}\). Furthermore, if \(d(x,y) > 4i+3\) then any vertex \(c' \in I(x,y)\) with \(d(x,c') > 2i+1\) and \(d(y,c') > 2i+1\) satisfies \(e(c') < \max \{e(x), e(y)\}\).

Proof

By Lemma 4, \(e(c) \le \max \{e(x), e(y)\} + 3i/2+1\). Suppose that \(d(x,y) \ge 4i+2\) and consider any vertex \(c' \in I(x,y)\) satisfying \(d(x,c') \ge 2i+1\) and \(d(c',y) \ge 2i+1\). By Lemma 4, \(e(c') \le \max \{e(x), e(y)\}-\min \{d(x,c'), d(y,c')\}+ 2i+1\). Hence, \(e(c') \le \max \{e(x), e(y)\}\).

Suppose now that \(d(x,y) > 4i+ 3\), i.e., \(d(x,y) \ge 4i + 4\). Consider any vertex \(c' \in I(x,y)\) satisfying \(d(x,c') > 2i+1\) and \(d(c',y) > 2i+1\). By Lemma 4, \(e(c') \le \max \{e(x), e(y)\}-\min \{d(x,c'), d(y,c')\}+ 2i+1\). Hence, \(e(c') < \max \{e(x), e(y)\}\). \(\square \)

Using Corollary 1 one can easily prove that the diameter of the center C(G) of an \(\alpha _i\)-metric graph G is at most \(4i+3\). Below we show that the bound can be improved.

Theorem 1

If G is an \(\alpha _i\)-metric graph, then \(diam(C(G)) \le 3i+2\).

Proof

Let us write \(r = rad(G)\) in what follows. Suppose by contradiction \(diam(C(G)) > 3i+2\). Since C(G) is \(d^{2i-1}\)-convex, every diametral path of C(G) must be fully in C(G). In particular, there exist \(x,y \in C(G)\) such that \(d(x,y) = 3i+3\) and \(I(x,y) \subseteq C(G)\). Furthermore, for every \(u \in V\) such that \(\max \{d(u,x),d(u,y)\} < r\), we obtain \(I(x,y) \subseteq D(u,r-1)\) because the latter disk is also \(d^{2i-1}\)-convex. Therefore, for every \(z \in I(x,y)\), we must have \(F(z) \subseteq F(x) \cup F(y)\).

Let ab be an edge on a shortest xy-path such that \(d(a,x) < d(b,x)\). Assume \(F(b) \not \subseteq F(a)\). Let \(v \in F(b) \setminus F(a)\) be arbitrary. Since G is an \(\alpha _i\)-metric graph, \(d(v,y) \ge d(v,b)+d(b,y)-i = r + \left( d(b,y) - i \right) \). Therefore, \(d(b,y) \le i\). In the same way, if \(F(a) \not \subseteq F(b)\), then \(d(a,x) \le i\). By induction, we get \(F(z) \subseteq F(x)\) (\(F(z) \subseteq F(y)\), respectively) for every \(z \in I(x,y)\) such that \(d(y,z) \ge i+1\) (\(d(x,z) \ge i+1\), respectively). In particular, for every t such that \(i+1 \le t \le d(x,y) - i - 1\), we must have \(F(z) \subseteq F(x) \cap F(y)\) for every \(z \in S_t(x,y)\).

Note that the above properties are true not only for \(x,y\in C(G)\) with \(d(x,y) = 3i+3\) but also for every \(x',y'\in C(G)\) with \(d(x,y)\ge 2i-1\), as \(d^{2i-1}\)-convexity argument can still be used.

Let \(c \in I(x,y)\) be such that \(F(c) \subseteq F(x) \cap F(y)\) and \(k:=|F(c)|\) is minimized. We claim that \(k < |F(x) \cap F(y)|\). Indeed, let \(v \in F(x) \cap F(y)\) be arbitrary. By Lemma 4, some vertex \(c_v \in S_{i+1}(x,y)\) satisfies \(d(c_v,v) \le r - 1\). Then, \(F(c_v) \subseteq \left( F(x) \cap F(y) \right) \setminus \{v\}\), and \(k \le |F(c_v)| \le |F(x) \cap F(y)|-1\) by minimality of c. Then, let \(y_c \in I(x,y)\) be such that \(F(y_c) \cap F(x) \cap F(y) \subseteq F(c)\) and \(d(x,y_c)\) is maximized (such a vertex must exist because \(c \in I(x,y)\) satisfies that condition). We have \(y_c \ne y\) because \(F(x) \cap F(y) \not \subseteq F(c)\). Therefore, the maximality of \(d(x,y_c)\) implies the existence of some \(v \in \left( F(x) \cap F(y)\right) \setminus F(c)\) such that \(d(v,y_c) = r - 1\). Since G is an \(\alpha _i\)-metric graph, \(d(v,y) \ge d(v,y_c) + d(y_c,y) - i = r + \left( d(y_c,y) - i - 1 \right) \). As a result, \(d(y_c,y) \le i +1\).

Then, for every \(z \in S_{i+1}(x,y_c)\), since we have \(d(z,y_c) = d(x,y) - i-1 - d(y_c,y) \ge d(x,y) - 2i-2 = i+1\), we obtain \(F(z) \subseteq F(x) \cap F(y) \cap F(y_c) \subseteq F(c)\). By minimality of k, \(F(z) = F(c)\). However, let \(v \in F(c)\) be arbitrary. By Lemma 4, there exists some \(c' \in S_{i+1}(x,y_c)\) such that \(d(c',v) \le r-1\), thus contradicting \(F(c') = F(c)\). \(\square \)

2.2 Approximating Radii and Diameters of \(\alpha _i\)-Metric Graphs

In this subsection, we show that a vertex with eccentricity at most \(rad(G)+O(i)\) and a vertex with eccentricity at least \(diam(G)-O(i)\) of an \(\alpha _i\)-metric graph G can be found in (almost) linear time.

First we show that a middle vertex of any shortest path between two mutually distant vertices has eccentricity at most \(rad(G)+2i+1\). Furthermore, the distance between any two mutually distant vertices is at least \(diam(G)-3i-2\).

Lemma 5

Let G be an \(\alpha _i\)-metric graph, xy be a pair of mutually distant vertices of G and z be a middle vertex of an arbitrary shortest path connecting x and y. Then,

\(e(z)\le rad(G)+2i+1\).

Furthermore, there is a vertex c in \(S_{\lfloor d(x,y)/2\rfloor }(x,y)\) with \(e(c)\le rad(G)+i\).

Proof

Let \(r=rad(G)\) and \(k=\lfloor d(x,y)/2\rfloor \). We need to show that for every vertex \(z\in S_{k}(x,y)\), \(e(z)\le r+2i+1\) holds. It will be sufficient to show that for a specially chosen vertex \(c\in S_k(x,y)\), we have \(e(c)\le r+i\). Then, since for any two vertices \(u,v\in S_k(x,y)\), \(d(u,v)\le i+1\) (see Lemma 2), we will get \(e(z)\le d(z,c)+e(c)\le r+2i+1.\)

Consider in \(S_k(x,y)\) vertices c with smallest eccentricity and among all those vertices pick that one whose |F(c)| is as small as possible. Let \(v\in F(c)\) be a most distant vertex from c and consider a neighbor t of c on a shortest path from c to v. As xy is a pair of mutually distant vertices, we have \(d(x,y)\ge d(x,v)\) and \(d(x,y)\ge d(y,v)\). We know also that \(d(c,x)\le d(c,y)\le r\) as \(d(x,y)\le 2r\).

If \(d(x,c)<d(x,t)\) then \(c\in I(x,t).\) By the \(\alpha _i\)-metric property applied to xctv, we get \(d(x,y)\ge d(x,v)\ge d(x,c)+d(c,v)-i\). That is, \(d(c,y)\ge d(c,v)-i\) and therefore \(e(c)=d(c,v)\le d(c,y)+i\le r+i\). Similarly, if \(d(y,c)<d(y,t)\) then \(e(c)=d(c,v)\le d(c,x)+i\le r+i\) must hold. So, in what follows, we may assume that \(d(x,c)\ge d(x,t)\) and \(d(y,c)\ge d(y,t)\), i.e., \(t\in S_k(x,y)\) must hold.

If \(e(t)=e(c)+1\) then for every \(s\in F(t)\), we have \(c\in I(t,s)\) and \(d(c,s)= d(c,v)\). If \(e(t)=e(c)\) then, by the choice of c, there must exist a vertex \(s\in F(t)\setminus F(c)\) (as \(v\in F(c)\setminus F(t)\)), and we have \(c\in I(t,s)\) and \(d(c,s)= d(c,v)-1\). In both cases, by the \(\alpha _i\)-metric property applied to \(c\in I(t,s)\) and \(t\in I(c,v)\), we get \(d(s,v)\ge d(s,c)+d(v,c)-i\ge 2d(c,v)-1-i=2e(c)-1-i\).

Now, since \(d(s,v)\le diam(G)\le 2r\), if \(e(c)\ge r+i+1\), we get \(2r\ge d(s,v)\ge 2e(c)-1-i\ge 2r+2i+2-i-1=2r+i+1>2r\), which is impossible.

This proves that \(e(c)\le r+i\) and therefore \(e(z)\le r+2i+1\) for every \(z\in S_k(x,y)\). \(\square \)

Lemma 6

Let G be an \(\alpha _i\)-metric graph and xy be a pair of mutually distant vertices of G. Then, \(d(x,y)\ge 2rad(G)-4i-3\) and \(d(x,y)\ge diam(G)-3i-2\). Furthermore, any middle vertex z of a shortest path between x and y satisfies \(e(z)\le \lceil d(x,y)/2\rceil +2i+1\).

Proof

Let z be a middle vertex of an arbitrary shortest path connecting x and y, and let v be a vertex furthest from z. By Lemma 4, \(d(z,v)\le \max \{d(x,v), d(y,v)\}-\min \{d(x,z), d(y,z)\}+2i+1\). Since xy are two mutually distant vertices, \(d(x,y)\ge \max \{d(x,v), d(y,v)\}\). Hence, \(e(z)=d(z,v)\le d(x,y)-\lfloor d(x,y)/2\rfloor +2i+1=\lceil d(x,y)/2\rceil +2i+1\). That is, \(d(x,y)\ge 2e(z)-4i-3\ge 2rad(G)-4i-3\).

To prove \(d(x,y)\ge diam(G)-3i-2\), consider a diametral pair of vertices uv, i.e., with \(d(u,v)=diam(G)\), and let \(k=\lfloor d(x,y)/2\rfloor \). By Lemma 4, there are vertices \(v',u'\in S_k(x,y)\) such that \(d(v',v)\le \max \{d(x,v), d(y,v)\}-\min \{d(x,v'), d(y,v')\}+i\) and \(d(u',u)\le \max \{d(x,u), d(y,u)\}-\min \{d(x,u'), d(y,u')\}+i\). By the triangle inequality and Lemma 2, \(diam(G)=d(u,v)\le d(u,u')+d(u',v')+d(v',v)\le (\max \{d(x,v), d(y,v)\}-\lfloor d(x,y)/2\rfloor +i)+(i+1)+(\max \{d(x,u), d(y,u)\}-\lfloor d(x,y)/2\rfloor +i)=\max \{d(x,v), d(y,v)\}+\max \{d(x,u), d(y,u)\}-d(x,y)+3i+2.\) Since, xy are mutually distant vertices, \(d(x,y)\ge \max \{d(x,v), d(y,v)\}\) and \(d(x,y)\ge \max \{d(x,u), d(y,u)\}\). Hence, \(diam(G)\le d(x,y)+d(x,y)-d(x,y)+3i+2=d(x,y)+3i+2\). That is, \(d(x,y)\ge diam(G)-3i-2\). \(\square \)

For each vertex \(v\in V\setminus C(G)\) of a graph G we can define a parameter

$$\begin{aligned} loc(v)=\min \{d(v,x): x\in V, e(x)<e(v)\} \end{aligned}$$

and call it the locality of v. It shows how far from v a vertex with a smaller eccentricity than that one of v exists. In \(\alpha _i\)-metric graphs, the locality of each vertex is at most \(i+1\).

Lemma 7

Let G be an \(\alpha _i\)-metric graph. Then, for every vertex v in \(V\setminus C(G)\), \(loc(v)\le i+1\).

Proof

Let x be a vertex with \(e(x)=e(v)-1\) closest to v. Consider a neighbor z of x on an arbitrary shortest path from x to v. Necessarily, \(e(z)=e(x)+1=e(v)\). Consider a vertex \(u\in F(z)\). We have \(u\in F(x)\) and \(x\in I(z,u)\), \(z\in I(x,v)\). By the \(\alpha _i\)-metric property, \(d(v,u)\ge d(v,x)+d(x,u)-i=d(v,x)-i+e(x)\). As \(e(v)\ge d(v,u)\), we get \(e(v)\ge d(v,x)-i+e(x)= d(v,x)-i+e(v)-1\), i.e., \(d(v,x)\le i+1\). \(\square \)

In \(\alpha _i\)-metric graphs, the difference between the eccentricity of a vertex v and the radius of G shows how far vertex v can be from the center C(G) of G.

Lemma 8

Let G be an \(\alpha _i\)-metric graph and k be a positive integer. Then, for every vertex v of G with \(e(v)\le rad(G)+k\), \(d(v,C(G))\le k+i\).

Proof

Let x be a vertex from C(G) closest to v. Consider a neighbor z of x on an arbitrary shortest path from x to v. Necessarily, \(e(z)=e(x)+1=rad(G)+1\). Consider a vertex \(u\in F(z)\). We have \(d(u,x)=rad(G)\) and \(x\in I(z,u)\), \(z\in I(x,v)\). By the \(\alpha _i\)-metric property, \(d(v,u)\ge d(v,x)+d(x,u)-i=d(v,x)-i+rad(G)\). As \(e(v)\ge d(v,u)\) and \(e(v)\le rad(G)+k\), we get \(rad(G)+k\ge e(v)\ge d(v,x)-i+rad(G)\), i.e., \(d(v,x)\le i+k\). \(\square \)

As an immediate corollary of Lemma  8 we get:

Corollary 2

Let G be an \(\alpha _i\)-metric graph. Then, for every vertex v of G,

$$\begin{aligned} d(v,C(G))+rad(G)\ge e(v)\ge d(v,C(G))+rad(G)-i. \end{aligned}$$

Proof

The inequality \(e(v)\le d(v,C(G))+rad(G)\) is true for any graph G and any vertex v by the triangle inequality. If G is an \(\alpha _i\)-metric graph then, by Lemma 8, \(d(v,C(G))\le e(v)-rad(G)+i\). \(\square \)

So, in \(\alpha _i\)-metric graphs, to approximate the eccentricity of a vertex v up-to an additive one-sided error i, one only needs to know rad(G) and the distance d(vC(G)).

Now, instead of a pair of mutually distant vertices, we consider a vertex v furthest from an arbitrary vertex. It turns out that its eccentricity is also close enough to diam(G). Furthermore, a middle vertex of any shortest path between that vertex v and a vertex u furthest from v has eccentricity at most \(rad(G)+O(i)\).

Lemma 9

Let G be an \(\alpha _i\)-metric graph and v be an arbitrary vertex. Then, for every \(u\in F(v)\), \(e(u)\ge 2rad(G)-2i-diam(C(G))\ge 2rad(G)-5i-2\ge diam(G)-5i-2\).

Proof

By Corollary 2, \(e(v)\ge d(v,C(G))+rad(G)-i\) and \(e(u)\ge d(u,C(G))+rad(G)-i\). Let \(v',u'\in C(G)\) be vertices of C(G) closest to v and u, respectively. By the triangle inequality, \(e(v)=d(v,u)\le d(v,v')+d(v',u')+d(u',u)\). Combining two inequalities for e(v), we get \(d(v,C(G))+rad(G)-i\le e(v)\le d(v,C(G))+d(v',u')+d(u,C(G))\), i.e., \(d(u,C(G))\ge rad(G)-i-d(v',u')\ge rad(G)-i-diam(C(G))\). Taking into account inequality \(e(u)\ge d(u,C(G))+rad(G)-i\) and Theorem 1, we have \(e(u)\ge 2rad(G)-2i-diam(C(G))\ge 2rad(G)-5i-2\ge diam(G)-5i-2\). \(\square \)

The latter inequality in Lemma 9 can be improved if we do not involve in the proof the diameter of the center C(G) but relay on the interval thinness. We get the same bound as for mutually distant vertices (see Lemma 6) on the eccentricity of a vertex most distant from an arbitrary vertex.

Lemma 10

Let G be an \(\alpha _i\)-metric graph and u be an arbitrary vertex. Then, for every \(v\in F(u)\), \(e(v)\ge diam(G)-3i-2\).

Proof

Let xy be a diametral pair of vertices of G, i.e., \(d(x,y)=diam(G)\). We will show that \(\max \{d(v,x), d(v,y)\}\ge diam(G)-3i-2\), hereby getting \(e(v) \ge \max \{d(v,x), d(v,y)\}\ge diam(G)-3i-2\).

Assume, by way of contradiction, that \(\max \{d(v,x), d(v,y)\}\le diam(G)-3(i+1)\). Let \(k= \lfloor (d(x,y)-3(i+1))/2\rfloor \) and \(x',y'\) be vertices from \(S_k(v,u)\) closest to x and y, respectively. Note that, since \(d(u,v)=e(u)\ge rad(G)\) and \(k=\lfloor (diam(G)-3(i+1))/2\rfloor \le \lfloor (2rad(G)-3(i+1))/2\rfloor <rad(G)\), k is smaller that d(vu) and hence vertices \(x',y'\) exist. By Lemma  2, \(d(x',y')\le i+1\).

Let \(d(v,y)\le diam(G)-3(i+1)\) and consider a neighbor \(y''\) of \(y'\) on a shortest path from \(y'\) to y. As \(y''\notin S_k(v,u)\), \(d(v,y'')>d(v,y')\) or \(d(u,y'')>d(u,y')\). In the former case, by the \(\alpha _i\)-metric property applied to \(v,y',y'',y\), we get \(d(v,y)\ge d(v,y')+d(y',y)-i\), i.e., \(d(y',y)\le d(v,y)-d(v,y')+i\le d(x,y)-3(i+1)-\lfloor (d(x,y)-3(i+1))/2\rfloor +i= \lceil (d(x,y)-3(i+1))/2\rceil +i.\) In the latter case (i.e., when \(d(u,y'')>d(u,y')\)), by the \(\alpha _i\)-metric property applied to \(u,y',y'',y\), we get \(d(u,y)\ge d(u,y')+d(y',y)-i\), i.e., \(d(y',y)\le d(u,y)-d(u,y')+i\). We know that \(d(u,v)\ge d(u,y)\) (as \(v\in F(u)\)) and \(d(u,v)-d(u,y')=d(v,y')\). Hence, \(d(y',y)\le d(v,y')+i=k+i\le \lceil (d(x,y)-3(i+1))/2\rceil +i.\) Thus, in either case, \(d(y',y)\le \lceil (d(x,y)-3(i+1))/2\rceil +i.\)

By symmetry, also \(d(v,x)\le diam(G)-3(i+1)\) implies \(d(x',x)\le \lceil (d(x,y)-3(i+1))/2\rceil +i.\) But then, by the triangle inequality, \(d(x,y)\le d(x,x')+d(x',y')+d(y',y)\le \lceil (d(x,y)-3(i+1))/2\rceil +i +i+1+ \lceil (d(x,y)-3(i+1))/2\rceil +i \le d(x,y)-1\). The contradiction obtained shows that \(\max \{d(v,x), d(v,y)\}\ge diam(G)-3i-2\) must hold. \(\square \)

Lemma 11

Let G be an \(\alpha _i\)-metric graph, \(z \in V\), \(x \in F(z)\), and \(y \in F(x)\). Any vertex \(c \in S_{\lfloor d(x,y)/2 \rfloor }(x,y)\) satisfies \(e(c) \le rad(G) + 4i+(i+1)/2+2\) and \(e(c) \le \lceil d(x,y)/2\rceil + 5i+3\).

Proof

Let \(v \in F(c)\) be a furthest vertex from c. Since \(y \in F(x)\), \(d(x,v) \le d(x,y)\). If also \(d(y,v) \le d(x,y)\) then, by Lemma 4, \(e(c) = d(c,v) \le \max \{d(v,x), d(v,y)\}-\min \{d(x,c), d(y,c)\}+ 2i+1\le d(x,y) -\lfloor d(x,y)/2\rfloor +2i+1=\lceil d(x,y)/2\rceil +2i+1\le rad(G)+2i+1\).

Let now \(d(y,v) > d(x,y)\ge d(x,v)\). Again, by Lemma 4, \(e(c) = d(c,v) \le d(y,v) - \lfloor d(x,y)/2 \rfloor + 2i+1\). By Lemma 9, \(d(x,y)=e(x)\ge 2rad(G) - 5i-2\ge d(y,v)- 5i-2\). Therefore, \(e(c) \le d(y,v) - \lfloor (2rad(G) - 5i-2)/2 \rfloor + 2i+1\le 2rad(G) - rad(G) + 4i+(i+1)/2+2=rad(G) + 4i+(i+1)/2+2\). Also, by Lemma 10, \(d(x,y)=e(x)\ge diam(G) - 3i-2\ge d(y,v)- 3i-2\). Hence, \(e(c) \le d(y,v) - \lfloor d(x,y)/2 \rfloor + 2i+1\le d(x,y) + 3i+2 -\lfloor d(x,y)/2 \rfloor +2i+1= \lceil d(x,y)/2 \rceil + 5i+3\). \(\square \)

Next we show that all central vertices are close to a middle vertex c of a shortest path between vertices x and y, provided that x is furthest from some vertex and that y is furthest from x. Namely, \(D(c, 4i + (i+1)/2+2) \supseteq C(G)\) holds.

Lemma 12

Let G be an \(\alpha _i\)-metric graph, and let \(z\in V\), \(x\in F(z)\) and \(y\in F(x)\). Let also c be a middle vertex of an arbitrary shortest path connecting x and y. Then, \(C(G)\subseteq D(c, 4i + (i+1)/2+2)\).

Proof

Consider an arbitrary vertex \(u \in C(G)\). By Lemma 4, \(d(c,u) \le \max \{d(x,u), d(y,u)\} - \min \{d(x,c), d(y,c)\} + 2i+1\). As \(e(u)=rad(G)\), \(\max \{d(x,u), d(y,u)\} \le rad(G)\) holds. Since c is a middle vertex of a shortest path between x and y, \(\min \{d(x,c), d(y,c)\} = \lfloor d(x,y) / 2 \rfloor \). As \(x \in F(z)\), by Lemma 9, \(d(x,y) = e(x) \ge 2rad(G) - 5i-2\). Hence, \(d(c,u) \le rad(G) - \lfloor (2rad(G) - 5i - 2) / 2 \rfloor + 2i+1 \le 4i + (i+1)/2+ 2\). \(\square \)

A stronger result can be obtained for a middle vertex of a shortest path between two mutually distant vertices.

Lemma 13

Let G be an \(\alpha _i\)-metric graph and xy be a pair of mutually distant vertices of G. Let also c be a middle vertex of an arbitrary shortest path connecting x and y. Then, \(C(G)\subseteq D(c, 4i +3)\).

Proof

The proof is analogous to that of Lemma 12. However, since xy are mutually distant, by Lemma 6, \(d(x,y) \ge 2rad(G) - 4i - 3\). Hence, for any \(u \in C(G)\), \(d(c,u) \le rad(G) - \lfloor (2rad(G) - 4i - 3) / 2 \rfloor + 2i+1 \le 4i + 3\). \(\square \)

There are several algorithmic implications of the results of this subsection. For an arbitrary connected graph G with m edges and a given vertex \(z\in V\), a vertex \(x\in F(z)\) most distant from z can be found in linear (O(m)) time by a breadth-first-search BFS(z) started at z. A pair of mutually distant vertices of an \(\alpha _i\)-metric graph can be computed in O(im) total time as follows. By Lemma 10, if x is a most distant vertex from an arbitrary vertex z and y is a most distant vertex from x, then \(d(x,y)\ge diam(G)-3i-2\). Hence, using at most O(i) breadth-first-searches, one can generate a sequence of vertices \(x:=v_1,y:=v_2, v_3, \dots v_k\) with \(k\le 3i+4\) such that each \(v_i\) is most distant from \(v_{i-1}\) (with \(v_0=z\)) and \(v_k\), \(v_{k-1}\) are mutually distant vertices (the initial value \(d(x,y)\ge diam(G)-3i-2\) can be improved at most \(3i+2\) times).

We summarize algorithmic results of this section in the following theorem.

Theorem 2

There is a linear (O(m)) time algorithm which finds vertices v and c of an m-edge \(\alpha _i\)-metric graph G such that \(e(v)\ge diam(G)-3i-2\), \(e(c)\le rad(G) + 4i+(i+1)/2+2\) and \(C(G)\subseteq D(c, 4i +(i+1)/2+2)\). Furthermore, there is an almost linear (O(im)) time algorithm which finds a vertex c of G such that \(e(c)\le rad(G) + 2i+1\) and \(C(G)\subseteq D(c, 4i +3)\).

Corollary 3

An additive O(i)-approximation of the radius and of the diameter of an \(\alpha _i\)-metric graph G with m edges can be computed in O(m) time.

2.3 Approximating all Eccentricities in \(\alpha _i\)-Metric Graphs

In this subsection, we show that the eccentricities of all vertices of an \(\alpha _i\)-metric graph G can be approximated with an additive one-sided error at most O(i) in (almost) linear total time.

Interestingly, the distances from any vertex v to two mutually distant vertices give a very good estimation on the eccentricity of v.

Lemma 14

Let G be an \(\alpha _i\)-metric graph and xy be a pair of mutually distant vertices of G. Any vertex \(v \in V\) satisfies \(\max \{d(x,v), d(y,v)\} \le e(v) \le \max \{d(x,v), d(y,v)\} + 3i+2\).

Proof

The inequality \(e(v) \ge \max \{d(x,v), d(y,v)\}\) holds for any three vertices by definition of eccentricity. To prove the upper bound on e(v) for any \(v \in V\), consider a furthest vertex \(u \in F(v)\) and let \(k=\lfloor d(x,y)/2\rfloor \). Note that, as x and y are mutually distant, \(d(x,y) \ge \max \{d(x,u), d(y,u)\}\). By Lemma 4, there are vertices \(v',u'\in S_k(x,y)\) such that \(d(v',v)\le \max \{d(x,v), d(y,v)\}-\min \{d(x,v'), d(y,v')\}+i\) and \(d(u',u)\le \max \{d(x,u), d(y,u)\}-\min \{d(x,u'), d(y,u')\}+i\). By the triangle inequality and Lemma 2, \(e(v)=d(u,v)\le d(u,u')+d(u',v')+d(v',v)\le (\max \{d(x,v), d(y,v)\}-\lfloor d(x,y)/2\rfloor +i)+(i+1)+(\max \{d(x,u), d(y,u)\}-\lfloor d(x,y)/2\rfloor +i)=\max \{d(x,v), d(y,v)\}+\max \{d(x,u), d(y,u)\}-d(x,y)+3i+2\le \max \{d(x,v), d(y,v)\}+d(x,y)-d(x,y)+3i+2= \max \{d(x,v), d(y,v)\}+3i+2.\) \(\square \)

By Lemma 14, we get the following left-sided additive approximations of all vertex eccentricities. Let xy be a pair of mutually distant vertices of G. For every vertex \(v \in V\), set \({\hat{e}}(v) := \max \{d(x,v), d(y,v)\}\).

Theorem 3

Let G be an \(\alpha _i\)-metric graph with m-edges. There is an algorithm which in total almost linear (O(im)) time outputs for every vertex \(v\in V\) an estimate \({\hat{e}}(v)\) of its eccentricity e(v) such that \(e(v)- 3i-2 \le {\hat{e}}(v) \le {e}(v).\)

If the minimum integer i for a graph G so that G is an \(\alpha _i\)-metric graph is known in advance, then we can transform \({\hat{e}}\) into a right-sided additive \((3i+2)\)-approximation by setting \({\hat{e}}(v) := \max \{d(x,v), d(y,v)\} + 3i+2\). Unfortunately, for a given graph to find the minimum i such that G is an \(\alpha _i\)-metric graph is not an easy problem. We observe that even checking whether a graph is \(\alpha _1\)-metric is at least as hard as checking if a graph has an induced subgraph isomorphic to \(C_4\). Indeed, take an arbitrary graph G and add a universal vertex to it. Let the resulting graph be \(G'\). Then, \(G'\) is an \(\alpha _1\)-metric graph if and only if G is \(C_4\)-free.

In what follows, we present two right-sided additive eccentricity approximation schemes for all vertices, using a notion of eccentricity approximating spanning tree introduced in [48] and investigated in [20, 25, 30, 32, 35]. We get for m-edge \(\alpha _i\)-metric graphs a O(m) time right-sided additive \((9i+5)\)-approximation and a O(im) time right-sided additive \((4i+2)\)-approximation.

A spanning tree T of a graph G is called an eccentricity k-approximating spanning tree if for every vertex v of G \(e_T(v)\le e_G(v)+ k\) holds [48]. All \((\alpha _1, \triangle )\)-metric graphs (including chordal graphs and the underlying graphs of 7-systolic complexes) admit eccentricity 2-approximating spanning trees [32]. An eccentricity 2-approximating spanning tree of a chordal graph can be computed in linear time [25]. An eccentricity k-approximating spanning tree with minimum k can be found in O(nm) time for any n-vertex, m-edge graph G [35]. It is also known [20, 30] that if G is a \(\delta \)-hyperbolic graph, then G admits an eccentricity \((4\delta +1)\)-approximating spanning tree constructible in \(O(\delta m)\) time and an eccentricity \((6\delta )\)-approximating spanning tree constructible in O(m) time.

Lemma 15

Let G be an \(\alpha _i\)-metric graph with m edges. If c is a middle vertex of any shortest path between a pair xy of mutually distant vertices of G and T is a BFS(c)-tree of G, then, for every vertex v of G, \(e_G(v)\le e_T(v)\le e_G(v)+ 4i+3.\) That is, G admits an eccentricity \((4i+3)\)-approximating spanning tree constructible in O(im) time.

Proof

Let \(e_G(v)\) (\(e_T(v)\)) be the eccentricity of v in G (in T, respectively). The eccentricity in T of any vertex v can only increase compared to its eccentricity in G. Hence, \(e_G(v) \le e_T(v)\). By the triangle inequality and the fact that all graph distances from vertex c are preserved in T, \(e_T(v) \le d_T(v,c) + e_T(c) = d_G(v,c) + e_G(c)\). We know that \(e_G(v) \ge \max \{d_G(y,v), d_G(x,v)\}\). By Lemma 4, also \(d_G(v,c) - \max \{d_G(y,v),\ d_G(x,v) \} \le 2i+1 - \min \{d_G(y,c),\ d_G(x,c)\}\) holds. Since c is a middle vertex of a shortest path between x and y, necessarily \(\min \{d_G(y,c),\ d_G(x,c)\} = \lfloor d_G(x,y)/2 \rfloor \) and, by Lemma 6, \(e_G(c) \le \lceil d_G(x,y)/2 \rceil + 2i+1\). Combining all these, we get \(e_T(v) - e_G(v) \le d_G(v,c) + e_G(c) - e_G(v) \le d_G(v,c) - \max \{d_G(y,v), d_G(x,v)\} + e_G(c) \le 2i+1 - \min \{d_G(y,c), d_G(x,c)\} + e_G(c) \le 2i+1 - \lfloor d_G(x,y) / 2 \rfloor + e_G(c) \le 2i+1 - \lfloor d_G(x,y) / 2 \rfloor + \lceil d_G(x,y)/2 \rceil + 2i+1 \le 4i + 3.\) \(\square \)

Lemma 16

Let G be an \(\alpha _i\)-metric graph with m edges, and let \(z\in V\), \(x\in F(z)\) and \(y\in F(x)\). If c is a middle vertex of any shortest path between x and y and T is a BFS(c)-tree of G, then, for every vertex v of G, \(e_G(v)\le e_T(v)\le e_G(v)+ 7i+5.\) That is, G admits an eccentricity \((7i+5)\)-approximating spanning tree constructible in O(m) time.

Proof

The proof follows the proof of Lemma 15 with one adjustment: replace the application of Lemma 6 which yields \(e_G(c) \le \lceil d_G(x,y)/2 \rceil + 2i+1\) with Lemma 11 which yields \(e_G(c) \le \lceil d_G(x,y)/2 \rceil + 5i+3\). Hence, \(e_T(v) - e_G(v) \le 2i+1 - \lfloor d_G(x,y) / 2 \rfloor + \lceil d_G(x,y)/2 \rceil + 5i+3 \le 7i + 5\). \(\square \)

Note that the eccentricities of all vertices in any tree \(T=(V,U)\) can be computed in O(|V|) total time. 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 \(v\in V\), \(e_T(v)=d_T(v,C(T))+rad(T)\). Hence, using BFS(C(T)) on T one can compute \(d_T(v,C(T))\) for all \(v\in V\) in total O(|V|) time. Adding now rad(T) to \(d_T(v,C(T))\), one gets \(e_T(v)\) for all \(v\in V\). Consequently, by Lemma 15 and Lemma 16, we get the following additive approximations for the vertex eccentricities in \(\alpha _i\)-metric graphs.

Theorem 4

Let G be an \(\alpha _i\)-metric graph with m edges. There is an algorithm which in total linear (O(m)) time outputs for every vertex \(v\in V\) an estimate \({\hat{e}}(v)\) of its eccentricity e(v) such that \(e(v)\le {\hat{e}}(v)\le e(v)+ 7i+5.\) Furthermore, there is an algorithm which in total almost linear (O(im)) time outputs for every vertex \(v\in V\) an estimate \({\hat{e}}(v)\) of its eccentricity e(v) such that \(e(v)\le {\hat{e}}(v)\le e(v)+ 4i+3.\)

Corollary 4

An additive O(i)-approximation of all vertex eccentricities of an \(\alpha _i\)-metric graph G with m edges can be computed in O(m) time.

3 Graphs with \(\alpha _1\)-Metric

Now we concentrate on \(\alpha _1\)-metric graphs, which contain all chordal graphs and all plane triangulations with inner vertices of degree at least 7 (see, e.g., [14, 15, 32, 53]). For them we get much sharper bounds. It is known that for \(\alpha _1\)-metric graphs the following relation between the diameter and the radius holds: \(2rad(G)\ge diam(G)\ge 2rad(G)-2\) [53].

First we recall some known results and give an auxiliary lemma.

Lemma 17

([4]) Let G be an \(\alpha _1\)-metric graph. Let xyvu be vertices of G such that \(v \in I(x,y)\), \(x\in I(v,u)\), and x and v are adjacent. Then \(d(u,y)=d(u,x) + d(v,y)\) holds if and only if there exist a neighbor \(x'\) of x in I(xu) and a neighbor \(v'\) of v in I(vy) with \(d(x',v')=2\); in particular, \(x'\) and \(v'\) lie on a common shortest path of G between u and y.

Theorem 5

([53]) G is an \(\alpha _1\)-metric graph if and only if all disks D(vk) \((v\in V\), \(k\ge 1)\) of G are convex and G does not contain the graph \(W_6^{++}\) from Fig. 1 as an isometric subgraph.

Fig. 1
figure 1

Forbidden isometric subgraph \(W_6^{++}\)

Lemma 18

([50]) All disks D(vk) \((v\in V\), \(k\ge 1)\) of a graph G are convex if and only if for every vertices \(x,y,z\in V\) and \(v\in I(x,y)\), \(d(v,z)\le \max \{d(x,z),d(y,z)\}\).

Letting z to be from F(v), we get:

Corollary 5

If all disks D(vk) \((v\in V\), \(k\ge 1)\) of a graph G are convex then for every vertices \(x,y\in V\) and \(v\in I(x,y)\), \(e(v)\le \max \{e(x),e(y)\}\).

Lemma 19

([32]) Let G be an \(\alpha _1\)-metric graph and x be an arbitrary vertex with \(e(x)\ge rad(G)+1\). Then, for every vertex \(z\in F(x)\) and every neighbor v of x in I(xz), \(e(v)\le e(x)\) holds.

We will need also the following auxiliary lemma.

Lemma 20

Let G be an \(\alpha _1\)-metric graph. Then, for every shortest path \(P=(x_1,\dots ,x_l)\) with \(l\le 4\) and a vertex u of G with \(d(u,x_i)=k\ge 2\) for all \(i\in \{1,\dots ,l\}\), there exists a vertex \(u'\) at distance 2 from each \(x_i\) \((i\in \{1,\dots ,l\})\) and at distance \(k-2\) from u.

Proof

We prove by induction on l. If \(l=1\), the statement is clearly correct. Assume now that there is a vertex \(u'\) that is at distance 2 from each \(x_i\) (\(i\in \{1,\dots ,l-1\}\)) and at distance \(k-2\) from u. Assume that \(d(u',x_l)\) is greater than 2, i.e., \(d(u',x_l)=3\). Consider a common neighbor a of \(u'\) and \(x_{l-1}\). We have \(x_{l-1}\in I(x_l,a)\) and \(a\in I(u,x_{l-1})\). Then, by the \(\alpha _1\)-metric property, \(k=d(x_l,u)\ge 1+k-1=k\), and therefore, by Lemma 17, there must exist vertices b and c such that \(bx_l, cb, ca\in E\) and \(d(c,u)=k-2\). As \(d(c,u)=d(u',u)=k-2\) and \(d(u,a)=k-1\), by convexity of disk \(D(u,k-2)\), vertices \(u'\) and c must be adjacent. If c is at distance 2 from \(x_1\) then, by convexity of disk D(c, 2), each vertex \(x_i\) (\(1\le i\le l\)) is at distance 2 from c, and we are done. If c is at distance 3 from \(x_1\), then from \(u'\in I(c,x_1)\) and \(c\in I(u',x_l)\), by the \(\alpha _1\)-metric property, we get \(d(x_1,x_l)\ge 2+2=4\), which is impossible since \(d(x_1,x_l)\le 3\). \(\square \)

Corollary 6

Let G be an \(\alpha _1\)-metric graph. Then, for every edge \(xy\in E\) and a vertex \(u\in V\) with \(d(u,x)=d(u,y)=k\), either there is a common neighbor \(u'\) of x and y at distance \(k-1\) from u or there exists a vertex \(u'\) at distance 2 from x and y and at distance \(k-2\) from u such that, for every \(z\in N(x)\cap N(u')\) and \(w\in N(y)\cap N(u')\), the sequence \((x,z,u',w,y)\) forms an induced \(C_5\) in G.

Proof

We may assume that \(k\ge 2\). By Lemma  20, there exists a vertex \(u'\) at distance 2 from x and y and at distance \(k-2\) from u. Consider a common neighbor z of x and \(u'\) and a common neighbor w of y and \(u'\). If \(zy,wx\notin E\) then, by distance requirements, either (xzwy) induces a \(C_4\) (which is impossible) or \((x,z,u',w,y)\) induces a \(C_5\). \(\square \)

3.1 The Eccentricity Function on \(\alpha _1\)-Metric Graphs is Almost Unimodal

The goal of this section is to prove the following theorem.

Theorem 6

Let G be an \(\alpha _1\)-metric graph and v be an arbitrary vertex of G. If

(i):

\(e(v)> rad(G)+1\) or

(ii):

\(e(v)=rad(G)+1\) and \(diam(G)<2 rad(G)-1\),

then there must exist a neighbor w of v with \(e(w)< e(v)\).

If \(e(v)=rad(G)+k\) for some integer \(k>0\), then \(d(v,C(G))\le k+1\).

Theorem 6 says that if a vertex v with \(loc(v)>1\) exists in an \(\alpha _1\)-metric graph G then \(diam(G)\ge 2rad(G)-1\), \(e(v)=rad(G)+1\) and \(d(v,C(G))=2\). That is, only in the case when \(diam(G)\in \{2rad(G)-1, 2rad(G)\}\), the eccentricity function may fail to be unimodal and yet all local minima of the eccentricity function are concentrated around the center C(G) of G (they are at distance 2 from C(G)). Two \(\alpha _1\)-metric graphs depicted in Fig. 2 show that this result is sharp.

Fig. 2
figure 2

Sharpness of the result of Theorem 6. a An \(\alpha _1\)-metric graph G with \(diam(G)=2rad(G)-1\) and a vertex (topmost) with locality 2. b A chordal graph (and hence an \(\alpha _1\)-metric graph) G with \(diam(G)=2rad(G)\) and a vertex (topmost) with locality 2. The number next to each vertex indicates its eccentricity

We will split the proof of Theorem 6 into a series of lemmas of independent interest. By Lemma 7, Lemma 8 and Corollary 2, we already know that every vertex v of an \(\alpha _1\)-metric graph has locality at most 2, is at distance at most \(k+1\) from C(G), provided that its eccentricity e(v) is at most \(rad(G)+k\), and satisfies \(d(v,C(G))+rad(G)\ge e(v)\ge d(v,C(G))+rad(G)-1.\) In the following lemmas, two specific properties of \(\alpha _1\)-metric graphs stated in Lemma 17 and Theorem 5 are heavily used.

Lemma 21

Let G be an \(\alpha _1\)-metric graph and v be a vertex of G with \(loc(v)=2\). Then, \(e(v)\le rad(G)+2\). Furthermore, if \(e(v)=rad(G)+2\), then \(diam(G)=2rad(G)\).

Proof

Let \(k:=e(v)\) and x be a vertex with \(d(x,v)=2\) and \(e(x)=k-1\) such that |F(x)| is as small as possible. Consider a common neighbor z of x and v and a vertex \(u\in F(z)\). Necessarily, \(e(z)=e(v)=e(x)+1\) and \(u\in F(x)\). We have \(x\in I(z,u)\) and \(z\in I(x,v)\). By the \(\alpha _1\)-metric property, \(d(v,u)\ge d(v,z)+d(x,u)=d(u,x)+1=e(z)=k\). As \(e(v)\ge d(v,u)\ge e(z)=e(v)\), i.e., \(k=d(v,u)\), by Lemma 17, there must exist vertices w and t such that \(wv, wt, tx\in E\) and \(d(t,u)=d(u,x)-1=k-2\).

If \(e(t)=e(x)+1\) then for every \(s\in F(t)\), we have \(x\in I(t,s)\) and \(d(x,s)= k-1\). If \(e(t)=e(x)\) then, by the choice of x, there must exist a vertex \(s\in F(t)\setminus F(x)\) (as \(u\in F(x)\setminus F(t)\)), and we have \(x\in I(t,s)\) and \(d(x,s)= k-2\). In both cases, by the \(\alpha _1\)-metric property applied to \(x\in I(t,s)\) and \(t\in I(x,u)\), we get \(d(s,u)\ge d(s,x)+d(u,t)\ge k-2+k-2=2k-4\).

Since \(d(s,u)\le diam(G)\le 2rad(G)\), we have \(k\le rad(G)+2\) and if \(k=rad(G)+2\) then \(d(s,u)=diam(G)=2rad(G)\). \(\square \)

Lemma 22

Let G be an \(\alpha _1\)-metric graph and v be a vertex of G with \(e(v)= rad(G)+2\). Then, \(loc(v)=1\).

Proof

Assume, by way of contradiction, that \(loc(v)=2\). Then, by Lemma 8, \(d(v,C(G))\le 3\). However, since \(e(v)= rad(G)+2\), v cannot have a vertex from C(G) at distance 2 or less as that would imply that a neighbor of v on a shortest path to C(G) has eccentricity at most \(rad(G)+1\), contradicting with \(loc(v)=2\). Thus, \(d(v,C(G))= 3\).

Let x be a vertex from C(G) closest to v and \(P=(x,z,y,v)\) be a shortest path between x and v chosen in such a way that the neighbor y of v in P has |F(y)| as small as possible. Necessarily, \(e(x)=rad(G)=e(z)-1\) and \(e(z)+1=e(y)=e(v)=rad(G)+2\). Consider a vertex \(u\in F(y)\). Since \(d(u,y)=rad(G)+2\), \(d(u,x)\le rad(G)\) and \(d(u,z)\le rad(G)+1\), we have \(d(u,x)= rad(G)=d(u,z)-1=d(u,y)-2\), i.e., \(x\in I(u,z)\). Applying the \(\alpha _1\)-metric property to \(x\in I(u,z)\) and \(z\in I(x,v)\), we get \(d(v,u)\ge d(v,z)+d(x,u)= rad(G)+2\). By Lemma 17, there exist vertices fwt such that \(fv,fz,fw,wt,tx\in E\) and \(d(t,u)=rad(G)-1\). Notice that \(f\ne y\) since \(d(u,y)=rad(G)+2\) and \(d(u,f)=rad(G)+1\). To avoid an induced \(C_4\), vertices f and y must be adjacent. As \(loc(v)=2\), we have also \(e(f)\ge e(v)\).

Now, we have \(f\in S_2(x,v)\) and \(u\in F(y)\setminus F(f)\). By the choice of y, there must exist a vertex s which is in F(f) but not in F(y). Hence, \(y\in I(f,s)\). Since also \(f\in I(y,u)\), by the \(\alpha _1\)-metric property, \(d(u,s)\ge d(f,u)+d(s,y)\ge rad(G)+1+rad(G)+1=2rad(G)+2>diam(G)\), which is impossible. Thus, \(loc(v)=1\) must hold. \(\square \)

Lemma 23

Let G be an \(\alpha _1\)-metric graph. Let vcbfaus be vertices of G such that vcbfa form an induced \(C_5\), \(p=d(u,f)=d(v,u)-2=d(c,u)-2\) and \(q=d(s,b)=d(v,s)-2=d(a,s)-2\) (See Fig. 3). Then, either \(d(u,s)=p+q+1\) or there is a vertex h which is adjacent to all vertices of \(C_5=(v,c,b,f,a)\).

Proof

By distance requirements, \(f\in I(b,u)\) and \(b\in I(f,s)\) hold. Hence, by \(\alpha _1\)-metric property, we have \(d(u,s)\ge p+q\). Assume, in what follows, that \(d(u,s)= p+q\). Then, by Lemma 17, there must exist vertices xyz such that \(xf,xz,yb,yz\in E\) and \(d(x,u)=p-1\) and \(d(y,s)=q-1\). See Fig. 3 for an illustration.

Fig. 3
figure 3

Illustration to the proof of Lemma 23

As \(d(v,x)=d(v,y)=3\) and \(z\in I(x,y)\), by convexity of disk D(v, 3), we get \(d(v,z)\le 3\). Vertex z cannot be adjacent to vca as \(d(v,y)=d(a,y)=3=d(v,x)=d(c,x)\). So, \(2\le d(v,z)\le 3\).

First consider the case when \(d(v,z)=2\). Consider a common neighbor h of v and z. As \(d(v,x)=d(v,y)=3\) and \(d(v,f)=d(v,b)=d(v,z)=2\), by convexity of disk D(v, 2), we get \(zf,zb\in E\). Convexities of disks D(y, 2) and D(x, 2) imply \(hc, ha\in E\) (notice that v is at distance 3 from both y and x, vertices ah are at distance 2 from x, vertices hc are at distance 2 from y). To avoid a forbidden induced \(C_4\), h must be adjacent to f and b as well. So, h is adjacent to all vertices of \(C_5=(v,c,b,f,a)\).

Now consider the case when \(d(v,z)=3\). Consider a path (vhgz) between v and z. If z is adjacent to f then it is adjacent to b (to avoid an induced \(C_4\)), and wise versa. But if \(fz, zb\in E\), by convexity of D(z, 2), a and c must be adjacent, contradicting with \(C_5=(v,c,b,f,a)\) being an induced cycle. So, \(zf,zb\notin E\), and hence (xzybf) forms an induced \(C_5\) and \(g\ne f,b\).

Vertices c and z cannot be at distance 2 from each other since then convexity of disk D(c, 2) and \(d(c,x)=3\) will imply \(zf\in E\), which is impossible. Hence, \(d(z,c)=3\) and, in particular, \(gc\notin E\) and \(h\ne c\). Similarly, \(d(a,z)=3\) holds and, in particular, \(ga\notin E\) and \(h\ne a\).

We claim that \(d(h,x)=d(h,y)=2\). If \(d(h,y)=3\) then using also \(d(c,z)=3\) we get \(z\in I(h,y)\), \(y\in I(z,c)\). By the \(\alpha _1\)-metric property, we obtain \(d(h,c)\ge d(h,z)+d(c,y)= 4\), contradicting with \(d(h,c)\le 2\). Similarly, \(d(h,x)=2\) must hold.

Now, convexity of disks D(y, 2) and D(x, 2) gives first \(hc,ha\in E\) (as \(d(y,h)=d(y,c)=2=d(y,v)-1\) and \(d(x,h)=d(x,a)=2=d(x,v)-1\)) and then \(hf,hb\in E\) (as \(d(y,h)=d(y,f)=2=d(y,a)-1\) and \(d(x,h)=d(x,b)=2=d(x,c)-1\)). So, h is adjacent to all vertices of \(C_5=(v,c,b,f,a)\). \(\square \)

Lemma 24

If an \(\alpha _1\)-metric graph G has a vertex v with \(loc(v)>1\) and \(e(v)=rad(G)+1\), then \(diam(G)\ge 2rad(G)-1\).

Proof

Set \(r:=rad(G)\). Assume, by way of contradiction, that \(diam(G)\le 2r-2\). Let v be an arbitrary vertex with \(loc(v)>1\) and \(e(v)=r+1\). Consider a vertex \(s\in F(v)\) and a vertex \(c\in S_1(v,s)\) with |F(c)| as small as possible. Since \(loc(v)>1\), \(e(c)\ge e(v)\). Let also u be an arbitrary vertex from F(c).

We claim that \(e(c)=d(u,c)=d(u,v)=e(v)\). If \(d(u,c)>d(u,v)\), then \(\alpha _1\)-metric property applied to \(v\in I(c,u)\) and \(c\in I(s,v)\) gives \(d(s,u)\ge d(s,c)+d(v,u)\ge e(v)-1+e(v)-1= 2r\), which is impossible. Hence, \(e(c)=d(u,c)=d(u,v)=e(v)=r+1\) must hold.

Assume that a vertex g exists in G such that \(gc,gv\in E\) and \(d(g,u)=r=d(u,c)-1\). If \(d(g,s)>d(c,s)\) then, by \(\alpha _1\)-metric property applied to \(c\in I(g,s)\) and \(g\in I(u,c)\), we get \(d(s,u)\ge d(s,c)+d(g,u)= e(v)-1+r= 2r\), which is impossible. If \(d(g,s)\le d(c,s)\), then \(g\in S_1(v,s)\) and, by the choice of c, there must exist a vertex \(t\in F(g)\setminus F(c)\) (recall that \(u\in F(c)\setminus F(g)\) as \(e(g)\ge r+1\)). So, \(\alpha _1\)-metric property applied to \(c\in I(g,t)\) and \(g\in I(u,c)\), gives \(d(t,u)\ge d(t,c)+d(g,u)\ge 2r\), which is impossible.

So, in what follows, we can assume that no common neighbor g of c and v with \(d(g,u)=r=d(u,c)-1\) can exist in G. Since, \(d(u,c)=d(u,v)\), by Corollary 6, there is a vertex f which is at distance 2 from c and v, at distance \(d(u,c)-2=r-1\) from u and forms with any \(b\in N(c)\cap N(f)\) and any \(a\in N(v)\cap N(f)\) an induced \(C_5=(c,b,f,a,v)\).

We claim that \(d(s,a)=d(s,v)\) for every \(a\in N(v)\cap N(f)\). Indeed, if \(d(s,a)<d(s,v)\) then, by convexity of disk D(sr), vertices a and c need to be adjacent (as both are adjacent to v with \(d(v,s)=r+1\)), contradicting with \(ac\notin E\). If \(d(s,a)>d(s,v)\) then, \(\alpha _1\)-metric property applied to \(v\in I(a,s)\) and \(a\in I(u,v)\), gives \(d(s,u)\ge d(s,v)+d(a,u)\ge 2r+1\), which is impossible.

From \(d(s,a)=d(s,v)\), we have also \(d(s,f)\ge d(s,c)\). Assume \(d(s,f)=d(s,c)+1\). If \(d(s,b)=d(s,c)\) then \(b\in I(s,f)\). Since also \(f\in I(b,u)\), \(\alpha _1\)-metric property implies \(d(s,u)\ge d(s,b)+d(f,u)=d(s,c)+r-1=2r-1\), which is impossible. If now \(d(s,b)=d(s,c)+1\), then \(c\in I(s,b)\). Since also \(b\in I(c,u)\), \(\alpha _1\)-metric property implies \(d(s,u)\ge d(s,c)+d(b,u)=2r\), which is impossible. The last two contradictions show that \(d(s,f)=d(s,c)+1\) is impossible, i.e., \(d(s,f)= d(s,c)\) must hold. By convexity of disk D(sr), \(d(s,b)\le r\) holds for every \(b\in I(f,c)\). We distinguish between two cases. In both cases we get contradictions.

Case 1: There is a common neighbor b of f and c which is at distance \(r-1=d(s,c)-1\) from s.

We have \(d(v,u)=r+1=d(c,u)=d(u,f)+2\) and \(d(v,s)=r+1=d(a,s)=d(s,b)+2\). By Lemma 23, either \(d(u,s)=2r-1\) (which is impossible) or there is a vertex h which is adjacent to all vertices of \(C_5=(b,c,v,a,f)\). The latter contradicts with our earlier claim that \(d(s,a)=d(s,v)\) for every \(a\in N(v)\cap N(f)\) (observe that \(h\in N(v)\cap N(f)\) and \(d(s,h)=d(s,b)+1=d(s,v)-1\)).

Case 2: There is no common neighbor b of f and c which is at distance \(r-1=d(s,c)-1\) from s.

So, for every \(b\in I(f,c)\), \(d(b,s)=r\). By Lemma 20, there exists a vertex \(s'\) at distance 2 from c and f and at distance \(r-2\) from s. Consider a common neighbor x of c and \(s'\) and a common neighbor y of f and \(s'\). We may assume that \(yc, xf\notin E\) (otherwise, we are in Case 1). We claim that \(d(y,v)=2\). Assume, \(d(y,v)=3\). If also \(d(a,x)=3\), then \(a\in I(y,v)\) and \(v\in I(a,x)\) and \(\alpha _1\)-metric property implies \(d(y,x)\ge d(y,a)+d(v,x)=4\), which is impossible. So, \(d(a,x)=2\) must hold and therefore, by convexity of disk D(a, 2), vertices x and y are adjacent (observe that \(x,y\in D(a,2)\) and \(s'\notin D(a,2)\)). As \(y\in I(f,x)\), \(y\notin D(v,2)\) and \(f,x\in D(v,2)\), we get a contradiction with convexity of disk D(v, 2). Thus, \(d(y,v)=2\) must hold. By convexity of disk D(v, 2), vertices x and y must be adjacent.

Consider a common neighbor w of y and v. By convexity of disk \(D(s',2)\), vertices w and c are adjacent. To avoid an induced cycle \(C_4\), w and x are also adjacent. If \(d(w,u)=d(u,c)-1\) then, by the choice of c, there exists a vertex \(t\in F(w)\setminus F(c)\) (recall that \(u\in F(c)\setminus F(w)\) as \(e(w)\ge r+1\)). So, \(\alpha _1\)-metric property applied to \(c\in I(w,t)\) and \(w\in I(u,c)\), gives \(d(t,u)\ge d(t,c)+d(w,u)\ge 2r\), which is impossible. So, \(d(w,u)=d(u,c)=r+1\) must hold. In particular, vertices w and f cannot be adjacent. Note also that \(d(a,y)=d(v,y)=2\) (as \(d(a,s)=d(v,s)\)) and \(wa\notin E\) (to avoid an induced \(C_4\)). Hence, (vwyfa) induce a \(C_5\) in G.

Now, we have \(d(v,u)=r+1=d(w,u)=d(f,u)+2\) and \(d(v,s)=r+1=d(a,s)=d(s,y)+2\). By Lemma 23, either \(d(u,s)=2r-1\) (which is impossible) or there is a vertex h which is adjacent to all vertices of \(C_5=(y,w,v,a,f)\). The latter contradicts with our earlier claim that \(d(s,a)=d(s,v)\) for every \(a\in N(v)\cap N(f)\) (observe that \(h\in N(v)\cap N(f)\) and \(d(s,h)=d(s,y)+1=d(s,v)-1\)).

The contradictions obtained prove the lemma. \(\square \)

Now Theorem  6 follows from Lemma 8, Lemma 21, Lemma 22 and Lemma 24. Here we formulate three interesting corollaries of Theorem  6.

Corollary 7

Let G be an \(\alpha _1\)-metric graph. Then,

(i):

if \(diam(G)<2rad(G)-1\) (i.e., \(diam(G)=2rad(G)-2)\) then every local minimum of the eccentricity function on G is a global minimum.

(ii):

if \(diam(G)\ge 2 rad(G)-1\) then every local minimum of the eccentricity function on G is a global minimum or is at distance 2 from a global minimum.

Corollary 8

For every \(\alpha _1\)-metric graph G and any vertex v, the following formula is true:

$$\begin{aligned} d(v,C(G)) + rad(G) \ge e(v) \ge d(v,C(G)) + rad(G)- \epsilon , \end{aligned}$$

where \(\epsilon \le 1\), if \(diam(G) \ge 2rad(G)-1\), and \(\epsilon =0\), otherwise.

A path \((v=v_0,\dots ,v_k=x)\) of a graph G from a vertex v to a vertex x is called strictly decreasing (with respect to the eccentricity function) if for every i (\(0\le i\le k-1)\), \(e(v_i)>e(v_{i+1})\). It is called decreasing if for every i (\(0\le i\le k-1)\), \(e(v_i)\ge e(v_{i+1})\). An edge \(ab\in E\) of a graph G is called horizontal (with respect to the eccentricity function) if \(e(a)=e(b)\).

Corollary 9

Let G be an \(\alpha _1\)-metric graph and v be its arbitrary vertex. Then, there is a shortest path P(vx) from v to a closest vertex x in C(G) such that:

(i):

if \(diam(G)<2rad(G)-1\) (i.e., \(diam(G)=2rad(G)-2)\) then P(vx) is strictly decreasing;

(ii):

if \(diam(G)\ge 2 rad(G)-1\) then P(vx) is decreasing and can have only one horizontal edge, with an end-vertex adjacent to x.

3.2 Diameters of Centers of \(\alpha _1\)-Metric Graphs

Observe that the center C(G) of a graph \(G=(V,E)\) can be represented as the intersection of all the disks of G of radius rad(G), i.e., \(C(G)=\bigcap \{D(v,rad(G)): v\in V\}\). Consequently, the center C(G) of an \(\alpha _1\)-metric graph G is convex (in particular, it is connected), as the intersection of convex sets is always a convex set. In general, any set \(\mathcal{C}_{\le i}(G):=\{z\in V: ecc(z)\le rad(G)+i\}\) is a convex set of G as \(\mathcal{C}_{\le i}(G)=\bigcap \{D(v,rad(G)+i): v\in V\}\).

Corollary 10

In an \(\alpha _1\)-metric graph G, all sets \(\mathcal{C}_{\le i}(G)\), \(i \in \{0, \dots , diam(G)-rad(G)\}\), are convex. In particular, the center C(G) of an \(\alpha _1\)-metric graph G is convex.

In this section, we provide sharp bounds on the diameter and the radius of the center of an \(\alpha _1\)-metric graph. Previously, it was known that the diameter (the radius) of the center of a chordal graph is at most 3 (at most 2, respectively) [15]. To prove our result, we will need a few technical lemmas.

Lemma 25

Let G be an \(\alpha _1\)-metric graph. Then, for every shortest path \(P=(x_1,x_2,x_3,x_4,x_5)\) and a vertex u of G with \(d(u,x_i)=k\) for all \(i\in \{1,\dots ,5\}\), there exist vertices tws such that \(d(t,u)=d(s,u)=k-1\), \(k-2 \le d(w,u)\le k-1\), and t is adjacent to \(x_1,x_2,w\) and s is adjacent to \(x_4,x_5,w\).

Proof

By Lemma 20, there is a vertex \(u'\) that is at distance 2 from each \(x_i\) \((1\le i\le 4)\) and at distance \(k-2\) from u. Assume that \(d(u',x_5)\) is greater than 2, i.e., \(d(u',x_5)=3\). Consider a common neighbor a of \(u'\) and \(x_{4}\). We have \(x_{4}\in I(x_5,a)\) and \(a\in I(u,x_{4})\). Then, by the \(\alpha _1\)-metric property, \(k=d(x_5,u)\ge 1+k-1=k\), and therefore, by Lemma 17, there must exist vertices b and c such that \(bx_5, cb, ca\in E\) and \(d(c,u)=k-2\). As \(d(c,u)=d(u',u)=k-2\) and \(d(u,a)=k-1\), by convexity of disk \(D(u,k-2)\), vertices \(u'\) and c must be adjacent. If c is at distance 2 from \(x_1\) then, by convexity of disk D(c, 2), each vertex \(x_i\) (\(1\le i\le 5\)) is at distance 2 from c, and we can replace \(u'\) with c (see the case when \(d(u',x_5)=2\) below). If c is at distance 3 from \(x_1\), then from \(u'\in I(c,x_1)\) and \(c\in I(u',x_5)\), by the \(\alpha _1\)-metric property, we get \(4=d(x_1,x_5)\ge 2+2=4\). Now, by Lemma 17, there must exist vertices tw and s such that \(sx_5, sc, sw, tu', tx_1, tw\in E\). Furthermore, since \(d(x_5,t)=d(x_5,x_2)=3\) and \(d(x_5,x_1)=4\), by convexity of disk \(D(x_5,3)\), vertices t and \(x_2\) must also be adjacent. Similarly, \(sx_4\in E\). Necessarily, \(d(u,t)=d(u,s)=k-1\). By convexity of disk \(D(u,k-1)\), either \(d(u,w)=k-1\) or \(d(u,w)=k-2\). In the latter case, w has all vertices \(x_i\), \(1\le i\le 5\), at distance 2, by convexity of disk D(w, 2).

The remaining case, when \(d(u',x_5)=2\), can be handled in a similar (even simpler) manner. Set \(w:=u'\), t is any common neighbor of \(u'\) and \(x_1\) and s is any common neighbor of \(u'\) and \(x_5\). By convexity of disks \(D(x_1,3)\) and \(D(x_5,3)\), the existence of edges \(tx_2\) and \(sx_4\) follows. \(\square \)

Fig. 4
figure 4

Illustration to Lemma 26

Lemma 26

Let G be an \(\alpha _1\)-metric graph. Then, for every shortest path \(P=(x_1,x_2,x_3,x_4,x_5)\) and a vertex u of G with \(d(u,x_i)=k\) for all \(i\in \{1,\dots ,5\}\), there exists a shortest path \(Q=(y_1,y_2,y_3)\) such that \(d(u,y_i)=k-1\), for each \(i\in \{1,\dots ,3\}\), and \(N(y_1)\cap P =\{x_1,x_2\}\), \(N(y_2)\cap P =\{x_2,x_3,x_4\}\) and \(N(y_3)\cap P =\{x_4,x_5\}\) (see Fig. 4).

Proof

By Lemma 25, there exist vertices ts such that \(d(t,u)=d(s,u)=k-1\), t is adjacent to \(x_1,x_2\) and s is adjacent to \(x_4,x_5\). If \(d(x_4,t)=3\), then \(x_2\in I(t,x_4)\) and \(t\in I(u,x_2)\) and, by the \(\alpha _1\)-metric property, \(d(x_4,u)\ge 2+k-1=k+1\), which is impossible. Hence, \(d(x_4,t)=2\) must hold. Let v be a common neighbor of t and \(x_4\). If \(d(v,u)=k\), then again the \(\alpha _1\)-metric property applied to \(v\in I(t,x_5)\) and \(t\in I(u,v)\) gives \(d(x_5,u)\ge 2+k-1=k+1\), which is impossible. Thus, \(d(v,u)=k-1\) must hold. As \(d(v,u)=k-1=d(s,u)\) and \(d(u,x_4)=k\), by convexity of \(D(u,k-1)\), vertices v and s must be adjacent. Notice also that \(x_3\) cannot be adjacent to t or to s. If, for example, \(x_3s\in E\) (the case when \(tx_3\in E\) can be handled in a similar way) then the \(\alpha _1\)-metric property applied to \(s\in I(u,x_3)\) and \(x_3\in I(s,x_1)\) will give \(d(x_1,u)\ge 2+k-1=k+1\), which is impossible. Now, convexity of disk \(D(x_1,2)\) implies edge \(vx_3\) and convexity of disk \(D(x_3,1)\) implies edge \(vx_2\). Letting \(y_1:=t\), \(y_2:=v\) and \(y_3:=s\), we get the required path Q. \(\square \)

Theorem 7

Let G be an \(\alpha _1\)-metric graph. For every pair of vertices st of G with \(d(s,t)\ge 4\) there exists a vertex \(c\in I^o(s,t)\) such that \(e(c)<\max \{e(s),e(t)\}\).

Proof

It is sufficient to prove the statement for vertices st with \(d(s,t)=4\).

We know, by Corollary 5, that \(e(c)\le \max \{e(s),e(t)\}\) for every \(c\in I(s,t)\). Assume, by way of contradiction, that there is no vertex \(c\in I^o(s,t)\) such that \(e(c)<\max \{e(s),e(t)\}\). Let, without loss of generality, \(e(s)\le e(t)\). Then, for every \(c\in I^o(s,t)\), \(e(c)=e(t)\). Consider a vertex \(c\in S_1(s,t)\). If \(e(c)>e(s)\), then \(e(c)=e(s)+1\). Consider a vertex z from F(c). Necessarily, \(z\in F(s)\). Applying the \(\alpha _1\)-metric property to \(c\in I(s,t)\), \(s\in I(c,z)\), we get \(e(c)=e(t)\ge d(t,z)\ge d(c,t)+d(s,z)= 3+e(s)=2+e(c)\), which is impossible. So, \(e(s)=e(c)=e(t)\) for every \(c\in I^o(s,t)\).

Consider an arbitrary shortest path \(P=(s=x_1,x_2,x_3,x_4,x_5=t)\) connecting vertices s and t.

We claim that for any vertex \(u\in F(x_3)\) all vertices of P are at distance \(k:=d(u,x_3)=e(x_3)\) from u. As \(e(x_i)=e(x_3)\), we know that \(d(u,x_i)\le k\) (\(1\le i\le 5\)). Assume \(d(u,x_i)=k-1\), \(d(u,x_{i+1})=k\), and \(i\le 2\). Then, the \(\alpha _1\)-metric property applied to \(x_i\in I(u,x_{i+1})\) and \(x_{i+1}\in I(x_{i},x_{i+3})\) gives \(d(x_{i+3},u)\ge k-1+2=k+1\), which is a contradiction with \(d(u,x_{i+3})\le k\). So, \(d(u,x_{1})= d(u,x_{2})= k\). By symmetry, also \(d(u,x_{4})= d(u,x_{5})= k\).

Hence, by Lemma 26, for the path \(P=(x_1,x_2,x_3,x_4,x_5)\), there exists a shortest path \(Q=(y_1,y_2,y_3)\) such that \(d(u,y_i)=k-1\), for each \(i\in \{1,\dots ,3\}\), and \(N(y_1)\cap P =\{x_1,x_2\}\), \(N(y_2)\cap P =\{x_2,x_3,x_4\}\) and \(N(y_3)\cap P =\{x_4,x_5\}\) (see Fig. 4). As \(y_i\in I^o(x_1,x_5)=I^o(s,t)\) for each \(i\in \{1,\dots ,3\}\), we have \(e(y_i)=e(x_3)=k\).

All the above holds for every shortest path \(P=(s=x_1,x_2,x_3,x_4,x_5=t)\) connecting vertices s and t. Now, assume that P is chosen in such a way that, among all vertices in \(S_2(s,t)\), the vertex \(x_3\) has the minimum number of furthest vertices, i.e., \(|F(x_{3})|\) is as small as possible. As \(y_2\) also belongs to \(S_2(s,t)\) and has u at distance \(k-1\), by the choice of \(x_3\), there must exist a vertex \(u'\in F(y_2)\) which is at distance \(k-1\) from \(x_3\). Applying the previous arguments to the path \(P':=(s=x_1,x_2,y_2,x_4,x_5=t)\), we will have \(d(x_i,u')=d(y_2,u')=k\) for \(i=1,2,4,5\) and, by Lemma 26, get two more vertices v and w at distance \(k-1\) from \(u'\) such that \(vx_1,vx_2,wx_4,wx_5\in E\) and \(vy_2,wy_2\notin E\) (see Fig. 5). By convexity of disk \(D(u',k-1)\), also \(vx_3,wx_3\in E\). Now consider the disk \(D(x_2,2)\). Since \(y_3,w\) are in the disk and \(x_5\) is not, vertices w and \(y_3\) must be adjacent. But then vertices \(y_2,x_3,w,y_3\) form a forbidden induced cycle \(C_4\).

Fig. 5
figure 5

Illustration to the proof of Theorem 7

Thus, a vertex \(c\in I^o(s,t)\) with \(e(c)<\max \{e(s),e(t)\}\) must exist. \(\square \)

Corollary 11

Let G be an \(\alpha _1\)-metric graph. Then, \(diam(C(G))\le 3\) and \(rad(C(G))\le 2\).

Proof

Assume, by way of contradiction, that there are vertices \(s,t\in C(G)\) such that \(d(s,t)\ge 4\). Then, by Theorem 7, there must exist a vertex \(c\in I^o(s,t)\) such that \(e(c)<\max \{e(s),e(t)\}\). The latter means that \(e(c)<rad(G)\), which is impossible. So, \(diam(C(G))\le 3\) must hold. As C(G) is a convex set of G, the subgraph of G induced by C(G) is also an \(\alpha _1\)-metric graph. According to [53], \(diam(G)\ge 2rad(G)-2\) holds for every \(\alpha _1\)-metric graph G. Hence, for a graph induced by C(G), we have \(3\ge diam(C(G))\ge 2rad(C(G))-2\), i.e., \(rad(C(G))\le 2\). \(\square \)

See Fig. 6 for the sharpness of these bounds. As chordal graphs are \(\alpha _1\)-metric graphs, we get also the following old result.

Corollary 12

([15]) Let G be a chordal graph. Then, \(diam(C(G))\le 3\) and \(rad(C(G))\le 2\).

Fig. 6
figure 6

Sharpness of results of Theorem 7 and Corollary 11. a A chordal graph with \(diam(C(G))=3\) and \(rad(C(G))=2\). b An \(\alpha _1\)-metric graph with a pair of vertices at distance 3 for which no vertex with smaller eccentricity exists in a shortest path between them. The number next to each vertex indicates its eccentricity

3.3 Finding a Central Vertex of an \(\alpha _1\)-Metric Graph

We present a local-search algorithm in order to compute a central vertex of an arbitrary \(\alpha _1\)-metric graph in subquadratic time (Theorem 8). Our algorithm even achieves linear runtime on an important subclass of \(\alpha _1\)-metric graphs, namely, \((\alpha _1,\varDelta )\)-metric graphs (Theorem 9), thus answering an open question from [32] where this subclass was introduced. The \((\alpha _1,\varDelta )\)-metric graphs are exactly the \(\alpha _1\)-metric graphs that further satisfy the so-called triangle condition: for every vertices uvw such that u and v are adjacent, and \(d(u,w) = d(v,w) = k\), there must exist some common neighbour \(x \in N(u) \cap N(v)\) such that \(d(x,w) = k-1\). Chordal graphs, and plane triangulations with inner vertices of degree at least 7, are \((\alpha _1,\varDelta )\)-metric graphs (see [14, 15, 32, 53]).

3.3.1 Distance-k Gates

We first introduce the required new notations and terminology for this part. In what follows, let \(\texttt {proj}(v,A) = \{a \in A : d(v,a) = d(v,A)\}\) denote the metric projection of a vertex v to a vertex subset A. For every k such that \(0 \le k \le d(v,A)\), we define \(S_k(A,v) = \bigcup \{ S_k(a,v) : a \in \texttt {proj}(v,A) \}\). A distance-k gate of v with respect to A is a vertex \(v^*\) such that \(v^* \in \bigcap \{ I(a,v) : a \in \texttt{proj}(v,A) \}\) and \(d(v^*,A) \le k\). If \(k=1\), then following [16] we simply call it a gate. Note that every vertex v such that \(d(v,A) \le k\) is its own distance-k gate. We study the existence of distance-k gates, for some \(k \le 2\), with respect to neighbour-sets and cliques. The latter are a cornerstone of our main algorithms. They are also, we think, of independent interest.

Lemma 27

Let x and v be vertices in an \(\alpha _1\)-metric graph G such that \(d(x,v) \ge 3\). For every vertices \(u,u' \in S_3(x,v)\), the metric projections \(\texttt {proj}(u,D(x,1))\) and \(\texttt{proj}(u',D(x,1))\) are comparable by inclusion.

Proof

Suppose by contradiction that \(U = \texttt {proj}(u,D(x,1))\) and \(U' = \texttt {proj}(u',D(x,1))\) are incomparable by inclusion. Let \(a \in U \setminus U'\) and \(a' \in U' \setminus U\). Observe that \(d(u,a) < d(u',a)\) and similarly \(d(u',a') < d(u,a')\). Furthermore, \(a,a' \in N(x) \cap I(x,v) (= D(x,1) \cap D(v,d(v,x)-1))\) must be adjacent because, according to Theorem 5, every disk is convex, and the intersection of two convex sets is also convex. As a result, applying \(\alpha _1\)-metric property to \(u,a,a',u'\), we get \(d(u,u') \ge d(u,a) + d(a',u') = 4\). A contradiction arises because \(u,u' \in S_3(x,v)\) and, by Lemma 2, the interval thinness of G is at most 2. \(\square \)

Lemma 28

Let x and u be vertices in an \(\alpha _1\)-metric graph G such that \(d(x,u) = 3\). For every vertices \(w,w' \in N(u) \cap I(x,u)\), the metric projections \(\texttt {proj}(w,D(x,1)),{} \texttt {proj}(w',D(x,1))\) are comparable by inclusion.

Proof

Since \(w,w' \in N(u) \cap I(u,x)\), which is the intersection of two disks, and by Theorem 5 every disk must be convex, the vertices w and \(w'\) must be adjacent. Suppose by contradiction that \(\texttt {proj}(w,D(x,1)),\texttt {proj}(w',D(x,1))\) are not comparable by inclusion. Let \(a,a' \in N(x)\) be such that \(a \in N(w) \setminus N(w')\) and \(a' \in N(w') \setminus N(w)\). We prove similarly as above that \(a,a' \in N(x) \cap I(x,u)\) must be adjacent. But then, vertices \(a,a',w',w\) induce a \(C_4\), which is impossible. \(\square \)

Corollary 13

Let x be an arbitrary vertex of an \(\alpha _1\)-metric graph G. Every vertex v of G has a gate \(v^*\) with respect to D(x, 1).

Proof

If \(d(v,x) \le 2\), then we can choose \(v^* = v\). From now on, \(d(x,v) \ge 3\). Let \(u \in S_3(x,v)\) be such that \(|\texttt{proj}(u,D(x,1))|\) is maximized. By Lemma 27, \(\texttt{proj}(v,D(x,1)) = \texttt {proj}(u,D(x,1))\). Then, let \(v^* \in N(u) \cap I(u,x)\) be such that \(|\texttt {proj}(v^*,D(x,1))|\) is maximized. By Lemma 28, \(\texttt {proj}(v^*,D(x,1)) = \texttt{proj}(u,D(x,1)) = \texttt {proj}(v,D(x,1))\). \(\square \)

We now turn our attention to cliques. A difference appears between general \(\alpha _1\)-metric graphs and \((\alpha _1,\varDelta )\)-metric graphs, which partly justifies the better runtime achieved for computing a central vertex in the latter subclass.

Lemma 29

([32]) Let K be a clique in an \((\alpha _1,\varDelta )\)-metric graph G. Every vertex v has a gate \(v^*\) with respect to K.

Lemma 29 does not hold for general \(\alpha _1\)-metric graphs. For example, if one takes an edge in \(C_5\), then the vertex at distance two to both end-vertices has no gate with respect to this edge. Nevertheless, we prove next the existence of distance-two gates.

Lemma 30

Let K be a clique in an \(\alpha _1\)-metric graph G. Every vertex v has a distance-two gate \(v^*\) with respect to K.

Proof

We may assume, without loss of generality, \(d(v,K) \ge 3\). Let \(v^* \in S_2(K,v)\) be maximizing \(|\texttt {proj}(v^*,K)|\). Suppose by contradiction that \(\texttt {proj}(v^*,K) \ne \texttt {proj}(v,K)\). Let \(x \in \texttt {proj}(v,K) \setminus \texttt {proj}(v^*,K)\) be arbitrary, and let \(w \in S_2(x,v)\). By maximality of \(|\texttt {proj}(v^*,K)|\), there exists a \(y \in \texttt {proj}(v^*,K) \setminus \texttt {proj}(w,K)\). Since G is an \(\alpha _1\)-metric graph, \(d(v^*,w) \ge d(v^*,y)+d(x,w) = 4\). We also have \(d(v^*,w) < d(v^*,y)+1+d(x,w) = 5\) because otherwise, the disk \(D(v,d(v,K)-2)\) could not be convex, thus contradicting Theorem 5. Therefore, \(d(v^*,w)=4\). By Lemma 17, there exist \(y' \in N(y) \cap N(v^*)\) and \(x' \in N(x) \cap N(w)\) such that \(d(x',y') = 2\). However, since we have \(x',y' \in I(v^*,w) \setminus D(v,d(v,K)-2)\), the latter still contradicts the convexity of disk \(D(v,d(v,K)-2)\). \(\square \)

3.3.2 Computation of Gates and Distance-two Gates

The problem of computing gates has already attracted some attention, e.g., see [16]. We use this routine in the design of our main algorithms.

Lemma 31

([39]) Let A be an arbitrary subset of vertices in some graph G with m edges. In total O(m) time, we can map every vertex \(v \notin A\) to some vertex \(v^* \in D(v,d(v,A)-1) \cap N(A)\) such that \(|N(v^*) \cap A|\) is maximized. Furthermore, if v has a gate with respect to A, then \(v^*\) is a gate of v.

The efficient computation of distance-two gates is more challenging. We present a subquadratic-time procedure that only works in our special setting.

Lemma 32

Let K be a clique in some \(\alpha _1\)-metric graph G with m edges. In total \(O(m^{1.41})\) time, we can map every vertex \(v \notin K\) to some distance-two gate \(v^*\) with respect to K. Furthermore, in doing so we can also map \(v^*\) to some independent set \(J_K(v^*) \subseteq D(v^*,1)\) such that \(\texttt {proj}(v^*,K)\) is the disjoint union of neighbour-sets \(N(w) \cap K\), for every \(w \in J_K(v^*)\).

Proof

For short, let us write \(p_K(v) = |\texttt {proj}(v,K)|\) for every vertex v. If \(v \in N(K)\), then we can set \(v^* = v\), \(J_K(v) = \{v\}\) and \(p_K(v) = |N(v) \cap K|\). This can be done in total O(m) time for every vertex of N(K). Thus from now on we only consider vertices v such that \(d(v,K) \ge 2\).

We compute \(J_K(u)\) for every vertex u such that \(d(u,K) = 2\). For that, we order the vertices of \(N(u) \cap N(K)\) by nonincreasing \(p_K\)-value. For every \(x \in N(u) \cap N(K)\), if there is a triangle xyu for some \(y \in N(K)\) ordered before x, then we claim that \(N(x) \cap K \subseteq N(y)\), and so we can ignore x. Indeed, since xy are adjacent, \(N(x) \cap K\) and \(N(y) \cap K\) must be comparable by inclusion (otherwise, since K is a clique, there would exist an induced \(C_4\) with xy and arbitrary vertices of \((N(x) \setminus N(y)) \cap K, (N(y)\setminus N(x)) \cap K\)). Since y was ordered before x, \(p_K(y) \ge p_K(x)\), which implies as claimed \(N(x) \cap K \subseteq N(y)\). Else, for any \(y \in N(K) \cap N(u)\) ordered before x, we claim that \(N(x) \cap K\) and \(N(y) \cap K\) must be disjoint. Indeed, otherwise, there would be an induced \(C_4\) with uxy and an arbitrary vertex of \(N(x) \cap N(y) \cap K\). Then, we put vertex x in \(J_K(u)\). Overall, we are left solving a variation of the well-known problem of deciding, for every edge in a graph, whether it is part of a triangle. This problem can be solved in \({O}(m^{1.41})\) time [2].

Finally, we consider all vertices v such that \(d(v,K) \ge 2\) by nondecreasing distance to K. If \(d(v,K) = 2\), then we set \(v^* = v\) and \(p_K(v) = \sum \{p_K(x) : x \in J_K(v)\}\). Otherwise, we pick some neighbour \(u \in N(v)\) such that \(d(u,K) = d(v,K)-1\) and \(p_K(u)\) is maximized. Then, we set \(v^* = u^*\) and \(p_K(v) = p_K(u)\). This procedure is correct assuming that a distance-two gate always exists, which follows from Lemma 30. \(\square \)

3.3.3 Local-search Algorithms

Now that we proved the existence of gates and distance-two gates, and of efficient algorithms in order to compute them, we turn our attention to the following subproblem: being given a vertex x in an \(\alpha _1\)-metric graph G, either compute a neighbour y such that \(e(y) < e(x)\), or assert that x is a local minimum for the eccentricity function (but not necessarily a central vertex). Our analysis of the next algorithms essentially follows from the results of Sect. 3.1. We first present the following special case, of independent interest, and for which we obtain a better runtime than for the more general Lemma 34.

Lemma 33

Let x be an arbitrary vertex in an \(\alpha _1\)-metric graph G with m edges. If \(e(x) \ge rad(G)+2\), then \(\bigcap \{N(x) \cap I(x,z) : z \in F(x)\} \ne \emptyset \), and every neighbour y in this subset satisfies \(e(y) < e(x)\). In particular, there is an O(m)-time algorithm that either outputs a \(y \in N(x)\) such that \(e(y) < e(x)\), or asserts that \(e(x) \le rad(G)+1\).

Proof

If \(e(x) \ge rad(G)+2\), then by Theorem 6, there exists a \(y \in N(x)\) such that \(e(y) < e(x)\). In particular, \(\bigcap \{N(x) \cap I(x,z) : z \in F(x)\} \ne \emptyset \). Let \(y'\) be an arbitrary neighbour of x in this subset. Suppose by contradiction \(e(y') \ge e(x)\). By Lemma 19, \(e(y') \le e(x)\). Hence, \(e(x) = e(y') \ge rad(G) + 2\). Furthermore, \(F(x) \cap F(y') = \emptyset \) because we assumed that \(y' \in N(x) \cap I(x,z)\) for every \(z \in F(x)\). But then, let \(z \in F(x), \ z' \in F(y')\) be arbitrary. Since G is an \(\alpha _1\)-metric graph, \(d(z,z') \ge d(z,y')+d(x,z') = e(y') - 1 + e(x) - 1 \ge 2(rad(G)+1) > diam(G)\). The latter is impossible.

Finally, we describe our O(m)-time algorithm for an arbitrary vertex x (of unknown eccentricity). We assume without loss of generality \(e(x) \ge 2\). We compute gates \(z^*\) with respect to D(x, 1) for every \(z \in F(x)\), whose existence follows from Corollary 13. By Lemma 31, this can be done in O(m) time. Then, we compute \(K = \bigcap \{ N(x) \cap I(x,z) : z \in F(x) \}\). Note that \(K = \bigcap \{ N(x) \cap N(z^*) : z \in F(x) \}\), and therefore, we can also compute K in O(m) time. If \(K = \emptyset \), then we can assert \(e(x) \le rad(G)+1\). Else, let \(y \in K\) be arbitrary. If \(e(x) \le e(y)\), then again we can assert that \(e(x) \le rad(G)+1\). Otherwise, we are done outputting y. \(\square \)

We can strengthen Lemma 33 as follows, at the expenses of a higher runtime.

Lemma 34

Let x be an arbitrary vertex in an \(\alpha _1\)-metric graph G with m edges. There is an \(O(m^{1.41})\)-time algorithm that either outputs a \(y \in N(x)\) such that \(e(y) < e(x)\), or asserts that x is a local minimum for the eccentricity function. If G is \((\alpha _1,\varDelta )\)-metric, then its runtime can be lowered down to O(m).

Proof

If \(e(x) \le 2\) then x is always a local minimum for the eccentricity function, unless \(e(x) = 2\) and x is adjacent to some universal vertex y. Therefore, we assume for the remainder of the proof \(e(x) \ge 3\). First we compute \(K = \bigcap \{ N(x) \cap I(x,z) : z \in F(x) \}\). This can be done in O(m) time by using the exact same approach as for Lemma 33. If \(K = \emptyset \), then clearly x is a local minimum for the eccentricity function. Otherwise, we are left deciding whether there exists a vertex of K with eccentricity smaller than e(x). For that, we claim that we only need to consider the vertices v such that \(d(v,K) \ge e(x)-1 \ge 2\). Indeed, by Theorem 5, the disks of G must be convex, which implies that K is a clique. In particular, every vertex v such that \(d(v,K) \le e(x)-2\) is at a distance at most \(e(x)-1\) to every vertex of K. Therefore, the claim is proved. Now, if \(d(v,K) = e(x)\) for at least one vertex v, then every vertex of K must have eccentricity at least e(x), hence we can assert that x is a local minimum for the eccentricity function. Otherwise, let \(F(K) = \{ v \in V : d(v,K) = e(x)-1 \}\). For every \(y \in K\), in order to decide whether \(e(y) < e(x)\), it suffices to decide whether \(y \in \bigcap \{ \texttt{proj}(v,K) : v \in F(K) \}\), or even more strongly to compute the number of vertices \(v \in F(K)\) such that \(y \in \texttt {proj}(v,K)\).

For general \(\alpha _1\)-metric graphs, we compute distance-two gates \(v^*\) for every \(v \in F(K)\), whose existence follows from Lemma 30. By Lemma 32, this can be done in \(O(m^{1.41})\) time. Being also given the independent sets \(J_K(v^*) \subseteq N(v^*)\), for every \(v \in F(K)\), as in Lemma 32, we compute the following weight function \(\alpha \) on N(K): \(\alpha (w) = |\{v \in F(K) : w \in J_K(v^*)\}|\). This can be done in O(m) time. Recall that for every \(v \in F(K)\), \(\texttt {proj}(v,K)\) is the disjoint union of \(N(w) \cap K\) for every \(w \in J_K(v^*)\). As a result, for every \(y \in K\), the number of vertices \(v \in F(K)\) such that \(y \in \texttt{proj}(v,K)\) is exactly \(\sum \{ \alpha (w) : w \in N(y) \setminus K \}\), which can be calculated in total O(m) time for every vertex of K.

Finally, assume for the remainder of the proof that G is \((\alpha _1,\varDelta )\)-metric, and let us modify this last part of the procedure as follows. We compute gates \(v^*\) for every \(v \in F(K)\), whose existence follows from Lemma 29. By Lemma 31, this can be done in O(m) time. For every \(w \in N(K)\), let \(\alpha (w) = |\{v \in F(K) : v^* = w\}|\). As before, for every \(y \in K\), the number of vertices \(v \in F(K)\) such that \(y \in \texttt {proj}(v,K)\) is exactly \(\sum \{ \alpha (w) : w \in N(y) \setminus K \}\), which can still be calculated in total O(m) time for every vertex of K. \(\square \)

3.3.4 The Main Procedures

We start presenting our algorithm for the general \(\alpha _1\)-metric graphs.

Theorem 8

If G is an \(\alpha _1\)-metric graph with m edges, then a vertex \(x_0\) such that \(e(x_0) \le rad(G)+1\) can be computed in O(m) time. Furthermore, a central vertex can be computed in \(O(m^{1.71})\) time.

Proof

By Theorem 2, we can compute in O(m) time a vertex \(x_0\) such that \(e(x_0) \le rad(G)+3\). We repeatedly apply Lemma 33 until we can further assert that \(e(x_0) \le rad(G)+1\) (and, hence, by Theorem 6, \(d(x_0,C(G))\le 2\)). Since there are at most two calls to this local-search procedure, the runtime is in O(m). Then, we apply the following procedure, starting from \(x_0\) and \(X_0 := V\), until we can assert that the current vertex \(x_i\) (considered at the \(i^{th}\) iteration) is central.

  1. 1.

    If \(deg(x_i) \le m^{.29}\), then we output a vertex of minimum eccentricity within \(D(x_i,2)\), and then we stop. This is done by applying Lemma 34 to every vertex of \(D(x_i,1)\). Otherwise (\(deg(x_i) > m^{.29}\)), we go to Step 2.

  2. 2.

    Let \(z_i \in F(x_i)\) be arbitrary. We set \(X_{i+1} := X_i \cap D(x_i,5) \cap D(z_i,e(x_i)-1)\). If \(X_{i+1} = \emptyset \), then we output \(x_i\). Otherwise, we pick an arbitrary vertex \(y \in X_{i+1}\), and then we go to Step 3.

  3. 3.

    We consider several cases in what follows.

    1. 1.

      If \(e(y) < e(x_i)\), then we output y;

    2. 2.

      Else, if \(e(y) = e(x_i)\), then we set \(x_{i+1}:=y\) and we go back to Step 1;

    3. 3.

      Else, there are three subcases. If \(\bigcap \{X_{i+1} \cap N(y) \cap I(y,w) : w \in F(y)\} = \emptyset \), then we output \(x_i\). Otherwise, we pick an arbitrary neighbour \(y'\) in this subset. If \(e(y') \ge e(y)\), then we also output \(x_i\). Else, we set \(y:=y'\) and we repeat Step 3.

We stress that at the \(i^{th}\) iteration we ensure at Step 2 that \(x_i \in X_i \setminus X_{i+1}\). In particular, \(X_0 \supset X_1 \supset \ldots \supset X_i\). It implies that our procedure eventually halts at some iteration T because we always stop at Step 2 if \(X_{i+1} = \emptyset \). Suppose by contradiction that we do not output a central vertex. For every i such that \(0 \le i < T\), we ensure at Step 3b that \(e(x_{i+1}) = e(x_i)\). Therefore, \(e(x_T) = e(x_{T-1}) = \ldots = e(x_0) \le rad(G)+1\). Since at the \(T^{th}\) iteration, we output a vertex of eccentricity at most \(e(x_T)\), we must have \(e(x_T) \ge rad(G)+1\). It implies \(e(x_i) = rad(G)+1\) for every i such that \(0 \le i \le T\). Then, by Theorem 6, \(d(x_i,C(G)) \le 2\) for every i such that \(0 \le i \le T\). Let us now consider the last step executed during iteration T. It cannot be Step 1 because a minimum eccentricity vertex within \(D(x_T,2)\) must be central. Suppose by contradiction that we halt at Step 2. Then, \(X_{T+1} = \emptyset \). We prove by induction that \(C(G) \subseteq X_i\) for every i with \(0 \le i \le T+1\), obtaining a contradiction. This is true for \(i=0\) because \(X_0 = V\). Assume now this is true for some i with \(0 \le i \le T\). Recall that \(d(x_{i},C(G)) \le 2\). By Corollary 11, \(diam(C(G)) \le 3\). As a result, \(C(G) \subseteq D(x_i,5)\). Furthermore, \(C(G) \subseteq D(z_i,e(x_i)-1)\) because we have \(rad(G)=e(x_i)-1\). Hence, \(C(G) \subseteq X_i \cap D(x_i,5) \cap D(z_i,e(x_i)-1) = X_{i+1}\). We deduce from the above that we must halt at Step 3. Since we suppose that we output a vertex of eccentricity \(e(x_T) = rad(G)+1\), it implies that we halt at Step 3c. In particular, we found a vertex \(y \in X_{T+1}\) such that \(e(y) \ge e(x_{T})+1\), and either \(\bigcap \{X_{T+1} \cap N(y) \cap I(y,w) : w \in F(y)\} = \emptyset \), or \(e(y') \ge e(y)\) for some arbitrary neighbour of y in this subset. However, by Corollary 9, there exists a shortest yC(G)-path that is decreasing and such that the only horizontal edge, if any, must have one end that is adjacent to the end-vertex in \(\texttt{proj}(y,C(G))\) (i.e., it must be the penultimate edge of the path, starting from y). In particular, the neighbour \(y''\) of y on this shortest path must satisfy \(e(y'') < e(y)\). Since \(y \in X_{T+1}\), \(C(G) \subseteq X_{T+1}\) and according to Theorem 5 the subset \(X_{T+1}\) must be convex (as intersection of convex disks), we get that \(y'' \in X_{T+1}\). Then, \(\bigcap \{X_{T+1} \cap N(y) \cap I(y,w) : w \in F(y)\} \ne \emptyset \). Furthermore, since we assume \(e(y) \ge rad(G)+2\), by Lemma 33, every neighbour \(y'\) in this subset must satisfy \(e(y') < e(y)\). A contradiction occurs.

We end up analysing the runtime of the procedure. Recall that all vertices \(x_0,x_1,\ldots ,x_T\) are pairwise different. Since all such vertices, except maybe the last one, have degree more than \(m^{.29}\), the number of iterations is in \(O(m/m^{.29}) = O(m^{.71})\). Let us consider an arbitrary iteration i, for some i such that \(0 \le i \le T\). During Step 1, either we do nothing or (only if \(i=T\)) we call Lemma 34 at most \(O(m^{.29})\) times and then we stop. In the latter case, the runtime is in \(O(m^{1.7})\). Step 2 takes O(m) time. Then, during Step 3, we only consider vertices \(y \in D(x_i,5)\). Since every such vertex y satisfies \(e(y) \le e(x_i)+5\), we can execute Step 3c at most five times. For every execution of Step 3c, we can slightly modify the algorithm of Lemma 33 in order to perform all computations in O(m) time. Therefore, Step 3 also takes O(m) time. Overall, the total runtime of any iteration is in O(m), except maybe for the last iteration whose runtime can be \(O(m^{1.7})\). Since there are only \(O(m^{.71})\) iterations, the final runtime is in \(O(m^{1.71})\). \(\square \)

To lower the runtime to O(m) for the \((\alpha _1,\varDelta )\)-metric graphs, we use a different approach that is based on the following additional properties of these graphs. Unfortunately, these properties crucially depend on the triangle condition.

Lemma 35

([32]) Let G be an \((\alpha _1,\varDelta )\)-metric graph. Then, in every slice \(S_k(y,z)\), there is a vertex w that is universal to that slice, i.e., \(S_k(y,z) \subseteq D(w,1)\).

Lemma 36

Let xy be adjacent vertices in an \((\alpha _1,\varDelta )\)-metric graph G such that both xy are local minima for the eccentricity function and \(e(x)=e(y)=rad(G)+1\). For every \(z \in \texttt{proj}(x,C(G))\), there exists a \(u \in N(x) \cap N(z)\) such that \(F(u) \subseteq F(x) \cap F(y)\).

Proof

First we prove that \(z \in \texttt {proj}(y,C(G))\). Suppose by contradiction it is not the case. By Theorem 6, \(d(x,C(G)) = d(y,C(G)) = 2\). Therefore, \(d(y,z) = 3\) and \(x \in N(y) \cap I(y,z)\). Let \(w \in N(x) \cap N(z)\) be arbitrary. Note that \(e(w) \le e(z)+1 = e(x)\). It implies \(e(w)=e(x)=rad(G)+1\) because x is assumed to be a local minimum for the eccentricity function. Then, let \(v \in F(w)\) be arbitrary. Since G is \(\alpha _1\)-metric, \(d(v,y) \ge d(v,z)+d(w,y) = rad(G)+2\). The latter is in contradiction with \(e(y)=rad(G)+1\).

Since xy are adjacent and \(d(x,z) = d(y,z) = 2\), the triangle condition implies the existence of some common neighbour \(u \in N(x) \cap N(y) \cap N(z)\). Recall that \(e(u) = e(x) = e(y) = rad(G)+1\). Suppose by contradiction that there exists a \(v \in F(u) \setminus F(x)\). Since G is an \(\alpha _1\)-metric graph, \(d(z,v) \ge d(z,u)+d(x,v) = 1 + rad(G)\), which is impossible for \(z\in C(G)\). As a result, \(F(u) \subseteq F(x)\). We prove similarly that \(F(u) \subseteq F(y)\), and so \(F(u) \subseteq F(x) \cap F(y)\). \(\square \)

Theorem 9

If G is an \((\alpha _1,\varDelta )\)-metric graph with m edges, then a central vertex can be computed in O(m) time.

Proof

The algorithm starts from a vertex x which is a local minimum for the eccentricity function of G. To compute such a vertex in O(m) time, we first apply Theorem 2 in order to compute a vertex of eccentricity at most \(rad(G)+3\). Then, we apply Lemma 34 at most three times.

We run a core procedure which either outputs two adjacent vertices \(u,v \in D(x,1)\) such that \(e(u)=e(v)=e(x)\) and F(u), F(v) are not comparable by inclusion, or outputs a central vertex. In the former case, let \(y \in F(u) \setminus F(v)\) and \(z \in F(v) \setminus F(u)\) be arbitrary. Since G is an \(\alpha _1\)-metric graph, \(d(y,z) \ge d(y,v)+d(u,z) = 2e(x)-2\). If \(d(y,z) \ge 2e(x)-1\), then \(rad(G) > e(x)-1\), and therefore x is a central vertex. From now on, we assume that \(d(y,z) = 2e(x)-2\). Then, any vertex of eccentricity \(e(x)-1\) must be contained in \(S_{e(x)-1}(y,z)\). Let w be such that \(S_{e(x)-1}(y,z) \subseteq D(w,1)\), whose existence follows from Lemma 35. We apply Lemma 34 in order to compute a minimum eccentricity vertex \(x'\) within D(w, 1). Finally, we output any of \(x,x'\) that has minimum eccentricity. To complete the description of our algorithm, we now present the core procedure.

  1. 1.

    We compute gates \(z^*\) with respect to D(x, 1) for every \(z \in F(x)\), whose existence follows from Corollary 13. By Lemma 31, this can be done in O(m) time. Then, for every \(y \in N(x)\), we compute \(f_x(y) = |\{ z \in F(x) : y \in N(x) \cap I(x,z) \}|\). This can also be done in O(m) time by enumerating the gates \(z^*\) in N(y) for every \(y \in N(x)\).

  2. 2.

    We choose a neighbour \(y_1\) such that \(f_x(y_1)\) is maximized. There are three cases.

    1. (a)

      If \(e(y_1) > e(x)\) then, by Lemma 19, we can assert that x is a central vertex. From now on, \(e(y_1) \le e(x)\). Since x is a local minimum for the eccentricity function, \(e(x) = e(y_1)\).

    2. (b)

      If \(y_1\) is not a local minimum for the eccentricity function of G, then by Lemma 34 we can compute a central vertex within \(N(y_1)\) in O(m) time. From now on both \(x,y_1\) are local minima for the eccentricity function.

    3. (c)

      If \(F(y_1) \setminus F(x) \ne \emptyset \), then we can output \(u=x,v=y_1\). Indeed, we also have \(F(x) \setminus F(y_1) \ne \emptyset \) because \(y_1 \in N(x) \cap I(x,z)\) for some \(z \in F(x)\). In what follows, we assume that \(F(x),F(y_1)\) are comparable by inclusion, and so, \(F(y_1) \subset F(x)\).

  3. 3.

    Let \(z_1 \in F(y_1)\) be arbitrary. We choose some neighbour \(y_2\) within \(N(x) \cap I(x,z_1)\) which maximizes \(f_x(y_2)\). Note that in order to compute \(N(x) \cap I(x,z_1)\), and so \(y_2\), in O(m) time, it suffices to only consider the vertices of \(N(x) \cap N(z_1^*)\). There are two cases.

    1. (a)

      If \(e(y_2) > e(x)\) then, by Lemma 19, we can assert that x is a central vertex. From now on we assume \(e(y_2) = e(x)\).

    2. (b)

      If \(y_2\) is not a local minimum for the eccentricity function of G, then by Lemma 34 we can compute a central vertex within \(N(y_2)\) in O(m) time. From now on vertices \(x,y_1,y_2\) are local minima for the eccentricity function.

  4. 4.

    Due to the maximality of \(f_x(y_1)\) and the existence of a \(z_1 \in F(x) \cap F(y_1)\), we have \(f_x(y_2) \le f_x(y_1) < |F(x)|\). Furthermore, both \(F(x) \setminus F(y_1), F(x) \setminus F(y_2)\) are nonempty. For each \(i \in \{1,2\}\), we compute \(B_i = \bigcap \{ N(x) \cap I(x,z) : z \in F(x) \setminus F(y_i) \}\). Since \(B_i = \bigcap \{ N(x) \cap N(z^*) : z \in F(x) \setminus F(y_i) \}\), it can be done in O(m) time. There are now two cases.

    1. (a)

      Assume the existence of an edge uv where \(u \in B_1, v \in B_2\). If \(\max \{e(u),e(v)\} > e(x)\) then, by Lemma 19, we can assert that x is a central vertex. Otherwise, we prove next that F(u), F(v) are not comparable by inclusion, and therefore we can output uv. Indeed, \(F(y_1),F(x) \cap F(y_2)\) are not comparable by inclusion because

      $$\begin{aligned} |F(x) \cap F(y_2)| = |F(x)| - f_x(y_2) \ge |F(x)| - f_x(y_1) = |F(y_1)| \end{aligned}$$

      and \(z_1 \in F(y_1) \setminus F(y_2)\). Furthermore, \(F(x) \cap F(u) \subseteq F(y_1)\) (\(F(x) \cap F(v) \subseteq F(y_2)\), respectively) because \(u \in B_1\) (\(v \in B_2\), respectively). Then, \(F(u) \cap F(x) = F(y_1)\) and \(F(v) \cap F(x) = F(y_2) \cap F(x)\), because otherwise this would contradict the maximality of either \(f_x(y_1)\) or \(f_x(y_2)\).

    2. (b)

      Finally, assume that every vertex of \(B_1\) is nonadjacent to every vertex of \(B_2\). We claim that x is a central vertex. Suppose by contradiction \(e(x) = rad(G)+1\). Let \(z \in \texttt {proj}(x,C(G))\) be arbitrary. By Lemma 36, there exist vertices \(u,v \in N(x) \cap N(z)\) such that \(F(u) \subseteq F(x) \cap F(y_1) = F(y_1)\), \(F(v) \subseteq F(x) \cap F(y_2)\). Note that \(\max \{e(u),e(v)\} \le e(z) + 1 = rad(G)+1\). Since x is a local minimum for the eccentricity function, we obtain \(e(u)=e(v)=rad(G)+1\). Then, \(u \in B_1\), \(v \in B_2\). In particular, uv must be nonadjacent, thus contradicting the convexity of \(D(x,1) \cap D(z,1)\), and so, Theorem 5.

\(\square \)

We leave as an open question whether there exists a linear-time algorithm for computing a central vertex in an \(\alpha _1\)-metric graph.

3.4 Approximating all Eccentricities in \(\alpha _1\)-Metric Graphs

It follows from the results of Sects. 3.3 and 2.2 that a vertex with eccentricity at most \(rad(G)+1\) and a vertex with eccentricity at least \(diam(G)-5\) can be found in linear time for every \(\alpha _1\)-metric graph G. Furthermore, all vertex eccentricities with an additive one-sided error at most 5 in an \(\alpha _1\)-metric graph can be computed in total linear time (see Sect. 2.3). Here, we present two immediate consequences of the results of Sect. 3, hereby answering some open questions from [25, 32].

Theorem 10

Every \(\alpha _1\)-metric graph G admits an eccentricity 3-approximating spanning tree. Furthermore, an additive 4-approximation of all vertex eccentricities in G can be computed in subquadratic total time.

Proof

It is sufficient to show that any breadth-first-search tree T of G rooted at a vertex \(c\in C(G)\) is an eccentricity 4-approximating spanning tree of G and any breadth-first-search tree T of G rooted at a vertex \(c\in C(C(G))\) (i.e., a central vertex of the subgraph of G that is induced by C(G)) is an eccentricity 3-approximating spanning tree of G. We do not know how to find efficiently a vertex \(c\in C(C(G))\) but, by Theorem 8, a central vertex c of G with m edges can be computed in \(O(m^{1.71})\) time.

Consider an arbitrary vertex v in G and let \(v'\) be a vertex of C(G) closest to v. By Corollary 8, \(e(v) \ge d(v,v') + rad(G)- \epsilon ,\) where \(\epsilon \le 1\). Since T is a shortest path tree and c is a central vertex of G, \(e_T(v)\le d_T(v,c)+e_T(c)=d_G(v,c)+e_G(c)=d_G(v,c)+rad(G)\). Hence, by the triangle inequality, \(e_T(v)-e_G(v) \le d_G(v,c)+rad(G)-d_G(v,v') - rad(G) + \epsilon \le d_G(c,v')+ \epsilon \le d_G(c,v')+ 1.\)

By Corollary 11, we know \(diam(C(G))\le 3\) and \(rad(C(G))\le 2\). Hence, if \(c\in C(G)\) then \(d_G(c,v')\le 3\), and if \(c\in C(C(G))\) then \(d_G(c,v')\le 2\). \(\square \)

For \((\alpha _1,\varDelta )\)-metric graphs this result can be strengthened further.

Theorem 11

Every \((\alpha _1,\varDelta )\)-metric graph G admits an eccentricity 2-approximating spanning tree. Furthermore, an additive 3-approximation of all vertex eccentricities in G with m edges can be computed in total O(m) time.

Proof

Let T be a BFS(c)-tree, where c is a central vertex of G. We can follow the proof of Theorem 10 and get \(e_T(v)-e_G(v) \le d_G(c,v')+ \epsilon \), where \(v'\) is a vertex of C(G) closest to v. In an \((\alpha _1,\varDelta )\)-metric graph G, we have \(\epsilon \le 1\), if \(diam(G) = 2rad(G)\), and \(\epsilon =0\), otherwise [32]. Furthermore, when \(diam(G)=2rad(G)\), \(diam(C(G))\le 2\) and \(rad(C(G))\le 1\) must hold [32]. Thus, if \(c\in C(G)\) then \(e_T(v)-e_G(v) \le d_G(c,v')+ \epsilon \le diam(C(G))+\epsilon \le 3\) (i.e., \(\le 3+0\) or \(\le 2+1\)), and if \(c\in C(C(G))\) then \(e_T(v)-e_G(v) \le d_G(c,v')+ \epsilon \le rad(C(G))+\epsilon \le 2\) (i.e., \(\le 2+0\) or \(\le 1+1\)). Note also that a central vertex of an \((\alpha _1,\varDelta )\)-metric graph can be computed in linear time (Theorem  9). \(\square \)

The existence of an eccentricity 2-approximating spanning tree in an \((\alpha _1,\varDelta )\)-metric graph is known already from [32]. The second part of Theorem  11 provides an answer to an open question from [25].

4 Concluding Remarks

We conclude the paper with some immediate questions building off our results.

  1. 1.

    Can our (approximation) bounds on eccentricities in general \(\alpha _i\)-metric graphs be improved? In particular,

    1. (i)

      is our bound on the eccentricity of a middle vertex of a shortest path between two mutually distant vertices best possible?

    2. (ii)

      is our bound on the eccentricity of a vertex furthest from an arbitrary vertex sharp?

    3. (iii)

      can our bound \(3i+2\) on the diameter of the center be improved to \(2i+1\)?

  2. 2.

    What best approximations of the radius and of the diameter of an \(\alpha _1\)-metric graph G can be achieved in linear time? In particular,

    1. (iv)

      does there exist a linear-time algorithm for finding a central vertex (and, hence, the exact radius) of an \(\alpha _1\)-metric graph?

    2. (v)

      is it possible to show that the eccentricity of a vertex furthest from an arbitrary vertex is at least \(diam(G)-2\)?

    3. (vi)

      can a vertex with eccentricity at least \(diam(G)-1\) be found in linear time?

Recall that in chordal graphs (a subclass of \(\alpha _1\)-metric graphs) a central vertex can be found in linear time and the eccentricity of a vertex furthest from an arbitrary vertex is at least \(diam(G)-2\) [16]. Furthermore, a vertex with eccentricity at least \(diam(G)-1\) can be found in linear time by a LexBFS [34]. On the other hand, computing the exact diameter of a chordal graph in subquadratic time is impossible unless the well known Strong Exponential Time Hypothesis (SETH) is false [6].