Lecture 08
Lecture 08
(CSE 0611101)
Graphs: Chapter 9
3
Graph Terminology : Different Types of Graphs
4
5
6
7
8
9
10
11
Table 1: Graph Terminology
Type Edges Multiple Edges Loops Allowed?
Allowed?
12
Directed Graph
• Definition 2: A directed graph(or digraph) (V,E)
consists of a nonempty set of vertices V and a set of
directed edges E.
• Each directed edge is associated with an ordered pair
of vertices.
• The directed edge associated with the ordered pair
(u,v) is said to start at u and end at v.
13
9.2 Graph Terminology and
Special Types of Graphs
• Basic terminology
• Adjacent vertices
• Degree of a vertex
– In-degree of a vertex
– Out-degree of a vertex
• Isolated vertex
• Pendant vertex
• The Handshaking Theorem
• Some Special Simple Graphs
• Bipartite Graphs
14
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}.
15
Basic Terminology
• Definition 3: The degree of a vertex in an undirected
graph is the number of edges incident with it, except
that a loop at a vertex contributes twice to the
degree of that vertex.
– The degree of the vertex v is denoted by deg(v).
16
Basic Terminology
17
Example 1 (p.598)
• Example 1 (p.598): What are the degrees of the vertices in the graphs G
and H?
Solution:
G: deg(a) = 2, deg(b) = deg(c)= deg(f)=4, deg(d)=1, deg(e) = 3,
and deg(g)= 0
H: deg(a) = 4, deg(b) = deg(e) = 6, deg(c) = 1, deg(d) = 5.
18
The Handshaking Theorem
• Theorem 1(The Handshaking Theorem):
Let G = (V,E) be an undirected graph with e edges.
Then
2e = deg(v)
Note: This applies even if multiple edges and loops are present
19
Example 2
• Example 2 (p.599): How many edges are there
in a graph with 10 vertices each of degree six?
20
Theorem 2 (p.599)
• Theorem 2: An undirected graph has an even
number of vertices of odd degree.
21
Initial vertex & Terminal Vertex
• 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/end vertex of (u, v).
• The initial vertex and terminal vertex of a loop are
the same.
22
In-degree & Out-degree of a vertex
• 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.
23
Example: In-degree & Out-degree of a vertex
1 3
24
Example: In-degree & Out-degree of a vertex
Solution:
deg-(1) = 0
deg-(2) = 3
deg-(3) = 4 2
deg+(1) = 2 1 3
deg+(2) = 3
deg+(3) = 2
• Practice Yourself: Example 4 (p.600)
25
Theorem 3
• Theorem 3:Let G = ( V, E ) be a graph with directed
edges. Then
26
Some Special Simple Graphs: Complete Graph(Kn)
27
Some Special Simple Graphs: Cycles(Cn)
28
Some Special Simple Graphs: Wheels(Wn)
29
Some Special Simple Graphs: n-Cubes(Qn)
30
Bipartite graphs
31
Bipartite graphs
32
Example 11(p. 603): Are the graphs H and H are
Bipartite?
33