Next Article in Journal
Optimization of the Multi-Facility Location Problem Using Widely Available Office Software
Next Article in Special Issue
Special Issue on “Graph Algorithms and Applications”
Previous Article in Journal
Ontology Based Governance for Employee Services
Previous Article in Special Issue
Algorithmic Aspects of Some Variations of Clique Transversal and Clique Independent Sets on Graphs
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

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

by
Serafino Cicerone
Department of Information Engineering, Computer Science and Mathematics, University of L’Aquila, I-67100 L’Aquila, Italy
Algorithms 2021, 14(4), 105; https://doi.org/10.3390/a14040105
Submission received: 10 February 2021 / Revised: 18 March 2021 / Accepted: 23 March 2021 / Published: 25 March 2021
(This article belongs to the Special Issue Graph Algorithms and Applications)

Abstract

:
Cicerone and Di Stefano defined 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 defined 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.

1. 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 ak-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 s G ( u , v ) = D G ( u , v ) / d G ( u , v ) , where D G ( u , v ) 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 s DH ( 2 ) .
Results. In this work, we provide three results for the class s DH ( 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 ) :
  • (adapted from [2]) G DH ( 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 c d ( C 5 ) = 1 ;
    -
    cycles C 6 with c d ( C 6 ) = 1 .
  • (this paper) G s DH ( 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 c d ( C 6 ) = 1 ;
    -
    cycles C 7 with c d ( C 7 ) = 1 ;
    -
    cycles C 8 with c d ( C 8 ) = 1 .
Here we used the notion of “chord distance” c d ( 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 ) :
  • (from [12]) G DH ( 1 ) if and only if c d ( C n ) > 1 for each cycle C n , n 5 , of G;
  • (this paper) G s DH ( 2 ) if and only if c d ( C n ) > 1 for each cycle C n , n 6 , of G.
The last result is a recognition algorithm for graphs belonging to s DH ( 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. Section 3 and Section 4 are devoted to providing the characterization based on minimal forbidden subgraphs and cycle-chord conditions for graphs in s DH ( 2 ) , respectively. In Section 5, we provide the algorithm for detecting quasi-holes and hence to solve the recognition problem for the class s DH ( 2 ) . Finally, Section 6 provides some concluding remarks.

2. 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 , , x k ) is a path in G if ( x i , x i + 1 ) E for 0 i < k ; vertex x i , for each 0 < i < k , 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 c d ( 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 c d ( 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 { v 3 , v 6 } is a cycle-pair that induces the cycle ( v 3 , v 4 , v 5 , v 6 , v 1 ) ; in particular, G [ v 3 , v 6 ] is induced by p G ( v 3 , v 6 ) = ( v 3 , v 1 , v 6 ) and P G ( v 3 , v 6 ) = ( v 3 , v 4 , v 5 , v 6 ) . 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:
( i )
d G ( u , v ) 2 for each pair { u , v } such that { u , v } S ( G ) ,
( i i )
there exists a cycle-pair { u , v } that induces the stretch number of G, that is { u , v } S ( G ) .
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 inducing-stretch cycle for G. In Figure 1, the represented graph G belongs to DH ( 3 / 2 ) ; moreover, both { v 3 , v 5 } and { v 3 , v 6 } are cycle-pairs in S ( G ) , and ( v 1 , v 3 , v 4 , v 5 , v 6 ) is the corresponding inducing-stretch cycle.

3. 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 c d ( C 5 ) = 1 ;
    (iii) 
    cycles C 6 with c d ( 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 s DH ( 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 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 ) . If d ( x , y ) 3 then v 1 must be incident to chords of the cycle G [ x , y ] .
Proof. 
Since G [ x , y ] is an inducing-stretch cycle of G, then s ( G ) = p q . If v 1 is not incident to any chords of G [ x , y ] , then the induced paths P G ( v 1 , y ) = ( v 1 , x , u 1 , u 2 , , u p 1 , y ) and p G ( v 1 , y ) = ( v 1 , v 2 , , v q 1 , y ) imply s G ( v 1 , y ) = p + 1 q 1 > p q , a contradiction. □
Let G be any graph. According to Lemma 1, let us consider an inducing-stretch cycle G [ x , y ] of G. Assume that G [ x , y ] 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 ) . Since P G ( x , y ) and p G ( x , y ) are induced paths, each chord of G [ x , y ] (if any) joins vertices v i and u j , with 1 i q 1 and 1 j p 1 . When some vertex v i is incident to chords of G [ x , y ] , 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:
  • l i = min { i | 1 i p 1 a n d ( v i , u i ) i s   a   c h o r d   o f G [ x , y ] }
  • r i = max { i | 1 i p 1 a n d ( v i , u i ) i s   a   c h o r d   o f G [ x , y ] }
Theorem 3.
Let G be a graph. G s DH ( 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 c d ( C 6 ) = 1 ;
(iii) 
cycles C 7 with c d ( C 7 ) = 1 ;
(iv) 
cycles C 8 with c d ( C 8 ) = 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 ) , ( i i ) , ( i i i ) , or ( i v ) , 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:
q = 2 :
 In this case, if G [ x , y ] is chordless, then it corresponds to a hole as described in Item ( i ) . If the chord distance of G [ x , y ] is equal to 1, all chords are incident to v 1 . According to p, we have:
p = 4
G [ x , y ] corresponds to the cycle in Item ( i i ) ;
p = 5
G [ x , y ] corresponds to the cycle in Item ( i i i ) ;
p = 6
G [ x , y ] corresponds to the cycle in Item ( i v ) ;
p 7
Let ( v 1 , u l 1 ) be the leftmost chord of v 1 . If l 1 4 the cycle ( v 1 , x , u 1 , u 2 , , u l 1 ) 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 :
s G ( u l 1 , y ) p l 1 2 7 3 2 = 2 .
Hence, G is a proper subgraph of G with s ( G ) 2 . 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 :
r 1 4
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 : s G ( x , u r 1 ) r 1 / 2 2 . Hence, G is a proper subgraph of G with s ( G ) 2 . 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 ) :
s G ( v 1 , y ) p 2 q 1   .
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. □
Figure 3 and Figure 4 summarize the characterizations based on forbidden subgraphs for classes DH ( 1 ) and s DH ( 2 ) , respectively. Figure 5 provides the list of all the minimal forbidden subgraphs of any graph in s DH ( 2 ) .

4. 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 c d ( 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 s DH ( 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.
Proof. 
According to Lemma 1, consider an inducing-stretch cycle G [ x , y ] of G. Since s ( G ) = 2 , assume that G [ x , y ] is formed by the vertices of the induced paths P G ( x , y ) = ( x , u 1 , u 2 , , u 2 s 1 , y ) and p G ( x , y ) = ( x , v 1 , v 2 , , v s 1 , y ) , with s 2 .
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 .
  • Assume r 1 > 4 . In this case, the induced paths ( x , u 1 , u 2 , , u r 1 ) and ( x , v 1 , u r 1 ) provide a stretch number s G ( x , u r 1 ) r 1 2 > 2 , a contradiction.
  • Assume r 1 2 . In this case, the induced paths ( v 1 , u r 1 , u r 1 + 1 , , u 2 s 1 , y ) and ( v 1 , v 2 , , v s 1 , y ) provide the following lower bound on s G ( v 1 , y ) :
    s G ( v 1 , y ) 2 s r 1 + 1 s 1 2 s 2 + 1 s 1 = 2 + 1 s 1 .
    This contradicts s ( G ) = 2 .
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 2 s 1 , y ) and ( v 1 , v 2 , , v s 1 , y ) . These paths induce the following lower bound on s G ( v 1 , y ) :
s G ( v 1 , y ) 2 s r 1 + 1 s 1 = 2 s 3 + 1 s 1 = 2 .
Hence, the above paths induce a proper subgraph G of G with stretch number 2. Hence, this proof can be recursively applied to G . □
Lemma 4.
Let G be a graph. s ( G ) 2 if and only if G contains, as an induced subgraph, a cycle C n , n 6 , with chord distance at most 1.
Proof. 
(⇐) Trivial.
(⇒)
If s ( G ) = 2 , then it is sufficient to use Lemma 3. Now, let us assume that s ( G ) = p / q > 2 such that p and q are coprime. By Lemma 1, if G [ x , y ] is an inducing-stretch cycle of G, according to the hypotheses, we may assume that G [ x , y ] is formed by the vertices of the induced paths P G ( x , y ) = ( x , u 1 , u 2 , , u p · s 1 , y ) and p G ( x , y ) = ( x , v 1 , v 2 , , v q · s 1 , y ) , with s 1 .
If d ( x , y ) = 2 , then G [ x , y ] contains at least 6 vertices and all its chords (if any) are incident to v 1 . Then, G [ x , y ] corresponds to the requested cycle.
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.
If r 1 3 , then the two induced paths ( v 1 , u r 1 , u r 1 + 1 , , u p · s 1 , y ) and ( v 1 , v 2 , , v q · s 1 , y ) provide the following lower bound for s G ( v 1 , y ) :
s G ( v 1 , y ) p · s r 1 + 1 q · s 1 .
Now we show that
p · s r 1 + 1 q · s 1 > p q .
It can be easily observed that Equation (1) is equivalent to
p q > r 1 1 .
Since r 1 3 and p / q > 2 by hypothesis, then Equation (2) holds. This implies that s G ( v 1 , y ) > p / q , a contradiction.
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 s DH ( 2 ) if and only if c d ( 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.

5. 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-NP-complete [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 3 i + 2 ) .
In this section, we propose a polynomial-time algorithm for solving the recognition problem for the class s DH ( 2 ) according to the following approach. Lemma 4 provides a characterization for all graphs not belonging to s DH ( 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 s DH ( 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.

5.1. 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.
Theorem 7
(from [15]). Given any connected graph G = ( V , E ) with | V | = n and | E | = m , it is possible to determine whether G contains a hole in O ( m 2 ) time and O ( n m ) space.
They also extended their result to larger versions of holes.
Corollary 1
(from [15]). Let G = ( V , E ) be a connected graph with | V | = n and | E | = m , and let k 5 be a constant. It is possible to determine whether G contains a hole on at least k vertices in O ( n m p 1 ) time and O ( m p 1 ) space if k = 2 p , and in O ( n + m p ) time and O ( n m p 1 ) space if k = 2 p + 1 .
Therefore, according to this corollary, it is possible to check whether G contains a hole H k , with k 6 vertices, in O ( n m 2 ) time and O ( m 2 ) space.

5.2. Quasi-Hole Detection Algorithm

We call quasi-hole any cycle C k such that k 5 and c d ( 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 ( v 0 , v 1 , , v ) , 4 , in G such that each path ( v i , v i + 1 , v i + 2 , v i + 3 ) , i = 1 , , 3 , is a P 4 of G.
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 ( i i ) c d ( C ) 1 :
( i )
Since C fulfills the conditions of the statement, then C contains at least 5 vertices;
( i i )
Suppose by contradiction that c d ( 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, c d ( C ) 1 .
Since both the properties at points ( i ) and ( i i ) hold, it follows that C is a quasi-hole. □
Algorithm 1: A quasi-hole detection algorithm.
Algorithms 14 00105 i001
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:
  • { v a b c | ( a , b , c ) is a P 3 in the graph G } is the vertex set of G + ;
  • { ( v a b c , v b c d ) | ( a , b , c , d ) is a P 4 in the graph G } is the edge set of G + .
If ( a , b , c ) is a path P 3 of G, then both the vertices v a b c and v c b a belong to G + . In a similar way, if ( a , b , c , d ) is a path P 4 of G, then the edges ( v a b c , v b c d ) and ( v d c b , v c b a ) 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.
Algorithms 14 00105 i002
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 adjacency-list (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. Lines 12–13). 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 2 m · 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:
Theorem 8.
Given any connected graph G = ( V , E ) with | V | = n and | E | = m , it is possible to determine whether G contains a quasi-hole in O ( n m 2 ) time and O ( n m ) space.
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 1, 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 ( n m ) 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 ( n m 2 ) . The algorithm requires O ( n m ) space: O ( n ) and O ( n m ) 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. □

5.3. 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 vertices, with k 5 . For any input graph G, we consider the following family of directed graphs G ( t ) :
  • { v u 1 u 2 u t 1 | ( u 1 , u 2 , , u t 1 ) is an induced path P t 1 in G } is the vertex set of G ( t ) ,
  • { ( v u 1 u 2 u t 1 , v u 2 u 3 u t ) | ( u 1 , u 2 , , u t ) is an induced path P t in G } is the edge set of 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 2 a vertices and O ( n m a ) on 2 a + 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 = 2 p , and in O ( n 2 + n m p ) time when k = 2 p + 1 .
The space required is O ( m p 1 ) when k = 2 p , and O ( n m p 1 ) when k = 2 p + 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 s DH ( 2 ) in O ( n 2 m 2 ) time and O ( m 2 ) space.

6. Conclusions

In this paper, we studied the class s DH ( 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 s DH ( 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 s DH ( 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 s DH ( 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 s DH ( 2 ) other specific combinatorial problems that have been solved in the class of distance-hereditary graphs.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The author declares no conflict of interest.

References

  1. Howorka, E. Distance-hereditary graphs. Q. J. Math. 1977, 28, 417–420. [Google Scholar] [CrossRef]
  2. Bandelt, H.J.; Mulder, H.M. Distance-hereditary graphs. J. Comb. Theory Ser. B 1986, 41, 182–208. [Google Scholar] [CrossRef] [Green Version]
  3. Brandstädt, A.; Le, V.B.; Spinrad, J.P. Graph Classes: A Survey; Society for Industrial and Applied Mathematics: Philadelphia, PA, USA, 1999. [Google Scholar]
  4. Brandstädt, A.; Dragan, F.F. A linear-time algorithm for connected r-domination and Steiner tree on distance-hereditary graphs. Networks 1998, 31, 177–182. [Google Scholar] [CrossRef]
  5. Chang, M.S.; Hsieh, S.Y.; Chen, G.H. Dynamic Programming on Distance-Hereditary Graphs. In International Symposium on Algorithms and Computation; Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 1997; Volume 1350, pp. 344–353. [Google Scholar]
  6. Gioan, E.; Paul, C. Dynamic distance hereditary graphs using split decomposition. In International Symposium on Algorithms and Computation; Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 2007; Volume 4835, pp. 41–51. [Google Scholar]
  7. Lin, C.; Ku, K.; Hsu, C. Paired-Domination Problem on Distance-Hereditary Graphs. Algorithmica 2020, 82, 2809–2840. [Google Scholar] [CrossRef]
  8. Nicolai, F.; Szymczak, T. Homogeneous sets and domination: A linear time algorithm for distance-hereditary graphs. Networks 2001, 37, 117–128. [Google Scholar] [CrossRef]
  9. Rao, M. Clique-width of graphs defined by one-vertex extensions. Discret. Math. 2008, 308, 6157–6165. [Google Scholar] [CrossRef]
  10. Cicerone, S.; Di Stefano, G.; Flammini, M. Compact-Port Routing Models and Applications to Distance-Hereditary Graphs. J. Parallel Distrib. Comput. 2001, 61, 1472–1488. [Google Scholar] [CrossRef] [Green Version]
  11. Esfahanian, A.H.; Oellermann, O.R. Distance-hereditary graphs and multidestination message-routing in multicomputers. J. Comb. Math. Comb. Comput. 1993, 13, 213–222. [Google Scholar]
  12. Cicerone, S.; Di Stefano, G. Graphs with bounded induced distance. Discret. Appl. Math. 2001, 108, 3–21. [Google Scholar] [CrossRef] [Green Version]
  13. Cicerone, S. Characterizations of Graphs with Stretch Number less than 2. Electron. Notes Discret. Math. 2011, 37, 375–380. [Google Scholar] [CrossRef]
  14. Cicerone, S.; Di Stefano, G. Networks with small stretch number. J. Discret. Algorithms 2004, 2, 383–405. [Google Scholar] [CrossRef]
  15. Nikolopoulos, S.D.; Palios, L. Detecting Holes and Antiholes in Graphs. Algorithmica 2007, 47, 119–138. [Google Scholar] [CrossRef] [Green Version]
  16. Hammer, P.L.; Maffray, F. Completely separable graphs. Discret. Appl. Math. 1990, 27, 85–99. [Google Scholar] [CrossRef] [Green Version]
  17. Cormen, T.H.; Leiserson, C.E.; Rivest, R.L.; Stein, C. Introduction to Algorithms, 2nd ed.; The MIT Press and McGraw-Hill Book Company: New York, NY, USA, 2001. [Google Scholar]
  18. Cicerone, S. Using Split Composition to Extend Distance-Hereditary Graphs in a Generative Way—(Extended Abstract). In International Conference on Theory and Applications of Models of Computation; Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 2011; Volume 6648, pp. 286–297. [Google Scholar] [CrossRef]
  19. Cicerone, S. On Building Networks with Limited Stretch Factor. In Web, Artificial Intelligence and Network Applications, Proceedings of the Workshops of the 34th International Conference on Advanced Information Networking and Applications, AINA, Caserta, Italy, 15–17 Aprli 2020; Advances in Intelligent Systems and Computing; Springer: Berlin/Heidelberg, Germany, 2020; Volume 1150, pp. 926–936. [Google Scholar] [CrossRef]
Figure 1. The chord distance of this C 6 graph is two because: (i) vertices v 1 and v 2 are consecutive in the cycle, (ii) every chord is incident to one of such vertices, and (iii) there is no other set with less than two vertices with the same properties.
Figure 1. The chord distance of this C 6 graph is two because: (i) vertices v 1 and v 2 are consecutive in the cycle, (ii) every chord is incident to one of such vertices, and (iii) there is no other set with less than two vertices with the same properties.
Algorithms 14 00105 g001
Figure 2. The minimal forbidden subgraphs of distance-hereditary graphs: from left to right, the hole, the house, the fan, and the domino. Dashed lines represent paths of length at least one.
Figure 2. The minimal forbidden subgraphs of distance-hereditary graphs: from left to right, the hole, the house, the fan, and the domino. Dashed lines represent paths of length at least one.
Algorithms 14 00105 g002
Figure 3. The forbidden subgraphs of DH ( 1 ) expressed according to the notion of chord distance. Dashed lines represent paths of length at least one. Dotted lines represent chords that may or may not exist.
Figure 3. The forbidden subgraphs of DH ( 1 ) expressed according to the notion of chord distance. Dashed lines represent paths of length at least one. Dotted lines represent chords that may or may not exist.
Algorithms 14 00105 g003
Figure 4. The forbidden subgraphs of graphs having stretch number less than 2. Dashed (dotted, respectively) lines represent paths of length at least one (chords that may or may not exist, respectively).
Figure 4. The forbidden subgraphs of graphs having stretch number less than 2. Dashed (dotted, respectively) lines represent paths of length at least one (chords that may or may not exist, respectively).
Algorithms 14 00105 g004
Figure 5. The minimal forbidden subgraphs of any graph with stretch number less than 2. Dashed lines represent paths of length at least one.
Figure 5. The minimal forbidden subgraphs of any graph with stretch number less than 2. Dashed lines represent paths of length at least one.
Algorithms 14 00105 g005
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Cicerone, S. A Quasi-Hole Detection Algorithm for Recognizing k-Distance-Hereditary Graphs, with k < 2. Algorithms 2021, 14, 105. https://doi.org/10.3390/a14040105

AMA Style

Cicerone S. A Quasi-Hole Detection Algorithm for Recognizing k-Distance-Hereditary Graphs, with k < 2. Algorithms. 2021; 14(4):105. https://doi.org/10.3390/a14040105

Chicago/Turabian Style

Cicerone, Serafino. 2021. "A Quasi-Hole Detection Algorithm for Recognizing k-Distance-Hereditary Graphs, with k < 2" Algorithms 14, no. 4: 105. https://doi.org/10.3390/a14040105

APA Style

Cicerone, S. (2021). A Quasi-Hole Detection Algorithm for Recognizing k-Distance-Hereditary Graphs, with k < 2. Algorithms, 14(4), 105. https://doi.org/10.3390/a14040105

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop