• 沒有找到結果。

Hamiltonian Path Problems on Distance-Hereditary Graphs

N/A
N/A
Protected

Academic year: 2021

Share "Hamiltonian Path Problems on Distance-Hereditary Graphs"

Copied!
19
0
0

加載中.... (立即查看全文)

全文

(1)2002 International Computer Symposium (ICS2002) Hamiltonian Path Problems on Distance-Hereditary Graphs Ruo-Wei Hung and Maw-Shang Chang∗ Department of Computer Science and Information Engineering National Chung Cheng University Ming-Hsiung, Chiayi 621, Taiwan, R.O.C. E-mail: {rwhung, mschang}@cs.ccu.edu.tw July 6, 2002. Abstract A Hamiltonian path of a graph G with respect to a subset T of vertices, |T | ≤ 2, is a Hamiltonian path P of G such that vertices in T are end vertices of P . Given a graph G and a subset T of vertices, the constrained Hamiltonian path problem involves testing whether a Hamiltonian path of G with respect to T exists. Hamiltonian path problem is the special constrained Hamiltonian path problem where T is empty. A connected graph G = (V, E) is distance-hereditary if every two vertices in V have the same distance in every connected induced subgraph of G containing them. This paper presents linear time algorithms for the constrained Hamiltonian path problems on distance-hereditary graphs whereas the best previous known algorithm for Hamiltonian path problem on distance-hereditary graphs runs in O(|V |5 ) time. Keywords: graph algorithms, Hamiltonian path problem, distance-hereditary graphs, cographs. AMS(MOS) subject classifications. 05C85, 68Q20, 68Q25, 68R10, 68W25.. 1. Introduction. All graphs considered in this paper are finite, undirected, without loops or multiple edges. Let G = (V, E) be a graph. Throughout this paper, let m and n denote the numbers of edges and vertices of graph G, respectively. A Hamiltonian path (resp. cycle) is a simple path (resp. cycle) that passes through each vertex of a graph G exactly once. The Hamiltonian path (resp. cycle) problem involves testing whether a Hamiltonian path (resp. cycle) exists in a graph. It is well known that these two problems are NP-complete for general graphs [18], and NP-complete even for special classes of graphs ∗ Correspondence. Author. 1.

(2) such as bipartite graphs [29], split graphs [19], circle graphs [15], and grid graphs [27], etc. We refer to the first and last vertices visited by a path P as end vertices of P . A Hamiltonian path of a graph G with respect to a subset T of vertices, |T | ≤ 2, is a Hamiltonian path P of G such that all vertices in T are end vertices of P . Given a graph G and a subset T of vertices, the constrained Hamiltonian path problem involves testing whether a Hamiltonian path of G with respect to T exists. Hamiltonian path problem is the special constrained Hamiltonian path problem where T is empty. Nicolai referred to the special constrained Hamiltonian path problem with |T | = 1 or |T | = 2 as 1HP problem or 2HP problem, respectively [31]. A connected graph is distance-hereditary if the distance between every two vertices in any connected induced subgraph is the same as in the original graph. Distance-hereditary graphs were introduced by Howorka [22], who gave the first characterization of these graphs. Bandelt and Mulder gave a constructive characterization which shows that a distance-hereditary graph can be constructed from an isolated vertex by adding vertices one by one through those operations called one vertex extensions [1]. Furthermore, Hammer and Maffray proposed a linear time recognition algorithm, which constructs a sequence of one vertex extensions for a distance-hereditary graph [21]. Chang et al. gave a recursive definition for distance-hereditary graphs [8]. Further properties and optimization problems in these graphs have been studied in [1, 3, 4, 6, 7, 16, 25, 32, 33, 34]. Distance-hereditary graphs are a subclass of parity graphs [9] and a superclass of cographs [10, 11] and Ptolemaic graphs [23]. Nicolai presented first polynomial time algorithms for the constrained Hamiltonian path problems on distance-hereditary graphs [31]. Nicolai showed that Hamiltonian cycle and 2HP problems on distance-hereditary graphs can be solved in O(n3 ) time. This leads to O(n4 ) and O(n5 ) time algorithms for 1HP and Hamiltonian path problems on distance-hereditary graphs, respectively. An algorithm for 2HP problem can be used to solve 1HP and Hamiltonian path problems on distance-hereditary graphs in O(n4 ) and O(n5 ) time, respectively, by a trivial reduction technique that reduces both 1HP and Hamiltonian path problems to 2HP problem. In [26], we proposed an O(n2 ) time algorithm for Hamiltonian cycle problem on distance-hereditary graphs. Recently, Hsieh et al. solved Hamiltonian cycle problem on distance-hereditary graphs in O(n + m) time [24]. But, it does not imply that the constrained Hamiltonian path problems on distance-hereditary graphs can be solved in O(n + m) time. By the reduction of Nicolai, it seems that the constrained Hamiltonian path problems are more difficult than Hamiltonian cycle problem on distance-hereditary graphs. Whether the constrained Hamiltonian path problems on distance-hereditary graphs can be solved in linear time is still open. In this paper, we shall present linear time algorithms to solve the constrained Hamiltonian path problems on distance-hereditary graphs. Courcelle et al. [12] first introduced the notion of the clique-width of graphs. The clique-width of a graph G is defined as the minimum number of labels needed to construct G, using the four graph operations: creation of a new vertex with label i, disjoint union, connecting vertices with specified labels and renaming labels. For more background on clique-width, we refer the reader to [12], [14]. Clique-width bounded graphs are especially interesting from algorithmic point of view. A lot of NP-hard graph problems can be solved in polynomial time for graphs of bounded clique-width if an expression for the graph is explicitly given. A graph problem P on bounded clique-width graphs is said to be an MS1 problem if it can be defined by a monadic second order logic (MS-logic) formula,. 2.

(3) using quantifiers on vertices but not on edges. And, P is called an MS2 problem if it is definable in MS-logic formula with quantifiers on vertices and edges. In [13], Courcelle et al. proved that all MS1 problems on clique-width bounded graphs can be solved in linear time. But, this result can not be applied to MS2 problems. Note that Hamiltonian path problem is not one MS1 problem. Recently, Espelage et al. proposed polynomial algorithms to solve some problems which are not MS1 problems on clique-width bounded graphs [17]. They solved Hamiltonian path problem for graphs 2 with bounded clique-width k in O(nk ) time. Furthermore, Golumbic et al. have shown that every distance-hereditary graph has clique-width at most 3 [20]. Hence, the algorithm in [17] for Hamiltonian path problem on distance-hereditary graphs runs in O(n9 ) time. Following the above introduction, we know that the best previous algorithm for Hamiltonian path problem on distance-hereditary graphs runs in O(n5 ) time. In this paper, we demonstrate that the reduction technique used in [5, 26, 31] can be extended to solve the constrained Hamiltonian path problems on distance-hereditary graphs. We show how to reduce an instance of the constrained Hamiltonian path problem on distance-hereditary graphs to a smaller instance of the same problem. Our algorithm runs in O(n + m) time. Using the reduction technique in [26] that reduces Hamiltonian cycle problem on distance-hereditary graphs to the same problem on distance-hereditary graphs, we have an O(n + m) time algorithm for Hamiltonian cycle problem on distance-hereditary graphs. Moreover, we can construct a Hamiltonian cycle and a constrained Hamiltonian path in the same time bound if they exist.. 2. Preliminaries. Graph terminology and notation used in this paper are standard, see Bondy and Murty [2]. Suppose A is a set of vertices in a graph G = (V, E). Let G[A] denote the subgraph of G induced by A. Let v be a vertex of G. We denote the (open) neighborhood of v, consisting of all vertices adjacent to v in G, by N (v), and the closed neighborhood of v, the set N (v) ∪ {v}, by N [v]. The (open) neighborhood of A, denoted by N (A), is the set of vertices in G that are adjacent to some vertex in A. The closed neighborhood of A in G, denoted by N [A], is N (A) ∪ A. Two disjoint vertex subsets A and B of a graph G are joint if every vertex of A is adjacent to each vertex of B. For a graph G, we use V (G) and E(G) to denote the vertex set and edge set of graph G, respectively. A path cover P of a graph G with respect to a subset T of V (G) is a set of pairwise vertex disjoint paths of G such that all vertices are visited by a path in P and all vertices in T are end vertices of paths in P. A minimum path cover of G with respect to T is a path cover of G with respect to T of minimum cardinality. Let π(G, T ) denote the cardinality of a minimum path cover of G with respect to T . For simplicity, we will use π(G) to denote π(G, T ) if T is empty. Given a graph G and a subset T of vertices, the constrained path cover problem involves finding a minimum path cover of G with respect to T . The path cover problem is a special case of the constrained path cover problem where T is empty. And the constrained Hamiltonian path problem is a special case of the constrained path cover problem. Given a minimum path cover P of G with respect to T , and a number d where π(G, T ) ≤ d ≤ |V (G)|, we can obtain a path cover P  of G with respect to T where |P  | = d easily by splitting paths of P. Thus the following lemma is obvious.. 3.

