9 2 Graph Terminology and Special Types Graphs

  • Slides: 24
Download presentation
9. 2 Graph Terminology and Special Types Graphs Basic Terminology • Definition 1: Two

9. 2 Graph Terminology and Special Types Graphs Basic Terminology • Definition 1: Two vertices u and v in an undirected graph G are called adjacent (or neighbors) in G if u and v are endpoints of an edge of G. • If e is associated with {u, v}, the edge e is called incident with the vertices u and v. The edge e is also said to connect u and v. The vertices u and v are called endpoints of an edge associated with {u, v}. • Definition 2: The degree of a vertex in an undirected graph is the number of edges incident with it, except that a loop at vertex contributes twice to the degree of that vertex. The degree of the vertex v is denoted by deg(v). 1

Basic Terminology • Example 1: What are the degrees of the vertices in the

Basic Terminology • Example 1: What are the degrees of the vertices in the graphs G and H displayed in Figure 1? FIGURE 1 The Undirected Graphs G and H. 2

Basic Terminology • Theorem 1: The Handshaking Theorem • Let G = (V, E)

Basic Terminology • Theorem 1: The Handshaking Theorem • Let G = (V, E) be an undirected graph with e edges. Then 2 e = v V deg(v) • Example 3: How many edges are there in a graph with 10 vertices each of degree six ? 3

Basic Terminology • Theorem 2: An undirected graph has an even number of vertices

Basic Terminology • Theorem 2: An undirected graph has an even number of vertices of odd degree. • Definition 3: When (u, v) is an edge of the graph G with directed edges, u is said to be adjacent to v and v is said to be adjacent from u. • The vertex u is called the initial vertex of (u, v), and v is called the terminal or end vertex of (u, v). The initial vertex and terminal vertex of a loop are the same. 4

Basic Terminology • Definition 4: In a graph with directed edges • The in-degree

Basic Terminology • Definition 4: In a graph with directed edges • The in-degree of a vertex v, denoted by deg- (v) , is the number of edges with v as their terminal vertex. • The out-degree of v, denoted by deg+ (v) , is the number of edges with v as their initial vertex. • (Note that a loop at a vertex contributes 1 to both the in-degree and the out-degree of this vertex. ) 5

Basic Terminology • Example 4: Find the in-degree and out-degree of each vertex in

Basic Terminology • Example 4: Find the in-degree and out-degree of each vertex in the graph G with directed edges shown in Figure 2. FIGURE 2 The Directed Graph G. 6

Basic Terminology • Theorem 3 : Let G=(V, E) be a graph with directed

Basic Terminology • Theorem 3 : Let G=(V, E) be a graph with directed edges. Then v V deg- (v) = v V deg+ (v)= |E| 7

Some Special Simple Graphs • Example 5: Complete Graphs The complete graph on n

Some Special Simple Graphs • Example 5: Complete Graphs The complete graph on n vertices, denoted by Kn, is the simple graph that contains exactly one edge between each pair of distinct vertices. The graphs Kn, for n= 1, 2, 3, 4, 5, 6, are displayed below. FIGURE 3 The Graphs Kn for 1≦ n ≦ 6. 8

Some Special Simple Graphs • Example 6: cycles The cycle Cn, n 3, consists

Some Special Simple Graphs • Example 6: cycles The cycle Cn, n 3, consists of n vertices v 1, v 2, . . . , vn and edges {v 1, v 2}, {v 2, v 3 } , . . . , {vn-1, vn} , and {vn , v 1}. The cycles C 3, C 4, C 5, and C 6 are displayed below. FIGURE 4 The Cycles C 3, C 4, C 5, and C 6. 9

Some Special Simple Graphs • Example 7: Wheels We obtain the wheel Wn when

Some Special Simple Graphs • Example 7: Wheels We obtain the wheel Wn when we add an additional vertex to the cycle Cn, for n 3, and connect this new vertex to each of the n vertices in Cn, by new edges. The wheels W 3 , W 4, W 5, and W 6 are displayed below. FIGURE 5 The Wheels W 3, W 4, W 5, and W 6. 10

Some Special Simple Graphs • Example 8: n-Cubes The n-dimensional hypercube, or n-cube, denoted

Some Special Simple Graphs • Example 8: n-Cubes The n-dimensional hypercube, or n-cube, denoted by Qn, is the graph that has vertices representing the 2 n bit strings of length n. • Two vertices are adjacent if and only if the displayed in Figure 6. Note that you can construct the (n+1)-cube Qn+1 from the n-cube Qn by making two copy of Qn , prefacing the labels on the vertices with a 0 in one copy of Qn and with a 1 in the other copy of Qn, and adding edges connecting two vertices that have labels differing only in the first bit. 11

