2-Trees: Structural Insights and the study of Hamiltonian Paths

2-Trees: Structural Insights and the study of Hamiltonian Paths

Abstract

For a connected graph, a path containing all vertices is known as Hamiltonian path. For general graphs, there is no known necessary and sufficient condition for the existence of Hamiltonian paths and the complexity of finding a Hamiltonian path in general graphs is NP-Complete. We present a necessary and sufficient condition for the existence of Hamiltonian paths in 2-trees. Using our characterization, we also present a linear-time algorithm for the existence of Hamiltonian paths in 2-trees. Our characterization is based on a deep understanding of the structure of 2-trees and the combinatorics presented here may be used in other combinatorial problems restricted to 2-trees.

1 Introduction

Hamiltonian path (cycle) problem is one of the most extensively studied problem, that looks for a spanning path (cycle) in a connected graph. Interestingly, such a problem has many applications in real life, related to medical genetic studies[9], for chromosome studies, in physics [3] and operational research [14]. Hamiltonian problem is one among the NP-complete problems in general graphs[39]. For a graph, the fundamental research question is to find a necessary and sufficient condition for the existence of a Hamiltonian path (Hamiltonian cycle). Surprisingly, there is no known necessary and sufficient condition despite many attempts from several researchers [12, 11, 29, 6, 46, 35, 2, 33, 48, 21]. However, there are well-known necessary conditions and sufficient conditions. Necessary condition by V.Chvatal [8] states that if a connected graph has a Hamiltonian cycle, then for each non-empty subset , the graph has at most components. Sufficient condition looks for structural conditions for a graph to have a Hamiltonian cycle, mostly for the presence of higher degree vertices in a graph. Sufficient conditions based on vertex degree has been proposed in the literature [12, 11, 29, 6, 46, 35, 2, 33]. Other sufficient conditions based on graph closure, independence number and connectivity have also been formulated [48, 21].

Interestingly, several variants of Hamiltonian path (Hamiltonian cycle) have been looked at in the past by imposing appropriate constraints. A graph is said to be homogeneously traceable, if there exist a Hamiltonian path beginning at every vertex of . A hypo-Hamiltonian graph is a non-Hamiltonian graph such that is Hamiltonian for every vertex, . Existence of homogeneously traceable graph and hypo-Hamiltonian graph [7, 50, 13] were studied in the literature. A graph is ordered Hamiltonian if for every ordered sequence of vertices, there exists a Hamiltonian cycle that encounters the vertices of the sequence in the given order. If there exist a Hamiltonian path between every pair of vertices then the graph is called Hamiltonian connected. A pancyclic graph on vertices is a graph which has every cycle of length . Sufficient conditions for the existence of ordered Hamiltonian, Hamiltonian connected, and pancyclic graphs, similar to Ore’s and Dirac’s results have also been proposed in the literature [26, 16, 34, 32].

On the algorithmic front, it is well-known that Hamiltonian path (Hamiltonian cycle) is NP-complete. When a combinatorial problem is NP-complete in general graphs, it is natural to study the complexity on restricted graph classes or special graph classes. The popular graph classes studied in the literature are chordal, interval, grid, chordal bipartite, distance hereditary, circular arc, cubic, and planar. It is proved that Hamiltonian problem is NP-complete on various restricted graph classes like chordal [1], grid [49], chordal-bipartite [19], planar [28], bipartite [45], directed path graph [15] and rooted directed path graph [4]. On the other side, nice polynomial-time algorithms for the same has been found on interval [23, 41], circular arc [42, 51], proper interval [5, 25], distance hereditary[40], and specific sub class of grid graphs [24]. Nice structural characterization for the existence of Hamiltonian cycle in claw -free graphs [44, 10, 38, 18, 30, 31, 22] has been studied in the past as well. A detailed survey on the Hamiltonian properties has been compiled by Broersma and Gould [17, 36, 37].

Chordal graphs are one among the restricted graph classes possessing nice structural characteristics. A graph is said to be chordal if every cycle of length more than three has a chord. A chord is an edge joining two non-consecutive vertices of a cycle. Given that chordal graphs have polynomial-time algorithm on various classical combinatorial problems such as vertex cover, clique, it is natural to investigate the complexity of Hamiltonian problems on chordal graphs. As already mentioned, Hamiltonian cycle problem on chordal graphs is NP-complete, this brings our focus on some subclasses of chordal graphs. Interestingly, interval graphs, a quite popular subclass of chordal graphs have a polynomial-time algorithm for Hamiltonian problem. Similarly, other special graph classes like proper-interval graphs and circular arc graphs also possess polynomial-time algorithms. To the best of our knowledge, these are the only polynomial-time results for Hamiltonian cycle problem on the sub class of chordal graphs.