(4) Lemma 2.1. For a graph G and a subset T of vertices, there exists a path cover P  of G with respect to T such that |π(G, T )| ≤ |P  | ≤ |V (G)|. Chang et al. have shown that distance-hereditary graphs have a graceful characterization [8]. The characterization makes use of the concept of twin sets. Every distance-hereditary graph has a twin set that is a subset of vertices. We use T S(G) to denote a twin set of a distance-hereditary graph G in the following. Definition 1. [8] The class of distance-hereditary graphs can be defined by the following recursive definition: (1) A graph K1 is a distance-hereditary graph and the twin set of K1 is the vertex of K1 . (2) If G1 and G2 are distance-hereditary graphs, then the union G of G1 and G2 is also a distancehereditary graph and T S(G) = T S(G1 ) ∪ T S(G2 ). In this case, we say that graph G is formed from G1 and G2 by false twin operation. (3) If G1 and G2 are distance-hereditary graphs, then the graph G obtained from G1 and G2 by connecting every vertex of T S(G1 ) to all vertices of T S(G2 ) is also a distance-hereditary graph and T S(G) = T S(G1 ) ∪ T S(G2 ). In this case, we say that graph G is formed from G1 and G2 by true twin operation. (4) If G1 and G2 are distance-hereditary graphs, then the graph G obtained from G1 and G2 by connecting every vertex of T S(G1 ) to all vertices of T S(G2 ) is also a distance-hereditary graph and T S(G) = T S(G1 ). In this case, we say that graph G is formed from G1 and G2 by attaching graph . G2 to graph G1 (called pendant vertex operation).. By the definition above, a binary ordered decomposition tree of a distance-hereditary graph G can be constructed in linear time. In the decomposition tree, each leaf is a single vertex of G and each internal node represents one of the tree operation, pendant vertex operation P , true twin operation T , and false twin operation F . The decomposition tree is called a PTF-tree P T (G) of the distancehereditary graph G. Let H, H1 , and H2 be subgraphs of G. If H is formed from H1 and H2 by a P (resp. T , F ) operation, then the root of P T (H) is a node labeled as P (resp. T , F ) and the left and right subtrees of the root are P T (H1 ) and P T (H2 ), respectively. Note that P T (G) is a binary ordered tree. For instance, Figure 1(b) depicts the corresponding PTF-tree of a distance-hereditary graph shown in Figure 1(a). Clearly, a PTF-tree of a distance-hereditary graph can be constructed in O(n + m) time. In the following, we assume that the PTF-tree P T (G) has been constructed. We will refer to the internal node labeled by u as u-node in P T (G) where u is either P , T , or F . The subtree of P T (G) rooted at node u is denoted by P T [u]. For each internal node u of P T (G), we denote by G(u) the representative graph of P T [u], and denote by ul and ur the left and right child nodes of u, respectively. Definition 2. Let P T (G) be a PTF-tree of a distance-hereditary graph G. Let S = {u0 , u1 , · · · , un−2 } be the ordered set of internal nodes by a breadth-first search on P T (G). Define an internal node ui , 0 ≤ i ≤ n − 2, of P T (G) to be a final pendant node if and only if ui is a P -node and each uj , j > i, . is either a T -node or a F -node.. For a distance-hereditary graph G, we partition V (G) into four disjoint subsets X, Y , Z, and T as follows. Let u be the final pendant node of P T (G). Initially, Z = ∅, T = ∅, X = V (G(ul )), 4.

(5) T v8 v6. v3. v7. v9. v2. v 10 v5. F. T F. v4. F. v0. v1. v6. P. v2. T. v1 P. v7. v0. v3. F v4 (b). (a). v5 T. v9 v8. v 10. Figure 1: (a)A distance-hereditary graph G, and (b)The corresponding PTF-tree of G.. and Y = V (G(ur )). Then, we visit the ancestor of u in P T (G) bottom up. Let w be the node currently visited. Note that we assume that T S(G(w)) has computed if we visit node w. If w is a F -node, we do nothing. If P T [u] is a subtree of P T [wl ], then Z = Z ∪ T S(G(wr )); otherwise, Z = Z ∪ T S(G(wl )). Repeat the above process until w is the root of P T (G) or X  T S(G(w)). Finally, we set T = V (G) − {X ∪ Y ∪ Z}. For example, X = {v4 , v9 }, Y = {v8 , v10 }, Z = {v1 , v5 }, and T = {v0 , v2 , v3 , v6 , v7 } for the PTF-tree shown in Figure 1(b). The following lemma gives some characterizations of vertex subsets obtained by the above procedure and can be easily verified by Definition 1. In the following lemma, X, Y, Z, and T are four disjoint subsets of vertices obtained by the previous paragraph. Lemma 2.2. Let X, Y, Z and T be the four disjoint subsets of vertex set V of a distance-hereditary graph G. Then the following three statements hold. (1) X and Y are joint, and X and Z are joint; (2) None of Y is adjacent to any vertex of V \ (X ∪ Y ); (3) None of X ∪ Y is adjacent to any vertex of T . It is clear that either X or Y induces a cograph. Furthermore, X ∪ Y induces a cograph, too. Note that G is disconnected if Z = ∅ and T = ∅, and G is a cograph if Z = ∅ and T = ∅. In the rest of the paper, assume G = (V, E) is distance-hereditary graph, X, Y, Z, and T form a partition of V satisfying Lemma 2.2 and Z is not empty. To simplify notation, denote X ∪ Y by S and Z ∪ T by W , respectively. By Lemma 2.2, we have N [Y ] ⊆ S, N [X] ⊆ (S ∪ Z), X and Y are joint, X and Z are joint, X induces a cograph, and Y induces a cograph. For a subset U of vertices of G, we say that a path P of G is a U -path if P has all its vertices in U . A subpath P  of path P is U -maximal if P  is a U -path and is not a proper subpath of any U -path of P . Denote the set of all U -maximal subpaths of P by Um (P ). For example, Xm (P ) is the set of all maximal X-paths of P , Wm (P ) is the set of all maximal W -paths of P , and Ym (P ) is the set of. 5.

