Graph
Discrete Mathematics
Course Code: 103
Special Types of Graphs - Complete Graph
• The complete graph on n vertices (Kn) is the simple graph that
contains exactly one edge between each pair of distinct vertices.
• The figures above represent the complete graphs, Kn, for n = 1, 2,
3, 4, 5, and 6.
Cycle
The cycle Cn (n ≥ 3), consists of n vertices v1, v2, …, vn and edges
{v1,v2}, {v2,v3}, …, {vn-1,vn}, and {vn,v1}.
Bipartite Graph
A simple graph is called bipartite if its vertex set V can be partitioned
into two disjoint nonempty sets V1 and V2 such that every edge in the
graph connects a vertex in V1 and a vertex in V2 (so that no edge in G
connects either two vertices in V1 or two vertices in V2).
Bipartite Graph (Example)
V1
V2
V6
Is C6 Bipartite?
V3
V5
V4
Yes. Why?
Because:
• its vertex set can be partitioned into the two sets V1 = {v1, v3, v5} and
V2 = {v2, v4, v6}
• every edge of C6 connects a vertex in V1 with a vertex in V2
Bipartite Graph (Example)
V1
V3
V2
Is K3 Bipartite? No. Why not?
Because:
• Each vertex in K3 is connected to every other vertex by an edge
• If we divide the vertex set of K3 into two disjoint sets, one set must contain two
vertices
• These two vertices are connected by an edge
• But this can’t be the case if the graph is bipartite
Complete Bipartite Graph
A complete bipartite graph Km,n is a graph that has its vertex set partitioned into two
subsets of m and n vertices, respectively with 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.
Regular or Complete Bipartite Graph
Figure 1: Regular Bipartite Graph
Figure 2: Complete Bipartite Graph
Bipartite Graph(Cont.)
Isomorphic Graph
• Two simple graphs are isomorphic if:
– there is a one-to one correspondence between the vertices of the
two graphs
– the adjacency relationship is preserved
• The simple graphs G1=(V1,E1) and G2=(V2,E2) are isomorphic if there
is a one-to-one and onto function f from V1 to V2 with the property that
a and b are adjacent in G1 iff f(a) and f(b) are adjacent in G2, for all a
and b in V1.
Isomorphic Graph(cont.)
Show that the graphs G = (V,E) and H = (W,F) displayed are isomorphic.
Solution: 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 and W. To see that this correspondence preserves adjacency, note that adjacent
vertices in G are u1 and u2,u1 and u3, u2 and u4, and u3 and u4, and each of the pairs f (u1) = v1 and
f(u2) = v4, f(u1) = v1 and f(u3) = v3, f(u2) = v4 and f(u4) = v2, and f(u3) = v3 and f(u4) = v2 consists of
two adjacent vertices in H.
Isomorphic Graph(cont.)
b
b
a
c
a
c
e
d
e
d
G
Are G and H isomorphic?
H
Isomorphic Graph(cont.)
It is often difficult to determine whether two simple graphs are isomorphic. There are n! possible one-to-one
correspondences between the vertex sets of two simple graphs with n vertices. Testing each such correspondence
to see whether it preserves adjacency and nonadjacency is impractical if n is at all large. Sometimes it is not hard
to show that two graphs are not isomorphic. In particular, we can show that two graphs are not isomorphic if we
can find a property only one of the two graphs has, but that is preserved by isomorphism. A property preserved
by isomorphism of graphs is called a graph invariant.
• For instance, isomorphic simple graphs must have the same number of vertices, because there is a one-to-one
correspondence between the sets of vertices of the graphs.
• Isomorphic simple graphs also must have the same number of edges, because the one-to- one correspondence
between vertices establishes a one-to-one correspondence between edges.
• In addition, the degrees of the vertices in isomorphic simple graphs must be the same. That is, a vertex v of
degree d in G must correspond to a vertex f(v) of degree d in H, because a vertex w in G is adjacent to v if and
only if f(v) and f(w) are adjacent in H.
Isomorphic Graph(cont.)
Are these two graphs isomorphic?
– They both have 5 vertices
– They both have 8 edges
– They have the same number of vertices with the same
degrees: 2, 3, 3, 4, 4.
Isomorphic Graph(cont.)
– G and H don’t appear to be isomorphic.
– However, we haven’t tried mapping vertices from G
onto H yet.
Isomorphic Graph(cont.)
• Start with the vertices of degree 2 since each graph only has one:
deg(u3) = deg(v2) = 2 therefore f(u3) = v2
• Now consider vertices of degree 3
deg(u1) = deg(u5) = deg(v1) = deg(v4) = 3
therefore we must have either one of
f(u1) = v1 and f(u5) = v4
f(u1) = v4 and f(u5) = v1
• Now try vertices of degree 4:
deg(u2) = deg(u4) = deg(v3) = deg(v5) = 4
therefore we must have one of:
f(u2) = v3 and f(u4) = v5
or
f(u2) = v5 and f(u4) = v3
Example (Cont.)
• There are four possibilities (this can get messy!)
f(u1) = v1, f(u2) = v3, f(u3) = v2, f(u4) = v5, f(u5) = v4
f(u1) = v4, f(u2) = v3, f(u3) = v2, f(u4) = v5, f(u5) = v1
f(u1) = v1, f(u2) = v5, f(u3) = v2, f(u4) = v3, f(u5) = v4
f(u1) = v4, f(u2) = v5, f(u3) = v2, f(u4) = v3, f(u5) = v1
Example (Cont.)
We permute the adjacency matrix of H (per function choices above) to
see if we get the adjacency of G. Let’s try:
f(u1) = v1, f(u2) = v3, f(u3) = v2, f(u4) = v5, f(u5) = v4
Does G = H’? Yes!
Example (Cont.)
Determine whether the graphs are isomorphic or not?
Adjacency Matrix and Incidence Matrix
A simple graph G = (V,E) with n vertices can be represented by its adjacency matrix, A,
where the entry aij in row i and column j is:
Let G = (V,E) be an undirected graph. Suppose v1,v2,v3,…,vn are the vertices and
e1,e2,e3,…,em are the edges of G. The incidence matrix w.r.t. this ordering of V and
E is the n×m matrix M = [mij], where
Adjacency Matrix example
Incidence Matrix example
Adjacency Matrix(Example)
1. Use adjacency lists to create a simple undirected graph. 2. Use adjacency lists to create a simple directed graph.
Example
Use an adjacency matrix to represent the pseudograph
Represent the pseudograph using an incidence matrix.