1 / 49

Discrete Mathematics

Discrete Mathematics. Chapter-8 Graphs. 感謝 大葉大學 資訊工程系 黃鈴玲老師 提供. §8.1 Introduction to Graphs. Def 1. A (simple) graph G=(V,E) consists of a nonempty set V of vertices, and E, a set of unordered pairs of distinct elements of V called edges. eg. G=(V,E), where V={ v 1 ,v 2 ,…,v 7 }

Download Presentation

Discrete Mathematics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Discrete Mathematics Chapter-8 Graphs 感謝 大葉大學 資訊工程系 黃鈴玲老師 提供

  2. §8.1 Introduction to Graphs • Def 1. A (simple) graph G=(V,E) consists of a nonempty set V of vertices, and E, a set of unordered pairs of distinct elements of V called edges. • eg. G=(V,E), where V={ v1,v2,…,v7 } E={ {v1,v2}, {v1,v3}, {v2,v3} {v3,v4}, {v4,v5}, {v4,v6} {v4,v7}, {v5,v6}, {v6,v7} } V1 V5 V3 V4 V6 V7 V2

  3. multiedge eg. • Def 2.Multigraph simple graph + “兩點間允許多條邊” V1 V5 V3 V4 V6 V2 V7

  4. ( loop即 ) simple graph + multiedge + loop • Def 3. pseudo graph : eg.

  5. Table 1. Graph Terminology

  6. Note: directed multigraph 中 U U V V 是 multiedge 邊為(u,v),(u,v) 不是 multiedge 邊為(u,v),(v,u) Exercise : 3,5,6,7,9

  7. §8.2 Graph Terminology (undirected) • Def 1. Two vertices u and v in a graph G are called adjacent in G if {u,v} is an edge of G. • Def 2. The degree of a vertex v, denoted by deg(v), in an (undirected) graph is the number of edges incident with it. (Note : 點跟點相連 : adjacent 點跟邊相連 : incident ) (Note : loop要算2次)

  8. Example 1. What are the degree of the vertices in the graph H ? • Sol : deg(a)=4 deg(b)=6 b a c deg(c)=1 deg(d)=5 deg(e)=6 deg(f)=0 e d f H

  9. eg. “ f ” in Example 1. • Def. A vertex of degree 0 is called isolated. Thm 1. (The Handshaking Theorem) Let G=(V,E) be an undirected graph with n edges (i.e., |E|=n). Then Pf :每條edge {u,v}會貢獻一個degree給u跟v

  10. eg. Example 1. there are 11 edges, and Example 2. How many edges are there in a graph with 10 vertices each of degree 6 ? Sol : 10  6 = 2n => n=30

  11. Thm 2. An undirected graph has an even number of vertices of odd degree. • Def 3. G: directed graph , G=(V,E) (u,v)E : u is adjacent to v v is adjacent from u u : initial vertex , v : terminal vertex u v

  12. Def 4. G=(V,E) : directed graph vV deg(v) : # of edges with v as a terminal. (in-degree) deg+(v) : # of edges with v as a initial vertex

  13. c a b e d f a is adjacent to b , b is adjacent from a a : initial vertex of (a,b) b : terminal vertex of (a,b) end deg-(a)=2, deg+(a)=4 deg-(b)=2, deg+(b)=1 : : deg-(f)=0, deg+(f)=0 • Example 3.

  14. b a • Thm 3. Let G=(V,E) be a digraph. Then pf : 每個 edge貢獻一個 out–degree 給 a 一個 in–degree 給 b

  15. n 2 Note : | E | = Def : The complete graph on n vertices, denoted by Kn, is the simple graph that contains exactly one edge between each pair of distinct vertices. Example 4. K3 K1 K2 K4

  16. C5 C6 • Example 5. The cycle Cn, n≧3, consists of n vertices v1,v2,…,vn and edges {v1,v2}, {v2,v3},…,{vn-1,vn},{vn,v1}. | E | = n

  17. W6 W5 • Example 6. Wn : (wheel), Cn中加一點連至其餘n點(n≧3) | V | = n + 1 | E | = 2n

  18. Def 5. A simple graph G=(V,E) is called bipartite if V can be partitioned into V1 and V2, V1∩V2=, such that every edge in the graph connect a vertex in V1 and a vertex in V2. Example 8. v1 v2 v3 ∴ C6 is bipartite. v4 v5 v6

  19. a c a b g e c b f d f d g e Example 10. Is the graph G bipartite ? Yes !

  20. Example 11. Complete Bipartite graphs (km,n) K3,3 K2,3 Note. | E | = mn

  21. a a b e e b c c d Def 6. A subgraph of a graph G=(V,E) is a graph H=(W,F) where W  V and F  E. (注意 F 要連接 W 裡的點) • Example 14. A subgraph of K5 subgraph of K5 K5

  22. b c a b c a b c a d e d d e f f • Example 15. • Def 7. The union of two simple graph G1=(V1,E1) and G2=(V2,E2) is the simple graph G1∪G2=(V1∪V2,E1∪E2) G1 G2 G1∪G2

  23. ex35上面A simple graph G=(V,E) is called regular if every vertex of this graph has the same degree. A regular graph is called n-regular if deg(v)=n , vV. eg. K4 : is 3-regular. Exercise : 5,7,21,23,25,35,37

  24. b c a d e §8.3 Representing Graphs and Graph Isomorphism ※Adjacency list Example 1. Use adjacency list to describe the simple graph given below. Sol :

  25. Example 2. (digraph) b a c e d

  26. a b c d ※Adjacency Matrices Def.G=(V,E) : simple graph,V={v1,v2,…,vn}. (順序沒關系) A matrix A is called the adjacency matrix of G if A=[aij]nxn , where a b c d a Example 3. b c undirected graph 的連 通矩陣必 “對稱” d b d c a b d c a

  27. 故矩陣 未必對稱 a b c d a a b b Example 5. (Pseudograph) (矩陣未必是0,1矩陣.) c d d c Def. If A=[aij] is the adjacency matrix for the directed graph, then 1 , if vi vj aij = 0 , otherwise

  28. G is isomorphic to H u2 u1 u4 u3 v1 v2 v4 v3 ※Isomorphism of Graphs • Def 1. The simple graphs G1=(V1,E1) and G2=(V2,E2) are isomorphic if there is an one-to-one and onto function f from V1 toV2 with the property that a~b in G1 iff f(a)~f(b) in G2,a,bV1 f is called an isomorphism. G H

  29. v1 v2 u2 u1 • Example 8. v4 v3 u3 u4 H G ※Isomorphism Graphs 必有 : (1) 相同的點數。 (2) 相同的邊數。 (3) 相同的degree分佈。 f(u1) = v1 f(u3) = v3 f(u2) = v4 f(u4) = v2

  30. b b a c a c e e d d ∵ H 有 degree = 1 的點,G 沒有 ∴ G  H ※給定二圖,判斷它們是否isomorphic的問題一般來說不易解,而且答案常是否定的。 Example 9. Show that G and H are not isomorphic. Sol :

  31. b s t e f w x g h d c z y v u a Example 10. Determine whether G and H are isomorphic. G H Sol : ∵ G 中 degree 為 3 的點有d, h, f, b 它們不能接成 4-cycle 但 H 中 degree 為3的點有s, w, z, v 它們可接成 4-cycle ∴ 不是 isomorphic. 另法 : G 中 degree 為 3 的點,旁邊都只連了另一個 deg = 3 的點 但 H 中 deg = 3 的點旁邊都連了 2 個 deg = 3 的點。

  32. H G v1 Example 11. Show that G H u1 u2 v3 u5 v2 u6 v6 v5 u4 u3 v4 Exercise : 3,7,14,17,19,23,37,39

  33. §8.4: Connectivity Def. 1,2 : • In an undirected graph, a path of length n from u to v is a sequence of adjacent vertices going from vertex u to vertex v. (e.g., P: u=x0, x1, x2, …, xn=v) • Note. A path of length n has n+1 vertices,n edges • A path is a circuit if u=v. • A pathtraversesthe vertices along it. • A path or circuit issimpleif it contains no vertex more than once. (simple circuit通常稱為cycle)

  34. Paths in Directed Graphs • Same as in undirected graphs, but the path must go in the direction of the arrows. Figure 5.

  35. Connectedness • Def. 3: • An undirected graph is connected (連通) iff there is a path between every pair of distinct vertices in the graph. • Def: • Connected component: maximal connected subgraph. (一個不連通的圖會有好幾個component) • Example 6

  36. Connectedness Def:A cut vertex separates one connected component into several components if it is removed. Def:A cut edge separates one connected component into two components if it is removed. Example 8.

  37. Connectedness in Digraphs Def. 4:A directed graph is strongly connected iff there is a directed path from a to b for any two vertices a and b. Example 9.

  38. Connectedness in Digraphs Def. 5: It is weakly connected iff the underlying undirected graph (i.e., with edge directions removed) is connected . • Note strongly implies weakly but not vice-versa. Example 9.

  39. Paths & Isomorphism • Note that connectedness, and the existence of a circuit or simple circuit of length k are graph invariants with respect to isomorphism. Example 12. Example 13.

  40. Counting Paths between Vertices Let A be the adjacency matrix of graph G. Theorem 2: The number of paths of length rfrom vi to vj is equal to (Ar)i,j. (The notation (M)i,j denotes mi,j where [mi,j] = M.) Example 14. Exercise: 15, 23, 25, 26

  41. §8.5: Euler & Hamilton Paths Def. 1: • An Euler circuit in a graph G is a simple circuit containing every edge of G. • An Euler path in G is a simple path containing every edge of G. Example 1.

  42. Useful Theorems Thm. 1:A connected multigraph has an Euler circuit iff each vertex has even degree. Thm. 2:A connected multigraph has an Euler path (but not an Euler circuit) iff it has exactly 2 vertices of odd degree. Example 4.

  43. Hamilton Paths Def. 2: • A Hamilton circuit is a circuit that traverses each vertex in G exactly once. • A Hamilton path is a path that traverses each vertex in G exactly once. Example 5.

  44. Useful Theorems Thm. 3 (Dirac’s Thm.):If (but not only if) G is connected, simple, has n3 vertices, and deg(v)n/2 v, then G has a Hamilton circuit. Exercise: 3, 5, 7, 21, 26, 28, 42, 43.

  45. §8.6: Shortest Path Problems Def: Graphs that have a number assigned to each edge are called weighted graphs. Shortest path Problem: Determining the path of least sum of the weights between two vertices in a weighted graph.

  46. Dijkstra’s Algorithm Figure 4. Exercise: 3

  47. §8.7: Planar Graphs Def. 1: A graph is calledplanar if it can be drawn in the plane without any edge crossing. Example 1:K4 is planar. Example 3: K3,3 is nonplanar. Exercise: 2,3,4

  48. §8.8: Graph Coloring Def. 1: A coloring of a simple graph is the assignment of a color to each vertex of the graph so that no two adjacent vertices are assigned the same color. Def. 2: The chromatic number of a graph is the least number of colors needed for a coloring of this graph. (denoted by c(G))

  49. §8.8: Graph Coloring Example 1 Example 2~4:c(Kn)=n, c(Km,n)=2, c(Cn)=2,3. Example 3’: If G is a bipartite graph, c(G)=2. Theorem 1. (The Four Color Theorem)The chromatic number of a planar graph isno greater than four. Exercise: 6, 7

More Related