(6) all maximal Y -paths of P . We call the first and last vertices visited by P the path-start and path-end of P , denoted by P athStart(P ) and P athEnd(P ), respectively. Both of them are end vertices of P . We call a W -path a zW z-path if its two end vertices are in Z. We call a path cover P of G[W ] a zW z-path-cover with respect to T if (a) all vertices in T ∩ W are end vertices of paths in P, and (b) all end vertices of paths in P are in either Z or T . Similarly, we define a path cover P of G[X] (resp. G[Y ]) with respect to T to be a path cover of G[X] (resp. G[Y ]) if (a) all vertices in T ∩ X (resp. T ∩ Y ) are end vertices of paths in P, and (b) all end vertices of paths in P are in either X (resp. Y ) or T . Lemma 2.3. Assume |T | ≤ 2 and P is a Hamiltonian path of G with respect to T . Then, Xm (P ) and Ym (P ) are path covers of G[X] and G[Y ], respectively, with respect to T . Lemma 2.4. Assume P is a Hamiltonian path of G with respect to T . Then, Wm (P ) is a zW z-pathcover of G[W ] with respect to T . Proof. By definitions.. Q.E.D.. Lemma 2.5. Assume |T | ≤ 2, t1 = |T ∩ X|, t2 = |T ∩ (V \ X)|, and P is an Hamiltonian path of G with respect to T . Then, |Xm (P )| + 1 − t1 ≥ |Wm (P )| + |Ym (P )| ≥ |Xm (P )| + t2 − 1. Proof. By definitions.. Q.E.D.. Lemma 2.6. Suppose |T | ≤ 2, t1 = |T ∩ X|, t2 = |T ∩ (V \ X)|, G[W ] has a zW z-path-cover B with respect to T , G[X] has a path cover D with respect to T , G[Y ] has a path cover F with respect to T , and |D| + 1 − t1 ≥ |B| + |F | ≥ |D| + t2 − 1. Then G has a Hamiltonian path with respect T . Proof. We can prove this lemma by showing how to obtain a Hamiltonian path of G with respect to T from B, F and D. Due to the space limitation, the proof is omitted.. Q.E.D.. Based upon the above two lemmas, the basic ideas of our algorithm to find a Hamiltonian path of G with respect to T is to find a zW z-path-cover B of G[W ] with respect to T , a path cover D of G[X] with respect to T , and a path cover F of G[Y ] with respect to T , satisfying the condition that |D| + 1 − t1 ≥ |B| + |F | ≥ |D| + t2 − 1 where t1 = |T ∩ X| and t2 = |T ∩ (V \ X)|. Since both G[X] and G[Y ] are cographs, we can find path covers of them with respect to T easily. But it takes us some efforts to find a zW z-path-cover of G[W ] with respect to T . Definition 3. Assume κ1 ≥ κ2 and κ1 ≥ 1. Let H be the graph that V (H) = I ∪ K and E(H) = {(u, v)|u, v ∈ K} where κ1 = |K| + |I| and |I| = κ2 − 1. Graph G∗ (κ1 , κ2 ) is obtained from G[W ] and H by making Z and V (H) joint. In other words, G∗ (κ1 , κ2 ) is the graph G∗ where V (G∗ ) = W ∪ X  , X  = I ∪ K, |X  | = κ1 , |I| = κ2 − 1, E(G∗ ) = E(G[W ]) ∪ EG∗ (Z, X  ) ∪ E(H), and EG∗ (Z, X  ) =  {(u, v)|u ∈ Z, v ∈ X  }. We will refer to G∗ (κ1 , κ2 ) as G∗ in the rest of the paper if κ1 and κ2 are understood without ambiguity. By definition, we have the following observations: G∗ [X  ] consists of κ2 connected components. 6.

(7) I is a set of κ2 − 1 isolated vertices in G∗ [X  ] and G∗ [K] is complete. Furthermore, π(G∗ [X  ], T ) = κ2 if |T ∩ X  | ≤ 2. Notice that I = ∅ if κ2 = 1. Lemma 2.7. Assume |T | ≤ 2, k = |T ∩ X  |, and P  is a Hamiltonian path of G∗ with respect to T . Then there exists a zW z-path-cover B of G[W ] with respect to T such that κ1 +1−k ≥ |B| ≥ κ2 +1−k.  (P  ) is a path cover of G∗ [X  ], Wm (P  ) is a zW z-path-cover of G∗ [W ]. Proof. By definition, Xm.   If k = 2, then |Xm (P  )| = |Wm (P  )| + 1. If k = 1, then |Xm (P  )| = |Wm (P  )|. If k = 0, then   (P  )| = |Wm (P  )| − 1. Hence, we have that |Xm (P  )| = |Wm (P  )| − 1 + k for 2 ≥ k ≥ 0. Let |Xm. B = Wm (P  ). It is easy to see that B is also a zW z-path-cover of G[W ]. Since κ1 = |X  | and  (P  )| = |B| − 1 + k ≥ κ2 by Lemma 2.1. Therefore, π(G∗ [X  ], T ) = κ2 , we have that κ1 ≥ |Xm κ1 + 1 − k ≥ |B| = |Wm (P  )| ≥ κ2 + 1 − k.. Q.E.D.. For simplicity, we use p, y and h to denote π(G[X]), |Y |, and π(G[Y ]), respectively, in the rest of the paper.. 3. The 2HP problem. Given a distance-hereditary graph G = (V, E) and a subset T = {s, t} of V , the 2HP problem is to determine whether G has a Hamiltonian path such that both of its end vertices are in T or not. The 2HP problem can be classified into the following six cases: (1) {s, t} ⊆ Y , (2) s ∈ Y and t ∈ W , (3) s ∈ Y and t ∈ X, (4) {s, t} ⊆ X, (5) s ∈ X and t ∈ W , and (6) {s, t} ⊆ W . We will prove the necessary and sufficient condition for reducing G to G∗ according to the above six cases below. Lemma 3.1. Assume T = {s, t} and T ⊆ Y . Then, G has a Hamiltonian path with respect to T if and only if |X| ≥ max{2, π(G[Y ], T )}, and G∗ (κ1 , κ2 ) has a Hamiltonian path with respect to T  where κ1 = |X| − max{0, π(G[Y ], T ) − 2}, κ2 = max{2, p − y + 2}, s ∈ I, t ∈ K, and T  = {s , t }. Proof. Only if part: Suppose P is a Hamiltonian path of G with respect to T . For clarity, let xm = |Xm (P )|, ym = |Ym (P )|, wm = |Wm (P )|, and h2 = π(G[Y ], T ). By Lemma 2.5, we have xm = ym + wm − 1. Since |X| ≥ xm ≥ p and y ≥ ym ≥ max{2, h2 }, we have |X| ≥ max{2, h2 } and |X| − max{2, h2 } ≥ xm − ym ≥ p − y. Hence, |X| − max{0, h2 − 2} ≥ wm + 1 ≥ max{2, p − y + 2}. Next we show that G∗ has a Hamiltonian path with respect to T  . By definition of G∗ , π(G∗ [X  ]) = κ2 . By Lemma 2.1, there exists a path cover D of G∗ [X  ] of size wm + 1 since κ1 ≥ wm + 1 ≥ κ2 . Furthermore, |I| ≥ 1 and |K| ≥ 1 since κ2 − 1 ≥ 1 and κ1 ≥ 2. Therefore, there exist two vertices s , t in X  such that s ∈ I, t ∈ K, and T  = {s , t }. Then we can construct a Hamiltonian path with respect to T  of G∗ from Wm (P ) and D easily. If part: Suppose P  is a Hamiltonian path of G∗ with respect to T  . Wm (P ) is a zW z-path-cover of G[W ]. By Lemma 2.7, G[W ] has a zW z-path-cover B where κ1 − 1 ≥ |B| ≥ κ2 − 1. There are two cases: Case 1: p ≥ |B| + h2 − 1. Let f = p − |B| + 1. It is easy to see that f ≥ h2 . In case of p − y + 2 ≤ 2, clearly y ≥ p ≥ p−(|B|−1) = f . In case of p−y +2 > 2, |B|+1 ≥ κ2 = p−y +2. Hence y ≥ p−|B|+1. 7.

