Download presentation
Presentation is loading. Please wait.
Published byCaitlin Dennis Modified over 9 years ago
1
Graph Theory Chapter 8 Hamiltonian Graphs 大葉大學 (Da-Yeh Univ.) 資訊工程系 (Dept. CSIE) 黃鈴玲 (Lingling Huang)
2
Copyright 黃鈴玲 Ch8-2 Outline 8.1 An Introduction to Hamiltonian Graphs 8.2 Which Graphs are Hamiltonian? 8.3 The Traveling Salesman Problem
3
Copyright 黃鈴玲 Ch8-3 8.1 An Introduction to Hamiltonian Graphs Definition: A graph of G is called Hamiltonian if G has a spanning cycle. A dodecahedron ( 正 12 面體 ) A hamiltonian cycle
4
Copyright 黃鈴玲 Ch8-4 Knight ’ s Tour Puzzle Is it possible for a knight to tour the chessboard ( n n ), that is, visit each square exactly once and return to its initial square? 4 4 chessboard: 此走法不存在 8 8 chessboard: 存在, see Fig 8-2
5
Copyright 黃鈴玲 Ch8-5 pf: (By induction on n ) Base: (n=3) OK Inductive: Assume the (n 1)- cube is hamiltonian. Consider the n -cube: Ex1: Show that the graph of the n -cube is hamiltonian. 3 - cube ( n 1)-cube x y y’y’ x’x’
6
Copyright 黃鈴玲 Ch8-6 Ex2: Show that the graph G below is not hamiltonian. hamiltonian cycle 必定包含這些 edge. hamiltonian cycle 必定包含這些 edge. Hint: 考慮通過此三點的 edge 本身已構成 cycle , 故不可能 hamiltonian 本身已構成 cycle , 故不可能 hamiltonian
7
Copyright 黃鈴玲 Ch8-7 Observe: hamiltonian. 1. C n ( n 3) is hamiltonian. hamiltonian. 2. K n ( n 3) is hamiltonian. hamiltonian. 3. A connected graph with cut-vertices is not hamiltonian.
8
Copyright 黃鈴玲 Ch8-8 G1G1 G3G3 GnGn G2G2 pf: G is hamiltonian a hamiltonian cycle C Suppose k ( G S ) = n, where G 1, G 2, …, G n are components of G S. Suppose k ( G S ) = n, where G 1, G 2, …, G n are components of G S. Let u i (1 i n ) be the last vertex of C that belongs to G i. Let u i (1 i n ) be the last vertex of C that belongs to G i. Let v i be the vertex that immediately follows u i on C. ( u i 的下一點即是 v i 且 v i S ) Let v i be the vertex that immediately follows u i on C. ( u i 的下一點即是 v i 且 v i S ) Thm 8.1: If G is hamiltonian, than k ( G S ) | S | for every S V(G), S . If G is hamiltonian, than k ( G S ) | S | for every S V(G), S . C … v1v1 v3v3 vnvn v2v2 u1u1 unun u3u3 u2u2
9
Copyright 黃鈴玲 Ch8-9 (1) v i S, i (2) v j v k, if j k (1) v i S, i (2) v j v k, if j k | S | n | S | n ∴ k ( G S ) ||. ∴ k ( G S ) | S |. G1G1 G3G3 GnGn G2G2 C … v1v1 v3v3 vnvn v2v2 u1u1 unun u3u3 u2u2
10
Copyright 黃鈴玲 Ch8-10 pf: 例如 K 2,3 上與下兩個 part 點數不一致 ∴ 無法有 hamiltonian cycle 上與下兩個 part 點數不一致 ∴ 無法有 hamiltonian cycle Ex5: Show that no bipartite graph of odd order is hamiltonian.
11
Copyright 黃鈴玲 Ch8-11 Homework Exercise 8.1: 1, 2, 3, 4, 5
12
Copyright 黃鈴玲 Ch8-12 Outline 8.1 An Introduction to Hamiltonian Graphs 8.2 Which Graphs are Hamiltonian? 8.3 The Traveling Salesman Problem
13
Copyright 黃鈴玲 Ch8-13 8.2 Which Graphs are Hamiltonian? Thm 8.2 (Dirac’s Thm) G : order p 3 If deg(v) p/2 v V(G), then G is Hamiltonian. deg(v) 2 v V(G) G C 3 Pf: (1) If p = 3 deg(v) 2 v V(G) G C 3 4, let P : v 1,v 2,…, v n (2) If p 4, let P : v 1,v 2,…, v n be a longest path in G. v1v1 v2v2 v3v3 v n-1 vnvn
14
Copyright 黃鈴玲 Ch8-14 Then every neighbor of v 1 and v n is on P. ∵ ∵ deg(v) p/2 ∴ n ∴ n 1+p/2 Claim: v i V(P), 2 i n, s. t., v 1 ~ v i and v i 1 ~ v n. pf of claim: If not, v j with v j ~ v 1 v j 1 ~ v n ∵ ∵ deg(v 1 ) p/2 ∴至少有 p/2 個點與不相連 ∴ v 1 到 v n 1 中至少有 p/2 個點與 v n 不相連 ∵ ∵ deg(v n ) p/2 ∴此 path 至少有 + + 1 個點 ∴此 path 至少有 p/2 + p/2 + 1 個點 v1v1 v2v2 v3v3 vi1vi1 vnvn v n-1 vivi (vn)(vn)
15
Copyright 黃鈴玲 Ch8-15 Let C : v 1, v 2, …, v i 1, v n, v n 1, …, v i, v 1 C is a cycle of length n. If n < p then u V(G C) ∵ ∵ deg(u) p/2, | V(C) | = n 1+ p/2 ∴ ∴ v k s.t. u ~ v k (1 k n) ∴ C ∪ {} ∴ C ∪ { uv k } contains a path longer than P. n = p C is a Hamiltonian cycle. ※ Thm8.2 中 deg(v) p/2 的條件若改為 (p 1)/2 則不保證存在 hamiltonian cycle. 例 : K n, n+1 v1v1 v2v2 v3v3 vi1vi1 vnvn v n-1 vivi
16
Copyright 黃鈴玲 Ch8-16 ※ Thm8.2 不能 cover 的例子 : (1) C n ( n 5): hamiltonian p 5, deg(v i ) = 2< p/2 i (2) +( K m U K n ): hamiltonian Fig 8-5: +( K 2 U K 3 ) p = m + n + 2 Suppose m < n, deg(v) = m + 1 < p/2 if v V(K m )
17
Copyright 黃鈴玲 Ch8-17 Thm8.3 Let G be a graph of order p 3. Suppose u and v are nonadjacent vertices of G s.t. deg(u) + deg(v) p. Then G is hamiltonian iff G + uv is hamiltonian. Pf: “ ”: trivial. “ ”: Let C be a hamiltonian cycle of G+uv. If uv C G is hamiltonian. If uv C spanning u-v path P (P = C uv)
18
Copyright 黃鈴玲 Ch8-18 P : ( P 上使用了所有點 ) Similar as the proof of Thm8.2, G has a hamiltonian cycle. u v
19
Copyright 黃鈴玲 Ch8-19 上述定理提供了判斷圖形是否 hamiltonian 的一種方法 重複將不相連但 degree 和 p 的兩點連一條邊 新圖形是否 hamiltonian 決定了原圖是否 hamiltonian Fig 8-6 p=7 Not hamiltonian!
20
Copyright 黃鈴玲 Ch8-20 Def: A closure c(G) of a graph G of order p is a graph obtained from G by recursively joining pairs of nonadjacent vertices whose degree sum is at least p until no such pairs remain. A closure c(G) of a graph G of order p is a graph obtained from G by recursively joining pairs of nonadjacent vertices whose degree sum is at least p until no such pairs remain. c(G) is unique. ※ c(G) is unique.
21
Copyright 黃鈴玲 Ch8-21 Thm8.5 G is hamiltonian c(G) is hamiltonian. Cor8.5(a) K p, then G is hamiltonian. Let G be a graph of order p 3. If c(G) K p, then G is hamiltonian. Fig 8.7 G is hamiltonian. K9c(G) K9 K9c(G) K9 G
22
Copyright 黃鈴玲 Ch8-22 Cor8.5(b) then G is hamiltonian. |V(G)| = p 3. u,v V(G). If deg(u) + deg(v) p u ~ v, then G is hamiltonian. Cor8.5(c) Then G is hamiltonian. |V(G)| = p 3. Let d 1, d 2, …d p be the degree sequence of G with d 1 d 2 … d p. Suppose for every k < p/2, d k k d p k p k. Then G is hamiltonian. Cor8.5(d) then G is hamiltonian. |V(G)| = p, |E(G)| = q. If q , then G is hamiltonian.
23
Copyright 黃鈴玲 Ch8-23 Ex5. Show that if a graph of order 3 has an isolated vertex or an end-vertex, then its closure is not complete. Ex5. Show that if a graph of order at least 3 has an isolated vertex or an end-vertex, then its closure is not complete. pf: (1) If u is an isolated vertex of graph G, then deg(u) = 0, deg(v) p 2 for every vertex v u. In c(G), u ~ v u v c(G) Kp c(G) Kp (2) If u is an end-vertex then deg(u) = 1, deg(v) p 2 if u ~ v c(G) Kp c(G) Kp
24
Copyright 黃鈴玲 Ch8-24 Homework Exercise 8.2: 1, 3, 4, 8, 9, 11
25
Copyright 黃鈴玲 Ch8-25 Outline 8.1 An Introduction to Hamiltonian Graphs 8.2 Which Graphs are Hamiltonian? 8.3 The Traveling Salesman Problem
26
Copyright 黃鈴玲 Ch8-26 8.3 The Traveling Salesman Problem G : connected weighted graph, v i V(G) : the cities, w(v i v j ) of edge v i v j : the distance to travel directly between v i and v j. (Assume that G is complete) TSP: Suppose that a salesman is required to make a round trip through a given collection of p ( 3) cities. What route should he take to minimize the total distance traveled? ※ TSP asks for a Hamiltonian cycle of minimum weight.
27
Copyright 黃鈴玲 Ch8-27 此處提供兩種作法 前提 : 需先符合 triangle inequality ( 三角不等式 ) w(v i,v k ) w(v i,v j ) + w(v j,v k ) w(v i,v k ) w(v i,v j ) + w(v j,v k ) vivi vjvj vkvk ∵ NP-complete ∴改成 find low weight 的 HC TSP: Given a weighted complete graph G and a positive constant B, does there exist a hamiltonian cycle C in G so that w(C) B ?
28
Copyright 黃鈴玲 Ch8-28 Algorithm 8.1 (a greedy algorithm) [ To determine a low weight HC in a weighted complete graph G of order p 3 satisfying the triangle inequality. ] 1. n 1. ( n is the cycle length) 2.Select any vertex of G to form C n. ( C n 剛開始只有一個點 ) 3.If n < p, then find a vertex v n not on C n s.t. w(u n v n ) is minimum for some u n is on C n, and go to Step 4. Otherwise, C n is the desired HC. 4.Let C n+1 be the ( n+1 )-cycle obtained by inserting v n immediately before u n on C n. 5. n n +1 and return to Step 3.
29
Copyright 黃鈴玲 Ch8-29 1. C 1 : v 1 2. ∵ v 2, …, v 6 中, w(v 1 v 4 ) 最小 ∴ C 2 : v 1 v 4 v 1 ∴ C 2 : v 1 v 4 v 13. ∵ w(v 3 v 4 ) 最小 ∵ w(v 3 v 4 ) 最小 ∴ C 3 : v 1 v 3 v 4 v 1 ( 加在要連的點之前 ) ∴ C 3 : v 1 v 3 v 4 v 1 ( 加在要連的點之前 ) v 1 v 2 v 3 v 4 v 5 v 6 v1v2v3v4v5v6v1v2v3v4v5v6 Fig 8-10 v 2 v 3 v 5 v 6 v1 v4 v1 v4
30
Copyright 黃鈴玲 Ch8-30 v 2 v 5 v 6 v1 v3 v4 v1 v3 v4 3 7 3 3 4 4 4 5 5 7 3 5 5 4 4 5 5 v 5 v 6 v1 v2 v3 v4 v1 v2 v3 v4 v 5 v1 v2 v3 v4 v6 v1 v2 v3 v4 v6 7 5 4 5 4 ∵ w(v 1 v 2 ) 最小 ∴ C 4 : v 1 v 3 v 4 v 2 v 1 5.6. C5: v1v3v4v2v6v1C5: v1v3v4v2v6v1C5: v1v3v4v2v6v1C5: v1v3v4v2v6v1 C 6 : v 1 v 5 v 3 v 4 v 2 v 6 v 1 4. C 6 的 weight 總和為 24, 而 min weight 為 18. 若改選別的點當 C 1, 可能 weight 總和更小.
31
Copyright 黃鈴玲 Ch8-31 Thm 8.8 : a given by Algorithm 8.1 C : a HC given by Algorithm 8.1 : min weight C m : min weight HC () 2 () w(C) 2 w(C m ) (Algorithm 8.1 不保證能找出 min HC, 但用 Algorithm 8.1 找出的 cycle 其 weight 但用 Algorithm 8.1 找出的 cycle 其 weight 不會大於 min HC 的兩倍.) 不會大於 min HC 的兩倍.)
32
Copyright 黃鈴玲 Ch8-32 Algorithm8.2 ( 利用 min spanning tree) 1. Find a min spanning tree T of G. 2. Conduct a depth-first search of T. ( 起點為 T 的 leaf) 3. If v i 1, v i 2, …, v i p is the order in which the vertices of T are visited in step 2, then output the hamiltonian cycle v i 1, v i 2, …, v i p, v i 1. [ To determine a low weight HC in a weighted complete graph G of order p 3 satisfying the triangle inequality. ] (Algorithm 8.2 找出的 cycle 其 weight 也不會大於 min HC 的兩倍.)
33
Copyright 黃鈴玲 Ch8-33 Fig 8-13 ( 原圖同 Fig 8-10) C: v 2,v 1,v 4,v 3,v 5,v 6,v 2 v2v2 v5v5 v4v4 v3v3 v1v1 v6v6 A min spanning tree T (a) 3 3 4 2 1 5 3 4 2 6 A depth-first search 從 v 2 開始 (b) 1 v2v2 v5v5 v4v4 v3v3 v1v1 v6v6 A HC (c) 5 3 4 2 1 4 weight 總和為 19
34
Copyright 黃鈴玲 Ch8-34 Exercise 8 Use Alg. 8.1 and 8.2 to find a closed walk whose weight does not exceed twice the weight of a shortest closed walk in the given weighted graph G. Sol: 先把 G 變成 complete G v2v2 v5v5 v4v4 v3v3 v1v1 4 1 3 2 3 5 4 5 7 3 G v2v2 v5v5 v4v4 v3v3 v1v1 1 3 2 3 5 4 v 1 v 2 v 3 v 4 v 5 v1v2v3v4v5v1v2v3v4v5
35
Copyright 黃鈴玲 Ch8-35 Homework Exercise 8.3: 1, 3, 4, 8
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.