• 沒有找到結果。

Hamiltonian Problems on Ptolemaic Graphs

N/A
N/A
Protected

Academic year: 2021

Share "Hamiltonian Problems on Ptolemaic Graphs"

Copied!
8
0
0

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

全文

(1)Hamiltonian Problems on Ptolemaic Graphs ∗ Maw-Shang Chang and Shaur-Ching Wu Department of Computer Science and Information Engineering Information Engineering National Chung Cheng University Min-Hsiun, Chiayi 621, Taiwan Email: [email protected] Gerard J. Chang. Hong-Gwa Yeh. Department of Applied Mathematics National Chiao Tung University Hsinchu 30050, Taiwan Email: [email protected]. Department of Applied Mathematics National University of Kaoshiung Kaoshiung 811, Taiwan Email: [email protected]. Abstract This paper gives a unified approach for solving the Hamiltonian path, the Hamiltonian cycle problems and their variants on Ptolemaic graphs. These algorithms run in linear time.. 1. Introduction. All graphs in this paper are finite, undirected, without loops or multiple edges. Let G = (V, E) be a graph with |V | = n and |E| = m. A connected graph is called Ptolemaic if and only if for any four vertices x, y, z, w of it we have the Ptolemaic inequality d(x, y)d(z, w) ≤ d(x, z)d(y, w) + d(x, w)d(y, z). Properties and optimization problems of Ptolemaic graphs have been studied in [2, 9, 15, 16, 20, 23, 18]. These graphs are superclasses of block graphs and subclasses of distance-hereditary graphs. A Hamiltonian path (respectively, cycle) of a graph G is a simple path (respectively, cycle) containing all vertices of G. The Hamiltonian path (respectively, cycle) problem is to determine whether a graph G has a Hamiltonian path (respectively, cycle) or not. This two problems are N P complete for general graphs [13]. We will use the notations HC, HP , (HP, s) and (HP, s, t) as abbreviations ∗ Supported partly by the National Science Council under grants NSC89-2115-M-194-020, NSC89-2115-M-390-002 and NSC85-2121-M009-024.. for “Hamiltonian cycle”, “Hamiltonian path”, “Hamiltonian path with endpoint s” and “Hamiltonian path with endpoints s and t”, respectively. Nicolai [20] presented the first polynomial-time algorithms for determining whether or not a Ptolemaic graph has an HP in O(n2 (n + m)) time, an (HP, s) in O(n(n + m)) time, an (HP, s, t) in O(n + m) time, an HC in O(n + m) time, for any s, t ∈ V , provided a d-extremal dismantling scheme is given (see [20] for definition). Whereas computing a d-extremal dismantling scheme requires O(n2 ) time [20] in a general graph. Though, most recently Dragan and Nicolai [11] presented a lineartime algorithm for computing such a d-extremal dismantling scheme on Ptolemaic graphs. They first gave an algorithm for the Hamiltonian cycle problem and then solved the Hamiltonian path problems by reducing them to the Hamiltonian cycle problem. It seems that exists a more efficient and unified algorithm for these Hamiltonian problems on Ptolemaic graphs if we avoid the use of d-extremal dismantling scheme and exploit the structure of Ptolemaic graphs. In this paper we give a unified approach to determine whether or not a Ptolemaic graph G has a HC, HP , (HP, s) or (HP, s, t) simultaneously in linear time. Our algorithm sharpens Nicolai’s idea and does not use the dextremal dismantling scheme. Notice that a graph G is Ptolemaic if and only if it is distance-hereditary and chordal [2, 9, 15, 16]. A graph is distance-hereditary if and only if every two vertices have the same distance in.

