Beyond Helly graphs: the diameter problem on absolute retracts

Guillaume Ducoffe1,2

1National Institute for Research and Development in Informatics, Romania 2University of Bucharest, Romania

Abstract Characterizing the graph classes such that, on n-vertex m-edge graphs in the class, we can compute the diameter faster than in O(nm) time is an important research problem both in theory and in practice. We here make a new step in this direction, for some metrically defined graph classes. Specifically, a subgraph H of a graph G is called a retract of G if it is the image of some idempotent endomorphism of G. Two necessary conditions for H being a retract of G is to have H is an isometric and isochromatic subgraph of G. We say that H is an absolute retract of some graph class C if it is a retract of any G ∈ C of which it is an isochromatic and isometric subgraph. In this paper, we study the complexity of computing the diameter within the absolute retracts of various hereditary graph classes. First, we show how√ to compute the diameter within absolute retracts of bipartite graphs in randomized O˜(m n) time. For the special case of chordal bipartite graphs, it can be improved to linear time, and the algorithm even computes all the eccentricities. Then, we generalize these results to the absolute retracts of k-chromatic graphs, for every fixed k ≥ 3. Finally, we study the diameter problem within the absolute retracts of planar graphs and split graphs, respectively.

1 Introduction

One of the most basic graph properties is the diameter of a graph (maximum number of edges on a shortest path). It is a rough estimate of the maximum delay in order to send a message in a communication network [34], but it also got used in the literature for various other purposes [2, 82]. The complexity of computing the diameter has received tremendous attention in the community [1, 16, 20, 22, 29, 28, 26, 31, 32, 33, 38, 48, 49, 50, 45, 53, 56, 73]. Indeed, while this can be done in O(nm) time for any n-vertex m-edge graph, via a simple reduction to breadth- first search, breaking this quadratic barrier (in the size n + m of the input) happens to be a

arXiv:2101.03574v1 [math.CO] 10 Jan 2021 challenging task. In fact, under plausible complexity assumptions such as the Strong Exponential- Time Hypothesis (SETH), the optimal running time for computing the diameter is essentially in O(nm) — up to sub-polynomial factors [79]. This negative result holds even if we restrict ourselves to bipartite graphs or split graphs [1, 15]. However, on the positive side, several recent works have characterized important graph classes for which we can achieve for the diameter problem O(m2−) time, or even better O(mn1−) time, for some  > 0. Next, we focus on a few such classes that are most relevant to our work. Specifically, we call G = (V,E) a Helly graph if every family of pairwise intersecting balls of G (of arbitrary radius and center) have a nonempty common intersection. The Helly graphs are a broad generalization of many better-known graph classes, such as: trees, interval graphs, strongly chordal graphs and dually chordal graphs [5]. Furthermore, a celebrated theorem

1 in Metric Graph Theory is that every graph is an isometric (distance-preserving) subgraph of some Helly graph [44, 64]. Other properties of Helly graphs were also thoroughly investigated in prior works [8, 9, 11, 25, 36, 37, 39, 41, 69, 77, 78]. In particular, as far as we are concerned here, there √ is a randomized O˜(m n)-time algorithm in order to compute the diameter within n-vertex m-edge Helly graphs with high probability [48]. Larger classes, related to the Helly graphs, have been considered recently. For instance, G = (V,E) is a k-Helly graph if every family of k-wise intersecting balls of G have a nonempty common intersection (Helly graphs are exactly the 2-Helly graphs). For every fixed k, there is a randomized √ O˜(m n)-time algorithm in order to compute the radius (minimum eccentricity of a vertex) within k-Helly graphs [46]. The Helly-gap of G = (V,E) is the least α such that, for every family of pairwise intersecting balls of G, if we increase all the radii by α then this family has a nonempty common intersection [23, 42]. It also follows from [48] that the radius and the diameter of a graph with bounded Helly-gap can be approximated up to some additive constant, that only depends on its Helly-gap. The latter result generalizes prior work on diameter and center approximations within hyperbolic graph classes [28]. Finally, the graphs of bounded “distance VC-dimension” were introduced in [30], where it was observed that, by a result from [72], they satisfy certain “fractional” Helly property. Many interesting graph classes have bounded distance VC-dimension, such as: proper minor-closed graph classes [30], interval graphs [50] and bounded -width graphs [17]. For all the aforementioned sub-classes, there exist algorithms in O(mn1−) time, for some  > 0, in order to compute all the eccentricities, and so, the diameter [47, 50, 73]. Partial results also have been obtained for the diameter problem on all graph classes of bounded distance VC-dimension [50, 48]. Recall that an endomorphism of a graph G is an edge-preserving mapping of G to itself. A retraction is an idempotent endomorphism. If H is the image of G by some retraction (in particular, H is a subgraph of G) then, we call H a retract of G. The notion of retract has applications in some discrete facility location problems [62], and it is useful in characterizing some important graph classes. For instance, the median graphs are exactly the retracts of hypercubes [4]. We here focus on the relation between retracts and Helly graphs, that is as follows. For some class C of reflexive graphs (i.e., with a loop at every vertex), let us define the absolute retracts of C as those H such that, whenever H is an isometric subgraph of some G ∈ C, H is a retract of G. Absolute retracts find their root in Geometry, where they got studied for various metric spaces [67]. In the special case of the class of all reflexive graphs, the absolute retracts are exactly the Helly (reflexive) graphs [63]. Motivated by this characterization of Helly graphs, and the results obtained in [48] for the diameter problem on this graph class, we here consider the following notion of absolute retracts, for irreflexive graphs. – Unless stated otherwise, all graphs considered in this paper are irreflexive. – Namely, let us first recall that a subgraph H of a graph G is isochromatic if it has the same chromatic number as G. Then, given a class of (irreflexive) graphs C, the absolute retracts of C are those H such that, whenever H is an isometric and isochromatic subgraph of some G ∈ C, H is a retract of G. We refer the reader to [6, 7, 10, 62, 61, 66, 68, 70, 76, 74, 75], where this notion got studied for various graph classes.

Our results. In this paper, we prove new structural and algorithmic properties of the absolute retracts of various hereditary graph classes, such as: bipartite graphs, k-chromatic graphs (for any k ≥ 3), split graphs and planar graphs. Our focus is about the diameter problem on these graph classes but, on our way, we uncover several nice properties of the shortest-path distribution of their

2 absolute retracts, that may be of independent interest.

• First, in Sec. 2, we consider the absolute retracts of bipartite graphs and some important subclasses of the latter. We observe that in the square of such graph G, its two partite sets induce Helly graphs. This result complements the known relations between Helly graphs and absolute retracts of bipartite graphs [7]. Then, we show how to compute the diameter of G from the diameter of both Helly graphs (actually, from the knowledge of the peripheral vertices in these graphs, i.e., those vertices with maximal eccentricity). Recently [40], we √ announced an O(m n)-time algorithm in order to compute all the eccentricities in a Helly graph. However, extending this result to the absolute retracts of bipartite graphs appears to be a more challenging task. We manage to do so for the subclass of chordal bipartite graphs, for which we achieve a linear-time algorithm in order to compute all the eccentricities. For that, we prove the stronger result that in the square of such graph, its two partite sets induce strongly chordal graphs. Here also, our result complements the known relations between both graph classes [18, 52].

• In Sec. 3, we generalize our above framework to the absolute retracts of k-chromatic graphs, for any k ≥ 3. Our proofs in this part are more technical and intricate than in Sec. 2. For instance, we cannot extract a Helly graph from each colour class anymore. Instead, we define a partial eccentricity function for each colour (i.e., by restricting ourselves to the distances between vertices of the same colour), and we prove that the latter functions almost have the same properties as the eccentricity function of a Helly graph.

• Our positive results in Sec. 2 and 3 rely on some Helly-type properties of the graph classes considered. However, our hardness result in Sec. 4 hints that the weaker property of being an absolute retract of some well-structured graph class is not sufficient on its own for faster diameter computation. Specifically, we prove that under SETH, there is no O(mn1−)-time algorithm for the diameter problem, for any  > 0, on the class of absolute retracts of split graphs. This negative result follows from an elegant characterization of this subclass of split graphs in [66].

• Finally, in Sec. 5, we briefly consider the absolute retracts of planar graphs. While there now exist several truly subquadratic-time algorithms for the diameter problem on all planar graphs [22, 50, 56] – with the best-known running time being in O˜(n5/3) – the existence of a quasi linear-time algorithm for this problem has remained so far elusive, and it is sometimes conjectured that no such algorithm exists [22]. We give evidence that finding such algorithm for the absolute retracts of planar graphs is already a hard problem on its own. Specifically, we prove that every planar graph is an isometric subgraph of some absolute retract of pla- nar graphs. This result mirrors the aforementioned property that every graph isometrically embeds in a Helly graph [44, 64]. It implies the existence of some absolute retracts of planar graphs with treewidth arbitrarily large and inner vertices of degree three. Doing so, we rule out two general frameworks in order to compute the diameter in quasi linear time on some subclasses of planar graphs [29, 51].

Let us mention that all graph classes considered here are polynomial-time recognizable. For the absolute retracts of k-chromatic graphs, the best-known recognition algorithms have superquadratic running-time (even for k = 2) [6, 10]. Fortunately, we do not need to execute these recognition

3 algorithms before we can compute the diameter of these graphs. Indeed, our algorithms in Sec. 2 and 3 are heuristics which can be applied to any graph. Sometimes, these algorithms may fail in outputting a value, that certifies the input graph is not an absolute retract of k-chromatic graphs, for some k. Conversely, if the input graph is an absolute retract of k-chromatic graphs, then the algorithm always succeeds in outputting a value and this value is exactly the diameter. We consider our framework to be especially useful for all subclasses of the absolute retracts of k-chromatic graphs that admit quasi linear-time recognition algorithms. In this respect, we stress that the absolute retract of bipartite graphs are a superclass of cube-free modular graphs, and so, of chordal bipartite graphs, cube-free median graphs and covering graphs of modular lattices of breadth at most two [6].

Notations. We mostly follow the graph terminology from [14, 35]. All graphs considered are finite, simple (i.e., without loops nor multiple edges), unweighted and connected. For a graph G = (V,E), let the (open) neighbourhood of a vertex v be defined as NG(v) = {u ∈ V | uv ∈ E} and its closed neighbourhood as NG[v] = NG(v) ∪ {v}. Similarly, for a vertex-subset S ⊆ V , S let NG(S) = v∈S NG(v) \ S, and let NG[S] = NG(S) ∪ S. The distance between two vertices u, v ∈ V equals the minimum number of edges on a uv-path, and it is denoted dG(u, v). We also let IG(u, v) denote the vertices “metrically” between u and v, i.e., IG(u, v) = {w ∈ V | dG(u, v) = r dG(u, w)+dG(w, v)}. The ball of center v and radius r is defined as NG[v] = {u ∈ V | dG(u, v) ≤ r}. Furthermore, let the eccentricity of a vertex v be defined as eG(v) = maxu∈V dG(u, v). The diameter and the radius of a graph G are defined as diam(G) = maxv∈V eG(v) and rad(G) = minv∈V eG(v), respectively. A vertex v ∈ V is called central if eG(v) = rad(G), and peripheral if eG(v) = diam(G). Note that we sometimes omit the subscript if the graph G is clear from the context. We introduce additional terminology where it is needed throughout the paper.

2 Bipartite graphs

The study of the absolute retracts of bipartite graphs dates back from Hell [60], and since then many characterizations of this graph class were proposed [6]. This section is devoted to the diameter √ problem on this graph class. In Sec. 2.1, we propose a randomized O˜(m n)-time algorithm for this problem. Then, we consider the chordal bipartite graphs in Sec. 2.2, that have been proved in [6] to be a subclass of the absolute retracts of bipartite graphs. For the chordal bipartite graphs, we present a deterministic linear-time algorithm in order to compute all the eccentricities. Let us introduce a few additional terminology. For a connected bipartite graph G, we denote its two partite sets by V0 and V1. A half-ball is the intersection of a ball with one of the two partite sets of G. Finally, for i ∈ {0, 1}, let Hi be the graph with vertex-set Vi and an edge between every two vertices with a common neighbour in G.

2.1 Faster diameter computation We start with the following characterization of the absolute retracts of bipartite graphs:

Theorem 1 ([6]). G = (V,E) is an absolute retract of bipartite graphs if and only if the collection of half-balls of G satisfies the Helly property.

This above Theorem 1 leads us to the following simple, but important for what follows, obser- vation about the internal structure of the absolute retracts of bipartite graphs:

4 Lemma 1. If G = (V0 ∪ V1,E) is an absolute retract of bipartite graphs then both H0 and H1 are Helly graphs.

Proof. For each i ∈ {0, 1} the balls of Hi are exactly the half-balls of G that intersect Vi and have as their center a vertex of Vi. Therefore, by Theorem 1, the collection of balls of Hi satisfies the Helly property, i.e., Hi is a Helly graph. Next, we prove that in order to compute diam(G), with G an absolute retract of bipartite graphs, it is sufficient to compute the peripheral vertices of the Helly graphs H0 and H1.

Lemma 2. If G = (V0 ∪ V1,E) is an absolute retract of bipartite graphs such that diam(H0) ≤ diam(H1) then, diam(G) ∈ {2diam(H1), 2diam(H1) + 1}. Moreover, if diam(G) ≥ 3 then we have diam(G) = 2diam(H1) + 1 if and only if:

• diam(H1) = 1;

• or diam(H0) = diam(H1) and, for some i ∈ {0, 1}, there exists a peripheral vertex of Hi whose all neighbours in G are peripheral vertices of H1−i.