(8) By Lemma 2.1, there exists a path cover F of G[Y ] such that |F | = f since y ≥ f ≥ h2 . By definition, G[X] has a path cover D of size d = p. By Lemma 2.6, G has a Hamiltonian path with respect to T since |B| + |F | = |D| + 1. Case 2: p < |B| + h2 − 1. Since |X  | = κ1 ≥ |B| + 1, we have that |X| = |X  | + max{0, h2 − 2} ≥ (|B| + 1) + max{0, h2 − 2} = |B| + max{1, h2 − 1} > p. By Lemma 2.1, there exists a path cover D of G[X] such that |D| = |B| + max{1, h2 − 1}. By definition, there exists a path cover F of G[Y ] such that |F | = max{2, h2 }. By Lemma 2.6, G has a Hamiltonian path with respect to T since |B| + |F | = |D| + 1.. Q.E.D.. Lemma 3.2. Assume T = {s, t}, s ∈ Y and t ∈ W . Then, G has a Hamiltonian path with respect to T if and only if |X| ≥ π(G[Y ], {s}), and G∗ (κ1 , κ2 ) has a Hamiltonian path with respect to T  where κ1 = |X| − π(G[Y ], {s}) + 1, κ2 = max{1, p − y + 1}, s is any vertex in X  , and T  = {s , t}. Proof. Only if part: Suppose P is a Hamiltonian path of G with respect to T . For clarity, let xm = |Xm (P )|, ym = |Ym (P )|, wm = |Wm (P )|, and h1 = π(G[Y ], {s}). By Lemma 2.5, we have xm = ym + wm − 1. Since |X| ≥ xm ≥ p and y ≥ ym ≥ h1 , we have |X| − h1 ≥ xm − ym ≥ p − y, i.e., |X| − h1 + 1 ≥ wm ≥ max{1, p−y +1}. Hence, |X|−h1 +1 ≥ 1, that is, |X| ≥ h1 . Next we show that G∗ has a Hamiltonian path with respect to T  . By definition of G∗ , π(G∗ [X  ]) = κ2 . By Lemma 2.1, there exists a path cover D of G∗ [X  ] of size wm since κ1 ≥ wm ≥ κ2 . We can construct a Hamiltonian path of G∗ with respect to T  from Wm (P ) and D easily. If part: Suppose P  is a Hamiltonian path of G∗ with respect to T  . Wm (P  ) is a zW z-path-cover of G[W ]. By Lemma 2.7, G[W ] has a zW z-path-cover B such that κ1 ≥ |B| ≥ κ2 . There are two cases: Case 1: p ≥ |B| + h1 − 1. Let f = p − |B| + 1. It is easy to see that f ≥ h1 . In case of p − y + 1 ≤ 1, clearly y ≥ p ≥ p−(|B|−1) = f . In case of p−y+1 > 1, |B| ≥ κ2 = p−y+1. Hence y ≥ p−|B|+1 = f . By Lemma 2.1, there exists a path cover F of G[Y ] such that |F | = f since y ≥ f ≥ h1 . By definition, G[X] has a path cover D of size d = p. By Lemma 2.6, G has a Hamiltonian path with respect to T since |D| = |B| + |F | − 1. Case 2: p < |B| + h1 − 1. Since |X  | = κ1 ≥ |B|, we have that |X| = |X  | + h1 − 1 ≥ |B| + h1 − 1 > p. By Lemma 2.1, there exists a path cover D of G[X] such that |D| = |B| + h1 − 1. By definition, there exists a path cover F of G[Y ] such that |F | = h1 . By Lemma 2.6, G has a Hamiltonian path with respect to T since |D| = |B| + |F | − 1. Q.E.D. We can prove the following lemmas by arguments similar to those for proving Lemma 3.1 or 3.2. Due to the space limitation, the proofs are omitted. Lemma 3.3. Assume T = {s, t}, s ∈ Y and t ∈ X. Then, G has a Hamiltonian path with respect to T if and only if |X| ≥ π(G[Y ], {s}) + 1, and G∗ (κ1 , κ2 ) has a Hamiltonian path with respect to T  where κ1 = |X|−π(G[Y ], {s})+1, κ2 = max{2, π(G[X], {t})−y +1}, s ∈ I, t ∈ K, and T  = {s , t }. Lemma 3.4. Assume T = {s, t} and T ⊆ X. Then, G has a Hamiltonian path with respect to T if and only if |X| ≥ h + 2, and G∗ (κ1 , κ2 ) has a Hamiltonian path with respect to T  where κ1 = |X| − h, κ2 = max{2, π(G[X], T ) − y}, s ∈ I, t ∈ K, and T  = {s , t }. 8.

(9) Lemma 3.5. Assume T = {s, t}, s ∈ X and t ∈ W . Then, G has a Hamiltonian path with respect to T if and only if |X| ≥ h + 1, and G∗ (κ1 , κ2 ) has a Hamiltonian path with respect to T  where κ1 = |X| − h, κ2 = max{1, π(G[X], {s}) − y}, s is any vertex in X  , and T  = {s , t}. Lemma 3.6. Assume T = {s, t} and T ⊆ W . Then, G has a Hamiltonian path with respect to T if and only if |X| ≥ h + 1, and G∗ (κ1 , κ2 ) has a Hamiltonian path with respect to T where κ1 = |X| − h and κ2 = max{1, p − y}.. 4. The 1HP problem. Given a distance-hereditary graph G = (V, E) and a subset T = {s} of V , the 1HP problem is to determine whether G has a Hamiltonian path P such that s is an end vertex of P or not. The 1HP problem can be classified into the following three cases: (1) T ⊆ Y , (2) T ⊆ X, and (3) T ⊆ W . If T ⊆ X, we shall prove that |X| ≥ h + 1 if G has a Hamiltonian path with respect to T . If T ⊆ Y , we shall prove that |X| ≥ π(G[Y ], T ) if G has a Hamiltonian path with respect to T . Then, we consider the case of T ⊆ W . In this case, we have two subcases that |X| = h and |X| ≥ h + 1. We will prove the necessary and sufficient condition for reducing G to G∗ according to the above cases below. Lemma 4.1. Assume T = {s} and T ⊆ Y . Then, G has a Hamiltonian path with respect to T if and only if |X| ≥ π(G[Y ], T ) and G∗ (κ1 , κ2 ) has a Hamiltonian path with respect to T  where κ1 = |X| − π(G[Y ], T ) + 1, κ2 = max{1, p − y + 1}, s ∈ X  , and T  = {s }. Proof. Only if part: Suppose P is a Hamiltonian path of G with respect to T . For clarity, let xm = |Xm (P )|, ym = |Ym (P )|, wm = |Wm (P )|, and h1 = π(G[Y ], T ). By Lemma 2.5, we have xm = ym + wm or xm = ym + wm − 1 depending on whether the end vertex of P other than s is in X or not. Hence, wm = xm − ym or wm = xm − ym + 1. Since |X| ≥ xm ≥ p and y ≥ ym ≥ h1 , we have |X| − h1 ≥ xm − ym ≥ p − y. Thus, |X| − h1 ≥ wm ≥ max{1, p − y} or |X| − h1 + 1 ≥ wm ≥ max{1, p − y + 1}. In either cases, we have |X| ≥ h1 and κ1 ≥ wm ≥ κ2 − 1. By definition of G∗ , π0 (G∗ [X  ]) = κ2 . By Lemma 2.1, there exists a path cover D of G∗ [X  ] of size wm or wm + 1 since κ1 ≥ wm ≥ κ2 or κ1 ≥ wm + 1 ≥ κ2 . We can construct a Hamiltonian path of G∗ with respect to T  from Wm (P ) and D easily. If part: Suppose P  is a Hamiltonian path of G∗ with respect to T  = {s }. Wm (P  ) is a zW z-path-cover of G[W ]. By Lemma 2.7, there exists a zW z-path-cover B of G[W ] with respect to T  such that κ1 + 1 − k ≥ |B| ≥ κ2 + 1 − k where 2 ≥ k = |T ∩ X  | ≥ 1. Then, we have κ1 ≥ |B| ≥ κ2 − 1. There are two cases: Case 1: p ≥ |B| + h1 . Let f = p − |B|. In case of p − y + 1 ≤ 1, clearly y ≥ p ≥ p − |B| = f . In case of p − y + 1 > 1, we have |B| ≥ κ2 − 1 = p − y and hence y ≥ p − |B| = f too. By Lemma 2.1, there exists a path cover F of G[Y ] such that |F | = f since y ≥ f ≥ h1 . By definition, G[X] has a path cover D of size d = p. By Lemma 2.6, G has an G has a Hamiltonian path with respect to T since |D| = |F | + |B|. Case 2: p < |B| + h1 . Since κ1 ≥ |B|, we have that |X| = |X  | + h1 − 1 ≥ |B| + h1 − 1. By Lemma 9.

