Download Presentation
## Outline

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -

**Outline**9.1 Graph and Graph Models 9.2 Graph Terminology and Special Types of Graphs 9.3 Representing Graphs and Graph Isomorphism 9.4 Connectivity 9.5 Euler and Hamiltonian Paths 9.6 Shortest-Path Problems 9.7 Planar Graphs 9.8 Graph Coloring**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 §9.1 Graphs and Graph Models Def 1. A graphG = (V, E) consists of V, a nonempty set of vertices (or nodes), and E, a set of edges. Each edge has either one or two vertices associated with it, called its endpoints. An edge is said to connect its endpoints. eg.**Def A graph in which each edge connects two different**vertices and where no two edges connect the same pair of vertices is called a simple graph. Def Multigraph: simple graph + there may be more than one edge connecting two given nodes(multiedges). v1 v5 eg. v3 v4 v6 v2 v7**simple graph + multiedge**+ loop Def.Pseudograph: (a loop: ) eg.**Def 2.Directed graph (digraph): graph with each edge**directed Note: Note: is not allowed in a simple directed graph. u u v v The two edges (u,v),(v,u) are not multiedges. The two edges (u,v),(u,v) are multiedges. Def.Directed multigraph: digraph+loop+multiedges**Table 1. Graph Terminology**Exercise : 3, 5, 6, 7, 9**Graph Models**Example 2. (Acquaintanceship graphs) We can use a simple graph to represent whether two people know each other. Each person is represented by a vertex. An undirected edge is used to connect two people when these people know each other. Kamlesh Jan Paula Todd eg Amy Lila Lizd Steve**Example 3. (Influence graphs)**In studies of group behavior it is observed that certain people can influence the thinking of others. Simple digraph Each person of the group is represented by a vertex. There is a directed edge from vertex a to vertex b when the person a influences the person b. eg Brian Linda Deborah Fred Yvonne**Example 9. (Precedence graphs and concurrent processing)**Computer programs can be executed more rapidly by executing certain statements concurrently. It is important not to execute a statement that requires results of statements not yet executed. Simple digraph Each statement is represented by a vertex, and there is an edge from a to bif the statement of b cannot be executed before the statement of a. S6 S5 eg S1: a:=0S2: b:=1S3: c:=a+1 S4: d:=b+a S5: e:=d+1S6: e:=c+d S3 S4 S1 S2**Ex 13. The intersection graph of a collection of sets A1,**A2, …, An is the graph that has a vertex for each of these sets and has an edge connecting the vertices representing two sets if these sets have a nonempty intersection. Construct the intersection graph of the following collection of sets.(a) A1 = {0, 2, 4, 6, 8}, A2= {0, 1, 2, 3, 4},A3= {1, 3, 5, 7, 9}, A4= {5, 6, 7, 8, 9}, A5= {0, 1, 8, 9}.**§9.2 Graph Terminology and Special Types of Graphs**u e v Def 1.G: undirected graph u and v are adjacent (or neighbors) e is incident with u and v u and v are endpoints of e 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 : A loop adds 2 to the degree.)**deg(a)=4**deg(b)=6 deg(c)=1 deg(d)=5 deg(e)=6 deg(f)=0 Sol : Example 1. What are the degrees of the vertices in the graph H ? b a c f e d H Def. A vertex of degree 0 is called isolated.**Thm 1. (The Handshaking Theorem)**Let G = (V, E)be an undirected graph with e edges (i.e., |E| = e). Then Note that this applies even if multiple edges and loops are present**eg. The graph H has 11**edges, and b a c Example 3. How many edges are there in a graph with 10 vertices each of degree six? e d f H Sol : 10 6 = 2e e=30**v**u Pf :Let V1={vV | deg(v) is even}, V2={vV | deg(v) is odd}. Thm 2. An undirected graph G = (V, E) has an even number of vertices of odd degree. is even. Exercise : 5 Def 3. G = (V, E): directed graph,e = (u, v) E : u is adjacent tov v is adjacent fromu u : initial vertex of ev : terminal (end) vertex of e e**Def 4.**G = (V, E) : directed graph, vV deg-(v) : # of edges with v as a terminal. (in-degree) deg+(v) : # of edges with v as a initial vertex (out-degree) Example 4. deg-(a)=2, deg+(a)=4 deg-(b)=2, deg+(b)=1 deg-(c)=3, deg+(c)=2 deg-(d)=2, deg+(d)=2 deg-(e)=3, deg+(e)=3 deg-(f )=0, deg+(f )=0 b a c f e d**Thm 3. Let G = (V, E) be a digraph. Then**pf : for each edgedeg+(u)gets increased by 1so does deg-(v) u v**(ex47)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 , vV. eg. K4 : is 3-regular. Exercise : 7, 49**Some Special Simple Graphs**Example 5. The complete graph on n vertices, denoted by Kn, is the simple graph that contains exactly one edge between each pair of distinct vertices. K1 K2 K3 K4 Note. Kn is (n-1)-regular, |V(Kn)|=n,**Example 6. The cycle Cn, n3, consists of n vertices v1,**v2, …, vnand nedges {v1,v2}, {v2,v3}, …, {vn-1,vn}, {vn,v1}. C5 C3 C4 NoteCn is 2-regular, |V(Cn)| = n,|E(Cn)| = n**W6**W5 Example 7. We obtained the wheelWn when we add an additional vertex to the cycle Cn,for n3, and connect this new vertex to each of the n vertices in Cn, by new edges. Note. |V(Wn)| = n + 1, |E(Wn)| = 2n, Wn is not a regular graph if n 3.**Q3**Example 8. The n-dimensional hypercube, or n-cube, denoted by Qn, is the graph that has vertices representing the 2n bit strings of length n.Two vertices are adjacent if and only if the bit strings that they represent differ in exactly one bit position. 110 111 10 11 100 101 0 1 010 Q1 00 01 011 Q2 000 001 Note. Qn is n-regular, |V(Qn)| = 2n, |E(Qn)| = (2nn)/2 =2n-1n**Some Special Simple Graphs**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 9. v1 v2 v3 v4 ∴ C6is bipartite. v5 v6 V1 V2**a**a b c Example 11. Is the graph G bipartite? g e c b f f d d g e G Yes ! Exercise : 21, 23, 25**Thm 4. A simple graph is bipartite if and only if it is**possible to assign one of two different colors to each vertex of the graph so that no two adjacent vertices are assigned the same color. a b Example 12. Use Thm 4 to show that G is bipartite. g c 1 1 2 2 f d e 2 1 2 G**Example 13. Complete Bipartite graphs (Km,n)**K2,3 K3,3 Note. |V(Km,n)| = m+n, |E(Km,n)| = mn,Km,nis regular if and only if m=n.**a**a b b e e c c d New Graphs from Old Def 6. A subgraph of a graph G=(V, E) is a graph H=(W, F) where W V and F E. Example 14. A subgraph of K5 subgraph of K5 K5**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 graphs G1=(V1, E1) and G2=(V2, E2) is the simple graph G1∪G2=(V1∪V2, E1∪E2) G1 G2 G1∪G2 Exercise : 51**b**c a e d §9.3 Representing Graphs and Graph Isomorphism ※Adjacency list Example 1. Use adjacency lists to describe the simple graph given below. Sol :**b**Example 2. (digraph) c a e d Exercise : 3**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]nn , where aij = 1, if {vi,vj}E, 0, otherwise. Example 3. a b c d a b d c a b b c d d c Note: The adjacency matrix of an undirected graph is symmetric. a**a**b c d b a a b Example 5. (Pseudograph) c d d c Def. If A=[aij] is the adjacency matrix for the directed graph, then 1 , if vi vj Maybe not symmetric. aij = 0 , otherwise Exercise : 7, 14, 17, 23**※Isomorphism of Graphs**v1 u1 u2 v2 G is isomorphic to 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 toV2 with the property that a~b in G1 iff f(a)~f(b) in G2, a,bV1 f is called an isomorphism. u3 v4 u4 v3 G H**Graph Invariants under Isomorphism**Necessary but not sufficient conditions for G1=(V1, E1) to be isomorphic to G2=(V2, E2): • |V1|=|V2|, |E1|=|E2|. • The number of vertices with degree n is the same in both graphs. • For every proper subgraph g of one graph, there is a proper subgraph of the other graph that is isomorphic to g.**v1**u1 u2 v2 Example 8. Show that G and H are isomorphic. u3 v4 u4 v3 G H Sol. The function f with f(u1) = v1,f(u2) = v4, f(u3) = v3, and f(u4) = v2 is a one-to-one correspondence between V(G)and V(H).**Example 9. Show that G and H are not isomorphic.**G H Sol : Ggets a vertex ofdegree1, while Hdoesn’t.**b**e s t f w x g h d c z y v u a Example 10. Determine whether G and H are isomorphic. G H Sol1: Are the subgraphs of G and H made up of vertices of degreee 3 and the edges connecting them isomorphic? Sol2: ∵ in G, deg(a)=2 ∴ a must corresponds to x,y,t,uinH ∵a is not adjacent to a vertex of degree 2 (inG), while all x,y,t,u are adjacent to a vertex of degree 2 (inH). ∴ notisomorphic.**v1**G H u1 u2 v3 Example 11. Determine whether the graphs G and H are isomorphic. u5 v2 u6 v6 v5 u4 v4 u3 Sol: f(u1)=v6, f(u2)=v3, f(u3)=v4, f(u4)=v5, f(u5)=v1, f(u6)=v2Yes Exercise : 37, 39, 40**G**H v1 u1 Ex44. Determine whether the graphs G and H are isomorphic. v2 u2 v8 u8 v3 u3 v7 u7 v6 u6 v4 u4 v5 u5 v1 has 5 neighbors, and the 5 neighbors can form a 5-cycle; u1 also has 5 neighbors, but the 5 neighbors couldn’t form a 5-cycle; Therefore G and H are not isomorphic.**Def. 1,2 :**In an undirected graph, a path of length nfrom utov is a sequence of n+1adjacent vertices going from vertex u to vertex v. (e.g., P: u=x0, x1, x2, …, xn=v.)( P has nedges.) Def: path: no repetitionvertices oredges. trail: path + repetitionverticeswalk: path + repetitionvertices and edges §9.4: Connectivity v w u y x Example path: u, v, y trail: u, v, w, y, v, x, y walk: u, v, w, v, x, v, y Ch9-40**G**v w u y x Def: cycle: path with u=vcircuit: trail with u=vclosed walk: walk with u=v Example cycle: u, v, y, x, u circuit: u, v, w, y, v, x, u closed walk: u, v, w, v, x, v, y, x, u**Paths in Directed Graphs**The same as in undirected graphs, but the path must go in the direction of the arrows. Connectedness in Undirected Graphs • Def. 3: • An undirected graph is connected if there is a path between every pair of distinct vertices in the graph. • Def: • Connected component: maximal connected subgraph. Ch9-42**Example 6 What are the connected components of the graph H?**b f d e c a h g H Ch9-43**Def:A cut vertex separates one connected component into**several components if it is removed.A cut edge separates one connected component into two components if it is removed. Example 8. Find the cut vertices and cut edges in thegraph G. Sol: f a d g cut vertices: b, c, e G cut edges: {a, b}, {c, e} b c e h Exercise : 29,31, 32 Ch9-44**Def. 4: A directed graph is strongly connected if there is a**path from a to b for any two vertices a,b. A directed graph is weakly connected if there is a path between every two vertices in the underlying undirected graphs. Connectedness in Directed Graphs Example 9Are the directed graphs G and H strongly connected or weakly connected? a b a b G H c c e e d d Ch9-45 strongly connected weakly connected**Paths and Isomorphism**Note that connectedness, and the existence of a circuit or simple circuit of length k are graph invariants with respect to isomorphism. u1 v1 Example 12.Determine whether the graphs G and H are isomorphic. v2 u2 u6 v6 v3 u3 u5 v5 u4 v4 H G Sol: No. G has no simple circuit of length 3, while H does.**Example 13.Determine whether the graphs G and H are**isomorphic. u2 v1 G H u1 u3 v5 v2 u5 u4 v4 v3 Sol. Both G and H have 5 vertices, 6 edges, two vertices of deg 3, three vertices of deg 2, a 3-cycle, a 4-cycle, and a 5-cycle. G and Hmay be isomorphic. The function f with f(u1) = v1, f(u2) = v4, f(u3) = v3, f(u4) = v2 and f(u5) = v5 is a one-to-one correspondence between V(G)and V(H). G and Hare isomorphic. Exercise : 19, 20 Ch9-47**Counting Paths between Vertices**Theorem 2: Let G be a graph with adjacency matrix A with respect to the ordering v1, v2, …, vn. The number of paths (walks) of length rfrom vito vj is equal to (Ar)i,j. Proof A A A2 j a b j a i i b a j i Ch9-48 b**Example 14. How many paths (walks) of length 4 are there**from a to d in the graph G? a b Sol.The adjacency matrix of G(ordering as a, b, c, d) is G d c 8 Q: a-b-a-b-d, a-b-a-c-d, a-c-a-b-d, a-c-a-c-d, a-b-d-b-d, a-b-d-c-d, a-c-d-b-d, a-c-d-c-d Exercise : 17 Ch9-49**The origin of Graph Theory**1736, Euler solved the Königsberg Bridge Problem C A D B §9.5: Euler & Hamilton Paths Q: Is there a simple circuit in this multigraph that contains every edge? Ch9-50