Graph Theory Chapter 7 Eulerian Graphs 大葉大學 (Da-Yeh Univ.) 資訊工程系 (Dept. CSIE) 黃鈴玲 (Lingling Huang)
Copyright 黃鈴玲 Ch7-2 Outline 7.1 An Introduction to Eulerian Graphs 7.2 Characterizing Eulerian Graphs Again 7.3 The Chinese Postman Problem
Copyright 黃鈴玲 Ch An Introduction to Eulerian Graphs 1736, Euler solved the Königsberg Bridge Problem ( 七橋問題 ) 1736, Euler solved the Königsberg Bridge Problem ( 七橋問題 ) Q: 是否存在一 種走法,可以走 過每座橋一次, 並回到起點?
Copyright 黃鈴玲 Ch7-4 Königsberg Bridge Problem Ans: 因為每次經過一個點,都需要從一條邊進入該點,再用另 一條邊離開,所以經過每個點一次要使用掉一對邊。 每個點上連接的邊數必須是偶數才行 此種走法不存在 A B C D Q: 是否存在一種走法,可以走過每條邊一次,並回 到起點? 陸地為點 橋為邊
Copyright 黃鈴玲 Ch7-5 Definition: (1) An eulerian circuit of a connected multigraph is a circuit ( 點可重複、邊不可重複 ) of G that contains all the edges of G. (2) A (multi)graph with an eulerian circuit is called an eulerian (multi)graph. (3) An eulerian trail of a connected multigraph G is an open trail ( 起點終點不同的 trail) of G that contains all the edges of G.
Copyright 黃鈴玲 Ch7-6 u9u9 u8u8 u2u2 u3u3 u4u4 u5u5 u6u6 u7u7 u1u1 G1G1 v5v5 v4v4 v3v3 v2v2 v1v1 v6v6 G2G2 eulerian circuit: eulerian trail:
Copyright 黃鈴玲 Ch7-7 Theorem 7.1: A connected multigraph G is eulerian if and only if the degree of each vertex is even. Pf: ( ) G is eulerian eulerian circuit C C 通過每一點時需用一條邊進入,用另一條邊離開 the degree of each vertex is even the degree of each vertex is even ()() Suppose every vertex of G is even. (Now we construct an eulerian circuit.)
Copyright 黃鈴玲 Ch7-8 Choose any vertex v and begin a trail T ( 邊不 可重複 ) at v as far as possible. If w is the last vertex of T, then any edge incident with w must belong to T. Claim: w = v Pf. If w v, then each time w is encountered on T before the last time, one edge is used to enter w and another edge is used to exit from w. Since w has even degree. There must be at least one edge incident with w that does not belong to T, a contradiction. Since w has even degree. There must be at least one edge incident with w that does not belong to T, a contradiction. If E(T) E(G ), 在 G T 中重複此法找出一個個的 circuit ,連接起來即可得 eulerian circuit.
Copyright 黃鈴玲 Ch7-9 v1v1 v2v2 Figure 7.4 (Algorithm 7.1, Eulerian circuit) v3v3 v5v5 v4v4 v6v6 Step 1: T 1 : v 1, v 2, v 3, v 4, v 5, v 1 Step 2: T 2 : v 3, v 5, v 6, v 3 Step 3: C = T 1 T 2 C: v 1, v 2, v 3, v 5, v 6, v 3, v 4, v 5, v 1 T2T2
Copyright 黃鈴玲 Ch7-10 Theorem 7.2: Let G be a nontrivial connected multigraph. Then G contains an eulerian trail if and only if G has exactly two odd vertices. Furthermore, the trail begins at one of the odd vertices and terminates at the other.
Copyright 黃鈴玲 Ch7-11 Homework Exercise 7.1: 1, 2
Copyright 黃鈴玲 Ch7-12 Outline 7.1 An Introduction to Eulerian Graphs 7.2 Characterizing Eulerian Graphs Again 7.3 The Chinese Postman Problem
Copyright 黃鈴玲 Ch Characterizing Eulerian Graphs Again Theorem 7.3: A connected graph G is eulerian if and only if every edge of G lies on an odd number of cycles of G.
Copyright 黃鈴玲 Ch7-14 Example (Figure 7.5) C 1 : u, v, x, u z x a uv y wb Consider the edge uv, it belongs to five cycles: C 2 : u, v, y, x, u C 3 : u, v, y, z, x, u C 4 : u, v, w, y, z, x, u C 5 : u, v, w, y, x, u
Copyright 黃鈴玲 Ch7-15 Homework Exercise 7.2: 4( a ) Ex4(a). Show that each edge of K n belongs to at least 2 n 2 1 cycles. C4:C4: Example: K 5 C3:C3: 個個 C5:C5: 個
Copyright 黃鈴玲 Ch7-16 Outline 7.1 An Introduction to Eulerian Graphs 7.2 Characterizing Eulerian Graphs Again 7.3 The Chinese Postman Problem
Copyright 黃鈴玲 Ch The Chinese Postman Problem Chinese Postman Problem: Suppose that a letter carrier must deliver mail to every house in a small town. The carrier would like to cover the route in the most efficient way and then return to the post office. Definition: For a connected graph G, an eulerian walk is a shortest closed walk covering all the edges of G. finding an eulerian walk
Copyright 黃鈴玲 Ch7-18 An alternative way to solve the Chinese Postman Problem: For a given connected graph G, determine an eulerian multigraph H of minimum size that contains G as its underlying graph. e. g., 將圖形 G 中的每個 edge 都複製一份 每點 degree 都會是偶數 每點 degree 都會是偶數 新圖有 eulerian circuit 存在 新圖有 eulerian circuit 存在 the length of an eulerian walk of G is at least q but no more than 2q. the length of an eulerian walk of G is at least q but no more than 2q.
Copyright 黃鈴玲 Ch7-19 Definition: A pair partition of V 0 (G) is a partition of V 0 (G) into n two-element subsets. For a pair partition , given by ={{ u 11, u 12 }, { u 21, u 22 }, …, { u n1, u n2 }}. Let us define and let m ( G ) = min { d ( ) | is a pair partition }. If G is not eulerian, then G contains an even number of odd vertices. Let V 0 (G) = {u 1, u 2, …, u 2n }, n 1, be the set of odd vertices of G.
Copyright 黃鈴玲 Ch7-20 If G is eulerian, then m(G ) = 0. Theorem 7.4 If G is a connected graph of size q, then an eulerian walk of G has length q + m ( G ). m(G ) m(G ) 代表的是 eulerian walk 中重複走的邊數 ※ How to find an eulerian walk of G ? (1) Find a pair partition with d ( ) = m ( G ). (2) If ={{ u 11, u 12 }, { u 21, u 22 }, …, { u n1, u n2 }}, determine shortest u i1 - u i2 paths Q i. (3) duplicate the edges of G that are on Q i. (4) An eulerian circuit in the new graph provides an eulerian walk of G.
Copyright 黃鈴玲 Ch7-21 How to find a pair partition of V 0 (G) for which m ( G )= d ( )? ※ How to find a pair partition of V 0 (G) for which m ( G )= d ( )? (1) Construct a complete weighted graph F K 2n of order 2n, where V ( F ) = V 0 (G), the weight of an edge in F is defined as the distance between the corresponding vertices in G. (2) Determine a perfect matching of F whose weight is as small as possible. (Let m be the maximum weight of F. 將 F 中每邊的 weight w 改為 m+1 w, find a maximum matching 即可 )
Copyright 黃鈴玲 Ch7-22 Example (Fig 7.6, solving the Chinese Postman Problem) u1u1 u2u2 v1v1 u3u3 v2v2 v3v3 v4v4 u4u4 (1) Find odd vertices (2) Graph F : u1u1 u2u2 u4u4 u3u (3) Graph F’ : u1u1 u2u2 u4u4 u3u Max matching (4) add Q i : u2u2 v1v1 u3u3 v2v2 v3v3 v4v4 u4u4 u1u1
Copyright 黃鈴玲 Ch7-23 (5) Eulerian walk: u2u2 v1v1 u3u3 v2v2 v3v3 v4v4 u4u4 u1u1 u 1,e 12, u 2, e 10, v 3, e 3, v 4, e 1, u 4, e 2, v 4, e 4, v 3, e 7, v 2, e 8, u 3, e 5, v 3, e 6, u 3, e 9, v 1, e 11, u 2, e 13, u 1 e 13 e 12 e6e6 e5e5 e 11 e9e9 e8e8 e7e7 e3e3 e4e4 e2e2 e1e1 e 10
Copyright 黃鈴玲 Ch7-24 Homework Exercise 7.3: 1, 3 Ex1. Prove that the length of an eulerian walk for a tree of size q is 2 q.