(10) 2.1, there exists a path cover D of G[X] such that |D| = |B| + h1 − 1. By definition, there exists a path cover F of G[Y ] such that |F | = h1 . By Lemma 2.6, G has a Hamiltonian path with respect to T since |D| = |B| + |F | − 1. Q.E.D. Lemma 4.2. Assume T = {s} and T ⊆ X. Then, G has a Hamiltonian path with respect to T if and only if |X| ≥ h + 1 and G∗ (κ1 , κ2 ) has a Hamiltonian path with respect to T  where κ1 = |X| − h, κ2 = max{1, π(G[X], T ) − y}, s ∈ X  , and T  = {s }. Proof. We can prove this lemma by similar arguments for proving Lemma 4.1. Due to the space limitation, the proof is omitted.. Q.E.D.. Lemma 4.3. Assume T = {s}, T ⊆ W and |X| = h. Then, G has a Hamiltonian path with respect to T if and only if G∗ (κ1 , κ2 ) has a Hamiltonian path with respect to T  where κ1 = 1, κ2 = 1, t ∈ X  , and T  = {s, t }. Proof. Only if part: Assume P is a Hamiltonian path of G with respect to T = {s}. Since |X| = h ≥ |Xm (P )| and |Ym (P )| ≥ h, we have 0 ≥ |Xm (P )| − |Ym (P )|. By Lemma 2.5, we have |Xm (P )| + 1 − t1 ≥ |Wm (P )| + |Ym (P )| where t1 = |T ∩ X|. Thus, 0 ≥ |Xm (P )| − |Ym (P )| ≥ |Wm (P )| − 1 + t1 . Since t1 ≥ 0, we have 0 ≥ |Wm (P )| − 1 + t1 ≥ |Wm (P )| − 1. Since W is not empty, we have |Wm (P )| = 1. Let Wm (P ) = {PW }. Note that one of end vertices of PW is in Z and the other end vertex of PW is vertex s. Without loss of generality, assume P athStart(PW ) ∈ Z. Then t PW is a Hamiltonian path of G∗ with respect to T  = {s, t }. If part: Suppose P  is a Hamiltonian path of G∗ with respect to T  . Since |X  | = 1, |Wm (P  )| = 1. Let Wm (P  ) = {PW }. One of end vertices of PW is s and the other end vertex of PW is in Z. It is easy to see that PW visits all vertices in W . Without loss of generality, assume P  = PW t where t ∈ X  . Let P = {P1 , P2 , · · · , Ph } be a minimum path cover of G[Y ], |P| = h and X = {x1 , x2 , · · · , xh }. Then P ∗ = PW x1 P1 x2 P2 x3 · · · Ph−1 xh Ph is a Hamiltonian path of G with respect to T = {s}.. Q.E.D.. Lemma 4.4. Assume T = {s}, T ⊆ W and |X| ≥ h + 1. Then, G has a Hamiltonian path with respect to T if and only if G∗ (κ1 , κ2 ) has a Hamiltonian path with respect to T where κ1 = |X| − h and κ2 = max{1, p − y}. Proof. We can prove this lemma by similar arguments for proving Lemma 4.1. Due to the space limitation, the proof is omitted. Q.E.D.. 5. The Hamiltonian Path problem. In this section we show how to reduce an instance of Hamiltonian path problem on distance-hereditary graphs to a smaller instance of Hamiltonian path problem or 1HP problem on distance-hereditary graphs. Lemma 5.1. Assume W is not empty. If there exists a Hamiltonian path P of G, then |X| ≥ π(G[Y ]).. 10.

(11) Proof. Let T be the set of end vertices of P . By Lemma 2.5, we have |Xm (P )| + 1 − t1 ≥ |Wm (P )| + |Ym (P )| where t1 = |T ∩ X|. Since |X| ≥ |Xm (P )|, 2 ≥ t1 ≥ 0, |Ym (P )| ≥ π(G[Y ]), and |Wm (P )| ≥ 1, we have |X| ≥ π(G[Y ]). Q.E.D. Lemma 5.2. Assume W is not empty and |T | ≤ 2. If there exists a Hamiltonian path P of G with respect to T where T ∩ Y = ∅, then |X| ≥ π(G[Y ]) + 1. Proof. By Lemma 2.5, we have |Xm (P )| + 1 − t1 ≥ |Wm (P )| + |Ym (P )| where t1 = |T ∩ X|. By definitions, 2 ≥ t1 ≥ 0, |X| ≥ |Xm (P )|, |Wm (P )| ≥ 1, and |Ym (P )| ≥ π(G[Y ]). In case of 2 ≥ t1 ≥ 1, it is easy to see that |X| ≥ π(G[Y ]) + 1. Assume t1 = 0. We have |Xm (P )| ≥ |Wm (P )| + |Ym (P )| − 1 Q.E.D. and |T ∩ W | = 2. In other words, |Wm (P )| ≥ 2. Thus |X| ≥ π(G[Y ]) + 1. Lemma 5.3. Assume W is not empty and |X| = π(G[Y ]). Then, G has a Hamiltonian path if and only if there exists a Hamiltonian path of G∗ (κ1 , κ2 ) with respect to T = {s} where κ1 = κ2 = 1 and s is the only vertex of X  . Proof. Only if part: Assume P is a Hamiltonian path of G. Let T be the set of end vertices of P . Since |X| = π(G[Y ]) ≥ |Xm (P )| and |Ym (P )| ≥ π(G[Y ]), we have 0 ≥ |Xm (P )| − |Ym (P )|. By Lemma 2.5, we have |Xm (P )| + 1 − t1 ≥ |Wm (P )| + |Ym (P )| where t1 = |T ∩ X|. Thus, 0 ≥ |Xm (P )| − |Ym (P )| ≥ |Wm (P )| − 1 + t1 . Since t1 ≥ 0, we have 0 ≥ |Wm (P )| − 1 + t1 ≥ |Wm (P )| − 1. Since W is not empty,   we have |Wm (P )| = 1. Let Wm (P ) = {PW }. Note that PW is also a Hamiltonian path of G∗ [W ] such   is in Z. Without loss of generality, assume P athStart(PW ) ∈ Z. that at least one end vertex of PW  Then sPW is a Hamiltonian path of G∗ with respect to T = {s}. If part:. Suppose P  is a Hamiltonian path of G∗ . Let T be the set of end vertices of P  . Since |X  | = 1, |Wm (P  )| = 1. Let Wm (P  ) = {PW }. By definition PW is a zW z-path. It is easy to see that PW visits all vertices in W . Without loss of generality, assume P  = PW s. Let P = {P1 , P2 , · · · , Ph } be a minimum path cover of G[Y ], |P| = h and X = {x1 , x2 , · · · , xh }. Then P ∗ = PW x1 P1 x2 P2 x3 · · · Ph−1 xh Ph is a Hamiltonian path of G. Q.E.D. Lemma 5.4. Assume |X| ≥ h + 1. Then, G has a Hamiltonian path if and only if G∗ (κ1 , κ2 ) has a Hamiltonian path where κ1 = |X| − h, and κ2 = max{1, p − y}. Proof. Only if part: Suppose P is a Hamiltonian path of G. Let T be the set of end vertices of P . For clarity, let xm = |Xm (P )|, ym = |Ym (P )|, and wm = |Wm (P )|. By Lemma 2.5, xm +1−t1 ≥ ym +wm ≥ xm +t2 −1 where t1 = |T ∩ X| and t2 = |T ∩ (V \ X)|. Since 2 ≥ t1 ≥ 0 and 2 ≥ t2 ≥ 0, we have that ym + wm + 1 ≥ xm ≥ ym + wm − 1. Therefore, wm + 1 ≥ xm − ym ≥ wm − 1, i.e., xm − ym = wm − 1, xm −ym = wm or xm −ym = wm +1. Since |X| ≥ xm ≥ p and y ≥ ym ≥ h, we have κ1 ≥ xm −ym ≥ κ2 . By definition of G∗ , π0 (G∗ [X  ]) = κ2 . By Lemma 2.1, there exists a path cover D of G∗ [X  ] of size wm − 1, wm or wm + 1. Hence, we can form a Hamiltonian path of G∗ from Wm (P ) and D easily. If part:. 11.