The objective of this paper is two fold. First, we present structural insights on 2-trees. Further, we present a necessary and sufficient condition for the existence of Hamiltonian paths, and using the characterization, a polynomial-time algorithm to obtain Hamiltonian paths in 2-trees is also presented.

Our Approach: Given a 2-tree , we perform a series of computations to obtain a Hamiltonian path. We first check whether is -pyramid free. If so, we output a Hamiltonian path. We next check whether is -pyramid free and contains exactly one -pyramid. If so, contains a Hamiltonian path. If is -pyramid free and contains at least two -pyramids, then we first perform a pruning of the 2-tree by removing 2-degree vertices iteratively satisfying some structural condition. During pruning, we also color the edges, in particular if an edge in is colored blue during pruning, it indicates that there is a -pyramid free sub 2-tree with as the base 2-tree. We also observe that the first level pruning yields a -pyramid free 2-tree with some edges are colored blue. On this pruned 2-tree we identify five sets of edges (non-blue edges) which will be removed from . The existence of Hamiltonian path in is determined based on some structural conditions on this simplified graph. We also highlight that each pruning step is a solution preserving step and indeed guarantees a Hamiltonian path.
Road Map: We next present graph preliminaries. In Section 2, we present a necessary and sufficient condition for a 2-tree to have Hamiltonian paths and Hamiltonian cycles. The algorithm for finding a Hamiltonian path in a 2-tree is presented in Section 2.4.

1.1 Graph Preliminaries

Notation is as per [20]. In this paper we work with simple, connected, unweighted graphs. For a graph the vertex set is and the edge set is and is adjacent to in and . The neighborhood of vertex is . The degree of a vertex is . denotes the maximum degree in . For a vertex , close(u). For an edge , close(e) . A 2-tree G can be inductively constructed as follows. An edge is a 2-tree. If G is a 2-tree on vertices, then select an edge and add a vertex to such that ; is also a 2-tree on vertices. We call a 2-tree -, if it has vertices and an edge such that . A -pyramid is shown in Figure 1. We call a 2-tree , -pyramid free if contains no -pyramid as an induced subgraph.
denotes a complete graph on vertices. A vertex is called a simplicial vertex if induces a complete subgraph of [27]. Perfect vertex Elimination Ordering (PEO) is an ordering of the vertices of a graph as () such that each is a simplicial vertex of the induced subgraph on vertices . Note that by definition 2-trees are chordal.

An (s,t)-Hamiltonian path is a Hamiltonian path from to . If , then the induced subgraph is represented as . For , we also use . is -free if does not contain as an induced subgraph. An edge-induced subgraph of is formed on the edge set and edge is incident on the vertex . denotes the number of connected components in the graph . For a connected graph , =. is a vertex separator if . A cut vertex is a vertex such that . represents the component of a disconnected graph containing a vertex . A -connected component is a component without a cut vertex. A block is a maximal 2-connected component of a graph. Path from vertex to , is represented as , where vertices are termed as internal vertices of . We use to represent and hence . Blue path is a path with all its edges blue.

2 Structural insights into 2-trees

In this section we shall present some insights into the structure of 2-trees. Below observation is a well-known characteristics of any 2-tree.

Observation 1

Let be a 2-tree. forbids , and as an induced subgraph.

Lemma 1

Let be a 2-tree and . If , then .

Proof

We use induction on . The claim is immediate for . For , let be a simplicial vertex in such that . From the induction hypothesis, in , for every , . Clearly, for every , , and . This completes the induction.

Theorem 2.1 (Chvatal [8])

If a graph has a Hamiltonian cycle, then for every , .

Theorem 2.1 is a well-known necessary condition for Hamiltonicity in general graphs. Also there is no necessary and sufficient condition for hamiltonicity in general graphs. In Theorem 2.2, we present a necessary and sufficient condition for the existence of Hamiltonian cycles in 2-trees. Further, we show that Theorem 2.1 is indeed sufficient for 2-trees, which we establish using Theorem 2.2, and Theorem 2.3.

