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

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

CSE 211 Discrete Mathematics
Chapter 9 Graphs.
Graph-02.
Chapter 9 Graphs.
Graph Theory Chapter 9 Planar Graphs 大葉大學 資訊工程系 黃鈴玲.
Applied Discrete Mathematics Week 12: Trees
1 Section 8.2 Graph Terminology. 2 Terms related to undirected graphs Adjacent: 2 vertices u & v in an undirected graph G are adjacent (neighbors) in.
: The largest Clique ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11324: The largest Clique 解題者:李重儀 解題日期: 2008 年 11 月 24 日 題意: 簡單來說,給你一個 directed.
1 Section 8.4 Connectivity. 2 Paths In an undirected graph, a path of length n from u to v, where n is a positive integer, is a sequence of edges e 1,
Applied Discrete Mathematics Week 12: Trees
KNURE, Software department, Ph , N.V. Bilous Faculty of computer sciences Software department, KNURE Discrete.
Discrete Mathematics Lecture 9 Alexander Bukharovich New York University.
Let us switch to a new topic:
22C:19 Discrete Math Graphs Spring 2014 Sukumar Ghosh.
9.2 Graph Terminology and Special Types Graphs
GRAPH Learning Outcomes Students should be able to:
Graphs Chapter 10.
Graph Theoretic Concepts. What is a graph? A set of vertices (or nodes) linked by edges Mathematically, we often write G = (V,E)  V: set of vertices,
1 Graphs Chapters 9.1 and 9.2 University of Maryland Chapters 9.1 and 9.2 Based on slides by Y. Peng University of Maryland.
16.1 CompSci 102© Michael Frank Today’s topics GraphsGraphs –Basics & types –Properties –Connectivity –Hamilton & Euler Paths Reading: Sections Reading:
Module #19: Graph Theory: part I Rosen 5 th ed., chs. 8-9 내년 3 월 ? 교환 학생 프로그램 영어 점수 미리미리 준비하세요.
Graph Theory Chapter 7 Eulerian Graphs 大葉大學 (Da-Yeh Univ.) 資訊工程系 (Dept. CSIE) 黃鈴玲 (Lingling Huang)
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 9 (Part 2): Graphs  Graph Terminology (9.2)
9.2: Graph Terminology. Special Simple Graphs Complete GraphsK 1,… CyclesC 3,… WheelsW 3,… N-cubesQ 1,… Complete bipartiteK 2,2,…
1 CS104 : Discrete Structures Chapter V Graph Theory.
Graph Theory Chapter 6 Matchings and Factorizations 大葉大學 (Da-Yeh Univ.) 資訊工程系 (Dept. CSIE) 黃鈴玲 (Lingling Huang)
Based on slides by Y. Peng University of Maryland
Module #19: Graph Theory: part II Rosen 5 th ed., chs. 8-9.
Discrete Mathematics Chapter 2 Basic Structures : Sets, Functions, Sequences, and Sums 大葉大學 資訊工程系 黃鈴玲 (Lingling Huang)
Graphs.  Definition A simple graph G= (V, E) consists of vertices, V, a nonempty set of vertices, and E, a set of unordered pairs of distinct elements.
Graphs What are Graphs? General meaning in everyday math: A plot or chart of numerical data using a coordinate system. Technical meaning in discrete.
Chapter 3 Trees and Forests 大葉大學 資訊工程系 黃鈴玲
September1999 CMSC 203 / 0201 Fall 2002 Week #13 – 18/20/22 November 2002 Prof. Marie desJardins.
Chapter 5 Graphs  the puzzle of the seven bridge in the Königsberg,  on the Pregel.
CS 103 Discrete Structures Lecture 20
Discrete Mathematics Chapter 7 Relations 感謝 大葉大學 資訊工程系 黃鈴玲老師 提供.
Discrete Mathematics Section 3.7 Applications of Number Theory 大葉大學 資訊工程系 黃鈴玲.
Graph Theory and Applications
Graphs 9.1 Graphs and Graph Models أ. زينب آل كاظم 1.
Graph Theory Chapter 4 Paths and Distance in Graphs 大葉大學 (Da-Yeh Univ.) 資訊工程系 (Dept. CSIE) 黃鈴玲 (Lingling Huang)
And before you really hate (mathematical) relations and begin to break your (social) relations, let’s switch to a new topic: Graphs Discrete Structures.
Discrete Structures CISC 2315 FALL 2010 Graphs & Trees.
Introduction to Graphs Slides by Gene Boggess
Combinatorial Mathematics
Graph Theory Chapter 10 Coloring Graphs 大葉大學 (Da-Yeh Univ.) 資訊工程系 (Dept. CSIE) 黃鈴玲 (Lingling Huang)
Chapter 9: Graphs.
Graph Theory Chapter 8 Hamiltonian Graphs 大葉大學 (Da-Yeh Univ.) 資訊工程系 (Dept. CSIE) 黃鈴玲 (Lingling Huang)
大葉大學 資訊工程系 黃鈴玲  G. Agnarsson and R. Greenlaw, Graph Theory: Modeling, Applications, and Algorithms, Pearson,  G. Chartrand and O. R. Oellermann,
Chapter 7 Planar Graphs 大葉大學 資訊工程系 黃鈴玲  7.2 Planar Embeddings  7.3 Euler’s Formula and Consequences  7.4 Characterization of Planar Graphs.
Discrete Mathematics Graphs. Outline 9.1 Graph and Graph Models 9.2 Graph Terminology and Special Types of Graphs 9.3 Representing Graphs and Graph Isomorphism.
Graphs Rosen, Chapter 8. NOT ONE OF THESE! One of these!
Chap 7 Graph Def 1: Simple graph G=(V,E) V : nonempty set of vertices E : set of unordered pairs of distinct elements of V called edges Def 2: Multigraph.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
رياضيات متقطعة لعلوم الحاسب MATH 226. Chapter 10.
1 Graphs Chapters 10.1 and 10.2 University of Maryland Chapters 10.1 and 10.2 Based on slides by Y. Peng University of Maryland.
Chapter Chapter Summary Graphs and Graph Models Graph Terminology and Special Types of Graphs Representing Graphs and Graph Isomorphism Connectivity.
An Introduction to Graph Theory
Discrete Mathematics Graphs.
Chapter 9 (Part 2): Graphs
Chapters 8.1 and 8.2 Based on slides by Y. Peng University of Maryland
Chapter 10 Independence, Dominance, and Matchings
Graph theory Definitions Trees, cycles, directed graphs.
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 10 Graphs Slides are adopted from “Discrete.
Discrete Mathematics Chapter 7 Relations.
Chapter 13 (Part 1): Graphs
Rosen 5th ed., chs. 8-9 ~44 slides (more later), ~3 lectures
Chapters 8.1 and 8.2 Based on slides by Y. Peng University of Maryland
CS100: Discrete structures
Discrete Mathematics Chapter-8 Graphs.
Presentation transcript:

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={ 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 V2 V7

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

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

Table 1. Graph Terminology Type Edges Multiple Edges Loops (simple) graph Undirected表示成 {u,v} Multigraph Pseudo graph Directed graph Directed 表示成 (u,v) Directed multigraph

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

§8.2 Graph Terminology Def 1. Two vertices u and v in a graph (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次)

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

Def. A vertex of degree 0 is called isolated. eg. “ f ” in Example 1. 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

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

Def 3. G: directed graph , G=(V,E) (u,v)E : u is adjacent to v 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

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

Example 3. deg-(a)=2, deg+(a)=4 deg-(b)=2, deg+(b)=1 : : : : deg-(f)=0, deg+(f)=0 a b c 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

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

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 Note : | E | = n 2

{v1,v2}, {v2,v3},…,{vn-1,vn},{vn,v1}. 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}. C5 C6 | E | = n

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

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

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

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

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 a e b c a b c d e

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) Example 15. a b c d e a b c d f G1 G2 a b c d e f G1∪G2

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

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

Example 2. (digraph) Initial vertex Terminal vertices a b,c,d,e b b,d a,c,e d e b,c,d a c e d

Def. G=(V,E) : simple graph, V={v1,v2,…,vn}. (順序沒關系) ※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 a c b d undirected graph 的連 通矩陣必 “對稱” d b d c a b d c a

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

※Isomorphism of Graphs v1 v3 v2 v4 u1 u3 u2 u4 G is isomorphic to H G H 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 to V2 with the property that a~b in G1 iff f(a)~f(b) in G2, a,bV1 f is called an isomorphism.

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

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

Determine whether G and H are isomorphic. Example 10. Determine whether G and H are isomorphic. a s v t u w x z y b d c e h f g 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 的點。

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

§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 path traverses the vertices along it. A path or circuit is simple if it contains no vertex more than once. (simple circuit通常稱為cycle)

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

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

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.

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.

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.

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.

Counting Paths between Vertices Let A be the adjacency matrix of graph G. Theorem 2: The number of paths of length r from 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

§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.

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.

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.

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.

§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.

Dijkstra’s Algorithm Figure 4. Exercise: 3

§8.7: Planar Graphs Def. 1: A graph is called planar 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

§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))

§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 is no greater than four. Exercise: 6, 7