(12) Suppose P  is a Hamiltonian path of G∗ . Let T be the set of end vertices of P  . Wm (P  ) is a zW z-path-cover of G[W ]. By Lemma 2.7, there exists a zW z-path-cover B of G[W ] with respect to T such that κ1 + 1 − k ≥ |B| ≥ κ2 + 1 − k where k = |T ∩X  |. Let |B| = wm . Then κ1 ≥ wm + k − 1 ≥ κ2 . There are two cases: Case 1: p ≥ wm + k − 1 + h. Let f = p − wm − k + 1. In case of p − y ≤ k, clearly y ≥ p − k ≥ p − k − (wm − 1) = f . In case of p − y > k, wm − 1 + k ≥ κ2 = p − y. Hence y ≥ p − wm − k + 1 = f . By Lemma 2.1, there exists a path cover F of G[Y ] such that |F | = f since y ≥ f ≥ h. By definition, G[X] has a path cover D of size d = p. By Lemma 2.6, G has a Hamiltonian path. Case 2: p < wm +k −1+h. Since |X  | ≥ wm −1+k, we have that |X| = |X  |+h ≥ wm −1+k +h > p. By Lemma 2.1, there exists a path cover D of G[X] such that |D| = wm +k−1+h. By definition, there exists a path cover F of G[Y ] such that |F | = h. By Lemma 2.6, G has a Hamiltonian path. Q.E.D.. 6. Linear time Algorithms for Hamiltonian Problems. In this section, we shall present linear time algorithms for the constrained Hamiltonian path problems on distance-hereditary graphs. Recall that the PTF-tree P T (G) of a distance-hereditary graph can be generated in O(n + m) time [8]. Notice that the notation used but not defined in this section can be found in Section 2. Before presenting our linear algorithms for the constrained Hamiltonian problems on distance-hereditary graphs, we state some relevant properties of cographs below. Let H1 = (V1 , E1 ) and H2 = (V2 , E2 ) be two cographs. A graph H = (V, E) is obtained from H1 and H2 by a ”union” operation, denoted by H = H1 + H2 , if V = V1 ∪ V2 and E = E1 ∪ E2 . And graph H = (V, E) is obtained from H1 and H2 by a ”joint” operation, denoted by H = H1 -. H2 , if V = V1 ∪ V2 and E = E1 ∪ E2 ∪ {(u, v)|u ∈ H1 and v ∈ H2 }. By definition of cographs, H is a cograph if it is obtained form H1 and H2 by either a ”union” or ”joint” operation. Obviously, each internal node of the PTF-tree P T (H) of a cograph H is either a T -node or a F -node. Let u be an internal node in P T (H). By Definition 1, it is easy to see that H(u) is obtained from H(ul ) and H(ur ) by a ”union” (resp. ”joint”) operation if u is a F -node (resp. T -node). In [10], [30], [28], and [31], some researchers have shown the following lemmas to compute π(H, T ) for a cograph H with respect to T , where 0 ≤ |T | ≤ 2. In the following, let H, H1 , and H2 be three cographs such that H is obtained from cographs H1 and H2 by a union or joint operation. Assume that η = max {π(Hi ) − |V (H3−i )|} if H = H1 -. H2 . 1≤i≤2. Lemma 6.1. [10][30][28] Let H1 and H2 be two cographs. Then (1) If H = H1 + H2 , then π(H) = π(H1 ) + π(H2 ); (2) If H = H1 -. H2 , then π(H) = max{1, η}. A graph is called Hamiltonian-connected if for every two different vertices there is a Hamiltonian path joining these vertices. In [28], Jung proved the following lemma: Lemma 6.2. [28] Let H, H1 , and H2 be cographs and H = H1 -. H2 . Then (1) H has a Hamiltonian path if and only if η ≤ 1; (2) H has a Hamiltonian cycle if and only if η ≤ 0 and |V (H)| ≥ 3; (3) H is Hamiltonian-connected if and only if η < 0. 12.

(13) By Lemma 6.2, H has a Hamiltonian cycle if H = H1 -. H2 and η ≤ 0. Hence, H has a Hamiltonian path with respect to {s}; that is, π(H, {s}) = 1. Assume that s ∈ V (H1 ) and η ≥ 1. Clearly, π(H1 ) ≤ π(H1 , {s}). If π(H1 ) = π(H1 , {s}), then s is an endpoint of one path in the minimum path cover of H1 . Then, we have the following lemma. Lemma 6.3. [31][28](1HP problem for cographs) Assume that T = {s} ⊆ V (H1 ). Then, (1) If H = H1 + H2 , then π(H, T ) = π(H1 , T ) + π(H2 ); (2) If H = H1 -. H2 , then   1 η π(H, T ) =  η+1. ,if η ≤ 0; ,if η ≥ 1, π(H1 ) = π(H1 , T ), and η = π(H1 ) − |V (H2 )|; ,otherwise.. By Lemma 6.2, H is Hamiltonian-connected if H = H1 -. H2 and η < 0. Hence, π(H, T ) = 1 if H = H1 -. H2 , |T | = 2, and η < 0. By similar to Lemma 6.3, we can easily derive the following lemma: Lemma 6.4. [31](2HP problem for cographs) Assume that T = {s, t} ⊆ H. Then, (1) If H = H1 + H2 , then π(H, T ) = π(H1 , T ) + π(H2 , T ); (2) If H = H1 -. H2 , then  1 , if η < 0;     η + 1 , if η ≥ 0, s ∈ V (H1 ), t ∈ V (H2 ), and     ((π(H1 ) = π(H1 , {s}) and η = π(H1 ) − |V (H2 )|) or  π(H2 ) = (π(H2 , {t}) and η = π(H2 ) − |V (H1 )|)); π(H, T ) =   η + δ , if η ≥ 0, T ⊆ V (H1 ), η = π(H1 ) − |V (H2 )|, and     δ = π(H1 , T ) − π(H1 );    η + 2 , otherwise. Following the above lemmas, we can easily compute π(H, T ), |T | ≤ 2, for cograph H in constant time if π(H1 ), π(H2 ), |V (H1 )| and |V (H2 )| are given. The basic ideas of our linear algorithm to solve the 2HP problem on a distance-hereditary graph G is sketched as follows. If G is a cograph, then we solve the 2HP problem by the algorithm given in [11, 31]. In the following, we assume that G is not a cograph and the PTF-tree of G has been constructed. We first traverse the PTF-tree P T (G) of G by a reverse breadth-first search which visits the nodes in the reverse ordering of a breadth-first search on P T (G). Let u be the node currently visited. If u is either a F -node or a T -node, we find π(G(u)), π(G(u), {s}) if s ∈ V (G(u)), and π(G(u), {s, t}) if s, t ∈ V (G(u)) by Lemma 6.1, 6.3, and 6.4. If u is a P -node, we reduce the 2HP problem for G to the same problem for G∗ by Lemma 3.1 to Lemma 3.6. For instance, given a PTFtree T shown in Figure 1(b) and T = {v0 , v8 }, our algorithm computes κ1 = 2 and κ2 = 1 when it visits the final pendant node of T . Then, the corresponding PTF-tree P T (G∗ ) of G∗ (κ1 , κ2 ) is shown in Figure 2 and T becomes {v0 , v9 }. Note that our algorithm does not need to re-traverse the nodes of X  in P T (G∗ ) since |X  | = κ1 and π(X  , T ) = κ1 are known. After completing the reverse breadth-first search on P T (G), we solve the 2HP problem for G in linear time. Let T = {s, t} be a subset of vertices and be the input of the 2HP problem. To solve the 2HP problem on a distance-hereditary graph G in linear time, we put a annotation on each node u in 13.