Observation 2

For every , any -pyramid free 2-tree is also a -pyramid free 2-tree.

Theorem 2.2

Let G be a 2-tree. G has a Hamiltonian cycle if and only if is -pyramid free.

Proof

Necessity: Assume for a contradiction that has a -pyramid. This implies there exist such that . By Lemma 1, . Further, by Theorem 2.1, has no Hamiltonian cycle, a contradiction to the premise.
Sufficiency: For any -pyramid free 2-tree on more than two vertices, the unique Hamiltonian cycle of is obtained by using the edge set .

Theorem 2.3

Let G be a 2-tree. For every , if and only if G is -pyramid free.

Proof

Necessity: Assume for a contradiction that has a -pyramid. This implies there exist such that . By Lemma 1, , a contradiction to the premise.
Sufficiency: follows from Theorem 2.1 and 2.2.

Corollary 1

For a 2-tree , has a Hamiltonian cycle if and only if for every , .

Proof follows from Theorem 2.2 and 2.3.
It is easy to see that graphs with Hamiltonian cycles contain Hamiltonian paths as well. However, the converse is not true always. Like Hamiltonian cycle problem there is no known necessary and sufficient condition for the existence of Hamiltonian paths in general graphs. We below recall a necessary condition on graphs having Hamiltonian paths.

Lemma 2

Let be a connected graph. If has a Hamiltonian path, then for every , .

Proof

Suppose to the contrary assume that in there exist at least components. Any Hamilton path switches between different components at least times each time using a different element of , a contradiction.

Lemma 3

Let be a 2-tree. If contains a -pyramid as an induced subgraph, then has no Hamiltonian path.

Proof

Let the -pyramid in is due to the edge . Clearly, . By Lemma 1, and from Lemma 2, it follows that has no Hamiltonian path.

The converse of the above lemma is not true and a counter example is illustrated in Figure 2. The example highlights the fact that there exist 2-trees with no -pyramid and contain -pyramids, yet it does not have Hamiltonian paths. We shall now focus our structural analysis on 2-trees containing -pyramids. In Lemma 4, we show that -pyramid free 2-trees having exactly one -pyramid has a Hamiltonian path.

Lemma 4

Let be a -pyramid free 2-tree. If contains exactly one -pyramid as an induced subgraph, then there exist a Hamiltonian path in .

Proof

Let the -pyramid is on the edge . Note that . By Lemma 1, and let and be those components. Let , , and . Consider the graphs induced on , respectively. Clearly each is a 3-pyramid free 2-tree. By Theorem 1, each has a Hamiltonian cycle and hence a Hamiltonian path. The -Hamiltonian path of and are , , and , respectively. The path is a Hamiltonian path in .

We next present some combinatorial observations on -pyramid free 2-trees with at least two -pyramids for the existence of Hamiltonian paths. We also observe that not all such 2-trees possess Hamiltonian paths. From now on we shall work with such 2-trees for our discussion.

2.1 A Simplification (Vertex Pruning)

We now present an approach that transforms a -pyramid free 2-tree with -pyramids into a 2-tree without -pyramids. Intuitively, for such a -pyramid with base edge , there are three 2-trees growing out of . While pruning, out of the three 2-trees we retain two and prune the other. While doing so, to remember the pruned 2-tree, we introduce coloring and labeling as part of our approach. Coloring of signifies that there is a 2-tree growing from and signifies the vertices of .

For a 2-tree , by vertex pruning we remove vertices of degree 2 satisfying some property and color some of the edges in , based on the closeness property. In particular, a vertex of degree 2 is pruned if its close edge, is not colored and on pruning , is colored blue. Let , and on deleting , we color the vertices blue and also the edge blue. We remember the pruned vertices using a label associated with . Initially all the edges are unlabeled, i.e., (empty string) for every . On deleting , we label as follows:

• if , then

• if , and then

• if , and then

• otherwise

For example, if the blue edges and are labeled and , respectively, then the label of the new blue edge will be .