Proof. Let i ∈ {0, 1}. Clearly, diam(G) ≥ maxu,v∈Vi dG(u, v) = 2diam(Hi). Furthermore, since G is connected, Vi is a of G, and therefore, every vertex of Vi has eccentricity at most 2diam(Hi) + 1. Overall, since we assume diam(H1) ≥ diam(H0), we get as desired diam(G) ∈ {2diam(H1), 2diam(H1) + 1}. Note that this result holds for any bipartite graph. In what follows, we further assume diam(G) ≥ 3. If diam(H1) ≤ 1 then, diam(G) ≤ 2diam(H1)+ 1 ≤ 3. Therefore, diam(H1) = 1 and diam(G) = 2diam(H1) + 1. From now on, diam(H1) ≥ 2. Let us first assume diam(G) = 2diam(H1) + 1. Observe that for each i ∈ {0, 1}, every vertex of Vi is at a distance at most 1 + 2diam(H1−i) from every vertex of V1−i (in order to see that, just take any neighbour of this vertex in V1−i). In particular, if diam(H0) < diam(H1), then every vertex of V0 has eccentricity at most 2diam(H0) + 1 < 2diam(H1), while every vertex of V1 has eccentricity at most max{2diam(H1), 2diam(H0) + 1} = 2diam(H1). Hence, in order to have diam(G) = 2diam(H1) + 1, we must have diam(H0) = diam(H1). Furthermore, for some fixed i ∈ {0, 1}, let v ∈ Vi be a peripheral vertex of G. Since 2diam(H1) + 1 = eG(v) ≤ 2eHi (v) + 1, we must have eHi (v) = diam(Hi) = diam(H1). In the same way, for any neighbour u ∈ NG(v), we have eG(v) ≤ max{2diam(Hi), 2eH1−i (u) + 1}, and therefore, we must also have eH1−i (u) = diam(H1−i) = diam(H1). It implies the existence of a peripheral vertex of Hi whose all neighbours are peripheral vertices of H1−i. Conversely, let us assume that diam(H0) = diam(H1) and that, for some i ∈ {0, 1}, there exists a v ∈ Vi such that: eHi (v) = diam(Hi) = diam(H1); for every u ∈ NG(v), eH1−i (u) = diam(H1−i) = diam(H1). Suppose by contradiction eG(v) < 2diam(H1) + 1. Then, since G is bipartite, all the vertices of V1−i are at a distance at most 2diam(H1)−1 from vertex v. Furthermore, for every x, y ∈ V1−i, since we have dG(x, y) = 2dH1−i (x, y), we obtain that for every even ` ≥ ` ` dH1−i (x, y) the half-balls NG[x] ∩ V1−i and NG[y] ∩ V1−i intersect. In particular, we may choose

` = 2(diam(H1) − 1) because diam(H1) ≥ 2 implies 2(diam(H1) − 1) ≥ diam(H1) ≥ dH1−i (x, y). 1 2(diam(H1)−1) But then, the half-balls NG(v) (= NG[v] ∩ V1−i) and NG [w] ∩ V1−i, for every w ∈ V1−i, pairwise intersect. By Theorem 1, there exists a u ∈ NG(v) s.t. eH1−i (u) ≤ diam(H1) − 1. This is a contradiction because such neighbour u cannot be peripheral in H1−i.

5 The remaining of Sec. 2.1 is devoted to the computation of all the peripheral vertices in both Helly graphs H0 and H1. While there exists a truly subquadratic-time algorithm for computing the diameter of a Helly graph [48], we observe that in general, we cannot compute H0 and H1 in truly subquadratic time from G. Next, we adapt [48, Theorem 2], for the Helly graphs, to our needs.

Lemma 3. If G = (V0 ∪ V1,E) is an absolute retract of bipartite graphs then, for any k, we can compute in O(km) time the set of vertices of eccentricity at most k in H0 (resp., in H1).

Proof. By symmetry, we only need to prove the result for H0. Let U = {v ∈ V0 | eH0 (v) ≤ k} be the set to be computed. We consider the more general problem of computing, for any t, a t t t partition Pt = (A1,A2,...,Apt ) of V0, in an arbitrary number pt of subsets, subject to the following constraints:

t T t t t • For every 1 ≤ i ≤ pt, let C := t N [v]. Let B := C ∩ V0 if t is even and let i v∈Ai G i i t t t t t Bi := Ci ∩ V1 if t is odd (for short, Bi = Ci ∩ Vt (mod 2)). We impose the sets Bi to be nonempty and pairwise disjoint.

Indeed, under these two conditions above, we have U 6= ∅ if and only if, for any partition P2k as 2k described above, p2k = 1. Furthermore if it is the case then U = B1 . The algorithm. We construct the desired partition by induction over t. If t = 0 then, let

V0 = {v1, v2, . . . , vp0 }. We just set P0 = ({v0}, {v1},..., {vp0 }) (each set is a singleton), and for 0 0 every 1 ≤ i ≤ p0 let Bi = Ai = {vi}. Else, we construct Pt from Pt−1. Specifically, for every t t−1 1 ≤ i ≤ pt−1, we let Wi := NG(Bi ). Then, starting from j := 0 and F := Pt−1, we proceed t−1 t as follows until we have F = ∅. We pick a vertex u s.t. #{i | Ai ∈ F, u ∈ Wi } is maximized. t S t−1 t−1 t t T t t−1 t Then, we set Aj := {Ai | Ai ∈ F, u ∈ Wi } and Bj := {Wi | Ai ∈ F, u ∈ Wi }. We add t t−1 t the new subset Aj to Pt, we remove all the subsets Ai , u ∈ Wi from F, then we set j := j + 1. Correctness. The base case of our above induction is trivially correct. In order to prove correctness of our inductive step, we need the following two intermediate claims.

t T t  Claim 1. W = Vt (mod 2) ∩ t−1 N [v] . i v∈Ai G

t−1 T t−1  t t−1 Proof. Recall that B = Vt−1 (mod 2) ∩ t−1 N [v] , and that W = NG(B ). Therefore i v∈Ai G i i t T t  T t  by construction, W ⊆ Vt (mod 2)∩ t−1 N [v] . Conversely, let w ∈ Vt (mod 2)∩ t−1 N [v] i v∈Ai G v∈Ai G t−1 be arbitrary. Let a ∈ Ai be arbitrary. There are two cases. If a 6= w then, by consider- 1 ing any x ∈ NG(w) ∩ IG(a, w), we get that the half-balls NG(w) (= NG[w] ∩ Vt−1 (mod 2)) and t−1 NG [a] ∩ Vt−1 (mod 2) intersect. Otherwise, a = w and then, t is even. Here also the half-balls t−1 t−1 NG(w) and NG [a] ∩ Vt−1 (mod 2) (= NG [a] ∩ V1) intersect because we have NG(w) = NG(a) ⊆ t−1 t−1 NG [a] ∩ Vt−1 (mod 2). Overall, in all the cases, the half-balls NG(w) and NG [a] ∩ Vt−1 (mod 2), for t−1 t−1 every a ∈ Ai , pairwise intersect. Then, by Theorem 1, vertex w has a neighbour in Bi .  t t It follows from this above claim that, for each subset Aj created at step t, we have Bj = Vt (mod 2) ∩ T t  t t N [v] , as desired. Observe that all the subsets B are nonempty since they at least contain v∈Aj G j t the vertex u ∈ Vt (mod 2) that is selected in order to create Aj. What now remains to prove is that t all the subsets Bj are pairwise disjoint. The latter easily follows from our next intermediate claim, namely:

6 t 0 t Claim 2. Let u ∈ Vt (mod 2) be a vertex maximizing #{i | u ∈ Wi }. For every index i s.t. u∈ / Wi0 , t T t we have W 0 ∩ t W = ∅. i u∈Wi i t Proof. It directly follows from the maximality of #{i | u ∈ Wi }.  t We are done applying this above claim at each creation of a new subset Aj. Complexity. The base case of our induction requires O(n) time. Let us prove that each t−1 inductive step requires O(m) time. First, since by the hypothesis the sets Bi are pairwise disjoint, t we can compute the sets Wi in total linear time. Then, we create an array of pt−1 lists, numbered t from 1 to pt−1. For each vertex u ∈ Vt (mod 2) s.t. {i | u ∈ Wi }= 6 ∅, we put it in the list numbered t t #{i | u ∈ Wi }. Since it only requires to scan the Wi ’s once, it takes O(m + n) time. We scan the lists in decreasing order (i.e., from pt−1 downto 1), going to the next list each time the current one is empty. When the current list is nonempty, we pick any vertex u of this list in order to create the t t t P t−1 t t−1 next subset Aj. Note that both subsets Aj and Bj can be computed in O( {|Ai |+|Wi | | Ai ∈ t t F, u ∈ Wi }) time. Finally, we need to discard the vertices of Bj from the list in which they are S t t−1 t  t currently contained, while for every other w ∈ {Wi | Ai ∈ F, u ∈ Wi } \Bj we need to update 0 t−1 t #{i | Ai0 ∈ F, w ∈ Wi0 } and the corresponding list. If, for each vertex, we store a pointer to its P t t−1 t position in the corresponding list, we can also do the latter in O( {|Wi | | Ai ∈ F, u ∈ Wi }) t−1 time. Overall, since each set Ai gets removed once from F, the total running time for the inductive step is in O(m + n). √ We use this above Lemma 3 when the respective diameters of H0 and H1 are in O( n). For larger values of diameters, we use a randomized procedure (Algorithm 1).

Algorithm 1 Diameter computation in Helly graphs. Require: A Helly graph H s.t. diam(H) > 3k = ω(log |V (H)|). log |V (H)| 1: Set p = c k , for some sufficiently large constant c. 2: Let U(p) contain every v ∈ V (H) independently with probability p. 3: for all v ∈ V (H) do 4: if ∀u ∈ U(p), dH (u, v) > k then 5: Sete ¯(v) := 0. 6: else 7: Sete ¯(v) := min{dH (u, v) + eH (u) | u ∈ U(p), dH (u, v) ≤ k}.

Lemma 4 (Theorem 3 in [48]). With high probability, Algorithm 1 runs in O˜(|E(H)| · |V (H)|/k) time, we have diam(H) = maxv∈V (H) e¯(v), and the peripheral vertices of H are exactly the vertices v ∈ V (H) which maximize e¯(v).

We are now ready to prove the main result of this section, namely:

Theorem 2. If G = (V ∪V ,E) is an absolute retract of bipartite graphs then, with high probability, 0 1 √ we can compute diam(G) in O˜(m n) time.

Proof. We may assume diam(G) ≥ 3. Indeed, a bipartite graph has diameter at most two if and only if it is complete bipartite. First, we compute the peripheral vertices of H0 and H1. For that, we start computing a 2-approximation of diam(G) in linear time (e.g., by computing the eccentricity of an arbitrary vertex). Let D be the resulting value. There are two cases.

7 √ • If D < n then, we compute the least k s.t. all vertices of H0 (resp., of H1) have eccentricity at most k. For that, it is sufficient to perform a one-sided binary search where, at each step, we apply Lemma 3. Note that this value k computed is in fact diam(H ) (resp., diam(H )). √ 0 1 In particular, the total running time is in O˜(mk) = O˜(mD) = O˜(m n). Then, in order to compute the peripheral vertices of H0 (resp., of H1), it is sufficient to apply Lemma 3 one more time in order to compute the vertices of eccentricity at most k − 1. √ • Otherwise, D ≥ n, and we apply Algorithm 1 to both H0 and H1. Since by Lemma 1, both H0 and H1 are Helly graphs, we have by Lemma 4 that the output of Algorithm 1 is correct with high probability. Furthermore, since any breadth-first search in either H0 or H1 can be simulated with a breadth-first search in G, the total running time for executing Algorithm 1 √ is with high probability (by Lemma 4) in O˜(mn/D) = O˜(m n).

Finally, in order to compute diam(G) from the peripheral vertices of H0 and H1, we apply the criterion of Lemma 2. For that, it is sufficient to scan the neighbourhood of each peripheral vertex of H0 and H1, and therefore it can be done in linear time.

2.2 Chordal bipartite graphs We improve Theorem 2 for the special case of chordal bipartite graphs. Recall (amongst many characterizations) that a bipartite graph is chordal bipartite if and only if every induced cycle has length four [58]. It was proved in [6] that every chordal bipartite graph is an absolute retract of bipartite graphs.

Theorem 3. If G = (V,E) is chordal bipartite then we can compute all the eccentricities (and so, the diameter) in linear time.

The remaining of this section is devoted to a proof of Theorem 3. For that, we subdivide our proof into four main steps (undefined terminology below is introduced step by step in this section):

1. We base ourselves on the results from [19, 43] in order to prove that H0 and H1 – the two Helly graphs induced by the partite sets of G in its square – are strongly chordal graphs.

2. The same as in Sec. 2.1, in general we cannot compute H0 and H1 from G in subquadratic time. In order to overcome this issue, we explain how to compute a clique-tree for these two graphs.

3. Then, we present an algorithm in order to compute all the eccentricities for strongly chordal graphs, being given as input the clique-tree of such graph (i.e., instead of its adjacency list).

4. Finally, we present an “all eccentricities” version of Lemma 2, and we explain how to solve the corresponding algorithmic problem for chordal bipartite graphs.

The chordal structure of the partite sets. A graph is chordal if it has no induced cycle of length more than three. It is strongly chordal if it is chordal and it does not contain any n- sun (n ≥ 3) as an induced subgraph [52]. A dually is a Helly graph in which the intersection graph of balls is chordal [5, 19]; for other characterizations of this graph class, see [19]. The relation between dually chordal graphs and strongly chordal graphs is as follows:

8 Lemma 5 ([19]). A graph is strongly chordal if and only if each induced subgraph is dually chordal.

th k 1 The k -iterated neighbourhood of a vertex V , denoted NG(v), is defined recursively as: NG(v) = k+1 k NG(v) (open neighbourhood) and NG (v) = NG(NG(v)) [43]. The following observation was used implicitly in Lemma 3:

Lemma 6. If G = (V ∪ V ,E) is bipartite then, for every k ≥ 1 and v ∈ V , N 2k(v) = N k [v]. 0 1 0 G H0

