A Quasi-Hole Detection Algorithm for Recognizing k -Distance-Hereditary Graphs, with k < 2

: Cicerone and Di Stefano deﬁned and studied the class of k -distance-hereditary graphs, i.e., graphs where the distance in each connected induced subgraph is at most k times the distance in the whole graph. The deﬁned graphs represent a generalization of the well known distance-hereditary graphs, which actually correspond to 1-distance-hereditary graphs. In this paper we make a step forward in the study of these new graphs by providing characterizations for the class of all the k -distance-hereditary graphs such that k < 2. The new characterizations are given in terms of both forbidden subgraphs and cycle-chord properties. Such results also lead to devise a polynomial-time recognition algorithm for this kind of graph that, according to the provided characterizations, simply detects the presence of quasi-holes in any given graph.


Introduction
Distance-hereditary graphs have been introduced by Howorka [1], and are defined as those graphs in which every connected induced subgraph is isometric; that is, the distance between any two vertices in the subgraph is equal to the one in the whole graph. Therefore, any connected induced subgraph of any distance-hereditary graph G "inherits" its distance function from G. Formally: Definition 1 (from [1]). A graph G is a distance-hereditary graph if, for each connected induced subgraph G of G, the following holds: d G (x, y) = d G (x, y), for each x, y ∈ G .
This kind of graph have been rediscovered many times (e.g., see [2]). Since their introduction, dozens of papers have been devoted to them, and different kinds of characterizations have been found: metric, forbidden subgraphs, cycle/chord conditions, level/neighborhood conditions, generative, and more (e.g., see [3]). Among such results, the generative properties resulted as the most fruitful for algorithmic applications, since they allowed researchers to efficiently solve many combinatorial problems in the class of distance-hereditary graphs (e.g., see [4][5][6][7][8][9]).
From an applicative point of view, distance-hereditary graphs are mainly attractive due to their basic metric property. For instance, these graphs can model unreliable communication networks [10,11] in which vertex failures may occur: at a given time, if sender and receiver are still connected, any message can be still delivered without increasing the length of the path used to reach the receiver.
Since in communication networks this property could be considered too restrictive, in [12] the class of k-distance-hereditary graphs has been introduced. These graphs can model unreliable networks in which messages can eventually reach the destination traversing a path whose length is at most k times the length of a shortest path computed in absence of vertex failures. The minimum k a network guarantees regardless the failed vertices is called stretch number. Formally: Definition 2 (from [12]). Given a real number k ≥ 1, a graph G is a k-distance-hereditary graph if, for each connected induced subgraph G of G, the following holds: d G (x, y) ≤ k · d G (x, y), for each x, y ∈ G .
The class of all the k-distance-hereditary graphs is denoted by DH(k). Concerning this class of graphs, the following relationships hold: • DH(1) coincides with the class of distance-hereditary graphs; • DH(k 1 ) ⊆ DH(k 2 ), for each k 1 ≤ k 2 .
Additional results about the class hierarchy DH(k) can be found in [13,14]. It is worth to notice that this hierarchy is fully general; that is, for each arbitrary graph G there exists a number k such that G ∈ DH(k). It follows that the stretch number of G, denoted as s(G), is the smallest number t such that G belongs to DH(t). In [12], it has been shown that the stretch number s(G) of any connected graph G can be computed as follows: • the stretch number of any pair {u, v} of distinct vertices is defined as is the length of any longest induced path between u and v, and d G (u, v) is the distance between the same pair of vertices; • s(G) = max {u,v} s G (u, v).
It follows that for any non-trivial graph G with n ≥ 4 vertices, by simply maximizing D(u, v) and minimizing d(u, v), we get s(G) ≤ (n − 2)/2. From the above relationship about s(G), we get that the stretch number is always a rational number. Interestingly, it has been shown that there are some rational numbers that cannot be stretch numbers. Formally, a positive rational number t is called admissible stretch number if there exists a graph G such that s(G) = t. The following result characterizes which numbers are admissible stretch numbers.
Theorem 1 (from [14]). A rational number t is an admissible stretch number if and only if t = 2 − 1 i , for some integer i ≥ 1, or t ≥ 2.
Apart from the interesting general results found for the classes DH(k), the original motivation was studying how (if possible) to extend the known algorithmic results from the base class, namely DH(1), to DH(k) for some constant k > 1. According to Theorem 1, in this work we are interested in studying the class containing each graph G such that s(G) < 2. Since this class contains graphs with stretch number strictly less than two, throughout this paper it will be denoted by sDH (2).
Results. In this work, we provide three results for the class sDH(2), namely two different characterizations and a recognition algorithm (notice that the characterizations have already been presented in [13] but with omitted proofs). The first characterization is based on listing all the minimal forbidden subgraphs for each graph in the class. It is interesting to observe the similarity with the corresponding result for the class DH(1): (1) if and only if the following graphs are not induced subgraphs of G: holes H n , for each n ≥ 5; -cycles C 5 with cd(C 5 ) = 1; -cycles C 6 with cd(C 6 ) = 1. • (this paper) G ∈ sDH (2) if and only if the following graphs are not induced subgraphs of G: holes H n , for each n ≥ 6; -cycles C 6 with cd(C 6 ) = 1; -cycles C 7 with cd(C 7 ) = 1; -cycles C 8 with cd(C 8 ) = 1.
Here we used the notion of "chord distance" cd(C) to express the position of possible chords within any cycle C (see Section 2 for a formal definition). Notice that in [14] a similar result has been provided for the generic class DH(2 − 1 i ), i > 1. The second result is a characterization based on a cycle-chord property. As in the previous case, notice the similarity with the corresponding result for the class DH(1): (1) if and only if cd(C n ) > 1 for each cycle C n , n ≥ 5, of G; • (this paper) G ∈ sDH(2) if and only if cd(C n ) > 1 for each cycle C n , n ≥ 6, of G.
The last result is a recognition algorithm for graphs belonging to sDH(2) that works in O(n 2 m 2 ) time and O(m 2 ) space. Basically, this algorithm exploits the result based on the cycle-chord property and, as a consequence, simply detects quasi-holes in any graph. A quasi-hole is any cycle with at least five vertices and chord-distance at most one (i.e., all the possible chords of the cycle must be incident to the same vertex). This algorithm is obtained by adapting the algorithm provided in [15] for detecting holes (i.e., any cycle with at least five vertices and no chords).
Outline. The paper is organized as follows. In Section 2, we introduce notation and basic concepts used throughout the paper. Sections 3 and 4 are devoted to providing the characterization based on minimal forbidden subgraphs and cycle-chord conditions for graphs in sDH(2), respectively. In Section 5, we provide the algorithm for detecting quasiholes and hence to solve the recognition problem for the class sDH (2). Finally, Section 6 provides some concluding remarks.