For any 2-tree , we define a sub 2-tree of , which is obtained by recursively pruning 2-degree vertices of such that is uncolored. Note that if is a -pyramid free 2-tree, then is -pyramid free. Further, for every 2-degree vertex in , is blue. Since is -pyramid free, contains a Hamiltonian cycle, and hence a Hamiltonian path as well. However, our objective is to find a Hamiltonian path in containing all the blue edges, as labels of blue edges records the pruned vertices. Further, such a Hamiltonian path can be easily extended to a Hamiltonian path in using the labels. Given this observation, we would like to investigate to get some more insights. We call as the vertex pruned 2-tree of . An expanded 2-tree of is a 2-tree obtained by growing each blue edge in with a -pyramid free 2-tree corresponding to the label of the blue edge. We define the Blue graph of as a sub graph induced on the blue edges of . For the next lemma we consider a -pyramid free 2-tree with at least two -pyramids and let be the vertex pruned 2-tree of and be the blue graph of .

Lemma 5

If has a Hamiltonian path, then the following hold:
(i) has exactly two vertices of degree .
(ii)
(iii) For such that and , at most one of has degree in

Proof

(i) Clearly, there are at least two vertices of degree in as has at least two -pyramids. Assume for a contradiction that there exist at least three vertices of degree in such that , , (see Figure 3). Clearly, has a Hamiltonian cycle and hence a Hamiltonian path. Now we claim that any longest path in (which is a Hamiltonian path in ) cannot be transformed to a Hamiltonian path in . Note that one of and has a specific order of appearence in . In particular, either or or appear consecutively in . Without loss of generality, let appear consecutively in . While extending to , we must include , thus we get . However in this extension is unvisited in . Therefore, is not a Hamiltonian path. This shows that any can not be extended to any Hamiltonian path in , a contradiction to the premise.

(ii) If , then there exist such that . Since is -pyramid free and contains a Hamiltonian cycle, is connected. Further, there exist a path in and for every , and are in different components of . Note that , and by Lemma 2, has no Hamiltonian path, a contradiction.

(iii) Assume for a contradiction that . Note that the edge is a blue edge. If there exist a blue edge , such that , then , and by Lemma 2, has no Hamiltonian path, a contradiction. Hence we can assume that there exist two edges such that , , and are blue as shown in Figure 4. Symmetric argument holds for the vertex . We now show by case analysis that any longest path in can not be transformed into any Hamiltonian path in . Since is a Hamiltonian path, must contain the vertex . Depending on the position of in we see various possibilities for as follows. , , , , . Now we shall show that each of the above Hamiltonian paths in can not be extended to any Hamiltonian path in .

We present the detailed case analysis in Table 1.

2.2 Another Simplification

In the previous section we have investigated the structure of -pyramid free 2-trees with at least two -pyramids by introducing the notion vertex pruning. In this section, we shall obtain some more insights by introducing another simplification. Our definition of and remains the same and in this section, we do not work with arbitrary , instead, we work with satisfying the following conditions to obtain the 2-tree .
(i) has exactly two vertices of degree .
(ii)
(iii) For such that and , at most one of has degree in
Note that this is precisely the conclusion of Lemma 5. The results presented in this section are based on such restricted and its corresponding . We define the 2-tree obtained from such as follows; let be two vertices of degree in and =, and and . We shall classify four types of Hamiltonian paths in based on .

Type 1 -Hamiltonian path if , , , and .
Type 2 -Hamiltonian path if and .
Type 3 -Hamiltonian path if , and and .
Type 4 -Hamiltonian path if , and and .

Theorem 2.4

has a Hamiltonian path if and only if has type 1 or type 2 or type 3 or type 4 -Hamiltonian path containing all the blue edges of .

Proof

Sufficiency: Let be a -Hamiltonian path containing all the blue edges. Replace every blue edge with where is the label of the blue edge in to get the expanded path . When is further extended by including labels, we get a path , which is a Hamiltonian path in .
Necessity: Let is a blue edge in . Assume for a contradiction that there is no Hamiltonian path in such that appear consecutively in . That is, does not contain all blue edges of . On expanding , to get a path in , clearly the does not appear in . This implies that is not a Hamiltonian path in , contradicting the premise.

Lemma 6

If has a Hamiltonian path, then .

Proof

Assume for a contradiction that there exist a vertex such that . Since there exist a Hamiltonian path in , by Theorem 2.4, there exist a -Hamiltonian path in containing all the blue edges of . Clearly, must contain all three blue edges incident on . However, it is well known that a path can not contain three edges having a vertex in common, a contradiction. Therefore, no such exists.

