M4 Module2
M4 Module2
M4 Module2
Ex:
Here V = {a, b, c} and E = { }
Trivial graph: A null graph with only one vertex is called a trivial graph.
Ex:
Here V = {a} and E = { }
Finite graph: A graph with only a finite number of vertices and edges
is called a finite graph otherwise it is called an infinite graph.
Order and Size: The number of vertices in a graph is called the order of the
graph and the number of edges in it is called its size.
In other words, for a graph G = (V, E) the cardinality of the set V denoted by
|V|, is called the order of G and the cardinality of the set E denoted by |E|, is
called the size of G. A graph of order n and size m is called a (n, m) graph.
End Vertices: If vi and vj denote two vertices of a graph and if ek denotes the
edge joining vi and vj, then vi and vj are called the end vertices of ek .
Ex:
Here a and b are the end vertices of e1.
Loop: An edge whose end vertices are one and the same is known as a loop.
Ex:
Parallel edges: Two edges which have the same end vertices are known as
parallel edges. Ex:
Multiple edges: If in a graph, there are two or more edges with the same end
vertices, the edges are called multiple edges.
Ex:
Simple graph: A graph which does not contain loops and multiple edges is
called a simple graph. Ex:
Multi graph: A graph which contains multiple edges but no loops is called a
multi graph.
Ex:
Ex:
In the above graph, A and B are adjacent vertices and e1, e2 are adjacent
edges.
Complete graph: A simple graph of order >= 2 in which there is an edge
between every pair of vertices is called a complete graph or a full graph. It
is denoted by Kn .
Complete graph with two, three, four and five vertices are shown in
figures below:
G contains no edge that joins two vertices both of which are in V1 or V2.
This graph is a bipartite graph with V1 = {A, B, C}, V2 = {P, Q, R, S} as
bipartites.
Complete Bipartite graph: A bipartite graph G = G (V1, V2, E) is called a
complete bipartite graph if there is an edge between every vertex in V1 and
every vertex in V2 .
The following figures show some complete bipartite graphs:
n (n 1) (n 2) ! n (n 1)
m m
(n 2) ! 2 2
2m n 2 n
2 E V V
2
Q2: Show that a complete graph with n vertices, namely Kn has
1
n (n 1) edges.
2
Solution: In a complete graph, there exists exactly one edge between every
pair of vertices.
Therefore,
the number of edges in a complete graph = the number of pair of vertices.
n (n 1) (n 2) !
m
(n 2) ! 2
n (n 1)
m
2
1
Thus, in a complete graph with n vertices, no. of edges = m n (n 1) .
2
Q3: Show that a simple graph of order 4 and size 7 and a complete
graph of order 4 and size 5 do not exist.
Solution:
(i) By data, order n = 4, size = m = 7
For a simple graph, 2m n 2 n
2 7 42 4
14 12 ( which is false)
Thus, a simple graph of order 4 and size 7 does not exist.
(ii) By data, order n = 4, size = m = 5
1
For a complete graph, m n (n 1)
2
1
5 4 (4 1)
2
5 6 ( which is false)
(i) The graph K4, 7 has 4+7 = 11 vertices and 4*7 = 28 edges
and the graph K7, 11 has 7+11 = 18 vertices and 7*11 = 77 edges.
Consider m = rs
72 = r*12
This gives r = 6.
Q5: Show that a simple graph of order n = 4 and size m = 5 cannot be
a bipartite graph.
Solution:
For a bipartite graph, we have 4m n 2 (1)
Given V n 4 and E m 5
4 5 42
i.e., 20 16 which is false .
Thus a simple graph of order n = 4 and size m = 5 cannot be a
bipartite graph.
Remember:
For a simple graph, 2m n 2 n
1
For a complete graph, m n (n 1)
2
For a complete bipartite graph Kr, s , there are r + s vertices and r*s
edges.
MATHEMATICAL FOUNDATIONS FOR
COMPUTING, PROBABILITY & STATISTICS
21MATCS41
Ex:
The graphs shown in figure (a), (b) are 2 – regular, 4 – regular graphs
respectively. A 3 – regular graph is called a cubic graph. The graph shown in
figure (c) is a 3 – regular (cubic) graph. This particular cubic graph has 10
vertices and 15 edges, which is called the PETERSEN graph. The graph
shown in fig (d) is a cubic graph with 8 = 23 vertices. This particular graph is
called 3D hypercube and is denoted by Q3.
In general, for any positive integer k, a loop free k – regular graph with 2k
vertices is called the k – dimensional hypercube (or k – cube) and is
denoted by Qk .
Hand Shaking Property: The sum of the degrees of all vertices in a graph
is an even number and this number is equal to twice the number of edges
in the graph. i.e, for a graph G = (V, E), deg(v) 2 E
vV
Proof: The above property is obvious from the fact that while counting the
degrees of vertices, each edge is counted twice(once at each end).
This property is called the hand shaking property because it states that if
several people shake hands, then the total number of handshakes must be
even.
In view of Hand Shaking Property(HSP), the sum on the LHS of equation (1)
is equal to twice the number of edges in the graph. And this sum is even.
The second term(sum) in the RHS of equation (1), is the sum of the degree
of vertices with even degree each. So, this sum is also even.
Thus the first term(sum) in the RHS of equation (1) must also be even.
i.e., deg(v1 ) deg(v2 ) deg(v3 ) ..... deg(vk ) EVEN (2)
But from the assumption made(*), each of deg(v1), deg(v2),.....deg(vk) is odd.
Therefore, number of terms in the LHS of equation (2) must be even.
i.e., k is even.
(Since odd numbers added even number of times, the result is even)
Hence the proof.
Problems:
Q1: Can there be a graph with 12 vertices such that two of the vertices
have degree 3 each and the remaining 10 vertices have degree 4 each? If
so, find its size.
Solution:
Sum of the degree of the vertices (2 3) (10 4)
= 46 , which is even.
Hence there can be a graph of the desired type.
By HSP, Sum of the degree of the vertices = twice the number of edges
i.e., 46 2 E
E 23
Therefore , the size of such graph is 23.
Q2: In a graph G = (V, E), what is the largest possible value for V
if E 19 and deg(v) 4 for all v V ?
Solution:
Given: All the vertices are of degree > = 4
Therefore, Sum of the degrees of vertices > = 4n
38 4n
38
n 9.5 10
4
i.e., n V 10
0 2 2 3 4 11 Even number
Thus no simple graph of degree sequence 0, 2, 2, 3, 4 exists.
(ii) By HSP, 1 1 2 3 7 Even number
Thus no simple graph of degree sequence 1, 1, 2, 3 exists.
(iii) By HSP, 2 3 3 4 5 6 23 Even number
Thus no simple graph of degree sequence 2, 3, 3, 4, 5, 6 exists.
(iii) By HSP, 2 2 4 6 14 Even number
But such a graph do not exist because with 4 vertices, we cannot draw a
simple graph having degrees 4 and 6.
Q5: (i) If a graph with ‘n’ vertices and ‘m’ edges is k – regular, show
kn
that m
2
(ii) Does there exist a cubic graph with 15 vertices?
(iii) Does there exist a 4-regular graph with 15 edges?
Solution:
(i) Given that the graph G is k – regular.
the degree of every vertex is k.
Therefore, If G has n vertices, then the sum of the degree of vertices is nk.
By HSP, this must be equal to 2m (if G has m edges)
kn
i.e., nk 2m m
2
(ii) If there is a cubic graph(3-regular graph) with 15 vertices, then the
kn
number of edges it should have is m
2
3 15 45
m (# since it is not an integer )
2 2
Thus a cubic graph with 15 vertices does not exist.
(iii) If there is a 4 – regular graph with 15 edges (i.e., k = 4, m = 15), then
the number of vertices it should have is
2 m kn
n sin ce m
k 2
n6
(ii) Given G is a regular graph, then all vertices of G must be of same
degree, say k.
Suppose the order of G is ‘n’.
Then, Sum of the degrees of the vertices = nk .
By HSP, deg( v) 2 E
vV
3n 6 12
3 n 18 n6
2m
Q7: For a graph with ‘n’ vertices and ‘m’ edges, show that
n
where is the minimum and is the maximum of the degree of the vertices.
Solution: Let d1, d2, d3,…..dn be the degrees of 1st, 2nd, …… nth vertex
respectively, then by HSP
deg(v) 2 E
vV
d1 d 2 d 3 ..... d n 2m (1)
n 2 m (from equation 1)
2m
(2)
n
It is also given that is the maximum of d1 , d 2 , d 3 ,....d n
i.e., d1 , d 2 , d 3 ,...... d n
2m
n
2m
i.e., (3)
n
Thus combining equations (2) and (3), we get
2m
n
MATHEMATICAL FOUNDATIONS FOR
COMPUTING, PROBABILITY & STATISTICS
21MATCS41
From the definition of the isomorphism of the graphs, it follows that if two
graphs are isomorphic, then they must have
(1) The same number of vertices
(2) The same number of edges
(3) An equal number of vertices with a given degree.
These conditions are necessary but not sufficient.
This means that two graphs for which these conditions hold need not be
isomorphic. In particular two graphs of the same order and same degree need
not be isomorphic.
Problems:
Q1: Verify that the 2 graphs given below are isomorphic:
Solution: Let us rewrite the given graphs and name them as G1 and G2.
Also we shall name the vertices of the 2 graphs.
u1 u2 v1 v4
u3 u4 v3 v2
G1 G2
Thus G1 G2
Q2: Verify the 2 graphs given below are isomorphic:
A B A
P B
Q D P
S
C Q
R S
C
D
R
G1 G2
Solution: The 2 graphs G1 and G2 has 8 vertices and 12 edges each.
And the degree of all the vertices in G1 and G2 are equal to 3.
We observe that A A , B B , ......... R R , S S .
This implies that, there is a 1 – 1 correspondence between the vertices of
G1 and G2.
Also {A , B} {A , B}, {B , C} {B , C}, ......... {R , S} {R , S}.
This implies that, there is a 1 – 1 correspondence between the edges of
G1 and G2.
Also adjacency of the vertices is preserved. Thus G1 G2
Q3: By labeling the graphs show that following graphs are isomorphic:
u1 u2 v1 v5
u7 v4
u3 v2
u6 u4 v7 v6
u5 v3
G1 G2
Solution: The 2 graphs G1 and G2 has 7 vertices and 14 edges each.
And the degree of all the vertices in G1 and G2 are equal to 4 each.
We observe that ui vi i 1, 2 .... 7
{ui , u j } {vi , v j } i 1, 2, ... 7 and j 1, 2, .... 7
This implies that, there is a 1 – 1 correspondence between the vertices of
G1 & G2 and there is a 1 – 1 correspondence between the edges of G1 & G2.
Also adjacency of the vertices is preserved.
G1 G2
Q4: By labeling the graphs show that following graphs are isomorphic:
u1 v6
u6 v10 v1 v7
u10 u2 v2
u5 v5
u7
u9 u8 v4 v3
u4 u3 v9 v8
G1 G2
Solution: The 2 graphs G1 and G2 has 10 vertices and 15 edges each.
And the degree of all the vertices in G1 and G2 are equal to 3 each.
We observe that ui vi i 1, 2 ......10
{ui , u j } {vi , v j } i 1, 2, .....10 and j 1, 2, ....10
This implies that, there is a 1 – 1 correspondence between the vertices of
G1 & G2 and there is a 1 – 1 correspondence between the edges of G1 & G2.
Also adjacency of the vertices is preserved.
G1 G2
Q5: Determine whether the following graphs are isomorphic or not.
u1 (2) v1 (3)
u5 (2) v5 (3)
u6 (3)
u4 (3) u8 (3) u2 (3) v4 (3) v8 (3) v2 (2)
v6 (2)
u7 (2) v7 (2)
G1 G2
u3 (2) v3 (2)
Solution:
(Let us write the degrees within brackets while naming the vertices)
The 2 graphs G1 and G2 has 8 vertices and 10 edges each.
We observe that, in G1, the vertex u1 of degree 2 is adjacent to vertices u2
and u4 whose degrees are 3 each.
Now suppose, the vertex u1 in G1 corresponds to v2 in G2(since both
are of same degree)
Then we observe that, in G2 , the vertex v2 of degree 2 is adjacent to vertex
v1 of degree 3 and vertex v3 of degree 2.
This implies that, the adjacency of vertices is not preserved.
u5 (4)
v5 (4) v6 (4)
u6 (3)
u8 (3)
v8 (3) v7 (3)
u7 (4)
v4 (3) v3 (4)
u4 (4) u3 (3)
G1 G2
Solution:
(Let us write the degrees within brackets while naming the vertices)
The 2 graphs G1 and G2 has 8 vertices and 14 edges each.
We observe that, the vertex u1 of degree 3 in the graph G1 is adjacent to
vertices u2, u4, u5, all of which are of degrees 4 each.
Now suppose, the vertex u1 in G1 corresponds to v1 in G2(since both
are of same degree)
Then we observe that, in G2 , the vertex v1 is adjacent to v2, v4 and v5
whose degrees are 4, 3, 4 respectively.
This implies that, the adjacency of vertices is not preserved.
1.
2.
3.
4.
MATHEMATICAL FOUNDATIONS FOR
COMPUTING, PROBABILITY & STATISTICS
21MATCS41
Ex:
For the graph shown in fig (a), the graph in fig (b) is a spanning sub graph
whereas the graph in fig (c) is a sub graph, but not a spanning sub graph.
Induced Sub graph:
Given a graph G = (V, E), if there is a sub graph G1 = (V1, E1) of G such that
every edge {A, B} of G is an edge of G1 also, where A, B V1
Then G1 is called an induced sub graph of G (induced by V1) and is
denoted by V1
Ex:
For the graph shown in fig (a), the graph shown in fig (b) is an induced sub
graph, induced by the vertex set V1 = {v1, v2, v3, v4} whereas the graph
shown in fig (c) is not an induced sub graph since there is no edge between
v3 and v4.
Edge disjoint and Vertex disjoint Sub graphs:
Let G be a graph and G1 and G2 be two sub graphs of G then,
(i) G1 and G2 are said to be edge disjoint if they do not have any common
edge. (ii) G1 and G2 are said to be vertex disjoint if they do not have any
common edge and any common vertex.
Ex 1:
G G1 G2
For the graph G, the graphs G1 and G2 are vertex disjoint, as well as
edge disjoint sub graphs.
Ex 2:
G G1 G2
The graphs G1 and G2 are edge disjoint, but not vertex disjoint since A
and D are common vertices in G1 and G2.
Operations on Graphs
Consider two graphs G1 = (V1, E1) and G2 = (V2, E2). Then the graph whose
vertex set is V1 V2 and the edge set is E1 E 2 is called the union of G1 , G 2
and is denoted by G1 G2 .
Thus G1 G 2 V1 V2 , E1 E 2
If V1 V2 then the graph whose vertex set is V1 V2 and the edge set is
Ex:
G K4 G
Self Complementary graphs: A simple graph G which is isomorphic to its
complement is called a self complementary graph.
Ex: GG
G G G G
Problems:
Q1: Let G be a simple graph of order ‘n’. If the number of edges in G is
56 and in G is 80 , then what is the value of n ?
Solution:
We have G K n G
G G
Example on 5 vertices:
G G