2k−1 2k−1 2k 2k Proof. By induction, for every k ≥ 1, NG (v) = NG [v] ∩ V1 and NG (v) = NG [v] ∩ V0. The lemma follows since we have N k [v] = N 2k[v] ∩ V . H0 G 0 1 For a vertex v in G, a maximum neighbour is a vertex u ∈ NG(v) such that, for any other 0 0 w ∈ NG(v), we have NG(w) ⊆ NG(u). A vertex v 6= v such that NG(v) ⊆ NG(v ) is said to cover v. Finally a maximum neighbourhood ordering of G is a total ordering V = (v1, v2, . . . , vn) of its vertex-set such that, for every 1 ≤ i ≤ n−2, the vertex vi has a maximum neighbour and is covered in the induced subgraph Gi := G \{v1, v2, . . . , vi−1}. We do not use the existence of a maximum neighbourhood ordering directly in our proofs, but rather the following two related results:

Lemma 7 ([43]). G = (V,E) is chordal bipartite if and only if every induced subgraph of G has a maximum neighbourhood ordering.

Lemma 8 (items (iii) and (v) of the main theorem in [43]). G has a maximum neighbourhood ordering if and only if the system of all iterated neighbourhoods has the Helly property and its intersection graph is chordal.

The next result now follows by combining Lemmas 5–8.

Lemma 9. If G = (V0 ∪ V1,E) is chordal bipartite, then H0 and H1 are strongly chordal.

Proof. By symmetry, it suffices to prove the result for H0. For that, by Lemma 9, it is sufficient to prove that every induced subgraph of H0 is dually chordal. Let U ⊆ V0 be arbitrary. We define GU as the subgraph induced by NG[U] (the union of U and of all the vertices of V1 with a neighbour in U). By construction, H0[U] is exactly the graph with vertex-set U and an edge between every two vertices with a common neighbour in GU . Furthermore, since the class of chordal bipartite graphs is hereditary, GU is chordal bipartite, and so, by [6], an absolute retract of bipartite graphs. It thus follows from Lemma 1 that H0[U] is a Helly graph. In order to prove that H0[U] is dually chordal, it now suffices to prove that the intersection graph of its balls is chordal. By the combination of Lemmas 7 and 8, the intersection graph IU of all iterated neighbourhoods of GU is chordal. By Lemma 6, the intersection graph of all balls of H0[U] is an induced subgraph of IU and therefore, it is also chordal.

Computation of a clique-tree. For a graph H = (V,E), a clique-tree is a tree T whose nodes are the maximal cliques of H and such that, for every v ∈ V , the maximal cliques of H containing v induce a connected subtree Tv of T . It is well-known that H is chordal if and only if it has a clique-tree [21, 55, 81]. Our intermediate goal is, given a chordal bipartite graph G = (V0 ∪ V1,E), to compute a clique-tree for H0 and H1 (that are chordal graphs by the above Lemma 9).

1This terminology is sometimes used, with a different meaning, for dually chordal graphs [19].

9 A hypergraph H = (X, R) is called a dual hypertree if there exists a tree T whose nodes are the hyperedges in R and such that, for every x ∈ X, the hyperedges containing x induce a connected subtree Tx of T (such tree T is called a join tree of H). Note that dual hypertrees can be recognized in linear time [80]. Furthermore, we have:

Lemma 10 ([43]). If G = (V0 ∪ V1,E) is chordal bipartite then, both hypergraphs (V0, {NG(v) | v ∈ V1}) and (V1, {NG(v) | v ∈ V0}) are dual hypertrees.

Corollary 1. If G = (V0 ∪ V1,E) is chordal bipartite then, we can compute a clique-tree for H0 and H1 in linear time.

Proof. By symmetry, we only prove the result for H0. Consider the hypergraph H = (V0, {NG(v) | v ∈ V1}). Note that the underlying graph of H (obtained by adding an edge between every two vertices that are contained in a common hyperedge of H) is exactly H0. Since by Lemma 10, H is a dual hypertree, every maximal clique of the underlying graph H0 must be a hyperedge of H [12]. Then, let us reduce H, i.e., we remove all hyperedges that are strictly contained into another hyperedge. Again since H is a dual hypertree, the resulting reduced hypergraph H0 can be computed in linear time [80]. Furthermore, by construction, the hyperedges of H0 are exactly the 0 maximal cliques of H0. Let us construct a join tree of H . It can be done in linear time [80]. We are done as such join tree is a clique-tree of H0.

Computation of all the eccentricities in the partite sets. Next, we propose a new algorithm in order to compute all the eccentricities of a H, being given a clique-tree. We often use in our proof the clique-vertex incidence graph of H, i.e., the bipartite graph whose partite sets are the vertices and the maximal cliques of H, and such that there is an edge between every vertex of H and every maximal clique of H containing it. Let us first recall the following result about the eccentricity function of Helly graphs:

Lemma 11 ([36]). If H = (V,E) is Helly then, for every vertex v we have eH (v) = dH (v, C(H)) + rad(H), where C(H) denotes the set of central vertices of H. Hence, by Lemma 11, we are left computing C(H). It starts with computing one central vertex. Define, for every vertex v and vertex-subset C, dH (v, C) = minc∈C dH (v, c). Follow- ∗ dH (v,C)−1 ing [27], we call a set C gated if, for every v∈ / C, there exists a vertex v ∈ NH [v] ∩ T ∗ ( {NH (c) | c ∈ C, dH (v, c) = dH (v, C)}) (such vertex v is called a gate of v). Lemma 12 ([24]). Every clique in a chordal graph is a gated set. Lemma 13 ([48]). If T is a clique-tree of a chordal graph H then, for every clique C of H, for ∗ every v∈ / C we can compute dH (v, C) and a corresponding gate v in total O(w(T )) time, where w(T ) denotes the sum of cardinalities of all the maximal cliques of H.

For every u, v ∈ V and k ≤ dH (u, v), the set LH (u, k, v) = {x ∈ IH (u, v) | dH (u, x) = k} is called a slice. We also need the following result about slices in chordal graphs: Lemma 14 ([24]). Every slice in a chordal graph is a clique. Now, consider the procedure described in Algorithm 2 in order to compute a central vertex. Lemma 15 (special case of Theorem 5 in [48]). Algorithm 2 outputs a central vertex of H.

10 Algorithm 2 Computation of a central vertex. Require: A strongly chordal graph H. 1: v ← an arbitrary vertex of H 2: u ← a furthest vertex from v, i.e., dH (u, v) = eH (v) 3: w ← a furthest vertex from u, i.e., dH (u, w) = eH (u) 4: for all r ∈ {deH (u)/2e , d(eH (u) + 1)/2e , 1 + deH (u)/2e} do 5: Set C := L(w, r, u) //C is a clique by Lemma 14 6: for all v∈ / C do ∗ 7: Compute dH (v, C) and a corresponding gate v //whose existence follows from Lemma 12 ∗ 8: Set S := {v | dH (v, C) = r} //gates of vertices at max. distance from C 9: for all c ∈ C do 10: if S ⊆ NH (c) then 11: return c

Lemma 16. If T is a clique-tree of a strongly chordal graph H then, we can implement Algorithm 2 in order to run in O(w(T )) time, where w(T ) denotes the sum of cardinalities of all the maximal cliques of H.

Proof. Lines 1–3 require executing breadth-first searches in H. It can be done in O(w(T )) time by executing breadth-first searches in the clique-vertex incidence graph IH of H. Note that we can compute IH in O(w(T )) time from the clique-tree T . Now, consider any of the at most three executions of the for loop starting at Line 4. The subset C at Line 5 can also be computed in O(w(T )) time using breadth-first searches in IH . Then, for implementing the computation of all the gates, at Line 6–7, we call Lemma 13. We are left explaining how to implement the internal for loop, starting at Line 9, so that it runs in total O(w(T )) time. For that, we assign a counter g(c) for every c ∈ C (initially equal to 0), whose final value must be |NH (c) ∩ S|. Doing so, the test at Line 10 boilds down to verifying whether g(c) = |S|. In order to correctly set the values of the counters g(c), c ∈ C, we root the clique-tree T arbitrarily and then we perform a breadth-first search of this tree T starting from the root. For each maximal clique K of H, let K0 be the common intersection with its father node in T (in particular, K0 = ∅ if K is the root). For every c ∈ C ∩ (K \ K0), we increase the counter g(c) by exactly |K ∩ S|. However, for every c ∈ C ∩ K0, we only increase the counter g(c) by |S ∩(K \K0)|; indeed, for these vertices, the contribution of the gates in S ∩K0 was already counted earlier during the breadth-first search. Overall, we just need to scan each maximal clique of H once, and so, the running time is in O(w(T )), as desired.

Then, given a central vertex c of H, we explain how to compute C(H) by local search in the neighbourhood at distance two around c. For that, we need one more structural result about the center of strongly chordal graphs, namely:

Lemma 17 ([36, 37]). If H is strongly chordal then, its center C(H) induces a strongly chordal graph of radius ≤ 1.

We also need the following nice characterization of strongly chordal graphs, namely:

Lemma 18 ([18, 52]). H is strongly chordal if and only if its clique-vertex incidence graph IH is chordal bipartite.

Proposition 1. If T is a clique-tree of a strongly chordal graph H = (V,E) then, we can compute its center C(H) in O(w(T )) time.

11 Proof. Let c ∈ C(H) be a fixed central vertex of H. By the combination of Lemmas 15 and 16, it can be computed in O(w(T )) time. We also compute the clique-vertex incidence graph IH from T , in O(w(T )) time. Let r := rad(H) (computable in O(w(T )) time by using a breadth-first search rooted at c in IH ). Note that if r ≤ 2, then in order to compute C(H), we are left computing all the vertices of eccentricity at most r in H. For that, since by Lemma 18 IH is chordal bipartite, we can use Lemma 3. It takes time linear in the size of IH , and so it takes O(w(T )) time. From 2 now on, we assume r ≥ 3. By Lemma 17, C(H) ⊆ NH [c]. In particular, If v ∈ V is such that 2 dH (v, c) ≤ r − 2 then it is trivially at a distance ≤ r from every vertex of NH [c]. Thus, in order to 2 compute C(H) from NH [c], we only need to consider the subsets Ar−1 := {v ∈ V | dH (v, c) = r−1} and Ar := {v ∈ V | dH (v, c) = r}. We prove as an intermediate claim that NH [c] is gated. Indeed, for every v∈ / NH [c], the closest vertices to v in this closed neighbourhood are those in the slice L(v, dH (v, c) − 1, c), and thus they induce a clique by Lemma 14. Then, the claim follows from ∗ Lemma 12. Furthermore, for every v∈ / NH [c], we can compute a corresponding gate v as follows: we contract in T the subtree Tc (induced by all the maximal cliques containing c) to a single node representing NH [c], then we apply Lemma 13. It takes O(w(T )) time. r−1 Now, let v ∈ Ar−1 ∪ Ar. If the closed neighbourhood of any vertex u intersects NH [c] ∩ NH [v] then, dH (u, v) ≤ r. Conversely, we claim that the closed neighbourhood of any central vertex must r−1 0 0 r−1 intersect NH [c] ∩ NH [v]. Indeed, observe that for every c ∈ C(H), NH [c ] ∩ NH [v] 6= ∅. By 0 0 Lemma 17, the balls NH [c ], c ∈ C(H) also pairwise intersect. Therefore, by the Helly property, r−1 T 0  r−1 there exists a x ∈ NH [v]∩ c0∈C(H) NH [c ] . We are done as in this situation x ∈ NH [c]∩NH [v]. We now analyse the following two cases: ∗ ∗ Case v ∈ Ar. Let v be the corresponding gate. Note that dH (v , c) = dH (v, NH [c]) − 1 = 2 ∗ dH (v, c) − 2 = r − 2. In particular, every vertex of NH [v ] is at a distance ≤ r from vertex v. r−1 Conversely, the closed neighbourhood of every central vertex must intersect NH [c] ∩ NH [v] = ∗ 2 ∗ L(v, r − 1, c) ⊆ NH [v ]. As a result, C(H) ⊆ NH [v ]. Case v ∈ Ar−1. Let Z = {z ∈ NH [c] | dH (v, c) = r − 1}. Note that c ∈ Z. Since the r−2 balls NH [v] and NH [z], z ∈ Z pairwise intersect, by the Helly property there exists a vertex 0 r−2 T 0 r−2 v ∈ NH [v] ∩ ( {NH (z) | z ∈ Z}). Observe that v ∈ NH [v] ∩ NH [c] = L(v, r − 2, c). In 2 0 particular, every vertex of NH [v ] is at a distance ≤ r from v. Conversely, since by Lemma 14 the r−1 0 2 0 set L(v, r − 2, c) is a clique, NH [v] ∩ NH [c] = L(v, r − 2, c) ∪ Z ⊆ NH [v ]. Thus, C(H) ⊆ NH [v ]. 0 ∗ Note that we may choose as our v any y ∈ NH (v ) that maximizes |NH [y] ∩ NH [c]|, where ∗ 0 v is the gate computed for v. In order to compute such vertex v , for every v ∈ Ar−1, we use a similar trick as for Lemma 16. Namely, for every y ∈ V , we assign a counter h(y) (initially equal to 0), whose final value must be |NH [y] ∩ NH [c]|. In order to correctly set the values of these counters, we root the clique-tree T arbitrarily and then we perform a breadth-first search of this tree T starting from the root. For each maximal clique K of H, let K0 be the common intersection with its father node in T (in particular, K0 = ∅ if K is the root). For every y ∈ K \ K0, we increase 0 the counter h(y) by exactly |K ∩ NH [c]|. However, for every y ∈ K , we only increase the counter 0 h(y) by |NH [c] ∩ (K \ K )|. Overall, we just need to scan each maximal clique of H once, and so, the running time is in O(w(T )). Finally, we scan each maximal clique K once more and, to every 0 vertex of K, we assign a vertex y ∈ K maximizing h(y). For every v ∈ Ar−1, we choose for v any vertex y assigned to v∗ and maximizing h(y). ∗ 0 Overall, let B := {c} ∪ {v | v ∈ Ar} ∪ {v | v ∈ Ar−1}. By the above case analysis, C(H) = {x ∈ V | ∀b ∈ B, dH (b, x) ≤ 2}. Since IH is chordal bipartite (Lemma 18) we can adapt the

12 technique of Lemma 3 in order to compute C(H)(i.e., we set k = 2, and then compute partitions of the subset B instead of computing partitions for the full half-set V ). It takes time linear in the size of IH , and so, it can be done in O(w(T )) time.