Lemma 7

If has a Hamiltonian path, then for every vertex such that , , one of the following holds:
(1) ,
(2) ,
(3)

Proof

Note that since the edge is blue, . From Lemma 6 it follows that . So . We now show that is not possible. Assume for a contradiction, . The proof of this claim is similar to Lemma 5.(iii) with minor modification on technical details. If there exist a blue edge , such that , then , and further . By Lemma 2, has no Hamiltonian path, a contradiction. Hence we can assume that there exist an edge such that , and is blue as shown in Figure 5. Also, , and is blue in . Any longest path in (which is also a Hamiltonian path in ) must contain . That is, can be one of , , . Since has a Hamiltonian path, when is extended to a Hamiltonian path in , it will include vertices and . On such expansion path will give one of to mentioned in Lemma 5. In particular is expanded to , , to , , and to . At this point an anlaysis similar to Lemma 5 will establish that to can not be extended to any Hamiltonian path in . This shows that can not be extended to any Hamiltonian path in , a contradiction.

Although in Lemma 5 we have shown is at most , there are exactly four 2-trees for which . For the rest is at most which we shall prove in the next lemma.

To present the next lemma we fix the following notation. We define four special -pyramid free 2-trees, and as follows. and . All the edges incident on are blue for each . Additionaly, the edge is blue in , the edge is blue in , and the edges are blue in . Note that each is a for some .

Lemma 8

If has a Hamiltonian path, and , then .

Proof

Assume for a contradiction that there exist . If , then the structure of is similar to and the only difference is the edge is blue in . Then note that and by Lemma 2, has no Hamiltonian path, a contradiction. Therefore, . Let , , and the edges are blue. Clearly, there exist paths in . If is not an edge in or is a blue edge, then , again a contradiction. Therefore, must be an edge and is not blue. Now we shall see the adjacency of vertices . Clearly, there is no such that or or . Existence of such yields -pyramid in the former and in the later, a contradiction. If or , then either or , a contradiction. To complete the proof we shall focus on . Let . Note that is not blue for . Further, and by Lemma 5.(i), there exist exactly two vertices of degree 2 in . Let such that . Note that the 2-tree obtained from on removing has , a contradiction to Lemma 6. Symmetric argument holds for the path , and this completes a proof.

2.3 Yet Another Simplification (Edge Pruning)

In Section 2.1 we have introduced first level pruning with the help of coloring and labeling of edges. This helps to record the pruned vertices and further we obtained nice structural results on the blue graph. It is natural to ask whether the existence of Hamiltonian path in is guaranteed (necessary and sufficient condition) using the Hamiltonian path containing all blue edges of . Surprisingly, the answer is no. However, using the second level pruning presented in Section 2.2, we can guarantee a Hamiltonian path in using a Hamiltonian path containing blue edges. Having highlighted this, it is natural to prune unnecessary (not part of any Hamiltonian path) non-blue edges from (), and this is the objective of this section.

With the definition of as before we shall introduce the following notations with respect to . We work with a unique PEO of such that .

• Separator edges =

• Non-separator edges = .

• The left non-separator edge of a vertex with is left() such that and .

• The right non-separator edge of a vertex with is right() such that and .

• Star vertices = such that

• A forced star refers to a star vertex with the blue left non-separator edge. If is a forced star, then such that , is also a forced star.

• A double forced star refers to a forced star vertex with the blue right non-separator edge.

• For a blue separator edge incident on a star vertex , we define left separator edge, left()= such that there is no where , .

• Similarly, right separator edge, right()= such that there is no where , .

With reference to Figure 6, the left and right separator edges of the blue edge of are and , respectively. The left and right non-separator edges of a star vertex are and , respectively.

Observation 3

For each , there exists at least three separator edges incident on , and for each , there exist exactly two non-separator edges incident on .

As mentioned before, the objective of this section is to prune unnecessary non-blue edges in and towards this end, we define five sets of edges, and (defined in Table 2) whose removal from yields the graph . Since can not be empty, need not be a 2-tree. In this section, we do not work with arbitrary , instead, we work with satisfying the following conditions to obtain .

1. .

2. For every vertex such that , , one of the following should hold

• ,

• ,

Note that this is precisely the conclusions of Lemmas 6 and 7.