(14) T F. T F. P. v2 F. v0 v6. T. v1 v7. X' v4. v3. T. v5 v9. Figure 2: The PTF-tree P T (G∗ ) after visiting the final pendant node of the PTF-tree shown in Figure 1(b) and the new T = {v0 , v9 }.. P T (G). The annotation contains a sequence (χ, τ, π0 , π1 , π2 ) of elements as follows: (1) χ: the number of vertices of G(u); (2) τ : |T ∩ V (G(u))|; (3) π0 : the minimum cardinality of path cover of G(u); (4) π1 : π(G(u), T  ) if T  = T ∩ V (G(u)) and |T  | = 1; (5) π2 : π(G(u), T ) if |T | = 2 and T ⊆ V (G(u)). We denote the above element on node u by u.γ where γ is either χ, τ , π0 , π1 , or π2 . Initially, υ.χ = 1, υ.π0 = 1, υ.π1 = 1, and υ.π2 = 1 for each leaf υ in P T (G). And , υ.τ = 1 if υ ∈ T ; otherwise, υ.τ = 0. Then, we traverse the internal nodes in P T (G) by a reverse breadth-first search. The algorithm is formally presented in the following. Algorithm 2HP-DH. Determine whether a given distance-hereditary graph has a Hamiltonian path with end vertices s, t or not. Input: A PTF-tree P T (G) of a distance-hereditary graph G = (V, E) and a subset T = {s, t} of V . Output: Yes or No. Method: 1. if G is a cograph then call the algorithm in [31]; 2. for each leaf node υ in P T (G) do 3. if υ ∈ T then υ.τ ←− 1; else υ.τ ←− 0; 4. υ.χ ←− 1; υ.π0 ←− 1; υ.π1 ←− 1; υ.π2 ←− 1; 5. Let S = {u0 , u1 , · · · , un−2 } be the ordered set of internal nodes by a breadth-first search on P T (G); 6. for i = n − 2 downto 0 do 7. if ui is either a T -node or a F -node then 8. Compute ui .χ, ui .τ , ui .π0 , ui .π1 , and ui .π2 by Lemma 6.1, 6.3, and 6.4; 9. if ui is a P -node then 10. Let L and R be the left and right child nodes of ui in P T (G), respectively; 14.

(15) 11. x ←− L.χ; p ←− L.π0 ; y ←− R.χ; h ←− R.π0 ; 12. Consider the following cases: 13. Case 1: R.τ = 2 (say T ⊆ Y ) /*Lemma 3.1*/ 14. if (x < max{2, R.π2 }) then return (No); 15. κ1 ←− x − max{0, R.π2 − 2}; κ2 ←− max{2, p − y + 2}; 16. Case 2: R.τ = 1 and L.τ = 1 (say s ∈ Y and t ∈ X) /*Lemma 3.3*/ 17. if (x < R.π1 + 1) then return (No); 18. κ1 ←− x − R.π1 + 1; κ2 ←− max{2, L.π1 − y + 1}; 19. Case 3: R.τ = 1 and L.τ = 0 (say s ∈ Y and t ∈ W ) /*Lemma 3.2*/ 20. if (x < R.π1 ) then return (No); 21. κ1 ←− x − R.π1 + 1; κ2 ←− max{1, p − y + 1}; 22. Case 4: L.τ = 2 (say T ⊆ X) /*Lemma 3.4*/ 23. if (x < h + 2) then return (No); 24. κ1 ←− x − h; κ2 ←− max{2, L.π2 − y}; 25. Case 5: L.τ = 1 and R.τ = 0 (say s ∈ X and t ∈ W ) /*Lemma 3.5*/ 26. if (x < h + 1) then return (No); 27. κ1 ←− x − h; κ2 ←− max{1, L.π1 − y}; 28. Case 6: L.τ = 0 and R.τ = 0 (say T ⊆ W ) /*Lemma 3.6*/ 28. if (x < h + 1) then return (No); 29. κ1 ←− x − h; κ2 ←− max{1, p − y}; 30. ui .χ ←− κ1 ; ui .π0 ←− κ2 ; ui .π1 ←− κ2 ; ui .π2 ←− κ2 ; ui .τ ←− L.τ + R.τ ; 31. if (u0 .π2 = 1) then return (Yes); else return (No); In the following, we give an example to illustrate Algorithm 2HP-DH. Example 1. Given a PTF-tree P T (G) shown in Figure 1(b) and T = {v0 , v8 }. Let S = {u0 , u1 , · · · , u9 } shown in Figure 3(a) be the ordered set of internal nodes by a breadth-first search on P T (G). Then, Algorithm 2HP-DH visits the elements of S in the reverse order. When it visits node u7 which is a final pendant node (P -node), it computes κ1 = 2, κ2 = 1, and reduces P T (G) to P T (G∗ (κ1 , κ2 )) shown in Figure 3(b). That is, P T [u7] is replaced by P T (X  ) where X  = I ∪ K, I is an independent set of size κ2 − 1, and K is a clique of size κ1 − κ2 + 1. Note that our algorithm does not need to visit any nodes in X  of P T (G∗ ) since π(X  , T ) = κ2 and |X  | = κ1 are known. After visiting all internal nodes of P T (G), we obtain that u0 .π2 = 1. Hence, G has a Hamiltonian path with respect to T . Figure 4 depicts the traversal on P T (G).. . The correctness of Algorithm 2HP-DH follows Lemma 3.1 to 3.6 and Lemma 6.1 to 6.4. Clearly, the computation done at each node by Algorithm 2HP-DH is bounded by a constant. Furthermore, Algorithm 2HP-DH visits each internal node exactly once. Therefore, we conclude the following theorem. Theorem 6.5. Algorithm 2HP-DH solves the 2HP problem for distance-hereditary graph G in O(n) time if the PTF-tree of G has been constructed. A PTF-tree P T (G) of a distance-hereditary graph G = (V, E) can be computed in O(n + m) time [8]. Thus, the following result immediately holds.. 15.

(16) T u0. T u0. T u1 F u3. F u2 P u4. v2. F u5. v0 v6. u7 P. F u2. v6. v1 v7. T u9 v9 v8. P u4. v2. F u5. v0. v5. u8 F. v4 (a). F u3. v3. T u6. v1 v7. T u1. u7 T. v3. T u6 v5. v4 v9 X': k 1=2, k 2=1. v 10. (b). Figure 3: (a)The reverse breadth-first traversal of the PTF-tree P T (G) presented in Figure 1(b) where T = {v0 , v8 }, and (b)The PTF-tree P T (G∗ ) of G∗ (κ1 , κ2 ) and T = {v0 , v9 }.. T (4,1,2,2,2). (3,1,3,3,3). (1,0,1,1,1). F. T. F. (1,1,1,1,1). (6,2,1,1,1). P. (1,0,1,1,1). F. k 1=1 k 2=1. (1,1,1,1,1). T. (2,0,2,2,2) (1,0,1,1,1). P. (1,0,1,1,1). (2,1,2,2,2). (1,0,1,1,1) (3,1,1,1,1). k 1=2 k 2=1. (1,0,1,1,1). (2,1,1,1,1). (2,0,2,2,2). (1,0,1,1,1). F. (1,0,1,1,1). T. (2,1,1,1,1). (1,0,1,1,1). (1,0,1,1,1). Figure 4: u0 .π2 = 1 after completing the traversal of nodes in P T (G), where the annotation on each node is a sequence (χ, τ, π0 , π1 , π2 ).. 16.