Computation of all the eccentricities in G. Before proving Theorem 3, we need a final ingredient. Let us first generalize Lemma 2 as follows.

Lemma 19. If G = (V0 ∪ V1,E) is an absolute retract of bipartite graphs then, the following holds for every i ∈ {0, 1} and v ∈ Vi:

• If eHi (v) ≤ rad(H1−i) − 1 then, eG(v) = 2eHi (v) + 1 = 2rad(H1−i) − 1.

• If eHi (v) = rad(H1−i) then, eG(v) = 2rad(H1−i) if and only if NG(v) ⊆ C(H1−i) and, for

every u ∈ V1−i, we have dH1−i (u, NG(v)) ≤ rad(H1−i)−1 (otherwise, eG(v) = 2rad(H1−i)+1).

• If eHi (v) ≥ rad(H1−i) + 1 then, eG(v) = 2eHi (v) if and only if we have eH1−i (u) < eHi (v) for

some neighbour u ∈ NG(v) (otherwise, eG(v) = 2eHi (v) + 1).

Proof. Let us first consider the case eHi (v) ≤ rad(H1−i) − 1. In particular, every neighbour u ∈ NG(v) is at a distance ≤ 1 + 2eHi (v) + 1 ≤ 2rad(H1−i) from any vertex of V1−i. Therefore, eHi (v) = rad(H1−i) − 1, and every vertex of NG(v) is central in H1−i. Observe that v must be at a distance ≥ 2rad(H1−i) − 1 from at least one vertex of V1−i since otherwise, the eccentricity of all the vertices of NG(v), in H1−i, would be < rad(H1−i). As a result, eG(v) = 2rad(H1−i) − 1.

Now, consider the case eHi (v) = rad(H1−i). Then, since G is bipartite, we have eG(v) = 2rad(H1−i) if and only if every vertex of V1−i is at a distance ≤ 2rad(H1−i) − 1 from vertex v (otherwise, eG(v) = 2rad(H1−i) + 1). Equivalently, eG(v) = 2rad(H1−i) if and only if, for every u ∈ V1−i, we have dG(u, NG(v)) ≤ 2rad(H1−i)−2. Again, since dH1−i (u, NG(v)) = dG(u, NG(v))/2, the latter is equivalent to have dH1−i (u, NG(v)) ≤ rad(H1−i) − 1. Note that since NG(v) is a clique of H1−i, this last equivalence also implies that NG(v) ⊆ C(H1−i).

Finally, consider the case eHi (v) ≥ rad(H1−i)+1. If furthermore there is a neighbour u ∈ NG(v) s.t. eH1−i (u) < eHi (v) then, vertex v is at a distance at most 2eH1−i (u) + 1 < 2eHi (v) from every vertex of V1−i, and so, eG(v) = 2eHi (v). Now, let us assume to have eH1−i (u) ≥ eHi (v) for every neighbour u ∈ NG(v). Suppose for the sake of contradiction eG(v) < 2eHi (v) + 1.

In particular, every vertex of V1−i must be at a distance at most 2eHi (v) − 1 from vertex v. 2eHi (v)−2 Equivalently for any x ∈ V1−i, the half-balls NG(v) and NG [x] ∩ V1−i intersect. Note that 2eHi (v)−2 2eHi (v) − 2 ≥ 2rad(H1−i) ≥ diam(H1−i). Hence, the half-balls NG [x] ∩ V1−i, x ∈ V1−i also pairwise intersect. But then, by Theorem 1, there is a neighbour u ∈ NG(v) such that eH1−i (u) ≤ (2eHi (v) − 2)/2 = eHi (v) − 1. A contradiction.

Of the three cases in the above Lemma 19, the real algorithmic challenge is the case eHi (v) = rad(H1−i), for some i ∈ {0, 1}. Finally, we prove that such case can be solved in linear time for chordal bipartite graphs.

Proof of Theorem 3. By Lemma 9, H0 and H1 are strongly chordal graphs. We compute clique- trees T0 and T1 for both H0 and H1, that takes linear time by Corollary 1. Note that in particular, for each i ∈ {0, 1} we get w(Ti) = O(m+n), with w(Ti) the sum of the cardinalities of the maximal cliques of Hi. Then, we compute all the eccentricities of H0 (resp, of H1), that is O(w(T0))- time equivalent to computing C(H0) according to Lemma 11 (resp., O(w(T1))-time equivalent to

13 computing C(H1)). By Proposition 1, the center can be computed in O(w(T0)) time (resp., in

O(w(T1)) time). Overall, for each i ∈ {0, 1} and every v ∈ Vi, we so computed eHi (v). It takes total linear time. Doing so, we can also compute rad(H0) and rad(H1) within the same amount of time. Finally, we are left explaining how to deduce from the latter the eccentricities eG(v), v ∈ V0

(the case v ∈ V1 is symmetric to this one). By Lemma 19, if eH0 (v) 6= rad(H1) then, we can compute eG(v) by scanning the neighbour set NG(v). Therefore, in total O(m) time, we can compute eG(v) for every v ∈ V0 s.t. eH0 (v) 6= rad(H1). In the same way, for every v ∈ V0 s.t. eH0 (v) = rad(H1) and NG(v) 6⊆ C(H1), we set directly eG(v) = 2rad(H1) + 1, that is correct by Lemma 19, and it also takes O(m) time in total.

Let S := {v ∈ V0 | eH0 (v) = rad(H1),NG(v) ⊆ C(H1)}. By Lemma 19, every vertex of S has eccentricity either 2rad(H1) or 2rad(H1) + 1 in G. We may further assume rad(H1) ≥ 3 because otherwise, we can compute the eccentricity of all the vertices of S in total O(m) time by applying the technique of Lemma 3. In this situation, we define a set W ⊆ V1 with the following property: for every v ∈ S, we have eG(v) = 2rad(H1) if and only if for every w ∈ W we have dG(v, w) ≤ 3. Note that doing so, we may compute the eccentricity of all the vertices of S in O(m) time by applying the same technique as for Lemma 3 (i.e., we set k = 3, then we compute partitions for W rather than for the full half-set V1). Furthermore, in order to compute this set W , we proceed in a quite similar fashion as for Proposition 1. We detail this procedure next. The algorithm. Let r = rad(H1). First, we compute a vertex c ∈ C(H1) that is adjacent to all the central vertices of H1 (such vertex is guaranteed to exist by Lemma 17). For every u ∈ V1   s.t. d (u, c) ≥ r − 1, we compute a vertex u∗ ∈ N r−2[u] ∩ T{N [x] | x ∈ N [c] ∩ N r−1[u]} H1 H1 H1 H1 H1 and we add this gate u∗ to the set W . Correctness. By Lemma 19, for every v ∈ S, we have eG(v) = 2rad(H1) if and only if, for every u ∈ V1, dH1 (u, NG(v)) ≤ r − 1. Note that if dH1 (u, c) ≤ r − 2 then, the distance in H1 between u and any vertex of C(H1) is at most r−1. So, we are only interested in those u s.t. dH (u, c) ≥ r−1.  1  Assume the existence for such vertex u of a u∗ ∈ N r−2[u]∩ T{N [x] | x ∈ N [c] ∩ N r−1[u]} . If H1 H1 H1 H1 ∗ dG(v, u ) ≤ 3 then, dG(u, v) ≤ 3+2(r−2) = 2r−1, as desired. Conversely, if eG(v) = 2rad(H1) then there must be a c ∈ N (v) ⊆ C(H ) s.t. d (c , u) ≤ r −1. In particular, c ∈ N [c]∩N r−1[u] ⊆ u G 1 H1 u u H1 H1 ∗ ∗ ∗ ∗ NH1 [u ] and therefore, dG(v, u ) ≤ dG(v, cu) + dG(cu, u ) = 1 + 2dH1 (cu, u ) ≤ 3. The existence of a u∗ as above was already proved in Proposition 1, but we repeat here the arguments for completeness. There are two cases. If d (u, c) = r then, N [c] ∩ N r−1[u] = L (u, r − 1, c), and H1 H1 H1 H1 the result follows from the combination of Lemmas 14 and 12. Otherwise, dH1 (u, c) = r − 1, and let Z = {z ∈ N [c] | d (u, z) = r − 1}. Since the balls N r−2[u] and N [z], z ∈ Z pairwise H1 H1 H1 H1 intersect, by the Helly property, there exists a u∗ ∈ N r−2[u] ∩ (T{N[z] | z ∈ Z}). Observe that H1 ∗ by construction, u ∈ LH1 (u, r − 2, c), that is a clique according to Lemma 14. We are done as N r−1[u] ∩ N [c] = L (u, r − 2, c) ∪ Z ⊆ N [u∗]. H1 H1 H1 H1 Complexity. The constructive proof of Proposition 1 yields an O(w(T1))-time algorithm in order to compute W . Therefore, this set W can be constructed in linear time.

3 k-chromatic graphs

Recall that a proper k-coloring of G = (V,E) is any mapping c : V → {1, 2, . . . , k} such that c(u) 6= c(v) for every edge uv ∈ E. The chromatic number of G is the least k such that it has a proper k-coloring, and a k-chromatic graph is a graph whose chromatic number is equal to k. Note

14 in particular with this definition that a (k − 1)-chromatic graph is not k-chromatic. We study the diameter within the absolute retracts of k-chromatic graphs, for every fixed k ≥ 3. Our approach requires such graphs to be equipped with a proper k-coloring. While this is a classic NP-hard problem for every k ≥ 3 [65], it is known that it can be done in polynomial time for absolute retracts of k-chromatic graphs [10]. We remind this colouring algorithm in Sec. 3.1 where we observe it can be implemented in order to run in linear time. Our general framework for diameter computation (somehow mimicking what we did in Sec. 2.1) is presented in Sec. 3.2. We complete our approach in Sec. 3.3, before concluding this section with its main result in Sec 3.4.

3.1 Colouring algorithm We start with a reminder of the Colouring algorithm presented in [10] (Algorithm 3). The descrip- tion below is exactly the same as in [10], where an O(n2) running-time was claimed.

Algorithm 3 Colouring algorithm. Require: A graph G = (V,E). 1: Pick a vertex u and let K be a maximal clique containing u. 2: Let k := |K| and let c : K → {1, 2, . . . , k} be a proper k-coloring. For each v ∈ K \{u}, colour the common neighbours of K \{v} with c(v). Then, let L be the set of vertices coloured so far. For each neighbour v of u not in L, there is a unique colour i such that u does not have a neighbour in L with colour i (otherwise, G is not an absolute retract). Assign c(u) := i. If NG[u] includes all of G, then goto Step 5. 3: For each vertex v ∈ V s.t. dG(u, v) = 2, there is a unique colour i not occurring in NG(u) ∩ NG(v) or in 2 {u} ∪ (NG(u) ∩ NG(v)) (otherwise, G is not an absolute retract). Assign c(v) := i. If NG[u] includes all of G, then goto Step 5, otherwise assign ` := 3. `−1 4: For each vertex v ∈ V s.t. dG(u, v) = `, there is a unique colour i not occurring in NG [u] ∩ NG(v) (otherwise, ` G is not an absolute retract). Assign c(v) := i. If NG[u] does not yet contain all of G, then assign ` := ` + 1 and start Step 4 again. 5: If c(u) = c(v) for some edge uv, then G is not an absolute retract. Otherwise, c is a proper k-coloring of G, and G is k-chromatic.

We refer to [10] for a correctness proof of Algorithm 3. Our modest, but important contribution for our claimed running-times is as follows:

Proposition 2. There is a linear-time algorithm such that, for every k ≥ 3, if the input G is an absolute retract of k-chromatic graphs, then it computes a proper k-coloring of G.

Proof. Consider the following modified version of Algorithm 3:

1. We start from an arbitrary vertex u and we greedily compute a maximal clique K containing vertex u. It takes linear time. Furthermore, let k := |K| and let c : K → {1, 2, . . . , k} be a proper k-coloring (i.e., obtained by numbering the vertices of K from 1 to k).

2. For every vertex x ∈ V , we compute |NG(x) ∩ K|. It can be done in linear time by scanning once the neighbourhood of each vertex v ∈ K. We consider the vertices v ∈ NG(u) \ K by non-increasing value of |NG(x) ∩ K|. Note that such ordering of NG(u) \ K can be computed using a linear-time sorting algorithm. As in the standard greedy coloring algorithm, we assign to v the least color i not present in its neighbourhood. If i ≥ k + 1 then, G is not an absolute retract and we stop. Doing so, it takes O(|NG(v)|) time in order to color v, and so, this whole step takes O(m) time.

15 3. We perform a breadth-first search rooted at u. Then, we consider the vertices v ∈ V s.t. dG(u, v) = 2. First, we search for the least color i such that i 6= c(u) and there is no neighbour of v coloured i. If i ≤ k then, we set c(v) := i. Otherwise, we assign to v the least color i not present in NG(v) (possibly, i = c(u)). If i ≥ k + 1 then, G is not an absolute retract and we stop. This whole step also takes O(m) time.

4. Finally, we consider all the remaining vertices v, dG(u, v) ≥ 3, by non-decreasing value of dG(u, v) (these distances were computed during the breadth-first search). Here also, we can compute such ordering of the remaining vertices by using a linear-time sorting algorithm. We apply the classic greedy coloring procedure, assigning to the current vertex v the least colour i not present in its neighbourhood. If i ≥ k + 1 then G is not an absolute retract, and we stop. Overall, the whole algorithm indeed runs in linear time. In order to prove correctness of this above algorithm, it suffices to prove that if G is an absolute retract, then it computes the same coloring as Algorithm 3. This is clear at Step 1, where we only colour the vertices of the maximal clique K. Then, at Step 2, we start coloring the neighbours of u with exactly k − 1 neighbours in K. Note that the only possible color amongst {1, . . . , k} to assign to such vertex x is c(v), where v is the unique non-neighbour of x in K. This is also what Algorithm 3 does. Let L be the set of vertices coloured so far. We continue coloring the remaining neighbours v ∈ NG(u) \ L. Algorithm 3 exploits the property that such vertices have exactly one color i ∈ {1, . . . , k} that is not present amongst their neighbours in L. But then, the classic greedy coloring procedure also assigns this color i to v. Next, consider a vertex v s.t. dG(u, v) = 2. If there is a unique available color i amongst {1, . . . , k} that is not present in NG(u) ∩ NG(v) then, Algorithm 3 assigns this color to v; so does the classic greedy coloring procedure. Otherwise, Algorithm 3 assigns to v the unique color amongst {1, . . . , k} that is not present in {u} ∪ (NG(u) ∩ NG(v)); so does our modified greedy coloring procedure, where we first exclude color c(u) from the range of possibilities. Finally, similar arguments apply to the vertices v s.t. dG(u, v) ≥ 3. In the remainder of the section, we always assume the input graph G to be given with a proper k-coloring. We sometimes use implicitly the fact that, for an absolute retract, such proper k-coloring is unique up to permuting the colour classes [76].