Some Special Simple Graphs FIGURE 6 The n-cube Qn for n = 1, 2,

Some Special Simple Graphs FIGURE 6 The n-cube Qn for n = 1, 2, and 3. 12

Bipartite Graphs • Definition 5: A simple graph G is called bipartite if its

Bipartite Graphs • Definition 5: A simple graph G is called bipartite if its vertex set V and be partitioned into two disjoint sets V 1 and V 2 such that every edge in the graph connects a vertex in V 1 and a vertex in V 2. • (so that no edge in G connects either two vertices in V 1 or two vertices in V 2 ). • When this condition holds, we call the pair (V 1 , V 2 ) a bipartition of the vertex set V of G. 13

Bipartite Graphs • Example 9: C 6 is bipartite, as shown in Figure 7,

Bipartite Graphs • Example 9: C 6 is bipartite, as shown in Figure 7, because is vertex set can be partitioned into the two sets V 1 ={v 1 , v 3 , v 5 }, V 2 ={v 2 , v 4 , v 6 }, and every edge of C 6 connects a vertex in V 1 and a vertex in V 2. FIGURE 7 Showing That C 6 Is Bipartite. 14

Bipartite Graphs • Example 11: Are the graph G and H displayed in Figure

Bipartite Graphs • Example 11: Are the graph G and H displayed in Figure 8 bipartite? FIGURE 8 The Undirected Graphs G and H. 15

Bipartite Graphs • Theorem 4 : A simple graph is bipartite if and only

Bipartite Graphs • Theorem 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. • Example 12: Use Theorem 4 to determine whether the graphs in Example 11 are bipartite. 16

Bipartite Graphs • Example 13: Complete Bipartite Graphs The complete bipartite graph Km, n

Bipartite Graphs • Example 13: Complete Bipartite Graphs The complete bipartite graph Km, n is the graph that has its vertex set partitioned into two subsets of m and n vertices, respectively. There is an edge between two vertices if and only if one vertex is in the first subset and the other vertex is in the second subset. The complete bipartite graphs K 2, 3 , K 3, 5 , K 2, 6 are displayed in Figure 9. 17

Bipartite Graphs FIGURE 9 Some Complete Bipartite Graphs. 18

Bipartite Graphs FIGURE 9 Some Complete Bipartite Graphs. 18

Some Applications of Special Types of Graphs • Example 14: Job Assignments Suppose that

Some Applications of Special Types of Graphs • Example 14: Job Assignments Suppose that there are m employees in a group and j different jobs that need to be done where m j. Each employee is trained to do one or more of these j jobs. We can use a graph to model employee capabilities. We represent each employee by a vertex and each job by a vertex. For each employee, we include an edge from the vertex representing that employee to the vertices representing all jobs that the employee has been trained to do. • Note that the vertex set of this graph can be partitioned into two disjoint sets, the set of vertices representing employees and the set of vertices representing jobs, and each edge connects a vertex representing an employee to a vertex representing a job. Consequently, this graph is bipartite. 19

Some Applications of Special Types of Graphs FIGURE 10 Modeling the Jobs for Which

Some Applications of Special Types of Graphs FIGURE 10 Modeling the Jobs for Which Employees Have Been Trained. • To complete the project, we must assign jobs to the employees so that every job has an employee assigned to it and no employee is assigned more than one job. 20

New Graphs from Old • Definition 6: A subgraph of a graph G= (V,

New Graphs from Old • Definition 6: A subgraph of a graph G= (V, E) is a graph H =(W, F), where W V and F E. A subgraph H of G is a proper subgraph of G if H G. 21

New Graphs from Old • Example 17: The graph G shown below is a

New Graphs from Old • Example 17: The graph G shown below is a subgraph of K 5. FIGURE 15 A Subgraph of K 5. 22

New Graphs from Old • Definition 7: The union of two simple graphs G

New Graphs from Old • Definition 7: The union of two simple graphs G 1= (V 1, E 1) and G 2= (V 2, E 2) is the simple graph with vertex set V 1 V 2 and edge set E 1 E 2. The union of G 1 and G 2 is denoted by G 1 G 2. 23

New Graphs from Old • Example 18: Find the union of the graphs G

New Graphs from Old • Example 18: Find the union of the graphs G 1 and G 2 shown in below. FIGURE 17 (a) The Simple Graphs G 1 and G 2; (b) Their Union G 1∪G 2. 24