Lecture 13
Lecture 13
Discrete Mathematics
Lecture 13
Graphs: Introduction
1
Outline
• What is a Graph?
• Terminology
• Some Special Simple Graphs
• Subgraphs and Complements
• Graph Isomorphism
2
What is a Graph ?
A graph consists of a nonempty set V of vertices
and a set E of edges, where each edge in E
connects two (may be the same) vertices in V.
3
Examples
a b 1 2 w x
c d 3 4 y z
1 2 w x w x
3 4 y z y z
6
Test Your Understanding
7
Terminology (Undirected Graph)
• Let e be an edge that connects vertices u and v
We say (i) e is incident with u and v
(ii) u and v are the endpoints of e ;
(iii) u and v are adjacent (or neighbors)
(iv) if u = v, the edge e is called a loop
8
Example
• What are the degrees and neighbors of each
vertex in the following graph ?
a c e
b d f
9
Handshaking Theorem
• Let G = (V, E) be an undirected graph with m edges
Theorem:
deg(v) = 2m
vV
10
Terminology (Directed Graph)
• Let e be an edge that connects vertices from u to v
We say (i) u = initial vertex, v = terminal vertex ;
(ii) u is adjacent to v;
(iii) v is adjacent from u;
(iv) if u = v, the edge e is called a loop
• The in-degree of a vertex v, denoted by deg–(v), is
the number of edges with v as terminal vertex
• The out-degree of a vertex u, denoted by deg+(u),
is the number of edges with u as initial vertex
11
Example
• What are the in- and out-degrees of each vertex
in the following graph ?
a c e
b d f
12
Handshaking Theorem
• Let G = (V, E) be directed graph with m edges
Theorem:
deg–(v) = deg+(u)
vV uV
= m
13
Some Special Simple Graphs
Definition: A complete graph on n vertices,
denoted by Kn, is a simple graph that contains
one edge between each pair of distinct vertices
Examples :
K1 K2 K3 K4 K5
14
Some Special Simple Graphs
Definition: A cycle Cn, n 3, is a graph that
consists of n vertices v1, v2, …, vn and n edges
{v1, v2}, {v2, v3}, …, {vn – 1, vn}, {vn, v1}
Examples :
C3 C4 C5 C6
15
Some Special Simple Graphs
Definition: A wheel Wn, n 3, is a graph that
consists of a cycle Cn with an extra vertex that
connects to each vertex in Cn
Examples :
W3 W4 W5 W6
16
Some Special Simple Graphs
Definition: An n-cube, denoted by Qn, is a graph
that consists of 2n vertices, each representing a
distinct n-bit string. An edge exists between two
vertices the corresponding strings differ in
exactly one bit position.
100 101
0 1 00 01 000 001
Q1 Q2 Q3 Q4
17
Some Special Simple Graphs
Definition: A bipartite graph is a graph such that
the vertices can be partitioned into two sets V and
W, so that each edge has exactly one endpoint
from V, and one endpoint from W
Examples :
a b a b
g g
c c
f f
e d e d
19
Check if a Graph is Bipartite
• The following is a very useful theorem :
Theorem: A simple graph is bipartite if and only if
it is possible to assign one of two different colors
to each vertex, so that no two adjacent vertices
are assigned the same color
21
Some Special Simple Graphs
Definition: A complete bipartite graph Km,n is a
bipartite graph with vertices partitioned into two
subsets V and W of size m and n, respectively,
such that there is an edge between each vertex in
V and each vertex in W
Examples :
22
Subgraphs and Complements
If G = (V, E) is a graph, then G’ = (V’, E’) is called a
subgraph of G if V’ V and E’ E.
g
c
f
e d e d e d e d
23
Subgraphs and Complements
If G = (V, E) is a graph, then the subgraph of G
induced by U V is a graph with the vertex set U
and contains exactly those edges from G with
both endpoints from U
a b
Ex : Consider the graph on the
g
right side c
What is its subgraph induced f
by the vertex set { a, b, c, g } ? e d
24
Subgraphs and Complements
If G = (V, E) is a graph, then the complement of G,
denoted by G, is a graph with the same vertex set,
such that
an edge e exists in G e does not exist in G
a b
Ex : Consider the graph on the
g
right side c
What is its complement ? f
e d
25
Graph Isomorphism
Graphs G = (V, E) and H = (U, F) are isomorphic if
we can set up a bijection f : V U such that
x and y are adjacent in G
f(x) and f(y) are adjacent in H
26
Graph Isomorphism
The following graphs are isomorphic to each other.
This graph is known as the Petersen graph :
27
Graph Isomorphism
How to show the following are not isomorphic ?
28