3.2 General framework The present section aims at introducing the necessary results and terminology for Sec 3.3. Recall that in a graph G = (V,E), a vertex v is covered by another vertex w if NG(v) ⊆ NG(w) (a covered vertex is called embeddable in [76]). We now introduce a first characterization of absolute retracts: Theorem 4 ([76]). Let k ≥ 3. The graph G = (V,E) is an absolute retract of k-chromatic graphs if and only if for any proper k-coloring c, every peripheral vertex v is adjacent to all vertices u with c(u) 6= c(v), or it is covered and G \ v is an absolute retract of k-chromatic graphs. We highlight the following special case of this characterization, that allows us to deal with the diameter-two case separately from the general case, namely: Proposition 3 ([76]). Let G = (V,E) be an absolute retract of k-chromatic graphs for some k ≥ 3, and let c be a corresponding proper k-coloring. Then, diam(G) ≤ 2 if and only if for every 1 ≤ i ≤ k, there exists a zi ∈ V with ziv ∈ E for all v ∈ V s.t. c(v) 6= i.

16 Corollary 2. If G = (V,E) is an absolute retract of k-chromatic graphs for some k ≥ 3, then we can decide whether diam(G) ≤ 2 in linear time. Proof. By Proposition 2, a proper k-coloring c : V → {1, . . . , k} can be computed in linear time. Then, we apply the criterion of Proposition 3. For that, for each colour i we choose as our candidate vertex for zi a maximum-degree vertex of colour i. Thus, in what follows, we focus on the case diam(G) ≥ 3. For that, we use in combination to Theorem 4 yet another characterization of absolute retracts (we refer the reader to [10] for other characterizations, leading to polynomial-time recognition algorithms): Theorem 5 ([10]). Let k ≥ 3. The graph G = (V,E) is an absolute retract of k-chromatic graphs if and only if the following conditions hold for any proper k-coloring c : V → {1, 2, . . . , k}: 1. For each colour i, any family of balls intersects in colour i whenever each pair of them does.

2. Every maximal clique of G has cardinality exactly k.

3. For each colour i and any two non-adjacent vertices u and v such that: c(v) 6= i, and either c(u) 6= i or dG(u, v) ≥ 3, there is a neighbour x of v on a shortest uv-path s.t. c(x) = i.

Let G = (V,E) be equipped with a proper k-coloring c. For every colour i, let Vi := {v ∈ V | c(v) = i} be called a colour class. We define, for every v ∈ Vi, ei(v) := max{dG(u, v) | u ∈ Vi}.A vertex v ∈ Vi is i-peripheral if it maximizes ei(v). Finally, let di := max{ei(v) | v ∈ Vi}. We now generalize Lemma 2, as follows: Lemma 20. Let G = (V,E) be an absolute retract of k-chromatic graphs for some k ≥ 3, and let c be a corresponding proper k-coloring. Then, max1≤i≤k di ≤ diam(G) ≤ 1 + max1≤i≤k di. Moreover, if diam(G) ≥ 3, then we have diam(G) = 1 + max1≤i≤k di if and only if:

• either max1≤i≤k di = 2;

• or, for some i 6= j s.t. di = dj is maximized, there is some i-peripheral vertex whose all neighbours coloured j are j-peripheral.

Proof. Clearly, we have max1≤i≤k di ≤ diam(G). In order to prove that we also have diam(G) ≤ 1 + max1≤i≤k di, it suffices to prove that each colour class Vi is a dominating set of G. For that, consider any vertex v ∈ V \ Vi. Let K be a maximal clique containing v. By Theorem 5, we have |K| = k, and therefore, K ∩ Vi 6= ∅. In particular, NG(v) ∩ Vi 6= ∅, as desired. In what follows, diam(G) ≥ 3. Then, if max1≤i≤k di = 2, we must have diam(G) = 1 + max1≤i≤k di = 3. From now on, we assume diam(G) ≥ max1≤i≤k di ≥ 3. Let us first assume diam(G) = 1 + max1≤i≤k di. Consider some peripheral vertex v of G, and let c(v) = i. Since Vi is a dominating set of G, eG(v) ≤ 1 + ei(v) ≤ 1 + di. In particular, we must have di is maximized and v is i-peripheral (otherwise, eG(v) < diam(G)). We pick some u ∈ V such that dG(u, v) = diam(G), and let c(u) = j. Note that j 6= i (otherwise, dG(u, v) ≤ di < diam(G)). Let x ∈ NG(v) ∩ Vj be arbitrary. Observe that we always have dG(u, v) ≤ 1 + dG(u, x) ≤ 1 + ej(x) ≤ 1 + dj. As a result, dj = di is maximized, and any neighbour x of vertex v with c(x) = j is j-peripheral. Conversely, suppose by contradiction this above necessary condition for having diam(G) = 1+max1≤i≤k di is not sufficient on its own for the absolute retracts of k-chromatic graphs. Without

17 loss of generality, amongst all the absolute retracts of k-chromatic graphs, G is a minimum counter- example for which the condition holds and diam(G) = max1≤i≤k di. For some i 6= j such that di = dj is maximized, let v be a i-peripheral vertex whose all neighbours coloured j are j-peripheral, and let u ∈ NG(v) be such that c(u) = j. Then, eG(u) = dj = di = diam(G). Observe that u cannot be adjacent to all the vertices coloured i (otherwise, di = 2 < 3). Therefore, by Theorem 4, u is covered 0 0 0 0 and G = G\u is an absolute retract of k-chromatic graphs. Let V1,V2,...,Vk be the colour classes 0 0 of G (induced by the coloring c restricted on V \{u}). Observe that for p 6= j we have Vp = Vp, 0 0 0 0 while Vj = Vj \{u}. Furthermore, let d1, d2, . . . , dk be the largest distances between vertices in a 0 0 0 0 0 same colour class of G . Since G is isometric, dp ≤ dp for all p. But, since Vi = Vi, we get di = di, 0 0 0 and therefore, maxp dp = maxp dp = di = diam(G). It implies diam(G ) = diam(G) = maxp dp. By minimality of G, the subgraph G0 is not a counter-example. Hence, vertex v must have some 0 0 neighbour u 6= u coloured j s.t. max{dG(u , x) | x ∈ Vj \{u}} ≤ di − 1. However, it implies 0 0 ej(u ) ≤ max{dG(u , u), di − 1} = max{2, di − 1} = di − 1. A contradiction.

3.3 Computation of the di’s Our strategy is as follows. First, we prove in Lemma 21 that we can reduce our study to the case √ √ k = 3. In Lemmas 22 and 25, respectively, we deal with the cases di = O( n) and di = Ω( n), respectively.

Reduction. The next Lemma 21 allows us to reduce the general case to k = 3.

Lemma 21. Let G = (V,E) be an absolute retract of k-chromatic graphs for some k ≥ 3, and let c be a corresponding proper k-coloring. For every distinct colours i1, i2, i3, the subgraph H :=

G[Vi1 ∪ Vi2 ∪ Vi3 ] is isometric. Moreover, H is an absolute retract of 3-chromatic graphs. Proof. Suppose by contradiction H is not isometric in G. Let u, v ∈ V (H) be such that no shortest uv-path of G is contained in H, and dG(u, v) is minimum for this property. Since H is induced, dG(u, v) > 1. But then, let j ∈ {i1, i2, i3}\{c(u), c(v)}. By Theorem 5, there is a neighbour x of v that is on a shortest uv-path of G and such that c(x) = j. In particular, x ∈ V (H). Since H is induced, we have vx ∈ E(H). However, by minimality of dG(u, v) we also have dH (x, u) = dG(x, u), and therefore dH (u, v) ≤ 1 + dH (x, u) = 1 + dG(x, u) = dG(v, u). A contradiction. Now, let us prove that H is an absolute retract of 3-chromatic graphs. For that, it suffices to prove that H satisfies the three properties stated in Theorem 5. – Note that, since c is the unique proper k-coloring of G, the restriction of c to H is the unique proper 3-coloring of this subgraph. –

r1 r2 1. Let j ∈ {i1, i2, i3} be fixed. Consider some family of balls in H, denoted NH [v1],NH [v2],..., rq NH [vq]. Let us assume these balls pairwise intersect in colour j, i.e., for every 1 ≤ a, b ≤ q we ra rb r1 r2 rq have NH [va]∩NH [vb]∩Vj 6= ∅. Since H is a subgraph of G, the balls NG [v1],NG [v2],...,NG [vq] also pairwise intersect in colour j (in G). By Theorem 5, there exists a vertex zj ∈ Vj ∩ T ra  {NG [va] | 1 ≤ a ≤ q} . Since Vj ⊆ V (H), and H is isometric in G, we get zj ∈ Vj ∩ T ra  {NH [va] | 1 ≤ a ≤ q} . 2. Let K be a maximal clique of H. We have K ⊆ K0 where K0 is a maximal clique of G. By Theorem 5, |K0| = k. It implies that every colour class intersects K0. Hence, 0 |K| = |K ∩ (Vi1 ∪ Vi2 ∪ Vi3 )| = 3.

18 3. Finally, let u, v ∈ V (H) and let j ∈ {i1, i2, i3} be such that c(v) 6= j and either c(u) 6= j or dH (u, v) ≥ 3. Since H is isometric, either c(u) 6= j or dG(u, v) ≥ 3. By Theorem 5, there exists a neighbour x of v coloured j that is on a shortest uv-path in G. Since x ∈ V (H) and H is isometric, x is also on a shortest uv-path in H.

Overall, all three properties of Theorem 5 are satisfied by H. It implies that H is an absolute retract of 3-chromatic graphs.

Small-diameter case. Next, we deal with the case when di is sufficiently small. Lemma 22. Let G = (V,E) be an absolute retract of 3-chromatic graphs, and let c be a corre- sponding proper 3-coloring. For each colour i and D ≥ 2, we can compute in O(Dm) time the set Ui := {v ∈ Vi | ei(u) ≤ D}. Proof. It suffices to prove the result for i = 1. For that, we generalize the techniques used in Lemma 3. Specifically, for every 1 ≤ t ≤ D, the objective is to compute a partition of V1, denoted Pt, subject to the following property: for each colour i, the |Pt| subsets Bt[A, i] := Vi ∩ T t  {NG[a] | a ∈ A} , for all A ∈ Pt, must be pairwise disjoint and, if i 6= 1 or t ≥ 2, these sets must also be nonempty. Being given any such partition PD, we observe that U1 6= ∅ if and only if PD = (V1) and, if it is the case, then U1 = BD[V1, 1].

The algorithm. For the base case t = 1, let Y := V1. While Y 6= ∅, we select some vertex x ∈ V2 such that |NG(x) ∩ Y | is maximized, we add NG(x) ∩ Y as a new group in P1, then we set Y := Y \ NG(x). Finally, we enumerate all groups A ∈ P1, and we scan the neighbourhoods of all vertices a ∈ A in order to compute the sets B1[A, i] for each colour i (note that B1[A, 1] = A if |A| = 1 and B1[A, 1] = ∅ otherwise). At step t + 1, for each group A ∈ Pt, let us define:

W (A, 1) := NG(Bt[A, 2]) ∩ V1,

W (A, 2) := NG(Bt[A, 3]) ∩ V2,

W (A, 3) := NG(Bt[A, 2]) ∩ V3.

Let F := Pt. While F= 6 ∅, we proceed as follows. We pick some v ∈ V1 such that #{A ∈ F | v ∈ 0 S 0 W (A, 1)} is maximized. Let A := {A ∈ F | v ∈ W (A, 1)}. We add A to Pt+1, for each colour i we 0 T set Bt+1[A , i] := {W (A, i) | A ∈ F, v ∈ W (A, 1)}, and we set F := F\{A ∈ F | v ∈ W (A, 1)}.

Correctness. We first consider the base case t = 1. Clearly, the sets B1[A, 1] (equal to either A, if it is a singleton, and to the empty set otherwise) are pairwise disjoint. Since at every step, in order to create a new group, we pick a vertex of V2 with a maximum number of unselected vertices in V1, it follows by construction that the sets B1[A, 2] are nonempty. By maximality of the vertex V2 selected at each step, it also follows that all these sets B1[A, 2] are pairwise disjoint (this is exactly the same argument as the one used for Claim 2, in Lemma 3). The next claim shows that both properties (i.e., being nonempty and pairwise disjoint) also hold for the sets B1[A, 3].

Claim 3. For A ⊆ V1, the neighbour-sets NG(a), a ∈ A intersect in colour 2 if and only if they intersect in colour 3.

19 Proof. Let us assume the balls NG[a], a ∈ A intersect in colour 2 (resp., in colour 3). In particular, the vertices of A are pairwise at distance two. By the third property of Theorem 5, the balls NG[a], a ∈ A pairwise intersect in colour 3 (resp., in colour 2), and therefore the claim now follows from the first (Helly-type) property of this Theorem 5.  From now on, we consider the inductive step (i.e., from t to t + 1). We need the following claim for our analysis: T t+1  Claim 4. For each colour i, t ≥ 1 and A ∈ Pt, we have W (A, i) = Vi ∩ {NG [a] | a ∈ A |} . T t+1  T t+1 Proof. By construction, W (A, i) ⊆ Vi ∩ {NG [a] | a ∈ A} . Conversely, let u ∈ {NG [a] | a ∈ A} be such that c(u) = i. Let j be the least colour available amongst {2, 3}\{i} (i.e., j = 2 if t i 6= 2 and j = 3 otherwise). We prove as a subclaim that, for every a ∈ A, the balls NG[a] and NG[u] intersect in colour j. For that, we need to consider three cases:

t t • Case u = a. This can only happen if i = 1. Then, NG[u] ⊆ NG[u] = NG[a]. Since u has at t least one neighbour coloured j, the balls NG[a] and NG[u] trivially intersect in colour j. • Case ua ∈ E. By Theorem 5, every maximal clique of G has cardinality 3. It implies that u, a have a common neighbour coloured j.

• Case dG(u, a) ≥ 2. By Theorem 5, there exists a neighbour x of u on a shortest au-path such that c(x) = j.

t Furthermore, since Bt[A, j] 6= ∅, the balls NG[a], a ∈ A, also pairwise intersect in colour j. By Theorem 5, there exists a x ∈ NG(u) ∩ Bt[A, j]. In order to conclude the proof, we just need to observe that u ∈ NG(Bt[A, j]) ∩ Vi = W (A, i).  0 When a new set A is created, as the union of sets in some nonempty family Q ⊆ Pt, we define 0 T 0 for each colour i, Bt+1[A , i] = {W (A, i) | A ∈ Q}. By the above Claim 4, Bt+1[A , i] = Vi ∩ T t+1 0 0 0  0 0 {NG [a ] | a ∈ A |} , as desired. It now remains to prove that all sets Bt+1[A , i],A ∈ Pt+1 are nonempty and pairwise disjoint. Observe that in order to create a new group, we repeatedly pick a vertex v ∈ V1 with a maximum number of unselected groups A ∈ Pt such that v ∈ W (A, 1). To ensure that all groups A ∈ Pt are eventually selected, we prove that:

Claim 5. For each t ≥ 1 and A ∈ Pt, we have W (A, 1) 6= ∅.

Proof. Let x ∈ Bt[A, 2]. Since G is an absolute retract, NG(x) ∩ V1 6= ∅. We are now done as we have by construction NG(x) ∩ V1 ⊆ W (A, 1).  0 0 By maximality of the vertex of V1 selected at each step, the sets Bt+1[A , 1],A ∈ Pt+1 are nonempty and pairwise disjoint. Finally, the next claim shows that both properties also hold for 0 the sets Bt+1[A , i], for any colour i: t Claim 6. For each colour i 6= 1, A ⊆ V1 and t ≥ 2, the balls NG[a], a ∈ A intersect in colour 1 if and only if they also intersect in colour i. t 0 Proof. First assume that the balls NG[a], a ∈ A intersect in colour 1. Let a, a ∈ A and let t t 0 v ∈ NG[a] ∩ NG[a ] such that c(v) = 1. W.l.o.g., a 6= v. For j ∈ {2, 3}\{i}, by Theorem 5 there exists a neighbour x of v on a shortest av-path such that c(x) = j. We divide our analysis into three cases:

20 • Case xa0 ∈/ E. By Theorem 5, there exists a neighbour y of x on a shortest xa0-path such that t t 0 c(y) = i. Note that y ∈ NG[a] ∩ NG[a ]. 0 0 • Case xa, xa ∈ E. By Claim 3, the neighbour-sets NG(a),NG(a ) intersect in colour i. Since t t 0 t ≥ 2, so do the balls NG[a],NG[a ]. • Case xa∈ / E, xa0 ∈ E. By Theorem 5, there exists a neighbour y of x on a shortest ax-path t−2 2 0 t t 0 such that c(y) = i. Note that y ∈ NG [a] ∩ NG[a ] ⊆ NG[a] ∩ NG[a ]. t Overall, the balls NG[a], a ∈ A pairwise intersect in colour i, and therefore by Theorem 5 there is a vertex coloured i in their common intersection. t 0 Conversely, assume that the balls NG[a], a ∈ A intersect in colour i. Let a, a ∈ A and let t t 0 u ∈ NG[a] ∩ NG[a ] such that c(u) = i. Here also, we divide our analysis into several cases: 0 • Case ua, ua ∈/ E. Let j ∈ {2, 3}\{i}. By Theorem 5 (applied twice) there exist x, y ∈ NG(u) that are on a shortest au-path and a shortest a0u-path respectively, such that c(x) = c(y) = t t 0 j. If x = y then, any neighbour z ∈ NG(x) coloured 1 is in NG[a] ∩ NG[a ]. Otherwise, dG(x, y) = 2. By Theorem 5, there is a shortest xy-path whose internal node z has colour 1. t t 0 Here also, z ∈ NG[a] ∩ NG[a ]. 0 0 2 t 2 0 • Case ua, ua ∈ E. In this situation, dG(a, a ) = 2, and the balls NG[a] ⊆ NG[a] and NG[a ] ⊆ t 0 NG[a ] intersect in colour 1. 0 0 0 • Case ua ∈ E, ua ∈/ E (The case ua∈ / E, ua ∈ E is symmetrical to this one). If dG(a, a ) ≤ t t t 0 0 0 then, the balls NG[a] and NG[a ] intersect in colour 1. Otherwise, dG(a , u) = t and dG(a, a ) = 0 t+1. If furthermore dG(u, a ) = t ≥ 3 then, by Theorem 5, there exists a neighbour x of u on a 0 2 t−1 0 t t 0 shortest a u-path such that c(x) = 1. In this situation, x ∈ NG[a]∩NG [a ] ⊆ NG[a]∩NG[a ]. Thus, we are left considering the special subcase t = 2. Let j ∈ {2, 3}\{i}, and let v ∈ 0 NG(a ) ∩ NG(u). Observe that we have c(v) = j. Furthermore, by Theorem 5, vertices a and u must have a common neighbour y coloured j (i.e., the third vertex in a maximal clique containing a and u). By construction, dG(y, v) = 2. Then, again by Theorem 5, there exists a common neighbour z ∈ NG(y) ∩ NG(v) such that c(y) = 1. In this situation, 2 2 0 t t 0 y ∈ NG[a] ∩ NG[a ] ⊆ NG[a] ∩ NG[a ]. t Overall, the balls NG[a], a ∈ A pairwise intersect in colour 1, and therefore by Theorem 5 there is a vertex coloured 1 in their common intersection.  Complexity. We revisit the approach taken in Lemma 3. For the base case t = 1 we compute in O(m) time, for each vertex of V2, its number of neighbours in V1. We create an array of |V1| lists, numbered from 1 to |V1|. Each vertex u ∈ V2 is put in the list numbered |NG(u) ∩ V1|. It takes O(n) time. Then, we scan the lists in decreasing order (i.e., from |V1| downto 1), going to the next list each time the current one is empty. When the current list is nonempty, we pick any vertex u of this list in order to create the next subset A ∈ P1. Note that A can be constructed in O(|NG(u)|) time. Since each vertex u gets used for the creation of at most one group (otherwise, 0 0 there would exist A, A ∈ P1 such that B1[A, 2] ∩ B1[A , 2] 6= ∅), the total running time in order to create all the groups of P1 is in O(n + m). Furthermore, after a group A is created, we need to actualize the number of unselected vertices in V1 for each x ∈ V2 (discarding all such vertices whose all neighbours in V1 are already selected). For that, we first scan NG(a), a ∈ A in order to

21 update, for each x ∈ V2, its number of unselected vertices in V1. Then, if each vertex of V2 keeps a pointer to its position in the unique list in which it is contained, we can update the list contents in P O( a∈A |NG(a)|) time (maximum number of vertices of V2 that need to be moved). Overall, this phase also takes total O(n + m) time. Finally, since P1 is a partition of V1, for each colour i we can create the sets B1[A, i], i ∈ A in O(m) time, simply by scanning the neighbour-sets of each vertex of V1. In order to complete our complexity analysis, it remains to prove that each inductive step (from t to t+1) also requires O(m) time. For that, since by the hypothesis the sets Bt[A, i],A ∈ Pt are pairwise disjoint, we can compute the sets W (A, i) in total linear time. Then, we proceed as for the first case (see also Lemma 3), but we now consider the vertices of V1 rather than V2, and for these vertices, we keep track of the number of sets W (A, i) they belong to rather than keeping track of their degrees. We get a running time proportional to P W (A, i) = O(n + m). A∈Pt