(2) every connected induced subgraph [2, 9, 14]. Distancehereditary graphs have been studied in [1, 2, 4, 5, 9, 10, 12, 14, 15, 16, 19, 21, 22, 23, 24, 6, 7]. A graph is chordal if every cycle of length > 3 has a chord. A graph is a cograph if there is no induced path containing 4 vertices.. 2. Preliminaries. In this paper the terminology and notation of Bondy and Murty [3] are followed. Suppose A and B are two sets of vertices in a graph G = (V, E). G[A] denotes the subgraph of G induced by A. The neighborhood NA (B) of B in A is the set of vertices in A that are adjacent to some vertex in B. The S closed neighborhood NA [B] of B in A is NA [B] B. For simplicity, NA (v), NA [v], N (B), and N [B] stand for NA ({v}), NA [{v}], NV (B), and NV [B], respectively. The distance dG (x, y) or d(x, y) between two vertices x and y in G is the minimum length of an x-y path in G. The hanging hu of a connected graph G = (V, E) at a vertex u ∈ V is the collection of sets L0 (u), L1 (u),. . . , Lt (u) (or L0 , L1 ,. . . , Lt if there is no ambiguity), where t = maxv∈V dG (u, v) and Li (u) = {v ∈ V : dG (u, v) = i} for 0 ≤ i ≤ t. For any T 1 ≤ i ≤ t and any vertex v ∈ Li , let N 0 (v) = N (v) Li−1 . A vertex v ∈ Li with 1 ≤ i ≤ t has a minimal neighborhood in Li−1 if N 0 (w) is not a proper subset of N 0 (v) for any w ∈ Li . For two disjoint vertex subsets X, Y of a graph G = (V, E), they are said to be joint if each vertex of X is adjacent to each vertex of Y . Notice that a Ptolemaic graph is chordal and distance-hereditary. In the following theorem several characterizations of distance-hereditary graphs and Ptolemaic graphs are stated, which are useful to our algorithm Theorem 1 [2, 9, 14] Suppose hu = (L0 , L1 , . . . , Lt ) is a hanging of a connected distance-hereditary graph G at u. (1) For any two vertices x, y ∈ Li , 1 ≤ i ≤ t, we have that N 0 (x) and N 0 (y) are either disjoint, or one of the two sets is contained in the other. Moreover, if G is Ptolemaic then every N 0 (x) induces a complete graph of G. (2) There exists a vertex v ∈ Li such that v has a minimal neighborhood in Li−1 . In addition, if v satisfies the above condition then for every pair of vertices x and y in N 0 (v), we have NV −N 0 (v) (x) = NV −N 0 (v) (y). (3) For every pair of vertices x, y ∈ Li , 1 ≤ i ≤ t, that are in the same component of G[V − Li−1 ], we have N 0 (x) = N 0 (y). (4) Every Li induces a cograph in G.. The following observation is the base of our algorithms: In Theorem 1, suppose t > 1, let Y be a component of G[Lt ] with |NLt−1 (Y )| ≤ |NLt−1 (B)| for every component B in G[Lt ]. Let X = NLt−1 (Y ) and Z = N [X]−(X∪Y ). It is clear that X, Y and Z are disjoint sets with N [Y ] ⊆ (X∪Y ) and N [X] ⊆ (X∪Y ∪Z). ¿From Theorem 1(3) and the choice of Y we note that any vertex in Y has a minimal neighborhood in Lt−1 , meanwhile X and Y are joint. Therefore by Theorem 1(2) X and Z are joint. Moreover X will induce a complete subgraph of G when G is a Ptolemaic graph.. 3. Hamiltonian Problems. Throughout this section, X, Y , and Z will denote three nonempty disjoint vertex subsets of a graph G = (V, E) with N [Y ] ⊆ (X ∪ Y ) and N [X] ⊆ (X ∪ Y ∪ Z) such that X and Y are joint, X and Z are joint, and X induces a complete subgraph of G, Y induces a cograph. An HP (respectively, HC, (HP, s), (HP, s, t) with |{s, t} ∩ Y | ≤ 1 is (X, Y )-canonical if it contains a subpath that visits all vertices in Y and no vertices in V − (X ∪ Y ). An hamiltonian path P which is an (HP, s, t) having {s, t} ⊆ Y is (X, Y )-canonical if P = P1 P2 P3 such that (i) P1 starts from s, (ii) P3 ends at t, (iii) P1 and P3 do not visit any vertex in V − (X ∪ Y ), (iv) P2 does not visit any vertex in Y , and (v) either P1 or P3 has all its vertices in Y . For a graph H, π0 (H) denotes the minimum number of pairwise disjoint paths covering H, π1 (H, s) denotes the minimum number of pairwise disjoint paths covering H such that s is endpoint of one of these paths, and π2 (H, s, t) denotes the minimum number of pairwise disjoint paths covering H such that s and t are endpoints of two of these paths, or π2 (H, s, t) = 1 if H contains an HP with endpoints s and t. For notational convenience we will use π0 (Y ), π1 (Y, s) and π2 (Y, s, t) to denote π0 (G[Y ]), π1 (G[Y ], s) and π2 (G[Y ], s, t) respectively. We say that a subpath P 0 of a path P is an (X, Y )-path if P 0 starts from a vertex in X, ends at a vertex in Y , and has all its vertices in X ∪ Y . A subpath P 0 of a path P is (X, Y )-maximal if P 0 is an (X, Y )-path and is not a proper subpath of any (X, Y )path of P . For a subset W of vertices of a graph G, we say that a subpath P is a (W )-path if P has all its vertices in W . A subpath P 0 of a path P is (Y )-maximal if P 0 is a (Y )-path and is not a proper subpath of any (Y )-path of P . Suppose P = p1 p2 · · · pk is a path and pi ’s are vertices visited by path P in the ordering that path P visits them. The reverse path of P , denoted by P , is the path that visits vertices pi ’s for all 1 ≤ i ≤ k in the reverse ordering that path P visits them..

(3) Lemma 2 If G has an (HP, s, t), then G has an (X, Y )-canonical (HP, s, t). Proof. Suppose P is an (HP, s, t) of G. If P has no (X, Y )-path, then it starts from vertex s ∈ Y and visits all vertices in Y before it visits any vertex not in Y . Clearly, it is an (X, Y )-canonical (HP, s, t). Thus, i we assume that P has an (X, Y )-path. Let {Pxy :1≤ i ≤ k} be the set of all (X, Y )-maximal subpaths of P. Without loss of generality, assume that t ∈ Y if |Y ∩ {s, t}| ≥ 1. Then, there are four cases: 1 1 2 2 k−1 k Case 1, P = Ps Pxy Pxz Pxy Pxz . . . Pxz Pxy Pt , 1 1 2 2 k−1 k Case 2, P = Pxy Pxz Pxy Pxz . . . Pxz Pxy Pt , 1 1 2 2 k−1 k Case 3, P = Ps Pxy Pxz Pxy Pxz . . . Pxz Pxy , and 1 1 2 2 k−1 k Case 4, P = Pxy Pxz Pxy Pxz . . . Pxz Pxy . i Clearly, each path Pxz starts from a vertex in X, ends at a vertex in Z, and has all its vertices in V − Y for all i, 1 ≤ i < k. Case 1. Since we assume that t ∈ Y if |Y ∩ {s, t}| ≥ 1, therefore s ∈ / Y in this case. Otherwise, t ∈ Y and hence Pt will contain an (X, Y )-maximal path, a contradiction. Thus, both paths Ps and Pt do not visit any vertex in Y , Ps ends at a vertex in Z, and Pt starts from a vertex in X. Clearly the following path is an (X, Y )-canonical (HP, s, t): 1 2 3 k 1 2 k−1 Ps Pxy Pxy Pxy . . . Pxy Pxz Pxz . . . Pxz Pt .. Case 2. This case can be proved by arguments similar to those for proving the above case. Case 3. If s ∈ Y , then either Ps is a Y -path or Ps = Py P 0 where Py is a Y -path, P 0 does not visit any vertex in Y and P 0 ends at a vertex in Z. In both cases, the following path is an (X, Y )-canonical (HP, s, t): 1 2 k−1 1 2 3 k Ps Pxz Pxz . . . Pxz Pxy Pxy Pxy . . . Pxy . 1 Case 4. Clearly, Pxy = Px P ” where Px is an X-path and P ” starts from a vertex in Y . Let P 0 be the reverse path of the following path: 1 2 k−1 Pxz Pxz . . . Pxz .. Obviously, P 0 starts from a vertex in Z and ends at vertex in X. Then, the following path is an (X, Y )canonical (HP, s, t): 2 3 k Px P 0 P ”Pxy Pxy . . . Pxy .. We use P − t to denote the subpath P 0 of P such that P = P 0 t and t is the last vertex visited by P . We use P − P 0 to denote the subpath P ” of P such that P = P ”P 0 . Let P be an (X, Y )-canonical (HP, s, t). of G. Suppose P has k (Y )-maximal paths. For 1 ≤ i ≤ k, let Pxi and Pyi be (X)-maximal and (Y )-maximal path, respectively. For simplicity, we use P−(X 0 ∪Y ) to denote the subpath of P obtained in all of the following three cases. Case 1, both s and t are in Y . In this case, without loss of generality, we assume that P = Py1 Pxx Py2 Px1 · · · Pyk−1 Pxk−2 Pyk where Py1 starts from vertex s, Pyk ends at vertex t, Pxx starts from a vertex in X and ends at a vertex in X, does not visits any vertex in Y . Obviously one has |X| ≥ k ≥ π2 (Y, s, t). We use P − Y to denote path Pxx Px1 Px2 · · · Pxk−2 . Note that P − Y contains an (X)path that visits at least k − 1 vertices of X. We use P − (X 0 ∪ Y ) to denote the path obtained by removing the last |X 0 | vertices from path P − Y . Since X and Z are joint, X and Y are joint, and X is a clique, we may assume that X 0 is any subset of X with |X 0 | less than or equal to the number of vertices visited by path Px1 Px2 · · · Pxk−2 . It is easy to see that P −(X 0 ∪Y ) starts from a vertex in X and ends at a vertex in X. Case 2, at most one of s and t is in Y . Without loss of generality, assume that t ∈ Y . In this case, P = Pw Py1 Px1 Py2 Px2 · · · Pyk−1 Pxk−1 Pyk where Pyk ends at vertex t, Pw starts from s, ends at a vertex in X, does not visits any vertex in Y . Obviously, k ≥ π1 (Y, t) and |X| ≥ k ≥ π1 (Y, t) ≥ π0 (Y ). In this case, we use P − Y to denote path Pw Px1 Px2 · · · Pxk−1 . Note that P − Y contains an (X)-path that visits at least k vertices of X. We use P −(X 0 ∪Y ) to denote the path obtained by removing the last |X 0 | vertices from path P − Y with |X 0 | less than or equal to the number of vertices visited by path Px1 Px2 · · · Pxk−1 . That is, P − (X 0 ∪ Y ) = (P − Y ) − Px∗ where the set of vertices visited by Px∗ is X 0 . Case 3, neither s nor t is in Y . In this case, P = Pw1 Py1 Px1 Py2 Px2 · · · Pyk−1 Pxk−1 Pyk Pw2 where Pw2 starts from a vertex in X, ends at vertex t, Pw1 starts from s, ends at a vertex in X, neither Pw1 nor Pw2 visits any vertex in Y . Obviously, k ≥ π0 (Y ) and |X| > k ≥ π0 (Y ). In this case, we use P − Y to denote path Pw1 Px1 Px2 · · · Pxk−1 Pw2 . Let Pw1 ends at x1 and Pw2 starts from x2 . Path x1 Px1 Px2 · · · Pxk−1 x2 is an (X)path that visits at least k + 1 vertices. Let X 0 be the last |X 0 | vertices visited by path x1 Px1 Px2 · · · Pxk−1 x2 . We use P − (X 0 ∪ Y ) to denote the path obtained from P − Y by removing the last |X 0 | vertices from path x1 Px1 Px2 · · · Pxk−1 x2 where |X 0 | ≤ k. That is, P − (X 0 ∪ Y ) = (Pw1 Px1 Px2 · · · Pxk−1 − Px∗ )Pw2 where the set of vertices visited by Px∗ is X 0 ..

(4) The concept of P − (X 0 ∪ Y ) will be frequently used in the proof of lemmas for developing our algorithm. Lemma 3 (1) If G has an (HP, s), then G has an (HP, s) such that at most one of its endpoint is in Y . (2) If G has an HP and |X| > π0 (Y ), then G has an HP such that neither of its two endpoints is in Y . (3) If |X| > π0 (Y ), s ∈ / Y , and G has an (HP, s), then there exists an (HP, s) such that neither of its two endpoints is in Y . Proof. (1) Suppose P is an (HP, s) of G that starts from s and ends at t. If t ∈ / Y , then the lemma is true already. In the following, we assume tht both s and t are in Y . By Lemma 2, assume that P is (X, Y )canonical and P = Py Pxz Pxy where Py , Pxz , and Pxy are subpaths of P, Py starts from s, Pxy ends at t, Pxy is an (X, Y )-maximal path, Pxz starts from a vertex in X, ends at a vertex in Z and does not visits any vertex in Y . Clearly, Py Pxy Pxz is an (HP, s) such that its endpoint other than s is not in Y . (2) Suppose P is an HP of G such that P starts from s and ends at t. If neither s nor t is in Y , then this statement is true. By statement (1) of this lemma, we may assume that P is an HP of G such that one of its endpoint is in Y and the other of its endpoint is not in Y . Without loss of generality, assume that t ∈ Y and s ∈ / Y . For notational convienence, let k = π0 (Y ). By Lemma 2, we may assume that P is an (X, Y )-canonical HP . Thus, P = Ps Pxy where Pxy is an (X, Y )-maximal path. Since Z 6= ∅, Ps ends at a vertex z ∈ Z. Consider graph G[Pxy ] which is the subgraph of G induced by the vertices visited by path Pxy . Suppose Ps visits a vertex in X. If s ∈ X, then Pxy Ps in HP that starts from a vertex in X and ends at a vertex in Z. Otherwise, let Ps = Ps1 Ps2 where Ps1 ends at vertex in Z and Ps2 starts from a vertex in X and ends at a vertex in Z. Then, Ps1 Pxy Ps2 is an HP whose endpoints are not in Y . In the following, we assume that Ps does not visits any vertex in X. That is, Pxy is an HP of G[X ∪ Y ]. Since |X| > π0 (Y ), there exists an HP, P 0 , of G[X ∪ Y ] such that P 0 = Px Py1 x1 Py2 x2 · · · Pyk xk is an HP of G[Pxy ] where xi ’s are vertices in Pxy ∩ X for 1 ≤ i ≤ k and Px is an (X)-path visits all vertices X − {xi : 1 ≤ i ≤ k}. Then, Ps P 0 is an HP of G whose endpoints are not in Y . Though the following lemma is inspired by those given in [20], it is slightly different from the original form in [20] and leads to a more simple algorithm. Lemma 4 Let X 0 ⊂ X and G0 = G − (X 0 ∪ Y ). (1) If G has an HC, then |X| ≥ π0 (Y ) + 1. (2) If |X| ≥ π0 (Y ) + 1 and |X 0 | = π0 (Y ), then G has an HC iff G0 has an HC.. Proof. (1) Suppose C is an HC of G. Let k be The number of (Y )-maximal paths in C. It is easy to see that k ≥ π0 (Y ). To connect these k (Y )-maximal paths into an HC, there are at k (V −Y )-maximal paths in C. These (V −Y )-maximal paths starts from a vertex in X and ends at a vertex in X. In other words, each of these (V − Y )-maximal paths visits at least one vertex in X. Since Z 6= ∅, at least one of these (V − Y )-maximal paths visits a vertex in Z. A (V − Y )-maximal path that visits a vertex in Z visits at least two vertices in X. Thus, |X| > k. (2) Suppose G has an HC. It is easy to see that G has an HP, denoted by P, that starts from a vertex s ∈ Z and ends at a vertex t ∈ X where s and t are adjacent in G. Obviously, P − (X 0 ∪ Y ) is an HP of G0 . Hence G0 has an HC. Conversely, suppse G0 has an HC. Then, G0 has an HP, denoted by P ∗ that starts from a vertex in x and ends at a vertex in Z. By the definition of X and Y , there exists an HP, denoted by P 0 , of G[X 0 ∪ Y ] that starts from a vertex in X and ends at a vertex in Y . Clearly, P 0 P ∗ is an HP of G. Since X and Z are joint, G has an HC. Now, we can explain the basic ideas of the algorithms. If G is a cograph, then we can solve the HC problem by the algorithm given in [8]. By Theorem 1, we can find vertex sets X, Y , and Z satisfying the conditions given at the begining of this section. By Lemma 4, we can solve the HC problem for G by solving the HC problem for G0 where the number of vertices of G0 is less than that of G. By repeatedly applying Lemma 4, eventually G0 becomes a cograph. This leads to a polynomial time algorithm for the HC problem in Ptolemaic graphs. The time complexity of this algorithm depends on how fast we can find vertex sets X and Y . Theorem 1 suggests a very efficient implementation for computing vertex sets X and Y by using a hanging of G. A hanging of G can be computed in O(n + m) time. Suppose G has a hanging hu at vertex u such as L0 (u), L1 (u),. . . , Lt (u). Then, X will be a subset of Lt−1 (u) and Y will be a subset of Lt (u). Since we delete vertices in X 0 and Y to obtain G0 , we can obtain a hanging for G0 from the hanging of G in O(|X 0 | + |Y |) time where X 0 is the set of vertices in X that are removed to obtained G0 . This leads to a linear time algorithm for the HC problem in Ptolemaic graphs. In the following, we prove lemmas necessary for developing our algorithm for the HP, (HP, s), and (HP, s, t) problems in Ptolemaic graphs by using the same approach. Lemma 5 Let X 0 ⊂ X, s0 ∈ X − X 0 , and G0 = G − (X 0 ∪ Y )..

(5) (1) If G has an HP , then |X| ≥ π0 (Y ). (2) Suppose |X| = π0 (Y ) and |X 0 | = π0 (Y ) − 1. Then, G has an HP iff G0 has an (HP, s0 ). (3) Suppose |X| > π0 (Y ) and |X 0 | = π0 (Y ). Then, G has an HP iff G” has an HP . Proof. (1) This statement can be proved by arguments similar to those for proving statement (1) of Lemma 4. (2) Suppose P is an HP of G. By arguments similar to those for proving statement (1) of Lemma 4, we can prove that |X| > π0 (Y ) if both endpoints of P is not in Y . Thus, at least one endpoint of P is in Y . By statement (1) of Lemma 3, we may assume that P has one endpoint in Y and the other endpoint not in Y . Withoout loss of generality, assume that P starts from s and ends at vertex t in Y . By Lemma 2, we may assume that P is (X, Y )-canonical. Thus, P − (X 0 ∪ Y ) is an HP of G0 . Besides, P −(X 0 ∪Y ) ends at a vertex in X since |X 0 | = π0 (Y ) − 1. In other words, P − (X 0 ∪ Y ) is an (HP, s0 ) of G0 . Conversely, suppose P 0 is an (HP, s0 ) of G0 and P 0 ends at vertex s0 . Since |X 0 | = π0 (Y ) − 1 and X and Y are joint, there is an HP , denoted by P 00 , of G[X 0 ∪ Y ] with both endpoints in Y . Thus, P 0 P 00 is an HP of G. (3) Suppose P is an HP of G where P starts from s and ends at t. By Lemma 3 (2), neither s nor t is in Y . By Lemma 2, assume that P is (X, Y )-canonical. Hence P − (X 0 ∪ Y ) is an HP of G0 . Conversely, suppose P 0 is an HP of G0 . Since |X 0 | = π0 (Y ), there is an HP , denoted by P”, of G[X 0 ∪ Y ] with one endpoint in X 0 and the other endpoint in Y . Since X − X 0 and Z are not empty, there is an edge (x, z) in P 0 with x ∈ X and z ∈ Z. Let P 0 = P1 P2 such that P1 ends at a vertex in Z and P2 starts from a vertex in X. Then, P1 P”P2 is an HP of G. Lemma 6 Suppose G has an (HP, s). (1) If s ∈ Y , then |X| ≥ π1 (Y, s). (2) If s ∈ X, then |X| > π0 (Y ). (3) If s ∈ V − (X ∪ Y ), then |X| ≥ π0 (Y ). Proof. This statement can be proved by arguments similar to those for proveing statement (1) of Lemma 4. Lemma 7 Let X 0 ⊂ X, s0 ∈ X − X 0 , and G0 = G − (X 0 ∪ Y ). (1) Suppose s ∈ Y , |X| ≥ π1 (Y, s) and |X 0 | = π1 (Y, s) − 1. Then, G has an (HP, s) iff G0 has a (HP, s0 ). (2) Suppose s 6∈ (X ∪ Y ), |X| = π0 (Y ) and |X 0 | =. π0 (Y ) − 1. Then, G has an (HP, s) iff G0 has an (HP, s, s0 ). (3) Suppose s 6∈ Y , |X| ≥ π0 (Y ) + 1 and |X 0 | = π0 (Y ). Then, G has an (HP, s) iff G0 has an (HP, s). Proof. (1) Suppose P is an (HP, s) of G. By Lemma 3 (3), we may assume that at most one endpoint of P is in Y . Withoout loss of generality, assume that P starts from t not in Y and ends at vertex s in Y . By Lemma 2, we may assume that P is (X, Y )-canonical. Thus, P − (X 0 ∪ Y ) is an HP of G0 . Since |X 0 | = π1 (Y, s) − 1 and P has at least π1 (Y, s) (Y )-maximal paths, P − (X 0 ∪ Y ) ends at a vertex in X. By the definition of X, Y , and Z, we may assume that P − (X 0 ∪ Y ) ends at vertex s0 . Conversely, suppose P 0 is an (HP, s0 ) of G0 , P 0 starts from s0 ∈ X − X 0 , and |X 0 | = π1 (Y, s) − 1. Since X is a clique and X and Y are joint, there is an HP, denoted by P 00 , of G[X 0 ∪ Y ] such that P 00 starts from s, ends at a vertex in Y . Thus, P”P 0 is an (HP, s) of G since X and Y are joint. (2) Suppose P is an (HP, s) of G. By Lemma 2, we may assume that P is (X, Y )-canonical (HP, s), starts from vertex s and ends at a vertex t. Path P has at least π0 (Y ) (Y )-maximal paths. Since |X| = π0 (Y, s) and Z 6= ∅, we have that t ∈ Y . Thus, P − (X 0 ∪ Y ) is an HP of G0 . Since |X 0 | = π0 (Y ) − 1 and P has at least π0 (Y ) (Y )-maximal paths, P − (X 0 ∪ Y ) ends at a vertex in X. By the definition of X, Y , and Z, we may assume that P − (X 0 ∪ Y ) ends at vertex s0 . In other words, P − (X 0 ∪ Y ) is an (HP, s, s0 ) of G0 . Conversely, by arguments similar to those for proving statement (1), we can show that if G0 has an (HP, s, s0 ), then G has an (HP, s). (3) Suppose P is an (HP, s) of G. By Lemma 3 (3) and 2, we may assume that P is (X, Y )-canonical (HP, s) and neither of its endpoints is in Y . Hence P − (X 0 ∪ Y ) is an (HP, s) of G0 . Conversely, suppose P 0 is an (HP, s) of G0 . Since Z 6= ∅, we have that P 0 = P1 P2 such that P1 ends at a vertex in Z and P2 starts from a vertex in X. Since |X 0 | = π0 (Y ), there is an HP , denoted by P 00 , of G[X 0 ∪ Y ] such that P” starts from a vertex in X and ends at a vertex in Y . Thus, P1 P”P2 is an (HP, s) of G since X and Y are joint and X and Z are joint. Lemma 8 Suppose G has an (HP, s, t). (1) If {s, t} ⊆ Y , then |X| ≥ 2 and |X| ≥ π2 (Y, s, t). (2) If s ∈ Y and t 6∈ Y , then |X − t| ≥ π1 (Y, s). (3) If s ∈ X and t 6∈ Y , then |X − s − t| ≥ π0 (Y ). (4) If {s, t} ∩ (X ∪ Y ) = ∅, then |X| ≥ π0 (Y ) + 1. Proof. This statement can be proved by arguments similar to those for proveing statement (1) of Lemma 4..

(6) Lemma 9 Let X 0 ⊂ X, s ∈ / X 0, t ∈ / X 0 , G0 = 0 0 0 G − (X ∪ Y ), and s and t be any two distinct vertices in X − X 0 . (1) Suppose {s, t} ⊆ Y , π2 (Y, s, t) = 1, |X| ≥ 2. Then, G has an (HP, s, t) iff G[V − Y ] has an (HP, s0 , t0 ). (2) Suppose {s, t} ⊆ Y , π2 (Y, s, t) > 1, |X| ≥ π2 (Y, s, t) and |X 0 | = π2 (Y, s, t) − 2. Then, G has an (HP, s, t) iff G0 has an (HP, s0 , t0 ). (3) Suppose t ∈ Y , s 6∈ Y , |X − s| ≥ π1 (Y, t), and |X 0 | = π1 (Y, t) − 1. Then, G has an (HP, s, t) iff G0 has an (HP, s, t0 ). (4) Suppose {s, t}∩Y = ∅, |X| ≥ π0 (Y )+1, |X−s−t| ≥ π0 (Y ) and |X 0 | = π0 (Y ). Then, G has an (HP, s, t) iff G0 has an (HP, s, t).. Y = ∅, and |X 0 | = π0 (Y ), P − (X 0 ∪ Y ) is an (HP, s, t) of G0 . Conversely, suppose P 0 is an (HP, s, t) of G0 . Since |X 0 | = π0 (Y ), there is an HP , denoted by P”, of G[X 0 ∪ Y ] that starts from a vertex in X and ends at a vertex in Y . Note that there exist vertices x ∈ (X −X 0 ) and z ∈ Z such that (x, z) is an edge of P 0 , since (X − X 0 ) and Z are not empty. Let P 0 = P1 P2 such that P1 ends at a vertex in Z and P2 starts from a vertex in X. Thus, P1 P”P2 is an (HP, s, t) of G, since X and Y are joint.. Proof. (1) Suppose P is an HP of G. By the definition of X and Y , we may let. Theorem 10 Algorithm HP-pt solves the Hamiltonian path problem for Ptolemaic graphs in linear time.. 1 2 k−1 k P = Py1 Pxx Py2 Pxx · · · Pyk−1 Pxx Py. Pyi. i Pxx. where each is a (Y )-maximal path and each does not visits any vertex in Y , starts from a vertex in X and ends at a vertex in X. It is easy to see that 1 2 k−1 Pxx Pxx · · · Pxx is an HP of G0 with both endpoints in X which can be replaced by s0 and t0 . Thus G0 has an (HP, s0 , t0 ). Conversely, suppose P 0 is an (HP, s0 , t0 ) of G0 . Since π2 (Y, s, t) = 1, there is an (HP, s, t), P 00 , of G[Y ]. Let P 00 = sP ∗ . Then, sP 0 P ∗ is an (HP, s, t) of G, since X and Y are joint. (2) Suppose P is an HP of G. By Lemma 2, we may assume that P is an (X, Y )-canonical (HP, s, t). Path P has at least π2 (Y, s, t) (Y )-maximal paths. Since |X 0 | = π2 (Y, s, t) − 2, P − (X 0 ∪ Y ) is an HP of G0 with both endpoints in X − X 0 which can be replaced by s0 and t0 . Thus G0 has an (HP, s0 , t0 ). Conversely, suppose P 0 is an (HP, s0 , t0 ) of G0 . Since |X 0 | = π2 (Y, s, t) − 2, we can cover G[X 0 ∪ Y ] by two vertex disjoint paths P1 and P2 with all their endpoints in Y such that P1 starts from vertex s, and P2 ends at vertex t. Thus, P1 P 0 P2 is an (HP, s, t) of G, since X and Y are joint. (3) Suppose G has an (HP, s, t). By Lemma 2, we may assume that it is (X, Y )-canonical. Since |X 0 | = π1 (Y, t) − 1, path P − (X 0 ∪ Y ) is an HP of G0 that starts from vertex s, ends at a vertex in X which can be replaced by vertex t0 . In other words, P − (X 0 ∪ Y ) is an (HP, s, t0 ) of G0 . Thus G0 has an (HP, s, t0 ). Conversely, suppose P 0 is an (HP, s, t0 ) of G0 that starts from vertex s and ends at vertex t0 . Since |X 0 | = π1 (Y, t) − 1, there is an (HP, t) P 00 of G[X 0 ∪ Y ] with both endpoints in Y . Thus, P 0 P 00 is an (HP, s, t) of G, since X and Y are joint. (4) Suppose G has an (HP, s, t). By Lemma 2, we may assume that it is (X, Y )-canonical. Since {s, t} ∩. In light of previous lemmas and theorem, we have the algorithm shown in Figure 1. for the Hamiltonian path problem on Ptolemaic graphs.. Proof. In the algorithm shown in Figure 1, we build the hanging hu by a breadth-first search, and use bucket sort to sort F. Next, since all the three parameters π0 (H), π1 (H, s) and π2 (H, s, t) can be determined in linear time for any cograph H [8, 17, 20]. Thus each level Li is emptied during the i-th iteration of the “for” loop in O(|Li | + |E(G[Li ])|) time. So the linearity of the whole algorithm follows. Finally, the correctness of the algorithm follows from Lemma 5 to 9. With the aid of previous lemmas and corollary, one can easily modify algorithm HP-pt to conclude the following corollary. Corollary 11 There exists a linear-time algorithm for determining whether or not a Ptolemaic graph G has an HC (respectively, (HP, s), (HP, s, t) for any vertices s, t in G).. References [1] H. J. Bandelt, A. Henkmann, and F. Nicolai, “Powers of distance-hereditary graphs,” Discrete Appl. math. 145 (1995) 37-60. [2] H. J. Bandelt and H. M. Mulder, “Distancehereditary graphs,” J. Comb. Theory, Series B 41 (1986) 182-208. [3] J. A. Bondy and U. S. R. Murty, Graph Theory with Applications, 1976. [4] A. Branstadt and F. F. Dragan, “A linear-time algorithm for connected r-domination and Steiner.

(7) [15] E. Howorka, “A characterization of distancehereditary graphs,” Quart. J. Math. Oxford (2) 28 (1977) 417-420. [16] E. Howorka, “A characterization of Ptolemaic graphs,” J. Graph Theory 5 (1981) 323-331. [17] H. A. Jung, “On a class of posets and the corresponding comparability graphs,” J. Comb. Theory, Series B 35 (1978) 125-133. [18] D. C. Kay and G. Chartrand, “A characterization of certain ptolemaic graphs,” Canad. J. Math. 17 (1965), 342-346. [19] H. M¨ uller and F. Nicolai, “Polynomial time algorithms for Hamiltonian problems on bipartite distance-hereditary graphs,” Inform. Process. Lett. 46 (1993) 225-230. [20] F. Nicolai, “Hamiltonian problems on distancehereditary graphs,” Technical Report SM-DU-264 (1994), University Duisburg. [21] H. G. Yeh and G. J. Chang, “Weighted connected domination and Steiner trees in distancehereditary graphs,” Discrete Appl. Math. 87 (1998) 245-253. [22] H. G. Yeh and G. J. Chang, “The path-partition problem in bipartite distance-hereditary graphs,” Taiwanese J. Math. 2 (1998) 353-360. [23] H. G. Yeh and G. J. Chang, “Weighted kdomination and weighted k-dominating clique in distance-hereditary graphs,” to appear in Theoretical Computer Science. [24] H. G. Yeh and G. J. Chang, “Centers and medians of distance-hereditary graphs”, submitted..

(8) Algorithm HP-pt. Determine whether or not a connected Ptolemaic graph has a HP . Input: A connected Ptolemaic graph G = (V, E). Output: Determine whether or not G has a Hamiltonian path. Method. C ← ∅; p ← 0; determine the hanging hu = (L0 , L1 , . . . , Lf ) of G at a vertex u; for i = f to 1 step -1 do { let F = {A1 , A2 , . . . , Aj } be the components of G[Li ]; sort F such that |NLi−1 (Ai1 )| ≤ |NLi−1 (Ai2 )| ≤ . . . ≤ |NLi−1 (Aij )|; if i = 1 then { j ← 1; Ai1 ← L1 + u; } for k = 1 to j do { Y ← Aik ; X ← NLi−1 (Y ); Case 1: C = ∅ if i = 1 and π0 (Y ) 6= 1 then GOTO (*); if |X| < π0 (Y ) then GOTO (*) else { if |X| = π0 (Y ) then p ← π0 (Y ) − 1 else p ← π0 (Y ); } let X 0 be any subset of X with |X 0 | = p and s0 ∈ (X − X 0 ); if p = π0 (Y ) − 1 then C ← {s0 }; Case 2: |C| = 1 (say C = {s}) if i = 1 then π1 (Y, s) 6= 1 then GOTO (*); if s ∈ Y then { if |X| < π1 (Y, s) then GOTO (*) else p ← π1 (Y, s) − 1; } if (s 6∈ Y and |X| < π0 (Y )) or (s ∈ X and |X| = π0 (Y )) then GOTO (*); if s 6∈ (X ∪ Y ) and |X| = π0 (Y ) then p ← π0 (Y ) − 1; if s 6∈ Y and |X| ≥ π0 (Y ) + 1 then p ← π0 (Y ); let X 0 be any subset of X with |X 0 | = p and t0 ∈ (X − X 0 − C); if p = π1 (Y, s) − 1 then C ← {t0 } else { if p = π0 (Y ) − 1 then C ← {s, t0 }; } Case 3: |C| = 2 (say C = {s, t} and w.l.o.g. say s ∈ Y as |C ∩ Y | = 1) if i = 1 and π2 (Y, s, t) 6= 1 then GOTO (*); if C ⊆ Y and (|X| < 2 or |X| < π2 (Y, s, t)) then GOTO (*); if |C ∩ Y | = 1 and |X − s − t| ≥ π1 (Y, s) then GOTO (*); if |C ∩ X| ≥ 1 and C ∩ Y = ∅ and |X − s − t| ≥ π0 (Y ) then GOTO (*); if C ∩ (X ∪ Y ) = ∅ and |X| ≥ π0 (Y ) + 1 then GOTO (*); if C ⊆ Y and π2 (Y, s, t) = 1 and |X| ≥ 2 then p ← 0; if C ⊆ Y and π2 (Y, s, t) > 1 and |X| ≥ π2 (Y, s, t) then p ← π2 (Y, s, t) − 2; if |C ∩ Y | = 1 and |X − t| ≥ π1 (Y, s) then p ← π1 (Y, s) − 1; if C ∩ Y = ∅ and |X| ≥ π0 (Y ) + 1 and |X − C| ≥ π0 (Y ) then p ← π0 (Y ); let X 0 be any subset of X with |X 0 | = p and s0 , t0 ∈ (X − X 0 − C); if p = 0 or p = π2 (Y, s, t) − 2 then C ← {s0 , t0 } else { if p = π1 (Y, s) − 1 then C ← {s0 , t}; } Li−1 ← Li−1 − X 0 ; } } print “G has Hamiltonian path”; exit; (*)print “G has no Hamiltonian path”;. Figure 1: The algorithm for the Hamiltonian path on Ptolemaic grpahs.

(9)

參考文獻

相關文件

Here, a deterministic linear time and linear space algorithm is presented for the undirected single source shortest paths problem with positive integer weights.. The algorithm

Primal-dual approach for the mixed domination problem in trees Although we have presented Algorithm 3 for finding a minimum mixed dominating set in a tree, it is still desire to

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

Assume that the partial multiplicities of purely imaginary and unimodular eigenvalues (if any) of the associated Hamiltonian and symplectic pencil, respectively, are all even and

Then, it is easy to see that there are 9 problems for which the iterative numbers of the algorithm using ψ α,θ,p in the case of θ = 1 and p = 3 are less than the one of the

Monopolies in synchronous distributed systems (Peleg 1998; Peleg

Theorem 5.6.1 The qd-algorithm converges for irreducible, symmetric positive definite tridiagonal matrices.. It is necessary to show that q i are in