Log In Sign Up

Obstructions to faster diameter computation: Asteroidal sets

by   Guillaume Ducoffe, et al.
National Institute for Research and Development in Informatics (ICI)

An extremity is a vertex such that the removal of its closed neighbourhood does not increase the number of connected components. Let Ext_α be the class of all connected graphs whose quotient graph obtained from modular decomposition contains no more than α pairwise nonadjacent extremities. Our main contributions are as follows. First, we prove that the diameter of every m-edge graph in Ext_α can be computed in deterministic O(α^3 m^3/2) time. We then improve the runtime to linear for all graphs with bounded clique-number. Furthermore, we can compute an additive +1-approximation of all vertex eccentricities in deterministic O(α^2 m) time. This is in sharp contrast with general m-edge graphs for which, under the Strong Exponential Time Hypothesis (SETH), one cannot compute the diameter in O(m^2-ϵ) time for any ϵ > 0. As important special cases of our main result, we derive an O(m^3/2)-time algorithm for exact diameter computation within dominating pair graphs of diameter at least six, and an O(k^3m^3/2)-time algorithm for this problem on graphs of asteroidal number at most k. We end up presenting an improved algorithm for chordal graphs of bounded asteroidal number, and a partial extension of our results to the larger class of all graphs with a dominating target of bounded cardinality. Our time upper bounds in the paper are shown to be essentially optimal under plausible complexity assumptions.


page 1

page 2

page 3

page 4


Fast deterministic algorithms for computing all eccentricities in (hyperbolic) Helly graphs

A graph is Helly if every family of pairwise intersecting balls has a no...

Around the diameter of AT-free graphs

A graph algorithm is truly subquadratic if it runs in O(m^b) time on con...

Optimal diameter computation within bounded clique-width graphs