Notation and Basic Concepts
We consider finite, simple, loop-less, undirected, and unweighted graphs G = (V, E) with vertex set V and edge set E. A subgraph of G is a graph having all its vertices and edges in G. Given S ⊆ V, the induced subgraph G[S] of G is the maximal subgraph of G with vertex set S. Given u ∈ V, N G (u) denotes the set of neighbors of u in G, and N G [u] = N G (u) ∪ {u}.
A sequence of pairwise distinct vertices (x 0 , x 1 , . . . , is an internal vertex of that path. A chord of a path is any edge joining two non-consecutive vertices in the path, and a path is an induced path if it has no chords. We denote by P k any induced path with k ≥ 3 vertices (e.g., an induced path on three vertices is denoted as P 3 whereas an induced path on four vertices is denoted as P 4 ). Two vertices x and y are connected in G if there exists a path (x, . . . , y) in G. A graph is connected if every pair of vertices is connected.
A cycle in G is a path (x 0 , x 1 , . . . , x k−1 ) where also (x 0 , x k−1 ) ∈ E. Two vertices x i and x j are consecutive in the cycle (x 0 , x 1 , . . . , x k−1 ) if j = (i + 1) mod k or i = (j + 1) mod k. A chord of a cycle is an edge joining two non-consecutive vertices in the cycle. We denote by C k any cycle with k ≥ 3 vertices, whereas H k denotes a hole, i.e., a cycle C k , k ≥ 5, without chords. The chord distance of a cycle C k is denoted by cd(C k ) and is defined as the minimum number of consecutive vertices in C k such that every chord of C k is incident to some of such vertices (see Figure 1 for an example of chord distance). We assume cd(H k ) = 0.
The length of any shortest path between two vertices x and y in a graph G is called distance and is denoted by d G (x, y). Moreover, the length of any longest induced path between them is denoted by D G (x, y). If x and y are distinct vertices, we use the symbols p G (x, y) and P G (x, y) to denote any shortest and any longest induced path between x and y, respectively. Sometimes, when no ambiguity occurs, we also use p G (x, y) and P G (x, y) to denote the sets of vertices belonging to the corresponding paths. If d G (x, y) ≥ 2, then {x, y} is a cycle-pair if there exist two induced paths p G (x, y) and P G (x, y) such that p G (x, y) ∩ P G (x, y) = {x, y}. In other words, if {x, y} is a cycle-pair, then there exist induced paths p G (x, y) and P G (x, y) such that the vertices in p G (x, y) ∪ P G (x, y) form a cycle in G; this cycle is denoted by G[x, y]. In Figure 1 . We use the symbol S(G) to denote the set containing all pairs {u, v} of connected vertices that induce the stretch number of G, namely S(G) = {{x, y} : s G (x, y) = s(G)}. The following lemma states that cycle-pairs are useful to determine the stretch number. Lemma 1 (from [12]). Let G be a graph such that s(G) > 1. The following relationships hold: This lemma suggests that studying s(G) concerns the analysis of cycles in G. In particular, if {u, v} is a cycle-pair that belongs to S(G), then the cycle G[u, v] is called inducingstretch cycle for G. In Figure 1, the represented graph G belongs to DH(3/2); moreover,

A Characterization Based on Forbidden Subgraphs
A well known characterization based on minimal forbidden subgraphs has been provided for the class of distance-hereditary graphs.
Theorem 2 (from [2]). A graph G is a distance-hereditary graph if and only if it does not contain, as an induced subgraph, any of the following graphs: the hole H n , n ≥ 5, the house, the fan, and the domino (cf. Figure 2). This result can be easily reformulated, and simplified, by using the notion of chord distance. In particular, it is possible to characterize in a compact way all the forbidden subgraphs by using just the notion of chord distance as follows: • G is a distance-hereditary graph if and only if the following graphs are not induced subgraphs of G: (i) H n , for each n ≥ 5; (ii) cycles C 5 with cd(C 5 ) = 1; (iii) cycles C 6 with cd(C 6 ) = 1.
It is worth to notice that in this way we do not consider the minimal subgraphs only (cf. Figure 3). In the following we provide a characterization similar to that of Theorem 2 for any graph G ∈ sDH (2). Before giving such a result, we need to recall the following technical lemma.

Lemma 2.
Let G be a graph and let G[x, y] be an inducing-stretch cycle of G defined by the induced Let G be any graph. According to Lemma 1, let us consider an inducing-stretch we denote by (v i , u l i ) and (v i , u r i ) the leftmost and rightmost chords of v i , respectively. Formally, the indices l i and r i are defined as follows: (2) if and only if the following graphs are not induced subgraphs of G: (i) H n , for each n ≥ 6; (ii) cycles C 6 with cd(C 6 ) = 1; Proof. (⇒) Each provided hole and cycle has stretch number greater or equal to 2, and hence it cannot be an induced subgraph of G. (⇐) We prove that if s(G) ≥ 2, then G contains one of the subgraphs in items (i), (ii), (iii), or (iv), or G contains a proper induced subgraph G such that s(G ) ≥ 2. In the latter case, we can recursively apply to G the following proof. According to Lemma 1, consider an inducing-stretch cycle G[x, y] of G and assume it is formed by the vertices of the induced paths P G (x, y) = (x, u 1 , u 2 , . . . , u p−1 , y) and p G (x, y) = (x, v 1 , v 2 , . . . , v q−1 , y). Notice that, since P G (x, y) and p G (x, y) are induced paths, each possible chord of G[x, y] joins vertices v i and u j , with 1 ≤ i ≤ q − 1 and 1 ≤ j ≤ p − 1. Since p q ≥ 2 by hypotheses, then q ≥ 2 by Item (i) of Lemma 1, and hence p ≥ 4. According to the value of q, we analyze two different cases: corresponds to the cycle in Item (i). When l 1 ≤ 3, consider the subgraph G induced by the vertices in the cycle (v 1 , u l 1 , u l 1 +1 , . . . , u p−1 , y). The induced paths P = (u l 1 , u l 1 +1 , . . . , u p−1 , y) and p = (u l 1 , v 1 , y) provide the following lower bound for s G : The statement follows by recursively applying to G this proof. q ≥ 3: In this case, according to Lemma 2, v 1 must be incident to chords. We now analyze two cases with respect to the value of r 1 , (v 1 , u r 1 ) being the rightmost chord of v 1 : Consider the subgraph G induced by the vertices in the cycle (v 1 , x, u 1 , u 2 , . . . , u r 1 ). In this case, the induced paths P = (x, u 1 , u 2 , . . . , u r 1 ) and p = (x, v 1 , u r 1 ) provide the following lower bound for s G : The statement follows by recursively applying to G this proof. r 1 ≤ 3: in this case the induced paths P = (v 1 , u r 1 , u r 1 +1 , . . . , u p−1 , y) and p = (v 1 , v 2 , . . . , v q−1 , y) provide the following lower bound for s G (v 1 , y): Since p−2 q−1 ≥ p q is equivalent to p q ≥ 2 (which holds by hypothesis), then the subgraph G induced by the vertices in both P and p is a proper subgraph of G with stretch p * /q * ≥ 2 and q * = q − 1. Hence, the statement follows by recursively applying to G this proof.
This concludes the proof.

A Characterization Based on Cycle-Chord Conditions
For the class of distance-hereditary graphs, Howorka provided the following well known characterization based on cycle-chord conditions. Theorem 4 (from [1]). Let G be a graph. G ∈ DH(1) if and only if each cycle C n , n ≥ 5, of G has two crossing chords.
In [12], this result has been reformulated in terms of chord distance: Theorem 5 (from [12]). Let G be a graph. G ∈ DH(1) if and only if cd(C n ) > 1 for each cycle C n , n ≥ 5, of G.
In the remainder of this section, we provide a similar characterization for graphs belonging to sDH(2). Lemma 3. Let G be a graph. If s(G) = 2 then G contains, as induced subgraph, a cycle C 6 with chord distance at most 1.
If s = 2 then the proof is concluded. In fact, cycle G[x, y] has 6 vertices and every chord of G[x, y] (if any) is incident to v 1 .
In the remainder of the proof assume s ≥ 3. In this case, according to Lemma 2, v 1 is incident to chords of G[x, y]. Let (v 1 , u r 1 ) be the rightmost chord incident to v 1 . We analyze different cases according to the value of r 1 .
It follows that either r 1 = 4 or r 1 = 3. In the first case the cycle (v 1 , x, u 1 , u 2 , u 3 , u 4 ) represents the requested cycle C 6 : chords of G[x, y] (if any) are all incident to v 1 . In the second case consider the induced paths (v 1 , u r 1 , u r 1 +1 , . . . , u 2s−1 , y) and (v 1 , v 2 , . . . , v s−1 , y). These paths induce the following lower bound on s G (v 1 , y): Hence, the above paths induce a proper subgraph G of G with stretch number 2. Hence, this proof can be recursively applied to G . In the remainder, assume that d(x, y) ≥ 3. In this case, by Lemma 2, vertex v 1 is incident to chords of G[x, y]: let (v 1 , u r 1 ) be the rightmost chord incident to it.
Then, it follows that r 1 ≥ 4. In this case, C = (x, u 1 , u 2 , . . . , u r 1 , v 1 ) is an induced cycle with r 1 + 2 ≥ 6 vertices and chord distance at most 1 (In C, all the possible chords are incident to v 1 ). This concludes the proof. This lemma can be reformulated so that it directly provides a characterization for the graphs under consideration. Theorem 6. Let G be a graph. G ∈ sDH(2) if and only if cd(C n ) > 1 for each cycle C n , n ≥ 6, of G.
Compare Theorems 5 and 6 to observe the similarity between the cycle-chord characterizations of graphs with stretch number equal to 1 and graphs with stretch number less than 2, respectively.

Recognition Algorithm
The distance-hereditary graphs, i.e., graphs in DH(1), can be recognized in linear time [16], while the recognition problem for the generic class DH(k), k not fixed, is co-NPcomplete [12]. For small and fixed values of k, in [14] a partial answer to this basic problem is given. In particular, Lemma 1 states that for k < 2, only specific rational numbers may act as stretch numbers. In [14], a characterization for each class DH(2 − 1/i), i > 1, has been provided, and such a characterization led to a polynomial time algorithm for the recognition problem for the class DH(2 − 1/i), with fixed i > 1. Unfortunately, the running time of this algorithm is bounded by O(n 3i+2 ).
In this section, we propose a polynomial-time algorithm for solving the recognition problem for the class sDH(2) according to the following approach. Lemma 4 provides a characterization for all graphs not belonging to sDH (2). It is based on detecting whether a given graph G contains or not an induced cycle C n , n ≥ 6, with chord distance at most 1. Now, assume that we have an algorithm A returning true if and only if a given graph G contains such a cycle. Then, to recognize whether G ∈ sDH(2) we can simply use A on G and certify the membership if and only if A return false. In the remainder of this section we show that such an algorithm A can be defined.

An Existing Hole Detection Algorithm
We remind that H k denotes a hole, i.e., a chordless cycle with k ≥ 5 vertices. In [15], Nikolopoulos and Palios provided the following result about the hole detection problem. Therefore, according to this corollary, it is possible to check whether G contains a hole H k , with k ≥ 6 vertices, in O(nm 2 ) time and O(m 2 ) space.

Quasi-Hole Detection Algorithm
We call quasi-hole any cycle C k such that k ≥ 5 and cd(C k ) ≤ 1. In what follows, we show that the hole-detection algorithms recalled in Theorem 7 and Corollary 1 can be adapted to detect quasi-holes in any connected graph G. This adapted version is called QuasiHoleDetection and it is described in pseudo-code as shown in Algorithms 1 and 2. The strategy behind QuasiHoleDetection is based on the following result:

Lemma 5. A connected graph G contains a quasi-hole if and only if there exists a cycle
Proof. (⇒) If G contains a quasi-hole C k then the vertices of C k form a cycle fulfilling the conditions of the statement (where v 0 is the only vertex incident to possible chords of the cycle). (⇐) Suppose that G admits cycles as described in the statement, and let C = (v 0 , v 1 , . . . , v ) be the shortest among such cycles. We now show that (i) C has at least 5 vertices and (ii) cd(C) ≤ 1: (i) Since C fulfills the conditions of the statement, then C contains at least 5 vertices; (ii) Suppose by contradiction that cd(C) > 1. Then, there must exist chords (v i , v j ) with both v i and v j different from v 0 . To each chord (v i , v j ) not incident on v 0 , we associate a "length" defined as length(v i , v j ) = |j − i|. Now, let (v l , v r ), with l < r, be a chord with minimum length. By definition, 0 < l < r ≤ holds. Since (v l , v l+1 , v l+2 , v l+3 ) is a P 4 , then r ≥ l + 4, and hence C = (v l , v l+1 , . . . , v r ) results to be a cycle with at least 5 vertices. Moreover, between v i and v j , for each l ≤ i < i + 2 ≤ j ≤ r, (i, j) = (l, r), cannot exist an edge, otherwise it would be a chord with length smaller than length(v l , v r ).
Since C is a cycle with at least 5 vertices and with chord distance zero, then it contradicts the fact that C is the shortest among the cycles fulfilling the conditions of the statement. Hence, cd(C) ≤ 1.
Since both the properties at points (i) and (ii) hold, it follows that C is a quasi-hole.  The above lemma is used by the provided algorithm for the detection of quasi-holes in G. To this end, we associate to G a directed graph G + defined as follows: If (a, b, c) is a path P 3 of G, then both the vertices v abc and v cba belong to G + . In a similar way, if (a, b, c, d) is a path P 4 of G, then the edges (v abc , v bcd ) and (v dcb , v cba ) must be contained in G + . Hence, visiting G + is equivalent to proceeding along P 4 s of G. It follows that the conditions of Lemma 5 on G can be verified by performing a revised DFS on G + (cf. [17]). In turn, the following lemma holds: Lemma 6. Let G be any connected graph, and let G + be its associated directed graph. By performing a DFS on G + , if the DFS-path is v u 0 u 1 u 2 , v u 1 u 2 u 3 , . . . , v u k−2 u k−1 u k , where u i = u j for each 0 ≤ i < j < k and u k = u for some such that 0 ≤ < k, then u , u +1 , . . . , u k−1 are vertices forming a cycle in G that fulfill Lemma 5. Conversely, if G contains a quasi-hole, the DFS on G + will meet a sequence of vertices in G + whose corresponding P 3 s in G produce a path as the path (v 1 , v 2 , . . . , v ) in the cycle as in Lemma 5.

Algorithm 2:
A recursive procedure used by QuasiHoleDetection to perform an adapted DFS.
Procedure: procedure Visit Input : four vertices base, u 1 , u 2 , and u 3 of G By following the same strategy used in [15], to reduce the space complexity required by G + , the DFS on G + is simulated by performing a revised DFS directly on G. This revised DFS on G is implemented by Algorithm QuasiHoleDetection (cf. Figure 1).
At Line 1, the algorithm computes the adjacency matrix M[ ] of G from its adjacencylist (we assume that G is provided as input according to this representation). M[ ] is used to check the adjacency in constant time. At Line 2, each vertex v 1 of G is checked against the following possible role: v 1 belongs to a quasi-hole C and all the chords of C, if any, are adjacent to v 1 . To perform this check, at Line 6 we consider each edge (v 2 , v 3 ) in G: if this edge, along with (v 1 , v 2 ) (cf. Line 7) or (v 1 , v 3 ) (cf. Line 12), form a path with three vertices, then the algorithm tries to extend this path into the requested cycle by recursively calling the Procedure Visit (see Algorithm 2).
Visit works according to Lemma 5: in any step, it attempts to extend a path P 3 defined by (u 1 , u 2 , u 3 ) into P 4 s of the form (u 1 , u 2 , u 3 , u 4 ); then, for each such P 4 , the procedure proceeds by extending the P 3 formed by (u 2 , u 3 , u 4 ) into P 4 s of the form (u 2 , u 3 , u 4 , u 5 ), and so on. In this situation, the active-path is first extended from (u 1 , u 2 , u 3 ) to (u 1 , u 2 , u 3 , u 4 ), then to (u 1 , u 2 , u 3 , u 4 , u 5 ) and so on. In case of backtracking, the last vertex is removed of the current active-path. By proceeding in this way, two cases may occur: • the initial vertex v 1 (called base in the algorithm) is added again to the active-path (cf. Line 4). If the length of the active-path is 5 or more (cf. Line 5), then the graph contains a cycle fulfilling the conditions of Lemma 5 and hence a quasi-hole is found; • at the end of the active-path there is a vertex different from base but already inserted in the active-path (cf. . In this case, again the conditions of Lemma 5 apply, but now we are sure that a hole is found. It is worth to remark that the ongoing active-path P on G and the ongoing DFS-path P + on G + contain exactly the same vertices: the elements of P correspond to the vertices of the P 3 s associated with the elements of P + (in P, the repeated vertices of G in adjacent P 3 s are present only once).
We now explain the role of the additional data structures AP[·] and walked_P 3 [(·, ·), ·]. The former is an auxiliary array of size n used to check if a vertex appears in the "active path" computed so far; given u, AP[u] is equal to 1 if u appears in the active path, 0 otherwise. Concerning the latter, during the visit on G + , vertices that correspond to path P 3 s of G are recorded so that they are not "visited" again. The entry walked_P 3 [(u 1 , u 2 ), u 3 ] equals one if and only if the vertices u 1 , u 2 , u 3 induce (u 1 , u 2 , u 3 ) as a path P 3 of G already encountered during the DFS, otherwise it equals zero. Since walked_P 3 [(·, ·), ·] has entries walked_P 3 [(u 1 , u 2 ), u 3 ] and walked_P 3 [(u 2 , u 1 ), u 3 ] for each edge (u 1 , u 2 ) ∈ E and for each u 3 ∈ V, then its size is 2m · n. Notice that Visit registers the entry of walked_P 3 [ ] at the beginning, thus avoiding another execution on the same path P 3 . In this way, Visit() is executed exactly once for each path P 3 of G.
Notice that the description of Visit() assures that starting from a P 3 formed by (u 1 , u 2 , u 3 ) we proceed to a P 3 formed by (u 2 , u 3 , u 4 ) only if (u 1 , u 2 , u 3 , u 4 ) is a path P 4 of G. The only exception is when u 1 coincides with the starting vertex v 1 selected at Line 2 by QuasiHoleDetection: in such a case (u 1 , u 2 , u 3 , u 4 ) may have chords from u 1 . For this purpose, the initial vertex v 1 is assigned to the variable base (cf. Line 4 of the main algorithm) and it is later passed to Visit (cf. Lines 9 and 14 of the main algorithm).
We can now provide the following statement: Proof. According to the above description of QuasiHoleDetection, its correctness follows from Lemmas 5 and 6, and from the inherent execution of DFS on G + . In the remainder of the proof we analyze the complexity of the algorithm about the required time and space. As G is a connected graph, we get n = O(m). Concerning the data structures used by the algorithm, we assume that from any edge (v 1 , v 2 ) it is possible to access in constant time both its endpoints; alike, from any entry in the adjacency matrix M[ ] of G corresponding to v 1 and v 2 it is possible to access in constant time the edge (v 1 , v 2 ).
Consider first the time complexity of performing the revised DFS of G. The visit starts at Line 6, and proceeds by recursive calls to Visit. This recursive procedure checks each path (u 1 , u 2 , u 3 ) of G which is a P 3 and tries to extend it into a P 4 of the form (u 1 , u 2 , u 3 , u 4 ). Notice that each set of vertices {u 1 , u 2 , u 3 , u 4 } where (u 1 , u 2 , u 3 ) is a P 3 and u 4 is adjacent to u 3 is uniquely characterized by the ordered pair ((u 1 , u 2 ), (u 3 , u 4 )) where (u 1 , u 2 ) and (u 3 , u 4 ) are ordered pairs of adjacent vertices in G. Hence, the time required to perform the whole visit according to the recursive executions of Visit is O(m 2 ). We can now determine the time complexity of QuasiHoleDetection.
Step at Line 1 clearly takes O(n 2 ) time. The subsequent loop at Line 2 is repeated O(n) times, and for each step the algorithm requires O(nm) time for the initialization at Line 3 and, as described before, O(m 2 ) time for visiting G according to the recursive calls to Visit.
It follows that the final time complexity is O(nm 2 ). The algorithm requires O(nm) space: O(n) and O(nm) for the arrays AP[ ] and walked_P 3 [ ], respectively, and O(n 2 ) for the adjacency matrix M[ ] and the adjacency-list used to represent G.

Detecting Quasi-Hole on at Least k Vertices
As in [15], the strategy described above to define a quasi-hole detection algorithm can be generalized to built algorithms for the detection of quasi-holes on at least k ver-tices, with k ≥ 5. For any input graph G, we consider the following family of directed graphs G (t) : By definition, G ≡ G (2) and G + ≡ G (4) where G + is the direct graph associated to G in Section 5.2. Therefore, in the same way that running DFS on G + ≡ G (4) allowed us to detect quasi-holes (on at least five vertices), running DFS on G (k−1) allows us to detect (extended) quasi-holes on at least k vertices, for each constant k ≥ 5. This is ensured by the following statement, which represents a generalization of Lemma 5: Lemma 7. Given a constant k ≥ 5, a graph G contains a quasi-hole on at least k vertices if and only if G contains a cycle (u 0 , u 1 , . . . , u t ), with t ≥ k − 1, such that (u i , u i+1 , . . . , u i+k−2 ) is an induced path P k−1 of G for each i = 1, 2, . . . , t − k + 2.
Lemmas 6 and 7 induce the following statement: Corollary 2. Let G be a connected graph and let k ≥ 5 be a constant. Assume that a DFS is executed on G (k−1) , the directed graph associated to G. If the active path computed by the DFS is v u 0 u 1 ···u k−3 , v u 1 u 2 ···u k−2 , . . . , v u r−k+3 u r−k+4 ···u r , where u i = u j for all 0 ≤ i < j < r, and u r = u p for some p such that 0 ≤ p < r, then u p , u p+1 , . . . , u r−1 are vertices forming a cycle in G that fulfill the conditions of Lemma 7. Conversely, if G contains a quasi-hole on at least k vertices, the DFS on G (k−1) will meet a sequence of vertices whose associated P k−2 s in G form a path as the path (u 1 , u 2 , . . . , u t ) in the cycle of Lemma 7.
Additionally, in this situation we do not build G (k−1) since we implicitly run DFS on this associated graph. In particular, we process each unvisited P k−2 of G as follows: we try to extend the induced path P k−2 formed by (u 0 , u 1 , . . . , u k−3 ) into P k−1 s of the form (u 0 , u 1 , . . . , u k−3 , u k−2 ); then, for each such P k−1 , we proceed by extending the P k−2 (u 1 , u 2 , . . . , u k−2 ) into P k−1 s, and so on. Since there exist O(m a ) induced paths on 2a vertices and O(nm a ) on 2a + 1 vertices, and it requires O(k) time to detect whether a vertex extends a P k−1 into a P k , we have the following corollary: Corollary 3. Let G = (V, E) be a connected graph with |V| = n and |E| = m, and let k ≥ 5 be a constant. By implicitly running DFS on G (k−1) it is possible to detect whether G contains a quasi-hole on at least k vertices in O(n 2 m p−1 ) time when k = 2p, and in O(n 2 + nm p ) time when k = 2p + 1.
The space required is O(m p−1 ) when k = 2p, and O(nm p−1 ) when k = 2p + 1. According to Lemma 4 and Corollary 3, we finally get the following result: Theorem 9. Let G = (V, E) be a connected graph with |V| = n and |E| = m. It is possible to recognize whether G ∈ sDH(2) in O(n 2 m 2 ) time and O(m 2 ) space.

Conclusions
In this paper, we studied the class sDH (2). It contains each graph G with stretch number less than two, that is s(G) < 2. These graphs form a superclass of the well studied distance-hereditary graphs, which corresponds to graphs with stretch number equal to one.
For the class sDH(2) we provided: (1) a characterization based on listing all the minimal forbidden subgraphs, (2) a characterization based on cycle-chord properties, and (3) a recognition algorithm that works in O(n 2 m 2 ) time and O(m 2 ) space. This algorithm exploits the result based on the cycle-chord property to detects quasi-holes in a graph; it is a simple adaptation of the algorithm provided in [15] for detecting holes.
The characterizations found seem to suggest that the graphs in sDH(2) and those in DH(1) may be really similar in structure and hence properties. As a consequence, it would be interesting to determine whether the class sDH(2) can be also characterized according to generative operations (we remind that the generative properties resulted as the most fruitful for devising efficient algorithms for distance-hereditary graphs). This problem has been partially addressed in [18,19].
On the contrary, Theorem 1 could suggest that graphs with stretch number greater or equal to two may have a completely different structure with respect to those in DH(1).
Another possible extension of this work could be to investigate in the class sDH(2) other specific combinatorial problems that have been solved in the class of distancehereditary graphs.