(17) Corollary 6.6. The 2HP problem on distance-hereditary graphs can be solved in O(n + m) time. With the aid of previous theorem and corollary, one can modify Algorithm 2HP-DH to conclude the following theorems. Theorem 6.7. There exists an algorithm to solve the 1HP problem on distance-hereditary graphs in O(n + m) time. Moreover, it can solve the 1HP problem in O(n) time if the PTF-tree has been computed. Theorem 6.8. There exists an algorithm to solve Hamiltonian path problem on distance-hereditary graphs in O(n + m) time. Moreover, it can solve Hamiltonian path problem in O(n) time if the PTF-tree has been constructed. In [26], we proved the following lemma for Hamiltonian cycle problem on distance-hereditary graphs. Lemma 6.9. [26] G has a Hamiltonian cycle if and only if |X| ≥ h + 1 and G∗ (κ1 , κ2 ) has a Hamiltonian cycle where κ1 = |X| − h and κ2 = max{1, p − y}. By the above lemma, one can modify Algorithm 2HP-DH to conclude the following corollary. Corollary 6.10. There exists an algorithm to solve Hamiltonian cycle problem on distance-hereditary graphs in O(n + m) time. Moreover, it can solve Hamiltonian cycle problem in O(n) time if the PTFtree has been computed. Though we only describe how to decide whether a distance-hereditary graph has a Hamiltonian path with respect to T , these algorithms can be easily extended to find a Hamiltonian path with respect to T following the constructive proofs of lemmas in Section 3, 4, and 5 in the same time bound.. References [1] H. J. Bandelt and H. M. Mulder, Distance-hereditary graphs, J. Combin. Theory Ser. B 41 (1986) 182-208. [2] J. A. Bondy and U. S. R. Murty, Graph Theory with Applications (Macmillan, London, 1976). [3] A. Brandst¨adt and F. F. Dragan, A linear-time algorithm for connected r-domination and Steiner tree on distance-hereditary graphs, Networks 31 (1998) 177-182. [4] H. J. Broersma, E. Dahlhaus, and T. Kloks, A linear time algorithm for minimum fill-in and treewidth for distance hereditary graphs, Discrete Appl. Math. 99 (2000) 367-400. [5] M. S. Chang, S. C. Wu, G. J. Chang, and H. G. Yeh, Hamiltonian problems on Ptolemaic graphs, in: Proceedings of Workshop on Algorithms and Theory of Computation, International Computer Symposium, Chiayi, Taiwan, R. O. C., (2001) 27-34.. 17.

(18) [6] M. S. Chang, S. C. Wu, G. J. Chang, and H. G. Yeh, Domination on distance-hereditary graphs, submitted. [7] M. S. Chang and R. L. Yang, Edge domination of distance-hereditary Graphs, in: Proceedings of Workshop on Algorithms, International Computer Symposium, Taiwan, R.O.C., (1998) 112-115. [8] M. S. Chang, S. Y. Hsieh, and G. H. Chen, Dynamic programming on distance-hereditary graphs, Lecture Notes in Comput. Sci., Vol. 1350, Springer, Berlin, (1997) 344-353. [9] S. Cicerone and G. D. Stefano, Graph classes between parity and distance-hereditary graphs, Discrete Appl. Math. 95 (1999) 197-216. [10] D. G. Corneil, H. Lerchs, and L. K. Stewart, Complement reducible graphs, Discrete Appl. Math. 3 (1981) 163-174. [11] D. G. Corneil, Y. Perl, and L. K. Stewart, A linear recognition algorithm for cographs, SIAM J. Comput. 14 (1985) 926-934. [12] B. Courcelle, J. Engelfriet, and G. Rozenberg, Handle-rewriting hypergraph grammars, J. Comput. System Sci. 46 (1993) 218-270. [13] B. Courcelle, J. A. Makowsky, and U. Rotics, Linear time solvable optimization problems on graphs of bounded clique-width, Theory Comput. Systems 33 (2000) 125-150. [14] B. Courcelle and S. Olariu, Upper bounds to the clique width of graphs, Discrete Appl. Math. 101 (2000) 77-114. [15] P. Damaschke, The Hamiltonian circuit problem for circle graphs is NP-complete, Inform. Process. Lett. 32 (1989) 1-2. [16] F. F. Dragan and F. Nicolai, LexBFS-orderings of distance-hereditary graphs with application to the diametral pair problem, Discrete Appl. Math. 98 (2000) 191-207. [17] W. Espelage, F. Gurski, and E. Wanke, How to solve NP-hard graph problems on clique-width bounded graphs in polynomial time, Lecture Notes in Comput. Sci., Vol. 2204, Springer, Berlin, (2001) 117-128. [18] M. R. Garey, D. S. Johnson, and R. E. Tarjan, The planar Hamiltonian circuit problem is NPcomplete, SIAM J. Comput. 5 (1976) 704-714. [19] M. C. Golumbic, Algorithmic Graph Theory and Perfect Graphs (Academic Press, New York ,1980). [20] M. C. Golumbic and U. Rotics, On the clique-width of some perfect graph classes, International J. Foundations of Comput. Sci. 11 (2000) 423-443. [21] P. L. Hammer and F. Maffray, Completely separable graphs, Discrete Appl. Math. 27 (1990) 85-99.. 18.

(19) [22] E. Howorka, A characterization of distance-hereditary graphs, Quart. J. Math. Oxford 28 (1977) 417-420. [23] E. Howorka, A characterization of Ptolemaic graphs, J. Graph Theory 5 (1981) 323-331. [24] S. Y. Hsieh, C. W. Ho, T. S. Hsu, and M. T. Ko, The Hamiltonian problem on distance-hereditary graphs, to appear in Proceedings of the eight Annual International Computing and Combinatorics Conference COCOON’02. [25] S. Y. Hsieh, C. W. Ho, T. S. Hsu, M. T. Ko, and G. H. Chen, A faster implementation of a parallel tree contraction scheme and its application on distance-hereditary graphs, J. Algorithms 35 (2000) 50-81. [26] R. W. Hung, S. C. Wu, and M. S. Chang, Hamiltonain cycle problem on distance-hereditary graphs, submitted. [27] A. Itai, C. H. Papadimitriou, and J. L. Szwarcfiter, Hamiltonian paths in grid graphs, SIAM J. Comput. 11 (1982) 676-686. [28] H. A. Jung, On a class of posets and the corresponding comparability graphs, J. Combin. Theory Ser. B 24 (1978) 125-133. [29] M. S. Krishnamoorthy, An NP-hard problem in bipartite graphs, SIGACT News 7 (1976) 26. [30] R. Lin, S. Olariu, and G. Pruesse, An optimal path cover algorithm for cographs, Computers Math. Appl. 30 (1995) 75-83. [31] F. Nicolai, Hamiltonian problems on distance-hereditary graphs, Technical Report SM-DU-264 (1994), University Duisburg. [32] F. Nicolai and T. Szymczak, Homogeneous sets and dominations: A linear time algorithm for distance-hereditary graphs, Network s 37 (2001) 117-128. [33] H. G. Yeh and G. J. Chang, Weighted connected domination and Steiner trees in distancehereditary graphs, Discrete Appl. Math. 87 (1998) 245-253. [34] H. G. Yeh and G. J. Chang, Weighted connected k-domination and weighted k-dominating clique in distance-hereditary graphs, Theoret. Comput. Sci. 263 (2001) 3-8.. 19.

(20)

數據

Figure 1: (a)A distance-hereditary graph G, and (b)The corresponding PTF-tree of G.
Figure 2: The PTF-tree P T (G ∗ ) after visiting the final pendant node of the PTF-tree shown in Figure 1(b) and the new T = {v 0 , v 9 }.
Figure 3: (a)The reverse breadth-first traversal of the PTF-tree P T (G) presented in Figure 1(b) where T = {v 0 , v 8 }, and (b)The PTF-tree P T (G ∗ ) of G ∗ (κ 1 , κ 2 ) and T = {v 0 , v 9 }.

參考文獻

相關文件

In particular, we present a linear-time algorithm for the k-tuple total domination problem for graphs in which each block is a clique, a cycle or a complete bipartite graph,

Breu and Kirk- patrick [35] (see [4]) improved this by giving O(nm 2 )-time algorithms for the domination and the total domination problems and an O(n 2.376 )-time algorithm for

From these results, we study fixed point problems for nonlinear mappings, contractive type mappings, Caritsti type mappings, graph contractive type mappings with the Bregman distance

A derivative free algorithm based on the new NCP- function and the new merit function for complementarity problems was discussed, and some preliminary numerical results for

Define instead the imaginary.. potential, magnetic field, lattice…) Dirac-BdG Hamiltonian:. with small, and matrix

We will give a quasi-spectral characterization of a connected bipartite weighted 2-punctually distance-regular graph whose halved graphs are distance-regular.. In the case the

Monopolies in synchronous distributed systems (Peleg 1998; Peleg

We give a quasi- spectral characterization of a connected bipartite weighted 2-punctually distance- regular graph whose halved graphs are distance-regular.. In the case the