Coudert et al. (SODA'18) proved that under the Strong Exponential-Time H...

Fast Diameter Computation within Split Graphs

When can we compute the diameter of a graph in quasi linear time? We add...

Diameter computation on H-minor free graphs and graphs of bounded (distance) VC-dimension

We propose to study unweighted graphs of constant distance VC-dimension ...

Geodetic convexity and Kneser graphs

The Kneser graph K(2n+k,n), for positive integers n and k, is the graph ...

On Supergraphs Satisfying CMSO Properties

Let CMSO denote the counting monadic second order logic of graphs. We gi...

1 Introduction

For any undefined graph terminology, see [BoM08]. All graphs considered in this paper are undirected, simple (i.e., without loops nor multiple edges) and connected, unless stated otherwise. Given a graph , let and . For every vertices and , let be their distance (minimum number of edges on a -path) in . Let denote the eccentricity of vertex (maximum distance to any other vertex). We sometimes omit the subscript if the graph is clear from the context. Finally, let be the diameter of .

Computing the diameter is important in a variety of network applications such as in order to estimate the maximum latency in communication systems 

[DeR94] or to identify the peripheral nodes in some complex networks with a core/periphery structure [KLPR+05]. On -vertex -edge graphs, this can be done in time by running a BFS from every vertex. This runtime is quadratic in the number of edges, even for sparse graphs (with edges for some ), and therefore it is too prohibitive for large graphs with millions of vertices and sometimes billions of edges. Using Seidel’s algorithm [Sei95], the diameter of any -vertex graph can be also computed in time, with the square matrix multiplication exponent. If , then this is almost linear-time for dense graphs, with edges for some constant (currently, it is only known that  [AlV21]). However, for sparse graphs, this is still in . In [RoV13], Roditty and Vassilevska Williams proved that assuming the Strong Exponential-Time Hypothesis of Impagliazzo, Paturi and Zane [ImP01], the diameter of -vertex graphs with edges cannot be computed in time, for any . Therefore, breaking the quadratic barrier for diameter computation is likely to require additional graph structure, even for sparse graphs. In this paper, we make progress in this direction.

Let us call an algorithm truly subquadratic if it runs in time on -edge graphs, for some fixed positive . Over the last decades, the existence of a truly subquadratic (often linear-time) algorithm for the diameter problem was proved for many important graph classes [AVW16, BCD98, BHM20, Cab18, CDV02, CDDH+01, CDP19, Dra93b, DDG21, DrN00, DNB96, Duc21c, Duc19, Duc21b, Duc21d, Duc21a, DHV20, FaP80, GKHM+18, Ola90]. This has culminated in some interesting connections between faster diameter computation algorithms and Computational Geometry, e.g., see the use of Voronoi diagrams for computing the diameter of planar graphs [Cab18, GKHM+18], and of data structures for range queries in order to compute all eccentricities within bounded treewidth graphs [AVW16, BHM20, CaK09], bounded clique-width graphs [Duc21a], or even proper minor-closed graph classes [DHV20]. However, this type of geometric approach usually works only if certain Helly-type properties hold for the graph classes considered [BDS87, BaP99, BoT15, CEV07, Duc21b, DrD21, DHV20]. Beyond that, the finer-grained complexity of the diameter problem is much less understood, with only a few graph classes for which truly subquadratic algorithms are known [BCT17]. The premise of this paper is that the asteroidal number could help in finding several new positive cases for diameter computation.

Related work.

Recall that an independent set in a graph is a set of pairwise non-adjacent vertices. An asteroidal set in a graph is an independent set with the additional property that, for every vertex , there exists a path between any two remaining vertices of that does not contain nor any of its neighbours in . Let the asteroidal number of be the largest cardinality of its asteroidal sets. The graphs of asteroidal number at most two are sometimes called AT-free graphs, and they generalize interval graphs, permutation graphs and co-comparability graphs amongst other subclasses [COS97]. It is worth mentioning here that all the aforementioned subclasses have unbounded treewidth and clique-width. The properties of AT-free graphs have been thoroughly studied in the literature [Bei18, BeB01, BFLM15, BKKM99, COS99, COS95, COS97, FMPR04, GHKL+09, GPvL, GoH17, HeK02, KrM12, KMT08, Sta10], and some of these properties were generalized to the graphs of bounded asteroidal number [CoS15, KKM97, KKM01].

In particular, as far as we are concerned here, there is a simple linear-time algorithm for computing a vertex in any AT-free graph whose eccentricity is within one of the diameter [CDDH+01]. However, it has been only recently that a truly subquadratic algorithm for exact diameter computation within this class was presented [Duc21c]. This algorithm runs in deterministic time on -edge AT-free graphs, and it is combinatorial – that means, roughly, it does not rely on fast matrix multiplication algorithms or other algebraic techniques. In fact both algorithms from [CDDH+01] and [Duc21c] are based on specific properties of LexBFS orderings for the AT-free graphs111It was also shown in [CDDH+01] that there exist AT-free graphs such that a multi-sweep LexBFS fails in computing their diameter. Therefore, we need to further process the LexBFS orderings of AT-free graphs, resp. of graphs of bounded asteroidal number, to output their diameter.. Roughly, the algorithm from [Duc21c] starts computing a dominating shortest path. In doing so, the search for a diametral vertex can be restricted to the closed neighbourhood of any one end of this path. However, in general this neighbourhood might be very large. The key procedure of the algorithm consists in further pruning out the neighbourhood so that it reduces to a clique. Then, we are done executing a BFS from every vertex in this clique. Both the computation of a dominating shortest path and the pruning procedure of the algorithm are taking advantage of the existence of a linear structure for AT-free graphs, that can be efficiently uncovered by using a double-sweep LexBFS [COS99]. Unfortunately, this linear structure no more exists for graphs of asteroidal number .


The structure of graphs of bounded asteroidal number, and its relation to LexBFS, is much less understood than for AT-free graphs. Therefore, extending the known results for the diameter problem on AT-free graphs to the more general case of graphs of bounded asteroidal number is quite challenging. Doing just that is our main contribution in the paper. In fact, we prove even more strongly that only some types of large asteroidal sets need to be excluded in order to obtain a faster diameter computation algorithm.

More specifically, an extremity is a vertex such that the removal of its closed neighbourhood leaves the graph connected, see [KKM01, KrS06]. Note that every subset of pairwise nonadjacent extremities forms an asteroidal set. A module in a graph is a subset of vertices such that every vertex of is either adjacent to every of or nonadjacent to every of . It is a strong module if it does not overlap any other module of . Finally, the quotient graph of is the induced subgraph obtained by keeping one vertex in every inclusionwise maximal strict subset of which is a strong module of (see also Sec. 2 for a more detailed discussion about the modular decomposition of a graph). It is known that except in a few degenerate cases, the diameter of always equals the diameter of its quotient graph [CDP19]. We are interested in the maximum number of pairwise nonadjacent extremities in the quotient graph, that according to the above is always a lower bound for the asteroidal number. See [KKM01, Fig. ] for an example where it is smaller than the asteroidal number.

Throughout the paper, let denote the class of all graphs whose quotient graph contains no more than pairwise nonadjacent extremities.

For every graph , we can compute estimates , in deterministic time so that for every vertex . In particular, we can compute a vertex whose eccentricity is within one of the diameter. Moreover, the exact diameter of can be computed in deterministic time.

Let us now sketch the main lines of our approach toward proving Theorem 1. First, we replace the input graph by its quotient graph, that can be done in linear time [TCHP08]. Then, we compute shortest paths with one common end-vertex , the union of which is a dominating set (to be compared with the dominating shortest path computed in [Duc21c] for the AT-free graphs). For that, we prove interesting new relations between graph extremities and LexBFS, but only for graphs that are prime for modular decomposition (this is why we need to consider the quotient graph). Roughly, our algorithm computes pairwise nonadjacent extremities, i.e., the other end-vertices of the shortest-paths than , by repeatedly executing a modified LexBFS. We stress that our procedure is more complicated than a multi-sweep LexBFS due to the need to avoid getting stuck between two mutually distant extremities. In doing so, the search for a diametral vertex can be now restricted to the closed neighbourhoods of only vertices (namely, to the furthest vertices from on every shortest path). However, unlike what has been done in [Duc21c] for AT-free graphs, we failed in further pruning out each neighbourhood to a clique. Instead, we present a new procedure which given a vertex outputs a vertex in its closed neighbourhood of maximum eccentricity. This is done by iterating on some extremities at maximum distance from vertex . Therefore, a key to our analyses in this paper is the number of extremities in a graph. We provide several bounds on this number. In doing so, our runtime for exact diameter computation can be improved to time for the bipartite graphs, and more generally to linear time for every graph in of constant clique number. We present some more alternative time bounds for our Theorem 1 in Sec. 5.2.

Matching (Conditional) Lower bounds.

The algorithm of Theorem 1 is combinatorial. In [Duc21c], the classic problem of detecting a simplicial vertex within an -vertex graph is reduced in time to the diameter problem on -vertex AT-free graphs. The best known combinatorial algorithm for detecting a simplicial vertex in an -vertex graph runs in time. In the same way, in [CDDH+01], Corneil et al. proved an equivalence between the problem of deciding whether an AT-free graph has diameter at most two and a disjoint sets problem which has been recently studied under the name of high-dimensional OV [DaK21]. The high-dimensional OV problem can be reduced to Boolean Matrix Multiplication, which is conjectured not to be solvable in time, for any , using a combinatorial algorithm [VaW18b]. It is open whether high-dimensional OV can be solved faster than Boolean Matrix Multiplication. Therefore, due to both reductions from [Duc21c] and [CEV07], the existence of an -time combinatorial algorithm for diameter computation within , for some function and for some , would be a significant algorithmic breakthrough.

Applications to some graph classes.

Let us review some interesting subclasses of graphs of , for some constant , for which to the best of our knowledge the best-known deterministic algorithm for diameter computation until this paper has been the brute-force -time algorithm.

A circle graph is the intersection graph of chords in a cycle. For every , a -polygon graph is the intersection graph of chords in a convex -polygon where the ends of each chord lie on two different sides. Note that the -polygon graphs form an increasing hierarchy of all the circle graphs, and that the -polygon graphs are exactly the permutation graphs. Recently [Duc21d], an almost linear-time algorithm was proposed which computes a -approximation of the diameter of any -polygon graph, for any fixed . By [StV18], every -polygon graph has asteroidal number at most . Therefore, for the -polygon graphs, we obtain an improved -approximation in linear time, and the first truly subquadratic algorithm for exact diameter computation.

A chordal graph is a graph with no induced cycle of length more than three. Chordal graphs are exactly the intersection graphs of a collection of subtrees of a host tree [Gav74]. We call such a representation a tree model. The leafage of a chordal graph is the smallest number of leaves amongst its tree models. In particular, the chordal graphs of leafage at most two are exactly the interval graphs, which are exactly the AT-free chordal graphs. More generally, every chordal graph of leafage at most also has asteroidal number at most  [LMW98]. In [Duc21c], a randomized -time algorithm was presented in order to compute the diameter of chordal graphs of asteroidal number at most . Our Theorem 1 provides a deterministic alternative, but at the price of a higher runtime. Even more strongly, by combining the ideas of Theorem 1 with some special properties of chordal graphs, we were able to improve the runtime to – see our Theorem 6.2. Previously, such as result was only known for interval graphs [Ola90].

A moplex in a graph is a module inducing a clique and whose neighbourhood is a minimal separator (the notions of module and minimal separator are recalled in Sec. 2). Moplexes are strongly related to LexBFS; indeed, every vertex last visited during a LexBFS is in a moplex [BeB98]. This has motivated some recent studies on -moplex graphs, a.k.a., the graphs with at most moplexes. In particular, every -moplex graph has asteroidal number at most  [BeB01, DGHK+21+]. Hence, our results in this paper can be applied to the -moplex graphs.

Finally, a dominating pair consists of two vertices and such that every -path is a dominating set. Note that every AT-free graph contains a dominating pair [COS97]. A dominating pair graph (for short, DP graph) is one such that every connected induced subgraph contains a dominating pair. The family of DP graphs in [PCK04, Sec. ] shows that for every , there exists a DP graph which is not in . However, we here prove that every DP graph with diameter at least six is in – see our Lemma 3.5. In doing so, we obtain a deterministic -time algorithm which, given an -edge DP graph, either computes its diameter or asserts that its diameter is . We left open whether the diameter of DP graphs can be computed in truly subquadratic time.

Organization of the paper.

We give the necessary graph terminology for this paper in Sec. 2. Then, in Sec. 3 we present some properties of graph extremities which, to our knowledge, have not been noticed before our work. In particular if a graph is prime for modular decomposition, then there always exists a diametral path whose both ends are extremities of the graph. We think these results could be helpful in future studies on the diameter problem (for other graph classes), and in order to better understand the relevant graph structure to be considered for fast diameter computation. We complete Sec. 3 with additional properties of extremities for graphs of bounded asteroidal number and for DP graphs. In Sec. 4, we relate extremities to the properties of Lexicographic Breadth-First Search. Doing so, we design a general framework in order to compute extremities under various constraints. We prove Theorem 1 in Sec. 5, then we discuss some of its extensions in Sec. 6. We conclude this paper and propose some open questions in Sec. 7.

Results of this paper were partially presented at the IPEC’22 conference.

2 Preliminaries

We introduce in this section the necessary graph terminology for our proofs. Let be a graph. For any vertex , let be its (open) neighbourhood and let be its closed neighbourhood. Similarly, for any vertex-subset , let and let . For any vertices and , we call a subset a -separator if and are in separate connected components of . A minimal -separator is an inclusion-wise minimal -separator. We call a subset a (minimal) separator if it is a (minimal) -separator for some vertices and . Alternatively, a full component for is a connected component of such that . It is known [Gol04] that is a minimal separator if there exist at least two full components for .


Recall that the distance between two vertices and equals the minimum number of edges on a -path. Let the interval contain all vertices on a shortest -path. Furthermore, for every , let be the ball of center and radius in . We recall that the eccentricity of a vertex is defined as . We sometimes omit the subscript if the graph is clear from the context. Let be the set of vertices most distant to vertex . The diameter and the radius of are defined as and , respectively. We call a diametral pair if .

Modular decomposition.

Two vertices are twins if we have . A twin class is a maximal vertex-subset of pairwise twins. More generally, a module is a vertex-subset such that for any . Note that any twin class is also a module. We call prime if its only modules are: for every (trivial modules). A module is strong if it does not overlap any other module, i.e., for any module of , either one of or is contained in the other or and do not intersect. We denote by the family of all inclusion wise maximal strong modules of that do not contain all the vertices of . Finally, the quotient graph of is the graph with vertex-set and an edge between every two such that every vertex of is adjacent to every vertex of . The following well-known result is due to Gallai:

[[Gal67]] For an arbitrary graph exactly one of the following conditions is satisfied.

  1. is disconnected;

  2. its complement is disconnected;

  3. or its quotient graph is prime for modular decomposition.

For general graphs, there is a tree representation of all the modules in a graph, sometimes called the modular decomposition, that can be computed in linear time [TCHP08]. Note that since we only consider connected graphs, only the two last items of Theorem 2 are relevant to our study. Moreover, it is easy to prove that if the complement of a graph is disconnected, then we have . Therefore, the following result is an easy byproduct of Gallai’s theorem for modular decomposition [Gal67]:

[cf. Theorem 14 in [CDP19]] Computing the diameter (resp., all eccentricities) of any graph can be reduced in linear time to computing the diameter (resp., all eccentricities) of its quotient graph .

An important observation for what follows is that, if a graph belongs to for some , then so does its quotient graph . Hence, we may only consider prime graphs in .


The hyperbolicity of a graph [Gromov1987] is the smallest half-integer such that, for any four vertices , the two largest of the three distance sums , , differ by at most . In this case we say that is -hyperbolic. To quote [DDG21]: “As the tree-width of a graph measures its combinatorial tree-likeness, so does the hyperbolicity of a graph measure its metric tree-likeness. In other words, the smaller the hyperbolicity of is, the closer is to a tree metrically.”

We will use in what follows the following “tree-likeness” properties of hyperbolic graphs:

[[CDEH+08]] If is -hyperbolic, then .

[Proposition 3(c) in [CDHV+19]] Let be a -hyperbolic graph and let be a pair of vertices of such that . We have .

[[CDEH+08]] Let be an arbitrary vertex of a -hyperbolic graph . If and , then let be satisfying . We have .

3 Properties of graph extremities

We present several simple properties of graph extremities in what follows. In Sec. 3.1, we give bounds on the number of extremities in a graph. Then, we show in Sec. 3.2 that, for computing the vertex eccentricities of a prime graph (and so, its diameter), it is sufficient to only consider its so-called extremities. In Sec. 3.3, we relate the location of the extremities in a graph to the one of an arbitrary dominating target. We state in Sec. 3.4 a relationship between extremities and the hyperbolicity of a graph (this result easily follows from [KKM01]). In Sec. 3.5, additional properties of extremities in some graph classes are discussed.

3.1 Bounds on the Number of Graph extremities

Every non-complete prime graph has at least two extremities [KKM01]. The remainder of this section is devoted to proving an upper bound on the number of extremities in a prime graph. Unfortunately, there may be up to extremities in an -vertex graph, even if it is AT-free. See the construction of [CDDH+01, Fig. ] for an example. It is worth mentioning this example also has clique-number equal to . Our general upper bounds in what follows show that only dense prime graphs may have extremities.

If is prime, then the number of its extremities is at most:

  • , where denotes the chromatic number of ;

  • , where is the clique number of , and is a Ramsey number.

In particular, it is in .


Let us denote by the number of extremities of , and let be induced by all the extremities. Note that is not necessarily connected. Since we assume that , the independence number of is at most . In this situation, (otherwise, either would contain an independent set of size , or and so, , would contain a clique of size ). Since the chromatic number of is at most , we also have that can be partitioned in at most independent sets, and so, . In particular, because for any graph . ∎

Let be prime, with extremities. Note that, using for any fixed , we get that . That is in for triangle-free graphs. For graphs of constant chromatic number, the bound of Lemma 3.1 is linear in . In particular, for the graphs of maximum degree , and for bipartite graphs.

3.2 Relationships with the diameter

To the best of our knowledge, the following relation between extremities and vertex eccentricities has not been noticed before:

If is a vertex of a prime graph with , then there exists an extremity of such that .

In particular, for every , there is an extremity so that .

We observe that a slightly weaker version of Lemma 3.2 could be also deduced from Lemma 4.2 (proved in the next section). The following lemma shall be used in our proofs:

[[KKM01]] Let be a minimal separator for a prime graph . For any component of , if does not contain an extremity of , then is a separator of for every .

Recall for what follows that a vertex is called universal if and only if all other vertices are adjacent to it.

Proof of Lemma 3.2.

Since we assume that , we have that cannot be a universal vertex (otherwise, would be a nontrivial module, thus contradicting that is prime). Let be arbitrary and we assume that is not an extremity. We shall replace by some extremity so that . First we observe that because we assume that is not a universal vertex. Let be disconnected from in , and let be a minimal -separator of (obtained by iteratively removing vertices from while and stay disconnected) – possibly, . –

We continue with a useful property of the connected components of . Specifically, let be any connected component of not containing vertex . We claim that for each . Indeed, every shortest -path contains a vertex and therefore, . In particular, (otherwise, for any and any that is on a shortest -path). It implies that, if is an extremity, then .

In what follows, let the connected component of in . Then, amongst all vertices of in another connected component than , let be minimizing and let be its connected component in . Let us assume that does not contain an extremity of (else, we are done). By Lemma 3.2, is a separator of . Let be separated from vertex in . We claim that . In order to see that, we first need to observe that is a full component for (otherwise, could not be a minimal -separator). Therefore if , then the subset would be connected, thus contradicting that and are disconnected in . This proves our claim, and from now on we denote the connected component of in . Observe that (otherwise, could not be a -separator in ). We further claim that . Indeed, recall that is a full component for . Hence, if it were not the case that then the subset would be connected, thus contradicting that and are disconnected in .

By the above claim, we get , for every . Thus, by minimality of , we obtain for every . But then, is a module of , and therefore because is prime. Finally, suppose by contradiction is not an extremity. By repeating the exact same arguments for instead of , we find another connected component of so that: is separated from in , and (possibly, and ). However, it implies that and are twins, a contradiction. Overall, we may choose for our vertex either an extremity of (if there exists one) or vertex . ∎

If is prime and , then there exist extremities such that .

Overall if we were given the extremities of a prime graph , then by Lemma 3.2, we could compute all eccentricities (and so, the diameter) in time. By Lemma 3.1, this runtime is in for the graphs within , which is subquadratic for any fixed . This bound can be improved to linear time for any graph of with constant clique number. However, the best-known algorithms for computing the extremities run in time and in time [KrS06], respectively. Furthermore, computing the extremities is at least as hard as triangle detection, even for AT-free graphs [KrS06]. We leave as an open problem whether there exists a truly subquadratic algorithm for computing all extremities in a graph.

3.3 Relationships with Dominating targets

A dominating target in a graph is a vertex-subset with the property that any connected subgraph of containing all of must be a dominating set. Dominating targets of cardinality two have been studied under the different name of dominating pairs. In particular, every AT-free graph contains a dominating pair [COS97].

[special case of Theorems and in [KKM01]] If is prime, then every inclusion-wise maximal subset of pairwise nonadjacent extremities in is a dominating target.

We have the following relation between extremities and dominating targets:

If is a dominating target of a graph (not necessarily prime), then every extremity of is contained in . In particular, there are at most extremities, where denotes the maximum degree of .


Suppose by contradiction the existence of some extremity . Then, is a connected subgraph of that contains all of but such that has no neighbour in . The latter contradicts that is a dominating target of . ∎

It follows from both Lemma 3.2 and Lemma 3.3 that, for any dominating target in a prime graph, there is a diametral vertex in . We slightly strengthen this result, as follows. The following simple lemmas also generalize prior results on AT-free graphs [CDDH+01] and graphs with a dominating pair [Duc21c].

If is a dominating target, then for any vertex .

In particular if , then .


We may assume that (else, we are done). In this situation, let be arbitrary. Then, let be the union of shortest -paths, for every . Since is a connected subgraph, we have . In particular, there is a shortest -path , for some fixed , such that . Observe that (otherwise, , and therefore ). So, let . If , then , and therefore, . A contradiction. As a result, . ∎

If is a dominating target of a graph , and no vertex of is in a diametral pair, then for every diametral pair .


Let be an arbitrary diametral pair of . In order to prove the result, by symmetry, it suffices to prove that . Since and (else, some vertex of would belong to a diametral pair), it follows from Lemma 3.3. ∎

This above Corollary 3.3 suggests the following strategy in order to compute the diameter of a prime graph . First, we compute a small dominating target . Then, we search for a diametral vertex within the neighbourhood of each of its vertices. If , then according to Lemma 3.3 there always exists such a with vertices. However, we are not aware of any truly subquadratic algorithm for computing this dominating target. By Lemma 3.3, it is sufficient to compute a maximal independent set of extremities, but then we circle back to the aforementioned problem of computing all extremities in a graph. In Sec. 5 in the paper, we prove that we needn’t compute a dominating target in full in order to determine what the diameter is. Specifically, we may only compute a strict subset of a dominating target (for that, we use the techniques presented in Sec. 4). However, the price to pay is that while doing so, we also need to consider a bounded number of vertices outside of and their respective neighbourhoods. Hence, the number of neighbourhoods to be considered grows to . This will be our starting approach for proving Theorem 1.

Finally, we want to stress here that the property of having a small dominating target is not sufficient on its own for ensuring faster diameter computation algorithms. Indeed, assuming the Strong Exponential-Time Hypothesis, the diameter of -vertex graphs with edges and a dominating edge cannot be computed in time, for any  [Duc21c]. For partial extensions of our results to the graphs with a bounded-cardinality dominating target, see Sec. 6.

3.4 Relationships with Hyperbolicity

Recall the definition of -hyperbolic graphs in Sec. 2. In a -hyperbolic graph , an “almost central” vertex of eccentricity , for some , can be computed in linear time, using a double-sweep BFS (see Lemma 2). Then, according to Lemma 2, any diametral vertex must at a distance , for some , to this almost central vertex. Roughly, we wish to combine these properties with the computation of some subset of a small dominating target (see Sec. 3.3) in order to properly locate some neighbourhood that contains a diametral vertex. For that, we need to prove here that graphs in are -hyperbolic for some depending on . Namely:

Every graph is -hyperbolic.


This result directly follows from the combination of several prior works. First, if the quotient graph of is -hyperbolic, for some , then so is  [Sot11]. Thus, from now on we assume (up to replacing by ) that graph is prime. By Lemma 3.3, contains a dominating target with vertices. Furthermore, if denotes a dominating target in a graph , then admits an additive tree -spanner [KKM01]. Since graphs with a tree -spanner are -hyperbolic [CDEH+08, DrK14], we obtain as desired that is -hyperbolic. ∎

We can improve this upper bound on the hyperbolicity for graphs of bounded asteroidal number. Specifically, a graph is -chordal if it has no induced cycle of length more than . Every graph of asteroidal number at most must be -chordal. Furthermore, for any , every -chordal graph is -hyperbolic [WuZ11]. Therefore, we obtain that the graphs of asteroidal number at most are -hyperbolic.

3.5 Extremities in some Graph classes

We complete this section with the following inclusions between graph classes.

Every graph of asteroidal number belongs to .

While this above Lemma 3.5 trivially follows from the respective definitions of and the asteroidal number, the following result is less immediate:

Every DP graph of diameter at least six belongs to .


Since the property of being a DP graph is hereditary, the quotient graph of any DP graph is also a DP graph. In particular, it suffices to prove even more strongly that an arbitrary DP graph of diameter at least six (not necessarily prime) cannot contain three pairwise nonadjacent extremities. Suppose by contradiction the existence of three such extremities . Let be a dominating pair. By Lemma 3.3, . Without loss of generality, let .

We claim that is not a separator of . Suppose by contradiction that it is the case. Let . Since and is an extremity of , must be contained in some connected component of . But similarly, since and is an extremity of , must be also contained in some connected component of . As a result, , and the only two components of are and . In particular, , that is a contradiction. Therefore, we proved as claimed that is not a separator of .

We now claim that are still extremities in the subgraph . By symmetry, it suffices to prove the result for vertex . Observing that removing all of leaves us with , we are done because is an extremity of . – However, please note that vertex may not be an extremity of . –

Since is a DP graph, there exists a dominating pair in this subgraph. Again by Lemma 3.3 we have . Without loss of generality, let (possibly, , resp. ). Now, let be a shortest -path of . By construction, is a dominating path of . In order to derive a contradiction, we shall prove, using , that . Indeed, doing so, since is a dominating pair, we obtain that , a contradiction. For that, let be arbitrary. We may further assume . If , then , therefore . From now on, let us assume that . Consider some index such that . Let be an induced -path such that . In the same way, let be an induced -path such that . Let us first assume that induces a cycle . Then, the length of must be because is a DP graph and no cycle of length contains a dominating pair. As a result, , and so . For the remainder of the proof, we assume that there exists a chord in the cycle induced by . Since the three of are induced paths, the only possible chords are: , for some ; or , for some . By symmetry, let be a chord of . Since is a shortest -path of , and , we obtain that . In particular, we obtain that , and so, . ∎

Lemma 3.5 does not hold for diameter-five DP graphs, as it can be shown from the example in [PCK04, Fig. 6], that has three pairwise nonadjacent extremities. Moreover, for every , there exists a diameter-two DP graph with pairwise nonadjacent extremities [PCK04]. We left open whether, for any , there exists some constant such that all diameter- DP graphs belong to .

4 A framework for computing extremities

We identify sufficient conditions for computing an independent set of extremities (not necessarily a maximal one). To the best of our knowledge, before this work there was no faster known algorithm for computing one extremity than for computing all such vertices. We present a simple linear-time algorithm for this problem on prime graphs — see Sec. 4.2. Then, we refine our strategy in Sec. 4.3 so as to compute one extremity avoided by some fixed connected subset. This procedure is key to our proof of Theorem 1, for which we need to iteratively compute extremities, and connect those to some pre-defined vertex using shortest paths, until we obtain a connected dominating set. In fact, our approach in Sec. 4.3 works under more general conditions which we properly state in Def. 4.3. Our main algorithmic tool here is LexBFS, of which we first recall basic properties in Sec. 4.1.

4.1 LexBFS

The Lexicographic Breadth-First Search (LexBFS) is a standard algorithmic procedure, that runs in linear time [RTL76]. We give a pseudo-code in Algorithm 1. Note that we can always enforce a start vertex by assigning to it an initial non empty label. Then, for a given graph and a start vertex , denotes the corresponding execution of LexBFS. Its output is a numbering over the vertex-set (namely, the reverse of the ordering in which vertices are visited during the search). In particular, if , then .

0:  A graph .
1:  assign the label to each vertex;
2:  for  to  do
3:      pick an unnumbered vertex with the largest label in the lexicographic order;
4:      for all unnumbered neighbours of  do
5:          add to ;
6:       /* number by */;
Algorithm 1 LexBFS [RTL76].

We use some notations from [COS99]. Fix some LexBFS ordering . Then, for any vertices and , if and only if . Similarly, if either or . Let us define and . Let also denote the lexicographic total order over the sets of LexBFS labels. For every vertices and , , let be the label of vertex when vertex was about to be numbered. We stress that (i.e., the vertex selected to be numbered at any step has maximum label for the lexicographic order). Furthermore, a useful observation is that is just the list of all neighbours of which got numbered before , ordered by decreasing LexBFS number. In particular, for any we have if and only if . We often use this latter property in our proofs.

[monotonicity property [COS99]] Let and be vertices of a graph such that: , and . If , then .

Let be vertices of a graph such that: , and . Then, .


Suppose by contradiction . In particular, , that is equivalent to . By Lemma 1 applied to , we get , a contradiction. ∎

4.2 Finding one extremity

It turns out that finding one extremity is simple, namely:

If is a prime graph with , and is any LexBFS order, then is an extremity of .


Suppose by contradiction to be disconnected. Let be the start vertex of the LexBFS ordering, and let be any component of which does not contain vertex . We denote by the vertex of with maximum LexBFS number. By maximality of , we obtain that . In particular, . Then, let . Since we have , by Corollary 4.1 we also get for every . But this implies for each , therefore is a nontrivial module of . A contradiction. ∎

An alternative proof of Lemma 4.2 could be deduced from the work of Berry and Bordat on the relations between moplexes and LexBFS [BeB00]. However, to the best of our knowledge, Lemma 4.2 has not been proved before.

4.3 Generalization

Before generalizing Lemma 4.2, we need to introduce a few more notions and terminology.

Let be a graph and let be pairwise independent. We write if and only if are in separate connected components of .

A vertex intercepts a path if , and it misses otherwise. We can easily check that if , then intercepts all -paths, and conversely if and , then misses a -path. Furthermore, we stress that for every fixed vertex and every vertex , is an extremity of if and only if there is no vertex such that .

Let and be, respectively, a vertex and a vertex-subset of some graph . We call a -transitive set if, for every and nonadjacent, .

Next, we give examples of -transitive sets.

If is a connected subgraph of a graph , then its closed neighbourhood is -transitive for every . In particular, every ball centered at and of arbitrary radius is -transitive.


Let and satisfy . Since and , there exists a -path of which all vertices except maybe are in . Furthermore, since we assume that , and so and are nonadjacent, we obtain . ∎

For an example of non-connected -transitive set, we may simply consider three pairwise nonadjacent vertices in a cycle. Then, is -transitive.

We are now ready to state the following key lemma:

Let be a prime graph with , let be arbitrary and let be -transitive. If , then we can compute in linear time an extremity such that is maximized.


We describe the algorithm before proving its correctness and analysing its runtime.

Algorithm. Let be any LexBFS() order of , and let be minimizing . First we compute the maximum index , , so that . We set , and . Then, while , we apply the following procedure:

  • We partition into groups so that two vertices are in the same group if and only if they have the same neighbours in .

  • Without loss of generality let be minimizing . We set , .

  • We set .

If (end of the while loop), then we output the unique vertex .

Correctness. We prove by induction that the following three properties hold, for any : (i) is a module of ; (ii) every is a vertex of such that is maximized; and (iii) for every , either is an extremity of or every connected component of that does not contain vertex satisfies .

First, we consider the base case . Recall that , where is the maximum index such that . By Corollary 4.1 we have for each , and so, . The latter implies that because is a (Lex)BFS order. Equivalently, , and by the minimality of we have that is a vertex of maximizing (Property (ii)). Moreover, for each , therefore is a module of (Property (i)). Now, let be arbitrary. If is not an extremity of , then let be any connected component of not containing vertex . We claim that . Indeed, suppose by contradiction . By maximality of , we have (for else, ). But then, we would get for any , and therefore by the definition of we should have . A contradiction. As a result we have . Furthermore, we have for each , that follows from the minimality of . Let be maximizing . In order to prove that , it now suffices to prove that . Suppose by contradiction that it is not the case. We first observe by maximality of . Therefore (since in addition, ), . Since we suppose , we also get by Corollary 4.1 that . Then, . However, it implies , thus contradicting the maximality of () for this property.

Then, let us assume that satisfy all of properties (i), (ii) and (iii), and that . By construction, all vertices in have the same neighbours in . Since and is a module of , we obtain that is a module of (Property (i)). Property (ii) also holds because it holds for and . Now, let be arbitrary, and let us assume it is not an extremity of . Let be any component of not containing vertex . By Property (iii), . Suppose by contradiction . Let . Since we have , we obtain . By minimality of , we get , which contradicts that .

The above Property (iii) implies that, if , then the unique vertex is indeed an extremity. Furthermore, by Property (ii), is a vertex of that maximizes . Hence, in order to prove correctness of the algorithm, all that remains to prove is that this algorithm eventually halts. For that, we claim that if then . Indeed, Property (i) asserts that is a module of . Let be the partition of such that two vertices are in the same group if and only if they have the same neighbours in . Since is prime, cannot be a nontrivial module of , and therefore . Hence, , as claimed. This above claim implies that eventually we reach the case when , and so, the algorithm eventually halts.

Complexity. Computing the LexBFS ordering can be done in linear time [RTL76]. Then once we computed vertex in additional time, we can compute the largest index such that as follows. We mark all the neighbours of vertex , then we scan the vertices by decreasing LexBFS number, and we stop at the first encountered vertex such that all vertices in are marked. Since all the neighbour-sets need to be scanned at most once, the total runtime for this step is linear. Finally, we dynamically maintain some partition such that, at the beginning of any step , this partition equals . If , then we consider each vertex sequentially, and we replace every group in the partition by the nonempty groups amongst . In doing so, we obtain the partition . We remove all groups but , computing along the way. By using standard partition refinement techniques [HMPV00, PaT87], after an initial processing in time each step can be done in