Discrete Mathematics and Combinatorics
(MCAN-104)
Prof. Dr. Krishanu Deyasi
Department of Basic Sciences & Humanities
IEM Kolkata
Subgraphs
A subgraph of a graph G = (V, E) is a graph H =(V’, E’) where V’ is a subset of V and E’ is a
subset of E
Application example: solving sub-problems within a graph
Representation example: V = {u, v, w}, E = ({u, v}, {v, w}, {w, u}}, H 1 , H2
u u u
v w v w v
Graph union
G = G1 U G2 wherein E = E1 U E2 and V = V1 U V2, G, G1 and G2 are simple graphs of G
Representation example: V1 = {u, w}, E1 = {{u, w}}, V2 = {w, v},
E1 = {{w, v}}, V = {u, v ,w}, E = {{{u, w}, {{w, v}}
u
u
w v
w w v
G1 G2 G
Representation
Incidence (Matrix): Most useful when information about edges is more desirable
than information about vertices.
Adjacency (Matrix/List): Most useful when information about the vertices is more
desirable than information about the edges. These two representations are also
most popular since information about the vertices is often more desirable than
edges in most applications
Representation- Incidence Matrix
G = (V, E) be an undirected graph. Suppose that v1, v2, v3, …, vn are the vertices and e1, e2, …, em are the edges of G. Then
the incidence matrix with respect to this ordering of V and E is the nx m matrix M = [m ij], where
1 when edge ej is incident with vi
m ij
0 otherwise
Can also be used to represent :
Multiple edges: by using columns with identical entries, since these edges are incident with the same pair of vertices
Loops: by using a column with exactly one entry equal to 1, corresponding to the vertex that is incident with the loop
Representation- Incidence Matrix
Representation Example: G = (V, E)
e1 e2 e3
u
v 1 0 1
e1 e2
u 1 1 0
v w w 0 1 1
e3
Representation- Adjacency Matrix
There is an N x N matrix, where |V| = N , the Adjacenct Matrix (NxN) A = [aij]
For undirected graph
1 if {vi, vj} is an edge of G
a ij
0 otherwise
For directed graph
1 if (vi, vj) is an edge of G
a ij
0 otherwise
This makes it easier to find subgraphs, and to reverse graphs if needed.
Representation- Adjacency Matrix
Adjacency is chosen on the ordering of vertices. Hence, there
as are as many as n! such matrices.
The adjacency matrix of simple graphs are symmetric (aij = aji)
(why?)
When there are relatively few edges in the graph the adjacency
matrix is a sparse matrix
Directed Multigraphs can be represented by using aij = number
of edges from vi to vj
Representation- Adjacency Matrix
Example: Undirected Graph G (V, E)
v u w
u
v 0 1 1
u 1 0 1
v w
w 1 1 0
Representation- Adjacency Matrix
Example: directed Graph G (V, E)
v u w
u
v 0 1 0
u 0 0 1
v w
w 1 0 0
Representation- Adjacency List
Each node (vertex) has a list of which nodes (vertex) it is adjacent
Example: undirectd graph G (V, E)
u
nod Adjacency List
e
u v,w
v w
v w, u
w u,v