Unit 5
Unit 5
UNIT -5
Graph Theory
Birth of Graph Theory
The Konigsberg Bridge Problem
in Prussia.
exactly once from start to end of any town which made Euler to
Null graph: A graph containing only isolated vertices is called null graph.
Example:
Parallel edges: If in a directed graph or undirected graph certain pairs of vertices are joined
by more than one edge, such edges are called paralled edge. A graph which contains some
parallel edges is called a multigraph.
Pseudo graph: A graph in which loops and parallel edges are allowed.
W e i g h t e d grap h : Graphs in whi ch a n u m b e r (weight) is assigned to each edge.
Here d e g (v 1 )=3, deg (v 2 )=3, deg (v 3 )=2, d e g (v 4 )=2, deg (v 5 )=2 and d e g (v 6 )=2.
Pendant vertex: If the degree of a vertex is one,
it is called a pendant vertex.
If G= (V, E) is an undirected graph with e edges, then ∑𝑖 deg(𝑣𝑖 ) = 2𝑒. [ The sum of
the degrees of all vertices of an undirected graph is twice the number of edges of the graph and
hence even].
Proof: Since every edge is incident with exactly two vertices, every edge contributes 2 to
Therefore all the e edges contribute (2e) to the sum of the degrees of the vertices.
is even.
Proof:
𝑑𝑒𝑔+
𝐺 𝑎 =1 𝑑𝑒𝑔𝐺− 𝑎 =2
𝑑𝑒𝑔+
𝐺 𝑏 =5 𝑑𝑒𝑔𝐺− 𝑏 =1
𝑑𝑒𝑔+
𝐺 𝑐 =1 𝑑𝑒𝑔𝐺− 𝑐 =2
𝑑𝑒𝑔+
𝐺 𝑑 =1 𝑑𝑒𝑔𝐺− 𝑑 =3
Theorem :
If G=(V,E) be a directed graph with 𝑒 edges then ∑𝑣∈𝑉 𝑑𝑒𝑔+𝐺 𝑣 = ∑𝑣∈𝑉 𝑑𝑒𝑔−
𝐺 𝑣 =e.
Verify handshaking theorem for the following digraph
𝑛 (𝑛−1)
Note: The number of edges in Kn is nC2 or . Hence, the maximum
2
number of edges in a simple graph with n vertices is 𝑛(𝑛−1)
2
.
Regular graph: If every vertex of a simple graph has the same
degree, then the graph is called a regular graph. If every vertex in a
regular graph has degree n, then the graph is called n-regular.
Bipartite graph: If the vertex set V of a simple graph G= (V, E)
can be partitioned into two subsets V 1 and V2 such that every
edge of G connects a vertex in V1 and a vertex in V2, then G is
called bipartite graph.
Complete bipartite graph: If each vertex of V 1 is
connected with every vertex of V 2 by an edge, then G is
called a complete bipartite graph. If V 1 contains m vertices
and V 2 contains n vertices, then the complete bipartite
graph is denoted by K m,n .
𝑛2
Theorem: The number of edges in a bipartite graph with n vertices is at most ( ).
4
Proof: Let the vertex set be partitioned into the two subsets V1 and V2. Let V1 contain x
vertices. Then V2 contains (n-x) vertices. The largest number of edges of the graph can be
obtained, when each of the x vertices in V1 is connected to each of the (n-x) vertices in V2.
Therefore, the largest number of edges f(x)= x(n-x), is a function of x. Now we have to find
the value of x for which f(x) is maximum. By calculus, 𝑓′ (x)=n-2x and 𝑓" (x)=-2.
𝑛 𝑛
whenx=( ) and 𝑓"( ) < 0.
2 2
𝑛
Hence, f(x) is maximum, when x= .
2
𝑛
Therefore the maximumnumber of edges required= 𝑓 = 𝑛2/4 .
2
Isomorphism: The simple graphs G1=(V1,E1) and G2=(V2,E2) are
V2 with the property that a and b are adjacent in G1, if and only if f(a)
and f(b) are adjacent in G2 for all a, b V1, such a function f is called
an isomorphism.
nonisomorphic
Example: Show that the graphs G and H are not isomorphic.
In G, |V|=5 and |E|=6. In H, |V|=5 and |E|=7. The number of edges in both the graphs G and
H are not equal. Therefore the graphs G and H are not isomorphic.
Problems for practice:
1. Show that the graphs G and H are not isomorphic.
Problem 2: Show that the following graphs G and H are
isomorphic.
nk
Squaring on both sides we get,
k
ni 2n k (n k)2
2
i1
k
ni (n k) 2 2n k
2
- (2)
i1
1
Now the maximum number of edges in the ith component of G ni (ni 1)
2
maximum number of edges of G, k
1
2 i1
ni (ni 1)
1 k 2
n i n
2 i1
1
2
(n k) 2 2n k n
1
2
(n k) 2 (n k)
(n k)(n k 1)
2
graph
EULERIAN CIRCUIT
deg(A)=2
deg(B)=2
deg(C) =4
deg(D)=2
deg(E)=2
A-B-C-E-D-C-A
A-B-C-D-E-F
G1 G2
Hamiltonian Path: A path of a graph G is called a Hamiltonian path,
a-b-c-d-a
Hamiltonian Path
a-b-c-d
Practice problem:
If there exists an edge between vertex vi and vj, where i is a row and j is a column
then the value of aij=1.
Since graph G consist of four vertices. Therefore, the adjacency matrix will be 4 x 4
matrix.
𝑀𝐴 =
Incidence Matrix Representation: If an Undirected Graph G consists of n
vertices and m edges, then the incidence matrix is an n x m matrix C = [cij] and
defined by
by
Consider the undirected graph G as shown in fig. Find its incidence matrix
MI.
:
Graph colouring
A graph has been coloured if colour is assigned to each vertex in such a way that
adjacent vertices have different colours.
Vertex colouring of a graph G is a mapping from f:V(G) to S.
Here pick a vertex color it green color the next vertex with red,
proceed the same way till you reach the fourth vertex. The fifth
vertex cannot be red or green so we need a third color say purple as
shown above.
What is the chromatic number of Kn?
No two vertices can be assigned the same color because every two
vertices of this graph are adjacent. Therefore the chromatic
number of Kn is n.
Example: K5
An edge colouring of G is a mapping from the edge set E(G) to the elements of S.
The edges of one colour form a colour class.
Weisstein, Eric W. "Edge Coloring." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/EdgeColoring.html
Four color theorem:
The four color theorem, or the four color map theorem, states
that, given any separation of a plane into contigious regions,
producing a figure called a map, no more than four colors are
required to color the regions of the map so that no two adjacent
regions have the same color.
A connected graph without any circuits is called a tree. It is a simple graph and has
no loops and no parallel edges.
Definition of forest:
An undirected graph is a tree, if and only if, there is a unique simple path between
every pair of vertices.
Any connected graph with n vertices and n-1 edges is called a tree.
Basis step:If n=1, the number of vertices is one and the number of edges is zero.
Hence the theorem is true for n=1.
Induction step: For n=2, the number of vertices is 2 and edges is 1. Hence also true for n=2
Assume that the theorem is true for .
Consider a tree with k+1 vertices. Let eij be an edge of the tree connecting vi and vj. Since G
is a tree eij is the only edge of the tree connecting vi and vj.
Example:
Since G has three vertices any
spanning tree of G will also have
three vertices and hence two
edges.
This can be done in 3C2 ways
that is 3 ways as shown in the
figure.
Definition of spanning set: Let G=(V, E) be a connected
undirected graph. A spanning set for G is a subset F of E such that
(V, F) is connected.
Number of vertices is 6 .
Hence the number of edges to be considered is 5.
1-2 1 Yes -
6-3 2 Yes -
5-4 6 Yes -
1-3 9 Yes -
5-6 9 Yes -
The other spanning trees possible for the same graph are
The edges of the minimum spanning tree are 𝐴𝐸, 𝐶𝐷, 𝐴𝐶, and 𝐴𝐵,
whose length is 15.
Problem: 3
Find the minimum spanning tree for the weighted graph shown in the figure by
using Kruskal’s algorithm.
Solution:
The number of vertices of the graph is 9. Therefore, the number of edges to be
considered is 8.
Edge Weight Included If not included circuit
or not formed
.
EF 1 Yes --
AD 2 Yes --
HI 2 Yes --
BD 3 Yes --
CF 3 Yes --
EH 3 Yes --
BC 4 Yes --
FH 4 No E – F –H – E The required minimum
FI 4 No E–F–I–H–E spanning tree consists of
the edges EF, AD, HI,
GH 4 Yes --
BD, CF, EH, BC, and GH.
AB 5 -- --
BE 5 -- --
The total length of the
BF 6 -- -- minimum spanning
. DG 6 -- -- tree=22
DE 7 -- --
DH 8 -- --
Concepts based on minimum spanning trees (MST):