Large-diameter case. Finally, we address the case when di is large. For that, we start with a simple intermediate lemma. Recall that, for every two vertices u and v and any ` ≤ d(u, v), we can define the slice L(u, `, v) := {x ∈ I(u, v) | d(u, x) = `}. Lemma 23. Let G = (V,E) be an absolute retract of k-chromatic graphs for some k ≥ 3, and let c be a corresponding proper k-coloring. For each colour i and u, v ∈ Vi such that u 6= v and dG(u, v) 6= 3, there exists a x ∈ L(u, 2, v) coloured i.

Proof. If dG(u, v) = 2 then, x = v. Otherwise, dG(u, v) ≥ 4. By Theorem 5, for any j 6= i there exists a neighbour y of u coloured j on a shortest uv-path. Since dG(y, v) ≥ 3, again by Theorem 5, there exists a neighbour x of y coloured i on a shortest yv-path, and so, on a shortest uv-path. A function is called unimodal if every local minimum is also a global minimum. It is known that the eccentricity function of a Helly graph is unimodal [36], and this property got used in [40] in order to compute all the eccentricities in this graph class in subquadratic time. Next, we prove that a similar, but weaker property holds for each colour class of absolute retracts, namely: Lemma 24. Let G = (V,E) be an absolute retract of k-chromatic graphs for some k ≥ 3, and let c be a corresponding proper k-coloring. For each colour i and any u ∈ Vi s.t. ei(u) ≥ (di + 5)/2 ≥ 7, 0 0 0 there exists a u ∈ Vi s.t. dG(u, u ) = 2 and ei(u ) = ei(u) − 2. 2 Proof. Let Xi = {x ∈ Vi | dG(u, x) ≥ 4}. By Lemma 23, for every x ∈ Xi, the balls NG[u] and ei(u)−2 0 0 NG [x] intersect in colour i. Furthermore, let x, x ∈ Xi be arbitrary. If dG(x, x ) ≤ ei(u) − 2 ei(u)−2 ei(u)−2 0 0 then the balls NG [x] and NG [x ] intersect in colour i. Otherwise, let ` := dG(x, x ) − (ei(u) − 2), and let 2t ∈ {`, ` + 1} be even. We prove by finite induction the existence of vertices 0 x0, x1, . . . , xt ∈ IG(x, x ) s.t., for every 0 ≤ p ≤ t, we have dG(x, xp) = 2p and c(xp) = i. For the base case p = 0, we have x0 = x. For 0 < p ≤ t, we observe that: 0 0 0 dG(xp−1, x ) = dG(x, x ) − 2(p − 1) = dG(x, x ) − 2p + 2 0 0 ≥ dG(x, x ) − 2t + 2 ≥ dG(x, x ) − (` + 1) + 2 0 = dG(x, x ) − ` + 1 = ei(u) − 1 > 3. 0 Then, the existence of xp follows from Lemma 23 (applied to the pair xp−1, x ). Furthermore, 0 2t ≤ ` + 1 = dG(x, x ) − ei(u) + 3 ≤ di − ei(u) + 3

≤ di − (di + 5)/2 + 3 = (di + 1)/2 = (di + 5)/2 − 2

≤ ei(u) − 2.

22 ei(u)−2 ei(u)−2 0 2 Thus, in this situation, x2t ∈ NG [x] ∩ NG [x ]. Overall, we obtain that the balls NG[u] ei(u)−2 0 2 and N [x], x ∈ Xi pairwise intersect in colour i. By Theorem 5, there exists a u ∈ N [u] ∩  G  G T ei(u)−2 0 0 {NG [x] | x ∈ Xi} such that c(u ) = i. Note that u 6= u because there must be a x ∈ Xi 0 s.t. dG(u, x) = ei(u) ≥ 4. We obtain that dG(u, u ) = 2 and that, for every x ∈ Vi \ Xi we have 0 0 0 dG(u , x) ≤ 2+dG(u, x) ≤ 5. As a result, ei(u ) ≤ max{5, ei(u)−2} = ei(u)−2. Since dG(u, u ) = 2, this must be an equality.

We end up applying this almost-unimodality property to the computation of the d ’s (assuming √ i these values to be at least in Ω( n)):

Lemma 25. Let G = (V,E) be an absolute retract of k-chromatic graphs for some k ≥ 3, let c be a corresponding proper k-coloring, and let i be such that di ≥ 8D + 5 = ω(log n). Then, with high probability, we can compute in total O˜(mn/D) time the value di and the i-peripheral vertices. Proof. We modify Algorithm 1 as follows. log n The algorithm. We set p = α D , for some sufficiently large constant α. Then, let Ui(p) contain every v ∈ Vi independently with probability p. For all v ∈ Vi, lete ¯i(v) := min{dG(u, v) + ei(u) | u ∈ Ui(p), dG(u, v) ≤ D} (with the understanding that, if no vertex of Ui(p) is at a distance ≤ D from v, thene ¯i(v) = 0). We output di = max{e¯i(v) | v ∈ Vi}, and we identify as i-peripheral all vertices v ∈ Vi such thate ¯i(v) is maximized.

Complexity. Since we have to perform a breadth-first search from every vertex of Ui(p), the running time of the algorithm is in O(m|Ui(p)|). Let us prove that with high probability, |Ui(p)| = ˜ ˜ O(n/D). First note that we have E [ |Ui(p)| ] = Θ(|Vi|/D). We claim to have |Vi| = Ω(D). In order to see that, consider x, y ∈ Vi s.t. dG(x, y) = di. Recall that di = Ω(D). Thus, by applying Lemma 23 Ω(D) times, we get the existence of a shortest xy-path with Ω(D) vertices coloured i. The latter proves, as claimed, |Vi| = Ω(D). Then, E [ |Ui(p)| ] = Ω(log n). By Chernoff bounds, we have |Ui(p)| = O˜(|Vi|/D) = O˜(n/D) with high probability.

Correctness. Let v ∈ Vi be arbitrary. We divide our analysis into two cases.

• Case ei(v) < (di + 5)/2 + 2D. For any u ∈ Ui(p) s.t. dG(u, v) ≤ D, ei(u) < (di + 5)/2 + 3D. Therefore,e ¯i(v) < (di + 5)/2 + 4D = di/2 + (8D + 5)/2 ≤ di.

• Case ei(v) ≥ (di + 5)/2 + 2D. In particular, we always fall in this case if v is i-peripheral. Then, by applying Lemma 24 D times, we get the existence of vertices x0 = v, x1, x2, . . . , xD such that, for every j > 0, dG(xj−1, xj) = 2 and ei(xj) = ei(xj−1) − 2. Observe that we have dG(v, xj) ≤ 2j and ei(xj) = ei(v) − 2j, and therefore dG(v, xj) = 2j. It implies that, if xj ∈ Ui(p) for some j,e ¯i(v) = ei(v). Let us prove this happens with high probability. Indeed:

α log n D −α Pr[Ui(p) ∩ {x0, x1, . . . , xD} = ∅] < (1 − p) = (1 − p) p ≤ n .

Summarizing both cases above, for all i-peripheral vertices v we havee ¯i(v) = ei(v) = di, whereas for every v ∈ Vi that is not i-peripheral,e ¯i(v) < di.

3.4 Main result We end up gathering all previous results in this section, in order to prove the following:

23 Theorem 6. If G = (V,E) is an absolute retract of k-chromatic graphs, for some k ≥ 3, then we √ can compute its diameter with high probability in O˜(m n) time. Proof. We may assume diam(G) > 1 (trivial case). By Corollary 2, we can decide in linear time whether diam(G) ≤ 2. Thus, from now on, let us assume diam(G) ≥ 3. We compute a proper k-coloring of G, that takes linear-time according to Proposition 2. Then, by Lemma 20, we can compute diam(G) in linear time if, for each colour i, we are given di and the corresponding i- peripheral vertices. In order to compute this information, let V1,V2,...,Vk be the colour classes. Up to repeating V1 (= Vk+1) and V2 (= Vk+2) at most once we may assume the number of colour to be a multiple of three, and then we partition the colour classes in disjoint triples Vi ∪Vi+1 ∪Vi+2. By Lemma 21, each subgraph Hi := G[Vi ∪ Vi+1 ∪ Vi+2] is isometric in G and is an absolute retract of 3-chromatic graphs. Therefore, we may restrict ourselves to Hi in order to compute the values d , d , d . Let n := |V (H )| and m := |E(H )|. By construction, P n = Θ(n) and i i+1 i+2 i i i i √ i i P m = Θ(m). Hence, if for each i our computations require O˜(m n ) time, the total running i i √ i i time is in O˜(m n). Let us prove it is the case for H1 (and so, by symmetry, for every i). Since there are only three colour classes in H , it is sufficient to prove that we can compute d and √ 1 1 all the 1-peripheral vertices in O˜(m1 n1) time. For that, we first compute D := e1(v) for some arbitrary v ∈ V . It takes O(m ) time and, by the triangular inequality, it is a 2-approximation of 1 1 √ d1. There are now two cases. If D ≤ 16 n1 + 10 then, we compute by one-sided binary search the smallest t such that ∀v ∈ V , e (v) ≤ t, that is exactly d . Note that at each step of the binary 1 1 1 √ search we apply Lemma 22, that results in a running time in O˜(m1d1) = O˜(m1D) = O˜(m1 n1). Furthermore, we can compute all the 1-peripheral vertices within the same amount of time, simply √ with one more call to Lemma 22 (for d − 1). Otherwise, d ≥ D/2 ≥ 8 n + 5, and we apply 1 1 √ 1 Lemma 4. With high probability, the running time is in O˜(m1 n1).

4 Split graphs

The graphs studied in the two previous Sec. 2 and 3 are exactly the absolute retracts of the class of all (irreflexive) graphs. In this section, we show that by considering the absolute retracts of more restricted graph classes, we may derive negative results about faster diameter computation. Specifically, G = (V,E) is a split graph if its vertex-set V can be partitioned into a clique K and a stable set S. In what follows, we always denote such a bipartition by K + S. We also use the standard notations ω(G) and α(G) for, respectively, the clique number (maximum cardinality of a clique) and the independence number (maximum cardinality of a stable set) of G. Let us recall the following hardness result about the diameter problem on split graphs: Lemma 26 ([15]). For any  > 0, there exists a c() s.t., under SETH, we cannot compute the diameter in O(n2−) time on the split graphs of order n and clique-number at most c() log n. Our main result in this section is that this above hardness result also holds for the absolute retracts of split graphs (Theorem 8). For that, we need a few preparatory lemmas, namely: Lemma 27 ([57]). Let G = (K + S, E) be a split graph. Exactly one of the following conditions holds: 1. |K| = ω(G) and |S| = α(G) (in this case the partition K + S is unique);

2. |K| = ω(G) − 1 and |S| = α(G) (in this case there exists an y ∈ S s.t. K + {y} is complete);

24 3. |K| = ω(G) and |S| = α(G) − 1 (in this case there exists an x ∈ K s.t. S + {x} is stable). Recall that G = (V,E) is a complete split graph if there exists a partition of its vertex-set into a clique K and a stable set S s.t. every vertex of S is adjacent to every vertex of K. In particular, a complete split graph has diameter at most two. Theorem 7 ([66]). A split graph is an absolute retract of split graphs if and only if it is a complete split graph or it has a unique partition of its vertex-set into a clique and a stable set. We are now ready to prove the main result of this section, namely: Theorem 8. There is a linear-time reduction from the diameter problem on split graphs to the same problem on the absolute retracts of split graphs. In particular, for any  > 0, there exists a c() s.t., under SETH, we cannot compute the diameter in O(n2−) time on the absolute retracts of split graphs of order n and clique-number at most c() log n. Proof. Let G = (V,E) be a split graph. First, we check in linear time whether diam(G) = 0 (i.e., G is a singleton) or diam(G) = 1 (i.e., G is a complete graph). From now on, let us assume diam(G) ≥ 2. Since G is a split graph, computing the diameter is equivalent to deciding whether diam(G) = 3. For that, we compute a partition of V into a clique K and a stable set S. It can be done in linear time [57]. For every vertex v, let deg(v) := |N(v)|. We apply the following pruning rules until no more vertex can be removed:

• If there exists a x ∈ K s.t. deg(x) = |K| − 1, then we remove x from G.

• If there exists a y ∈ S s.t. deg(y) = |K|, then we remove y from G. Complexity. Let us explain how both rules above can be applied exhaustively in total linear time. For that, we maintain an array of n − 1 lists, numbered from 1 to n − 1, so that each vertex of S of degree i must be contained into the ith such list. We proceed similarly for the vertices of K (but in a separate array of lists). Note that such a data structure can be initialized in linear time, simply by computing the degree sequence of the graph. If we further store, for each vertex, a pointer to its position in the unique list in which it is contained, then every time we remove a vertex v, we can update the structure in a time proportional to deg(v). The latter results in a total update time in O(m). Finally, if at each step we maintain the cardinality |K| of the clique K, then in order to check whether one of the two pruning rules applies, we are left testing whether at most two lists of our data structure are nonempty. Correctness. In order to prove correctness of these above pruning rules, let us first define a super- simplicial vertex as any vertex v s.t. N(v) = K \{v}. Note that if x ∈ K is s.t. deg(x) = |K| − 1 then, N(x) = K \{x}, and so, x is super-simplicial. In the same way if y ∈ S is s.t. deg(y) = |K| then, N(y) = K, and so, y is super-simplicial. Summarizing the above, we can only prune super- simplicial vertices. Now, we claim that, for a split graph G and a super-simplicial vertex v of G, we have diam(G) = 3 if and only if diam(G \{v}) = 3. Indeed, since G \{v} is an isometric subgraph of G, diam(G \{v}) = 3 implies diam(G) ≥ 3, hence (since G is a split graph) diam(G) = 3. Conversely, if diam(G) = 3 then, there exist y, y0 ∈ S s.t. d(y, y0) = 3. In order to prove that diam(G \{v}) = 3, it suffices to prove that none of y and y0 can be a super-simplicial vertex. That is indeed the case because, since K is a dominating set of G, any super-simplicial vertex has eccentricity at most two.

25 Finally, let G0 be the resulting subgraph after no more vertex can be removed. Observe that we have reduced the computation of diam(G) to the computation of diam(G0). We shall prove that there exists a unique partition of V (G0) into a clique K0 and a stable set S0. By Theorem 7, this will imply that G0 is an absolute retract of split graphs. Let K0 and S0 be a partition of V (G0) into a clique and a stable set, and suppose for the sake of contradiction this partition is not unique. By Lemma 27, either there exists y ∈ S0 s.t. K0 + {y} is complete, or there exists x ∈ K0 s.t. S0 + {x} is a stable set. In the former case, deg(y) = |K0|, while in the latter case, deg(x) = |K0| − 1. But then, we could still have applied one of our two pruning rules above, a contradiction.

5 Planar graphs

Our last (non-algorithmic) section is about the absolute retracts of planar graphs The latter have been characterized in [61], assuming the Four-color conjecture. Since this is now a theorem [3], the characterization of absolute retracts of planar graphs is complete:

Theorem 9 ([61]). A planar graph G is an absolute retract of planar graphs if and only if it is maximal planar and, in an embedding of G in the plane, any triangle bounding a face of G belongs to a subgraph of G isomorphic to K4. To our best knowledge, there has been no relation uncovered between the absolute retracts of planar graphs and other important planar graph subclasses. We make a first step in this direction. Specifically, the Apollonian networks are a subclass of planar graphs that can be defined recursively, as follows. The triangle K3 is an Apollonian network. If G is an Apollonian network, and f a triangular face in a plane embedding of G, then the graph G0, obtained by adding a new vertex adjacent to the three ends of f, is also an Apollonian network. The Apollonian networks of order at least four (all Apollonian networks but the triangle) have some important alternative characterizations, namely they are exactly the maximal planar chordal graphs of order at least four [71], the planar 3-trees [13], and the uniquely 4-colorable planar graphs [54].

Proposition 4. Every Apollonian network with at least four vertices is an absolute retract of planar graphs.

Proof. Let G be an Apollonian network of order at least four. In particular, G is maximal planar. Consider any triangular face f in a plane embedding of G. We also have that G is a 3-tree, and so, all its maximal cliques have four vertices. In particular, there exists a vertex adjacent to all three vertices of f. By Theorem 9, G is an absolute retract of planar graphs.

However, this above inclusion is strict (e.g., see Fig. 1 for a counter-example). Indeed, our main result in this section is as follows:

Theorem 10. Every connected planar graph is an isometric subgraph of some absolute planar retract. In particular, there are absolute retracts of planar graphs with arbitrarily large treewidth.

Proof. Let G = (V,E) be a connected planar graph. The result is trivial if |V | ≤ 2. From now on, we assume |V | ≥ 3. We first prove the existence of a biconnected planar graph H1 in which G isometrically embeds. If G is already biconnected, then we set H1 := G. Otherwise, let u be a cut-vertex of G. In any fixed planar embedding of G, consider a clock-wise ordering of NG(u). There must be two consecutive neighbours x, y in different connected components of G \ u. We

26 Figure 1: An absolute planar retract of treewidth ≥ 5. add a new vertex z∈ / V such that N(z) = {u, x, y}. Since x, y are consecutive in the clock-wise 0 ordering of NG(u), the resulting graph G := G + u is still planar. It is also easy to check that G isometrically embeds in G0 because u, x, y are pairwise at distance at most two in G. Overall, by iterating this above operation, we obtain the desired biconnected planar graph H1 in which G isometrically embeds. Note that because H1 is biconnected, in any plane embedding of H1, the boundary of each face is a simple cycle [35, Proposition 4.2.6]. Then, we claim that H1 is an isometric subgraph of some planar H2 such that, in some plane embedding of H2 all the faces have length at most five. In order to prove the claim, fix a plane embedding of H1 and let the simple cycle C be the boundary of some face of length ≥ 6 (if no such face exists then, we are done by setting H2 := H1). Pick some path [u, v, w] of length two on the cycle C. Let C0 be obtained from C by contracting [u, v, w] to a single vertex x. We add a copy of C0 in the face of which C is a boundary, we add an edge between x and all of u, v, w, and finally we add an edge between every y ∈ C \{u, v, w} and its copy in C0. Note that doing so, we replace the face bounded by C by a new face bounded by C0 and by 0 some new triangular and quadrangular faces. Let H1 be the resulting planar graph. We prove as 0 0 an intermediate subclaim that H1 isometrically embeds in H1. For that, fix a shortest-path in H1 0 0 0 0 between some two vertices a, b ∈ V (H1). Assume there is a subpath P = [c1, . . . , cp] fully in C (otherwise, we are done). There is a natural mapping between the latter and the path P of C that is obtained by uncontracting the path [u, v, w]. Note that the length of P is at most the length of P 0 0 0 plus two. Furthermore, let x, y ∈ C be the respective neighbours of c1, cp on the shortest ab-path. By construction, x, y ∈ V (P ). Hence, we may replace [x, P 0, y] by P on the shortest ab-path. By repeating this operation until there is no more vertex of C0 on the shortest ab-path, we prove as 0 claimed that H1 isometrically embeds in H1. Overall, we repeat the above operations until there is no more face of length ≥ 6 in the plane embedding. Doing so, we obtain H2. We further claim that H2 is an isometric subgraph of some plane triangulation H3. This is easily achieved by adding, in the middle of each face, a new vertex adjacent to all the vertices of the boundary. Note that H2 isometrically embeds in H3 because all its faces have length at most five, and so, weak diameter at most two. Finally, let us prove that every plane triangulation H3 isometrically embeds in some absolute planar retract H4. The construction is the same as in the previous step, namely, we add in the middle of each (triangular) face a new vertex adjacent to all the vertices of the boundary. Doing so, since each face of H4 shares exactly one edge with a triangular face of H3, we satisfy the following

27 property: any triangle bounding a face of H4 belongs to a subgraph isomorphic to K4. Furthermore, H4 is a plane triangulation of order ≥ |V | ≥ 3, and so, it is maximal planar [35, Propositions 4.2.8 and 4.4.1]. By Theorem 9, H4 is an absolute planar retract. We stress that the proof of Theorem 10 is constructive, and that it leads to a polynomial- time algorithm in order to construct an absolute planar retract in which the input planar graph G isometrically embeds. In contrast to our result, the smallest Helly graph in which a graph G isometrically embeds may be exponential in its size [59].

References

[1] A. Abboud, V. Vassilevska Williams, and J. R. Wang. Approximation and fixed parameter subquadratic algorithms for radius and diameter in sparse graphs. pages 377–391. SIAM, 2016. [2] R. Albert, H. Jeong, and A.-L. Barab´asi. Diameter of the world-wide web. nature, 401(6749):130–131, 1999. [3] K. Appel and W. Haken. Every planar map is four colorable. Bulletin of the American mathematical Society, 82(5):711–712, 1976. [4] H.-J. Bandelt. Retracts of hypercubes. Journal of graph theory, 8(4):501–510, 1984. [5] H.-J. Bandelt and V. Chepoi. Metric graph theory and geometry: a survey. Contemporary Mathematics, 453:49–86, 2008. [6] H.-J. Bandelt, A. D¨ahlmann,and H. Sch¨utte.Absolute retracts of bipartite graphs. Discrete Applied Mathematics, 16(3):191–215, 1987. [7] H.-J. Bandelt, M. Farber, and P. Hell. Absolute reflexive retracts and absolute bipartite retracts. Discrete Applied Mathematics, 44(1-3):9–20, 1993. [8] H.-J. Bandelt and E. Pesch. Dismantling absolute retracts of reflexive graphs. European Journal of Combinatorics, 10(3):211–220, 1989. [9] H.-J. Bandelt and E. Pesch. A Radon theorem for Helly graphs. Archiv der Mathematik, 52(1):95–98, 1989. [10] H.-J. Bandelt and E. Pesch. Efficient characterizations of n-chromatic absolute retracts. Jour- nal of Combinatorial Theory, Series B, 53(1):5–31, 1991. [11] H.-J. Bandelt and E. Prisner. Clique graphs and Helly graphs. Journal of Combinatorial Theory, Series B, 51(1):34–45, 1991. [12] C. Beeri, R. Fagin, D. Maier, and M. Yannakakis. On the desirability of acyclic database schemes. Journal of the ACM (JACM), 30(3):479–513, 1983. [13] T. Biedl and L. V´el`azquez. Drawing planar 3-trees with given face areas. Computational Geometry, 46(3):276–285, 2013. [14] J. A. Bondy and U. S. R. Murty. Graph theory, volume 244 of Graduate Texts in Mathematics. Springer-Verlag London, 2008.

28 [15] M. Borassi, P. Crescenzi, and M. Habib. Into the square: On the complexity of some quadratic- time solvable problems. Electronic Notes in Theoretical Computer Science, 322:51–67, 2016.

[16] M. Borassi, P. Crescenzi, and L. Trevisan. An axiomatic and an average-case analysis of algorithms and heuristics for metric properties of graphs. In Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 920–939. SIAM, 2017.

[17] N. Bousquet and S. Thomass´e.VC-dimension and Erd˝os–P´osaproperty. Discrete Mathematics, 338(12):2302–2317, 2015.

[18] A. Brandst¨adt.Classes of bipartite graphs related to chordal graphs. Discrete Applied Math- ematics, 32(1):51–60, 1991.

[19] A. Brandst¨adt,F. Dragan, V. Chepoi, and V. Voloshin. Dually chordal graphs. SIAM Journal on Discrete Mathematics, 11(3):437–455, 1998.

[20] K. Bringmann, T. Husfeldt, and M. Magnusson. Multivariate Analysis of Orthogonal Range Searching and Graph Distances. Algorithmica, pages 1–24, 2020.

[21] P. Buneman. A characterisation of rigid circuit graphs. Discrete Mathematics, 9(3):205–212, 1974.

[22] S. Cabello. Subquadratic algorithms for the diameter and the sum of pairwise distances in planar graphs. ACM Transactions on Algorithms (TALG), 15(2):1–38, 2018.

[23] J. Chalopin, V. Chepoi, A. Genevois, H. Hirai, and D. Osajda. Helly groups. Technical Report arXiv:2002.06895, arXiv, 2020.

[24] G. Chang and G. Nemhauser. The k-domination and k-stability problems on sun-free chordal graphs. SIAM Journal on Algebraic Discrete Methods, 5(3):332–345, 1984.

[25] M. Chastand, F. Laviolette, and N. Polat. On constructible graphs, infinite bridged graphs and weakly cop-win graphs. Discrete Mathematics, 224(1-3):61–78, 2000.

[26] V. Chepoi. On distances in benzenoid systems. Journal of chemical information and computer sciences, 36(6):1169–1172, 1996.

[27] V. Chepoi and F. Dragan. A linear-time algorithm for finding a central vertex of a chordal graph. In ESA, pages 159–170. Springer, 1994.

[28] V. Chepoi, F. Dragan, B. Estellon, M. Habib, and Y. Vax`es.Diameters, centers, and approx- imating trees of δ-hyperbolic geodesic spaces and graphs. In Symposium on Computational Geometry (SocG), pages 59–68. ACM, 2008.

[29] V. Chepoi, F. Dragan, and Y. Vax`es.Center and diameter problems in plane triangulations and quadrangulations. In Symposium on Discrete Algorithms (SODA’02), pages 346–355, 2002.

[30] V. Chepoi, B. Estellon, and Y. Vax`es. Covering planar graphs with a fixed number of balls. Discrete & Computational Geometry, 37(2):237–244, 2007.

[31] D. Corneil, F. Dragan, M. Habib, and C. Paul. Diameter determination on restricted graph families. Discrete Applied Mathematics, 113(2-3):143–166, 2001.

29 [32] D. Coudert, G. Ducoffe, and A. Popa. Fully polynomial FPT algorithms for some classes of bounded clique-width graphs. ACM Transactions on Algorithms (TALG), 15(3):1–57, 2019.

[33] P. Damaschke. Computing giant graph diameters. In International Workshop on Combinatorial Algorithms (IWOCA), pages 373–384. Springer, 2016.

[34] J. De Rumeur. Communications dans les r´eseaux de processeurs. Masson Paris, 1994.

[35] R. Diestel. Graph Theory. Graduate Texts in Mathematics. Springer, 2010. 4th edition.

[36] F. Dragan. Centers of graphs and the Helly property. PhD thesis, Moldova State University, 1989.

[37] F. Dragan. Domination in quadrangle-free Helly graphs. Cybernetics and Systems Analysis, 29(6):822–829, 1993.

[38] F. Dragan. Almost diameter of a house-hole-free graph in linear time via LexBFS. Discrete applied mathematics, 95(1-3):223–239, 1999.

[39] F. Dragan and A. Brandst¨adt.r-dominating cliques in graphs with hypertree structure. Dis- crete Mathematics, 162(1-3):93–108, 1996.

[40] F. Dragan, G. Ducoffe, and H. Guarnera. Fast deterministic algorithms for computing all eccentricities in (hyperbolic) helly graphs. Manuscript in preparation.

[41] F. Dragan and H. Guarnera. Obstructions to a small hyperbolicity in Helly graphs. Discrete Mathematics, 342(2):326 – 338, 2019.

[42] F. Dragan and H. Guarnera. Helly-gap of a graph and vertex eccentricities. Technical Report arXiv:2005.01921, arXiv, 2020.

[43] F. Dragan and V. Voloshin. Incidence graphs of biacyclic hypergraphs. Discrete Applied Mathematics, 68(3):259–266, 1996.

[44] A. Dress. Trees, tight extensions of metric spaces, and the cohomological dimension of cer- tain groups: a note on combinatorial properties of metric spaces. Advances in Mathematics, 53(3):321–402, 1984.

[45] G. Ducoffe. A New Application of Orthogonal Range Searching for Computing Giant Graph Diameters. In Symposium on Simplicity in Algorithms (SOSA), 2019.

[46] G. Ducoffe. Distance problems within Helly graphs and k-Helly graphs. Technical Report arXiv:2011.00001, arXiv preprint, 2020.

[47] G. Ducoffe. Optimal diameter computation within bounded clique-width graphs. Technical Report arXiv:2011.08448, arXiv, 2020.

[48] G. Ducoffe and F. Dragan. A story of diameter, radius and Helly property. 2020. To appear in Networks.

30 [49] G. Ducoffe, M. Habib, and L. Viennot. Fast diameter computation within split graphs. In International Conference on Combinatorial Optimization and Applications, pages 155–167. Springer, 2019.

[50] G. Ducoffe, M. Habib, and L. Viennot. Diameter computation on H-minor free graphs and graphs of bounded (distance) VC-dimension. In Proceedings of the Fourteenth Annual ACM- SIAM Symposium on Discrete Algorithms (SODA), pages 1905–1922. SIAM, 2020.

[51] D. Eppstein. Subgraph isomorphism in planar graphs and related problems. pages 283–309, 2002.

[52] M. Farber. Characterizations of strongly chordal graphs. Discrete Mathematics, 43(2-3):173– 189, 1983.

[53] A. Farley and A. Proskurowski. Computation of the center and diameter of outerplanar graphs. Discrete Applied Mathematics, 2(3):185–191, 1980.

[54] T. Fowler. Unique Coloring of Planar Graphs. PhD thesis, Georgia Institute of Technology, Mathematics Department, 1998.

[55] F. Gavril. The intersection graphs of subtrees in trees are exactly the chordal graphs. Journal of Combinatorial Theory, Series B, 16(1):47–56, 1974.

[56] P. Gawrychowski, H. Kaplan, S. Mozes, M. Sharir, and O. Weimann. Voronoi diagrams on planar graphs, and computing the diameter in deterministic O˜(n5/3) time. In Symposium on Discrete Algorithms (SODA), pages 495–514. SIAM, 2018.

[57] M. Golumbic. Algorithmic graph theory and perfect graphs, volume 57. Elsevier, 2004.

[58] M. Golumbic and C. Goss. Perfect elimination and chordal bipartite graphs. Journal of Graph Theory, 2(2):155–163, 1978.

[59] H. Guarnera, F. Dragan, and A. Leitert. Injective hulls of various graph classes. Technical Report arXiv:2007.14377, arXiv, 2020.

[60] P. Hell. R´etractions de graphes. PhD thesis, Th`ese(Ph. D.: Math´ematiques)–Universit´ede Montr´eal.1972., 1972.

[61] P. Hell. Absolute planar retracts and the four color conjecture. Journal of Combinatorial Theory, Series B, 17(1):5–10, 1974.

[62] P. Hell. Absolute retracts in graphs. In Graphs and Combinatorics, pages 291–301. Springer, 1974.

[63] P. Hell and I. Rival. Absolute retracts and varieties of reflexive graphs. Canadian journal of mathematics, 39(3):544–567, 1987.

[64] J. Isbell. Six theorems about injective metric spaces. Commentarii Mathematici Helvetici, 39(1):65–76, 1964.

[65] D. S. Johnson and M. R. Garey. Computers and intractability: A guide to the theory of NP-completeness. WH Freeman, 1979.

31 [66] S. Klavˇzar.Absolute retracts of split graphs. Discrete Mathematics, 134(1-3):75–84, 1994.

[67] J. Klisowski. A survey of various modifications of the notions of absolute retracts and absolute neighborhood retracts. In Colloquium Mathematicum, volume 46, pages 23–35. Institute of Mathematics Polish Academy of Sciences, 1982.

[68] T. Kloks and Y.-L. Wang. On retracts, absolute retracts, and foldings in cographs. Optimiza- tion Letters, 12(3):535–549, 2018.

[69] M. Lin and J. Szwarcfiter. Faster recognition of clique-Helly and hereditary clique-Helly graphs. Information Processing Letters, 103(1):40–43, 2007.

[70] C. Loten. Absolute retracts and varieties generated by chordal graphs. Discrete mathematics, 310(10-11):1507–1519, 2010.

[71] L. Markenzon, C. M. Justel, and N. Paciornik. Subclasses of k-trees: Characterization and recognition. Discrete Applied Mathematics, 154(5):818–825, 2006.

[72] J. Matousek. Bounded VC-dimension implies a fractional Helly theorem. Discrete & Compu- tational Geometry, 31(2):251–255, 2004.

[73] S. Olariu. A simple linear-time algorithm for computing the center of an interval graph. International Journal of Computer Mathematics, 34(3-4):121–128, 1990.

[74] E. Pesch. Minimal extensions of graphs to absolute retracts. Journal of graph theory, 11(4):585– 598, 1987.

[75] E. Pesch. Products of absolute retracts. Discrete mathematics, 69(2):179–188, 1988.

[76] E. Pesch and W. Poguntke. A characterization of absolute retracts of n-chromatic graphs. Discrete mathematics, 57(1-2):99–104, 1985.

[77] N. Polat. Convexity and fixed-point properties in Helly graphs. Discrete Mathematics, 229(1- 3):197–211, 2001.

[78] N. Polat. On constructible graphs, locally Helly graphs, and convexity. Journal of Graph Theory, 43(4):280–298, 2003.

[79] L. Roditty and V. Vassilevska Williams. Fast approximation algorithms for the diameter and radius of sparse graphs. In Proceedings of the forty-fifth annual ACM symposium on Theory of computing (STOC), pages 515–524, 2013.

[80] R. Tarjan and M. Yannakakis. Simple linear-time algorithms to test chordality of graphs, test acyclicity of hypergraphs, and selectively reduce acyclic hypergraphs. SIAM Journal on computing, 13(3):566–579, 1984.

[81] J. R. Walter. Representations of rigid cycle graphs. PhD thesis, Wayne State University, Department of Mathematics, 1972.

[82] D. Watts and S. Strogatz. Collective dynamics of ‘small-world’ networks. Nature, 393(6684):440–442, 1998.

32