0 ratings0% found this document useful (0 votes) 250 views110 pagesDM Unit 3 IT
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, 
claim it here.
Available Formats
Download as PDF or read online on Scribd
[ unite int | Wl
| _ Graph Theory
Q.1 Define graphs with examples.
Ans. : Graphs : A graph is an ordered pair (V(G), E(G)) where
i) V(G) is non empty finite set of elements known as vertices or nodes.
V(G) is called the vertex set.
ii)E(G) is a family of unordered pairs (not necessarily distinct) of
elements of v, known as edges or arc or branches of G. E(G) is known
as edge set.
 
 
 
Graphs are so named because they can be represented diagrammatically in
the plane.
It is denoted by V(G, E).
a) Each vertex of G is represented by a point or small circle in the plane.
In practical examples vertex set may be the set of states or cities or
objects etc.
b) Every edge is represented by a continuous curve or straight line
segment. Edges may be the route among states or cities or relation
among objects etc. Diagrams of road maps, electrical circuits, chemical
compounds, job scheduling family trees, all have two objects common
namely vertices and edges.
Let us consider the following examples of graphs with V(G) and E(G). -
1) (a 3} 2 {4 2"
i
|
1
  
VG) = (1, 2,3, 4} VG) = (62345, 6)
 
B-)Graph Theory
Discrete Mathematics ge
1, 6),
: 4) E(G.) = {(, 2) (1, 5) Cs
bs an a ; (2, 5), (2, 3) G4) 4 5),
a 4.6.6, 9)
4 pe
3) y 8
     
V(G3) = {a, b, ¢, d} V(Gp) = (1, 2,3, 4, 5, 6}
E(G3) = {@, b),@d) (b,c) EGy) = {(1, 2), (1, 6), (2, 3),
, @), (d, a} (2,5), (2, 5), 3, 4),
(4, 5), 5, 6)}
 
5) ¥ V(Gs)= {a, b, ¢, d}
EGs)= {(@, b), (@, ©), (b, &) (, €), (b, 0),
(c, ©) (¢, d) (d, d), (4, e)}
ob 7
6)
V(Go ) = {a, b}
E (Ge) = {a, b) (a, a) (b, b) = fey, 2, €3)
 
i) Tf x and y are two vertices of a graph G and unordered pait
{% y} = (% y) = e is an edge then we say that edge ¢ joins x and y ot
€ is incident to both vertices x and y.
| In this case, vertices x and y are said
i example (1), ¢ = (2, 3) «. e is incident at
one incident on e = (2, 3).
ii) Two vertices x and y are said to be adjacent to each other if the paif
(x, y) is an edge of G.
to be incident one e.g. In
2 and 3 and vertices 2, 3 are
A Guide for Engineering StudentsDiscrete Mathematics 3-3 Graph Theory
oO raph Theory
Ife = (% y) is an edge of G then x and y are said to be end vertices
of ¢ and we can say that ¢ is incident at x and y.
iii) Two edges e; and e5 are said to be adjacent if they have a common
vertex i.e. Ife, and e2 are adjacent then e; = {x, y} and e = {y, z}.
iv) An edge joining a vertex to itself is called a loop. E.g. In example (5)
there are 2 loops (c, c) and (d, d).
y)A pair of vertices of a graph is joined by two or more edges, such
edges are called as multiple or Parallel edges,
In example (4) (2, 5) (2, 5) are multiple edges,
3.2 : Types of Graphs
Q.2 Explain different types of graphs.
1) Multigraph : A graph in which a pair of vertices is joined by two or
more edges is called a multigraph or multiple graph,
ie. A graph having multiple edges is called a multigraph, In examples
(1), (2), 3), (6), graphs are not multigraphs and graphs in examples
(4), (5) are multigraphs.
2) Pseudograph : A graph having loops but no multiple edges is called a
Pseudograph.
Graphs in examples (3), (5) and (6) are pseudographs. A graph having
only loops is called a Haary graph. For example :
 
 
 
pee fh A
Fig. Q.2.4
  
Graph G is a pseudograph is well as Haary graph. Graph G, is
Pseudograph but not Haary graph. Graph G3 is neither Pseudo not
graphs.
3) Simple graph : A graph without loops and multiple edges is called a
Simple graph. Graphs in examples (1) and (2) are simple graphs.
hs in examples (3), (4), (5), (6) are not simple graphs,
“Null graph : A graph G (V, E) is said to be null graph if E is a
empty set. Null graph on n vertices is denoted by Ny.
Geconas A Gulde for Engineering Studentsee. eOry
 
Discrete Ma fathematics
°
My
Ny
5) Finite graph : A graph G (V, ) in 1
sets is called a finite graph. Otherwise infinite 8
6 Directed graph : A sr GV, B) is said 19)
elements of E are an or rs of vertices. £8
E= {(a, b), (b, &) @ OF
aye EG)
rected is called a >
Ny
ne vy (x) and E (x) are finite
finite graph.
directed graph if the
aph
dered pail
Here (a, c) # (c, a) (
‘A graph which is not di
Non-directed graph or graph.
7) Weighted graph : A graph G (V, E) in
which some weight is assigned to every
edge of G, is called weighted graph. : 5
Fig. Q.2.3 Weighted graph
number of
lied the indegree of v. It is denoted by
Fig, 0.2.2 Directed graph
8) Degree of a vertex :
a) In a directed graph G the
edges ending at vertex v is cal
deg G* (v) or d* (v)
b) Outdegree : In a directed graph G, the number of edges beginning
at vertex v is called the outdegree of v. It is denoted by deg G™ (v) of
d-(v).
c) The number of — a
edges incident at a ES g b ¢
vertex v of a graph °
G with self loops
counted twice is a 6 2 a!
& 6,
called the degree of
the vertex v. It is a
Fig. Q.2.4
denoted by d(v). A
vertex of degree one is called pendent vertex. A vertex of d 0
legree zer'
is called isolated vertex. An edge inci
e
pendent edge. ige incident at pendent vertex is called
 
  
 
A Guide for Engineering StudentsDiscrete Mathematics 3-5 Graph Theory
 
 
 
 
 
 
 
 
 
 
eg.
In graph Gi,
Vertices | Indegree_| Outdegree
a 0 2
b 2 1
c 2 1
d 1 1
In graph G2,
d@) = 2, db)=2+2=4, de)=4, de)=l
dd) =3 , dh=0
.. f is an isolated vertex. e is a pendent vertex. An edge {c, e} is a
pendent edge.
9) Order and size of graph : The number of vertices in a finite graph G
js called the order of G. The number of edges in a finite graph G is
called size of the graph. A graph of order n and size m is called (n, m)
graph. '
If G is a (p, q) graph then G has p vertices and q edges.
10) Degree sequence of a graph :
Let G be a graph with vertex set V = {V¥1,V2/V3-+-Vn} and
d; = deg (v;) then the sequence (dy, d2,43,.--dn) in any order is called
the degree sequence of G.
Note: 1) Vertices of G are ordered so that degree sequence is
monotonically increasing.
2) Two graphs with same degree sequence are called to be degree
equivalent. e.g.
d(vy) = 4, d (v2) = 3,
d(w3) = 2, d(vs) = 5,
d (v6) = 3), d(vq) =1
“Its degree seq. is (4, 3, 2, 1, 5, 3)
By relabelling vertices we may write
dey y
‘Bree sequence as (1, 2, 3, 3, 4, 5).
 
Fig. Q.2.5Graph Th,
Discrete Mathematics sao 2
E) be any graph then
Q.3 Handshaking lemma : Let G (Vs 5 of G.
4 (v) = 2q where q denotes the number of edge
vev
Aus. : Proof: Let us argue by induction on q. Suppose 4 = 0 ie. G has
no edge i.e. E is an empty set. So d(v) = 0, V ve V-
“Did (v) = 2q = 0.
Let G be a giaph with q > 0 edges. Choose any edge e = {u, v} of g
Consider the graph G obtained from G as follows :
i) The vertex set of G, is same as the vertex set of G i.e.
VGi)=V@=V=p
ii) The edges of G, are all edges of G except e.
In other words, G is obtained from G by deleting the edge e.
 d(x) + dg, (w+ dg, (v) = 2-1)
xeV
xeuy
> d(x) + dg, (u)-1+dg(v)-1 = 2q-2)
xeV
xe uy
Dd) = 2q Hence the proof,
xeV
The result is so named because it impli
iplies that
hands, the total number of hands shaken must be
involved in one handshake. ~
if several people shake
even as two hands are
Note : If $d (v) = Odd :
2» number then there does not exist any graph
with this degree sequence,
:
ee
A Guide for Engineering Students0
i
0
0
 
The agi ay = Number of edges joining v; and v;
a "cy matrix of the following graph is
ee.vraph
Discrete Mathematics» 3-8 Grap) Th,
 
Vy V2 V3 Vy V5
 
vf. 1000 |" Vs
vo]1 0201 |
@) = 2 f
an v3]0 2010 wr
vy ]0 0102
Pan Fig. Q.4.2
2. Incidence Matrix: Let G be a graph with n vertices and nm cg
without self loops, The incidence matrix is denoted by X (G) or 1 (@) ang
defined as
X@ =
xy =
Uxilnem Where
 
Lif" edge is incident on i vertex vj.
= 0 otherwise,
X G) is an x m matrix whose 0 rows corre
m columns corres
spond to the n vertices ‘and
spond to m edges. The grap!
are given below
h and it’s incidence Matriy
ep
2&3 &4 5 eg ey
“fl 000017
X@="2]1 116000
Ys 10 011104
Y4]J0 001119
YVslO 100000
Sx7
 
Properties of Incidence Matrix
1) It contains only 0 and 1,
a tow is equal to the degree of the
Corresponding vertex, .
4) Two identical columns corres;
spond to the parallel edges in graph.
5) A row with all 0’s tepresents an isolated vertex,
6) A row with single 1 represents a pendent vertex,
 
 
A Guide for Engineering Suder®porte Materials 3-9 Graph Theory
re incidence matrix of a graph with loop is
give 8S follows +
d: ie
ds 0 ; Fig. 44
0
& e:
1
1
y 3x3
3, Adjacency Matrix of a Diagraph (Directed graph)
Let G be a directed graph with n vertices and without parallel edges. The
adjacency matrix is denoted by
were, A) = [aglan
1 if there is an edge directed from v; to vj
 
= 0 otherwise
In network flow, adjacency matrix is also known as connection matrix or
masition matrix. The adjancency matrix and diagraph are given below.
V1 V2 V3 V4 V5 V6
vy,f0 10000
 
v2/0 01000
AM)=v,/0 10000
vs]0 00000 :
_s G Fig. O48
ve ll 000 0 Oleug oo
4. Incidence Matrix of Diagraph : The incidence matrix of a diagraph
‘ith n vertices m edges and no self loops is a matrix,
XG) = [xy] nvm where
de enn, ;th
Xj = 1 if j edge e; is incident out of i vertex vj.
1
-1 if j® edge e; is incident into of vertex vj.
0 otherwise.
  
A Guide for Engineering Studentsa
ee
Gi
Discrete Mathematics 3-10
FAP Theoy,
A graph and its incidence matrix are given below :
eS ee
 
Yif-1 0 0 0 4 41 Soa, |
Yetl 10 0 0 0 op ms
X@ea=y, 0 -1 1-1 0 0 Ne:
valo 0-10 0 0 ns
Ys}O 0 0 4 0 ~1 Fig. Q.4.6 °
YeolO0 0 0 0 ~1 9 6x6
Note
+i) Sum of elements in each 4
&8 Show that ima graph the number of vertices of odd degree ig
even, ‘
‘olumn of incidence matrix is zero,
Ans. : Let G be a ( — q) graph.
By handshaking lemma Daw,)= 2q
vieV
Now separate out Vertices of even degree and odd degree
~ Yee = Yas
» dy) =2q
vieV xeVv yeV
evendegree odd degree
Dai) = 24 = 240) = Even number
vev : xeV
odd degree even degree
. The sum of vertices of odd degree is even,
Hence the number of vertices of
Q.6 Show that the maximum number of edges in a simple graph
5 ices ig BO@-1)
with n vertices is ——.
odd degree is even,
Ans. : Let G be a graph with n vertices
-. By handshaking Jemma .
Y 4 = am
= vev
‘Sm edges
 
A Guldg for Engineering Srudt™®ey
piserete Mathematics 3-11 Graph Theory
Let x € V -.x must be adjacent to remaining (x — 1) vertices
nd @yea- lL ¥xev .
‘. Equation (1) = (9-1) + (M- 1) +... n times = 2 m
n(a-1)=2m
n(n-1)
m= 7
Hence the maximum number of edges in any simple graph with n vertices
,. n(o- 1)
2
Q7 Determine the number of edges in a graph with 6 nodes, 2 of
degree 4 and 4 of degree 2. Draw to such graphs. IS [SPPU : Dec.-09]
Ans. : Let G be the required graph with 6 nodes and m edges.
.. By handshaking lemma
Yaw = 2m
veG
d(v)+d(v2)+dv3)+d(va)+d(vs)+/ (vg )=2m
4444+24+2+2+2 =2m
2m = 16
m = 8
Hence 8 edges are required.
Two such graphs are given below.
 
Fig. Q.7.4
 
 
A Guide for Engineering Studentscere) aa = raph Theory
D Ma tc 3-12 G
iscrete Mathematics
i h that 2
h with 12 nodes suc! of
it possible to construct a graph ;
has node fi we degree 3 and the remaining have degree
we BSISPPU : Dect)
Ans. : Let G be the required graph with 12 vertices.
By handshaking lemma.
Yaw) = 2m
ve VG)
G+3)+Gt4+4e4ege4eatgt44+4)=2m
6+40°=
=> m = 23
+. It is possible to construct such graph.
  
  
 
& 9 Is graph exist for the degree sequence 4, 4, 3, 3, 2, 2, 1.
+ Now apply handshaking lemma
Ye () = 2m= Even
4444343424241 = Bven
19 = Even which is impossible
". Such graph does not exist,
Q.10 How many simple labelled Sraphs with n vertices are there ?
TSTSPPU : May-10]
Ans.: We know that a simple j
graph with n verti
tices has maximum
possible number of edges aac) = m (say),
To construct a simple graph with © edges and n vertices,
can be done in
‘e | Ways.
. ™C, ways where m= 2") and 9 cee
Hence the total number of ways to construct such graphs js given by
[F} (THE (8) =) va
A Guide for Engineering Studentswhematles 3.
ae Math ZB Graph Theory
ast show that a simple graph of order 4 and size 7 does not exist.
Let G be a simple graph with 4 vertices,
n(n-1)_ 4x
has at most =o “ = 6 edges,
Ags.
then G
put given that G has 7 edges which is contradiction.
«there cam not be a simple graph with 4 vertices and 7 edges,
42 Explain i) Regular graph ii) Complete graph iii) Bipartite
ph iv) Complete bipartite graph.
‘gs. 1) Regular Graph : A graph G is said to be r-regular graph if
every Vertex of G has degree r.
j) Regular graph of degree zero is called null graph.
iA regular graph of degree 3 is called cubic graph,
eg.
i) o—— I
 
5 ° o——o
| Ng: 4 +regular graph 4+ regular graph |
 
2- regular graphs 3+ regular graph
  
Fig. Q.12.1
?) Complete Graph : A simple graph G in which every pair of distinct
ane axe adjacent is called a complete graph. If G is @ complete graph
‘ Vertices then it is denoted by Ky-
“— graph, there is an edge between every pair of distinct
aad K,, every vertex is adjacent to remaining
of each vertex is n — 1.
Ths K
n — 1 vertices so
a iS a(n — 1) - regular graph.
‘A Guide for Engineering StudentsDiscrete Mashematics sol Sr The
n(n-}) edges,
 
Ky has exactly
Consider the following examples :
  
Fig. 12.2
M) Bipartite Graph: 4 graph G (v, E) is said to be bipartite Staph if
KS Vertex set can be partitioned into two disjoint subsets say V) and V3
sock that vy) Uv) =v and
‘1 OV2 = and every edge of G joins a Vertex of v; to a vertex of vo
Ih Bipartite graph, vertices of V1 should not be adjacent. It is free from
loops. ,
 
Following Saphs are bipartite graphs
“a
v2" {1.2.3}
   
 
ce |
MS 23) |
*25f@.b.g}
  
 
Fig. 0.42.3
'V) Complete Bipartite graph : A bipartite graph
ue By ey v= yaaa ‘1 OV) = 03s said to be complete Bipartite
M each vertex o; is joined to ey, ve .
oe 1 'S Joined to every vertex of V2 by a unique
If ivy] = m, |v] =
then the complete bipartite
denoted by Kan seh G
Wi Uvy, Bis
 
A Guide for Engineering Sodenpiserete Mathematics 3-15 Graph Theory
piseete Mahe _Grai Theory
|
|
3 |
|
|
|
1
|
|
1
5) \ t } p> A
Kaa Kaa
Fig. Q.12.4
The graph K, ,, is called as star graph.
Examples ¢
| Kya ' Koo
Ka
 
 
   
Q.13 Is there exist any complete bipartite graph with 7 vertices and
14 edges ?
Ans. : First find all possible bipartitions of 7. They are 6 + 1, 5 + 2,
423
 
We know that, if G(vj Uv>,E) is a bipartite graph then the number
edges in G is equal to |v | - |v]
FS A= bil: bal
Here 'B = 14 But 6.1 = 6, 5.2.= 10, 4.3 = 12
Therefore the complete bipartite graphs with 7 vertices has 6 or 10 or 12
edges only.
Therefore any complete bipartite graph with 7 vertices and 14 edges.
Q44 Explain isomorphism of graphs with examples.
US[SPPU : Dec.-12]
Ans. : In real life we come across so many similar objects or figures
With respect to size, shape or orientation. Similarly there are a few
Concepts in graph theory which deal with the similarity of graphs wart,
reas of vertices or number of edges, number of regions and so on.
Ae all such similarities the most important one is an isomorphism of
iphs,
 
Gicone®ie
Discrete Mathematics 3-16 Graph Theory
Definition: Let G, (V,E)) and Gz (V2, Ez) be two graphs, G any
Gy are said to be isomorphic graphs if
i) There exists a bijective function 9: > Vp
ii) There exists a bijective function y : E, — Ey such that e =
(x, yy is
an edge in G, iff (6 (%), 6 (y)) is an edge in Gy.
The pair of functions 6,and y is called an isomorphism of G, and G4
is denoted by G, = Gy. i
Suppose two graphs G, (Vj, E,) and G2 (Vy, Ep) are isomorphic eraphs,
Then it is clear that
D M=M
| ie. G and G) must have same number of vertices,
i) |E\|=|Ep| ie. Gy and Gy must have same number of edges,
¥8) G, and G) must have an equal number of vertices with the same
degree,
iv)
Gi and G2 must have an equal number of loops.
v)
vi)
vii)
Gi and G, must have same number of pendent.
Gy and G, must have same number of pendent edges,
If u and v are adjacent in G
are also adjacent,
In general it is easier to
Prove two graphs are not isomorphic by proving
that any one of the above property fails,
Consider the following example
then the Corresponding vertices in G,
 
Fig. 14.1
These graphs have i) The same number of vertices.
ii) The same number of. edges,
iii) An equal number of vertices of degree k.
These conditions are necessary for two Braphs to be isomorphic but
sufficient. ~
i‘
A Guide for Engineering Std"a
piscrete Mathematics 3-17 Graph Theory
A, h G, d (8) = 3, d (&) = 1, d @ = 1 and x and y are adjacent to
vertex X
pgsph G2. d@pa3dQypyal
| ere is only one pendent vertex adjacent to x). Hence adjacency is not
ved. Therefore G, is not isomorphic to G2 ie. G, = G).
Note : Isomorphism of graphs is an equivalence relation.
Examples =
Q.45 Draw all isomorphic graphs on vertices 2 and 3.
Ans. : i) For 3 vertices.
. o——o
% Yo V3 a OF @; are isomorphic graphs |
gs
and > are isomorphic graphs
 
 
$—F_ard_ g—9_zte isornorphie graphs
g
 
 
Fig. Q.15.1 (a)
Q.46 Draw all non isomorphic graphs on 2 and 3 and 4 vertices.
Aus. : All non-isomorphic graphs
on 2 vertices are
Ra a isomorphic graphs on 3
 
  
Fig. Q.16.1 (a)Graph Theo
-18 ny
Discrete Mathematics 3-1
Al non. Bonar graphs on 4 vertices,
ee = ia
6
kone
Fig, 16.1 (b)
9.17 Draw all non isomorphic graphs on 5 vertices and 5 edges,
Ans. : The following are non isomorphic graphs with 5 vertices and 5
edges.
 
 
   
7 ~ )
|
“ag atria
Q.18 Find whether the following cr
Pairs of graphs are isomorphic or i g vy Y%
= WN &
~Ans.: i) Both the gtaphs have 4 i?
Vertices and 5 edges, |
Both have 2 vertices of degree 3 and
2 vertices of degree 2,
OBE d (y,
assy,
 
Fig. Q.18.4
V2» V3s V4} such that
Cry
boy,
doy;
$ preserves adjacency and non-adjacency of vertices,
 
A Guide for Engineering Studerwe
pert Mathematics 3-19 Graph Theory
yor = E; Is bijective.
Gis isomorphic to Graph G,.
i)
 
Fig. Q.18.1 (a)
‘As G has 4 edges and G> has 5 edges, G, and G, are not isomorphic
graphs.
ii) G, And G>
are not isomorphic
graphs because in
G, vertices vy
ad v3; of 4
degree are non
adjacent while in ’
G,, the vertices x
and y of degree 4
are adjacent.
 
Fig. Q.18.1 (b)
Q49 Identify whether the given graphs are isomorphic or not.
_SSISPPU : Dec.-12]
Ams.: In graph Gy, there are 2
vertices of degree 3. But in G,
thee is only one vertex of o
degree 3, So G, and G» are not
isomorphic graphs,
Fig. 1st
ip es —-
ox
  
“Fig. Q.19.4 (a) _
=3.20
 
Discrete Mathematics
Graph Gy has 9 edges nd Gy has 8 edges.
Y He.
Q.20 Show that the following graphs are isomorphic
7 © geaphs, |
‘Therefore Gy and Gy are not isomorphic graphs
USP [SPPU ; Mayatg
 
oy
Fig. .204
| Ans. + All graphs Gj, Gy and Gs have 10 vertices and 15 edges,
AI! these graphs are Suregular graphs, Also they preserve adjaceny
Hence all graphs are isomorphic, Isomorphism is’ given by
hoof 2 + g¢ 3 5 hoa sy
Sj 630
T3b 8 ce 94d “Oe
In the similar way, we ean show that Gy and G5 are isomorphic graphs.
2.21 Are the graphs isomorphic ? Why ?
| ‘Ans. Given graphs Gy and Gy have 8 vertices and 10 edges.
  
Fig Q2ia
Both the graphs have 4 vertices of de
Also the adjacency is preserved.
6: v (G1) > VG) is defined as
Bree 2 and 4 vertices of deste!
8910920 33d 4058 155,856 457,
(
A Guide for Engineering Sities
pcre MO Graph they
ois bijective.
., G, and Gp are isomorphic graphs,
a2 Explain how fo obtain new graphs from old graphs with
examples. KS ISPPU : May-07, Dec.-09, 12]
ans. A good mathematical theory must contain sufficient
models and examples. Moreover it must have
objects from old ones.
In this section we derive new graphs from old graphs.
1) Subgraphs : Let G (V, E) be any graph. A graph H (Vy;
be subgraph of G if VC V and E, cE,
We also say that G is a supergraph of H.
eg.
number of
methods to generate new
+ E}) is said to
 
Graphs H, Hy, H3 and Hy are subgraphs of G. But graphs Hs and He
ae not subgraph as (4,7) € E (Hs) but (4, 7) ¢E (G) and
(6 Ne E (Hg) but (6, 7) ¢ E (G).
Properties :
}) Each graph is a subgraph of itself.
2)A subgraph of a subgraph of a graph G is a subgraph of G.
3)A graph G - {v} is a subgraph of G which is obtained from G by
Temoving the vertex v € G and also the edges which are incident at v.
4) ee (G) then G - e is a subgraph of G obtained from G by deleting
the edge e,
 
 
ECODEY A Guide for Engineering StudentsDiscrete Mathematics 3-22
  
In above example H, - {5} is
  
 
and H, - (4, 5) is given by py
 
2) Edge Disjoint Subgraphs : Two subgraphs Hy and Hy of the graph
are said to be edge disjoint subgraphs of a graph G if there is no edgy
common between Hy and Hp ie, E (Hy) 0 E (Hy) = 6 It may tay
common vertex.
3) Vertex Disjoint Subgraphs : Two subgraphs H, and H, of the era
G axe said to be vertex disjoint subgraphs if there is no vertex commes
between Hy and Hy ie. V(Hy) 9 V (Hy) = @
Note : 1) Alll vertex disjoint subgraphs are edge disjoint subgraphs.
‘4 Spanning Subgraph : Let G (V, E) be any graph, A subgraph H oft
Staph G is said to be spanning subgraph if V (G) = ).
Example : Let G be the following graph :
  
244
:
3
eo ee ¢
8 7 6
He
 
Fig. Q.22.4
 
et
A Guide for Engineering S™Mathematles :
Discrete Jed Graph Theory
 
Graphs Hy, U2 Are subgraphs of G,
Hy and Hy are edge disjoint subgraphs but not vertex disjoint subgraphs.
Hy and Hy are vertex disjoint subgraphs as well edge disjoi
Fut as edge disjoint
subgraphs Hs and Mg are spanning subgraphs of Gas
V (is) = V (ie) = VG).
§) Factors of a Graph : Let G be any graph, A kefuctor of a graph G is
defined to be a spanning subgraph of the graph with the degree of each
of its vertex being K. K-factor is a K-regular graph,
 
 
When G has a I-factor, say Gj, if the number of vertices are even and
edges of G are point disjoint,
In particular, Kq4 1 can not have a Iefuctor but Koy can have 1-factor
of graph.
Example 1)
 
   
4 4
s ‘4-factor of G 2iactor of G
Fig, Q.22.2
xX (a De
4 3 40-———03 a 3 4s af
1=factor 2-factor 3. factor 1
Fig. Q.22.3
Complement of a Graph : Let G be a simple graph. The complement
Of G is denoted by G is the graph whose vertex set is the same as the
 
A Guide for Engineering Stutents|
Graph Theory
Discrete Mathematles 3-24
TOT
5 " 7 a
£G and i h two vertices are adjacent if and only jp
. ;
they are not adjacent in G.
if it is isomorphic to jt,
A graph is said to be self complementary graph if it is is norp! i
st
complement.
eg.
» —) it)
 
G is isomorphic to G.
Note :
“. Gis self complementary graph.
1) For any graph G, (G) = G
2) The complement of the nul
il graph on n vertices is the complete graph
Kn on n vertices and vic
e versa.
3) Ky is self complementary graph.
Examples ;
Q.23 For the following Braphs, determine whether H (V', E’) is #
subgraph of G where
DV'= A,B,C), = (4, B), (A, BR}
fi
A Guide for Engineering StuderFes
Discrete Mathematics 3-25 Graph Theory
iy v’= (BCD) E’ = (B, ©), (B, D)
1) V' = {A B, C, D},
 
E'= (A, O}
DS [SPPU : May-07, Dec.09]
Ans.: i) H is not a subgraph of G = nd
ecause F € V (H) Fig. Q.23.1
put Fe V (G), so V (HK) ¢ VG)
ii) Here VC VG), E’ CE (G), so H (V, E’) is a subgraph of G.
iii) Here V Cv (G), but E’ ¢ E (G) Therefore H (V, FE) is not a
subgraph of G.
Q.24 Draw all self complementary graphs on 5 vertices.
CS [SPPU : Dec.-12]
Ans. : The: following graphs are
self complementary graphs on 5
vertices.
Here G; = Gy and G) = G;
 
= G, as well as Gy are self G,
complementary graphs. oe
 
Q.25 Explain operations on graphs.
Ans.: We define some standard operations of graphs like intersection,
union, Ringsum etc, .
A) Intersection of Two Graphs: The intersection of two graphs
Gi (V,,E,) and Gy (V,, E>) is a graph G (V, E) whose vertex set is
=\ OV) and edge set is
ESE, ME . The intersection of G, and Gy is denoted by G9 Gp.
eg,
 
 
 
CODES, A Guide for Engineering Sudentsv
. |
Graph Th }
Discrete Mathematles 3-36 €Ory
Vp = (Vis Var V3 V5) }
Vm (Vqy Ve Van Vad
aa Ep = (e1s¢5,&6)
Ey (ey, e203 ea)
 
 
Therefore G = G) AG) (vy E) where Ce 1. |
Ve Vv = Wi Varah | a |
Ey AE: = (i) | 8
: (S108)
Fig, 0.25.2
B) Union of Two Graphs : Let G, (Vj,E1)} G2 (V2,E2) be two
graphs. The union of Gy and G» is denoted by G; U G2 = G (¥, E) ang
it is a graph whose vertex set is
V = Vj Uy and Edge set is
 
 
E=E, UE;
Consider the graphs G, and Gy as shown in
above example : | My te ve
The union of G, and G, is given by G(v, E) | e{ lez ¥
where V= Vj UV) = (ys Vas V3 Vas V5} yas *
V= Vi U Ve = {@1,€2,€3,€4s &55 &6} SS
Ne * Both graphs G, and G are subgraphs ae
C) The Ring Sum of, Two Graphs : The ring sum of two graphs
G) (V;, Ey) and G, (Vp, Ep) is denoted by G = G, ® G) (V, E) whos
vertex set is V = Vj U Vp and the edge set consists of those edges which
are either in E, or in E> but not in both ie. E = (Ey UE) ~ (Ey AEy)
The ring sum of above graphs G, and G; is
given by G (V, E) = G, ® G {
V= (Vy, V2, V3, V4 Vs} = VW UV) \
E = (Ey UE2)~ (Ey NE) a
= {c2, 3, €4, €5, 6} ~
D) Sum of Two Graphs : The sum of two Se
vertex disjoint graphs G, (Vj,E,) and Gp (V),E,) is denoted
G,+G = G (V, B) is defined as the graph whose vertex set i8
V (G, UG») and consisting of edges which are in G, or Gp toget™
 
    
 
 
 
 
5
‘A Guide for Engineering Suitpve nema’ 3-27 Graph Theory
ages ob ed by joining each vertex of G t
ip te n 1 1 t each vertex of
wi qhus Gi + G2 i8 nothing but the graph G,UG, in which each
ee of G, is joined to each vertex of Gy by an edge,
x
 
 
eg If
Gy GS yen, Gen, |
$2  LNN
Gi +G, G,+G,
Fig. Q.25.5
 
Note : The sum N,, +N, of null graphs is nothing but the complete
bipartite graph Kin, n-
2) Product of Two Graphs : Let G, (Vj,E)) and Gp (V;,E>) be two
vertex disjoint graphs then the product of G, and G) is denoted by
GxG = G (V, E) is a graph whose vertex set is V = Vx V and two
edges (61, X) and (y, y2) are adjacent if x; = yy and xp is adjacent to
yz in Gy or Xy = yy and x; is adjacent to y; in G).
eg. If
 
 
Fig. 0.25.7
"Decomposition : A graph G is said to have been decomposed into
‘S° sbaraphs H and K if H UK = G and H OK = Null graph i. each
SS of G occurs either in H or in K but not in both. But vertices may
in both. In this context isolated vertices are not considered.
  
‘A Guide for EnginesDiscrete Mathematics
 
Fig. Q.25.8 /
G) Fusion of vertices : A pair of vertices a and eee Gam
said to be fused if a and b are replaced by a single n ‘ane pee Such
that every edge that was incident on either a or b or Fi ident
the new vertex c. The fusion of two vertices do not change the Humbe oj
edges but reduced number of vertices by 1.
eg.
e 2 8
i GS Graph after fusion | Graph after fusion
i of bande te and a
Fig. Q.25.9 Fig. 0.25.10
Q.26 Paths’ and circuits with examples,
1) Path: An alternating Sequence of vertices and edges
Vor e1~€2~€3— Vg —en Vy beginning are ending wit
vertices in which each edge is incident with the two vertices immediately
Preceding if and following it is called a path,
The vertices vy and v, are called
terminal vertices and vy, V3, ...
are called its interior vertices.
e.g. Let G be the following graph.
Following are some examples of path
i) Vi-e-v2-v; Fig. Q.26.4
a-1
 
3 37 V4~€4~V5 19 ~v3 ~e) - v5
ili) ve-es “V5 ~€19-V3 ~eg ~ v6
iv) vj ~e6-ve
a ae
Queene A Guide for Engineering Stipiserere Mathematles 3-29 Graph Theory
Graph Theory
here are $0 many paths between every distinct
h G. Depending upon the nature of terminal
wypes at path. :
{pith in which terminal vertices are equal is called a closed path. A
closed path is known as circuit. A path in which’ terminal vertices are
distinct, is called an open path.
pair of vertices of given
l vertices, there are two
in above examples, paths in (i) and (jv) are open paths and (ii) and
Gi ae closed paths.
4, Simple Path : A path in a graph G is said to be a simple path if
the edges do not repeat in the path. Vertices may be repeated.
eg. i) ¥p—€1—V¥2—€2 —V3 —e19 —Vs is a simple path.
 
vp #1 V2 ~€2 ~V3 C19 — V5 —€g ~Vy —€7—V@ is a simple path
in which v3 is repeated.
itl) v3—€3—~V4—€4-Vs—e\g-V3-eg—ve is a simple path in
which v3 is repeated. ‘
ivv3 —€3 V4 —€4 — V5 —€j9 —V3 ~€3 — vq is not a simple path as an
edge e3 is repeated.
2, Elementary Path : A path in a graph G is said to be elementary path
if vertices do not repeat in the path. Every elementary path is a simple
path,
eg.i) vy—e;-V9—e) —V3 is an elementary path.
ii)vy-e) ~vy —e) —V3 —eg —eg —€7 —V2 is not an elementary path.
But it is simple path.
3. Simple and Elementary Circuits : A closed path is known as
circuit,
A simple path which is closed is called a simple circuit of graph.
Ih other words, A circuit in a graph G is said to be simple circuit if all
edges of a circuit are distinct.
A circuit in a graph G is said to be elementary circuit if all vertices of a
circuit are distinct except the terminal vertices ie. the first and last
Vertices. The number of edges in any circuit (or path) is called the length
of the circuit (or path).
Th above graph G.
88 i) vy) ~v9 ep —vg ey —V5 C9 V2 -€1-V1 8 a cirouit
with e; repeated twice and v2 is also repeated twice.
 
 
 
 
Qeony ~ ‘A Guide for Engineering Students3-30 Graph
 
Discrete Mathematics
 
V2 —€7 ~V 6 ~ C6 ~
ii me V5 09 V2 £7 V6 ~&
ii) v) -ey -v2.—€2 V3 ~ 810 “9 nes
simple circuit but not elementary re as V2 is rep a 4
ili) v)-e)-v2-e7-Vo-e6~ YI S an elementary circuit,
Q.27 Define connected and disconnected graphs.
id to be connected graph if there exists...
Ans. 3 A graph G is sai Ne. A graph which i not connected jg at
between every pair of vertices.
the disconnected graph.
A disconnected graph consists of two or more parts called components 5
blocks if each of which is connected and there is no path between tio
vertices if they belong to different components.
Q.28 Explain edge and vertex connectivity.
Ans. : Edge Connectivity : A set of edges of a connected graph G
whose removal disconnects G is called a disconnecting set of G. A cutse;
is defined as a minimal disconnecting set ie. A minimal set of edges
whose removal from G gives a disconnected graph is called a cutset.
If a cutset of a graph contains only one -
edge, then that edge is called as an
isthmus or bridge. The number of edges
in the smallest cutset of G is called the
edge connectivity of G. It is denoted by 2.
(G).
e.g. Consider the following graph G.
Cutsets of G are as follows :
i) f{e4, 5, 6}, ii) (ey, €3, eg),
iii) {e;,e2}, *
A set {e;, 2, €3} is not a cutset because
its subset {e), e>} is a cutset. The edge
connectivity of graph G is 2. ie.
AG) =2.
 
Fig. Q.28.2
Consider the following graph Gy.
Graph Gy has edge connectivity 1 as G, - {e,} is a disconnected graph. “
e; is an isthmus or Bridge.
G — ep is also disconnected graph. -. €> is also isthmus.
Ay eu
 
A Guide for Engineering Stude"®
_piserete Mathematles -
. Graph Theory
2) Vertex Connectivity : The vertex c ivi .
connected graph G is defined as pemncetivity k(G) of a simple
smallest number of vertices whose removal . y,
disconnects the graph. ;
In graph G, the sets {v>, vs, v4}, ‘: e
(v2, V3» V4> V5}, {¥2, V3} disconnect
graph G. The smallest set is {v2, v3} v3 %
ek@=2 Fig. 0.28.3
1) A graph G is said to be k-connected if its vertex connectivity is k.
2)A graph G is said to be seperable graph if its vertex connectivity is
one.
3) A vertex v of a connected graph G is said to be cut vertex if G - {v}
is a disconnected graph.
4)k (G) $A(G) $8
ie. one connectivity < edge connectivity < minimum degree of a vertex
in G an
’@s [=]
n
where e = Number of edges in G. n = Number of vertices in G.
Q29 Explain shortest path algorithm and Dijkstra's algorithm.
ES [SPPU : May-05, 07, 14, 15, Dec.-06, 07, 12, 13, 14, 15]
each edge e of a graph a real
Ans. : Suppose there is associated to
ight of e, A weighted graph is a
number w (e). w (e) is called the wei
graph in which each edge has a weight. The weight of graph G is the
sun of weight of all edges of G. Weighted graph has many applications
in communication networks. Given @ railway network connecting several
sities, determine a shortest route between two cities.
We consider the weighted graph where the vertices are the towns, rail
Toads are the edges and the weight represent the distance between directly
linked cities, Therefore weights are non negative integers. The problem is
tivity two given cities. Of
all paths, find their
mies and i ficient. So we required different
edges) this may not be efficient. 1 if
gee aes problems, Cee slgorithm was found by Dijkshtra
59) and is known as Dijkshtra’s algorithm.
“A Guide for Engineering Students|
Dp. 3-32
Graph Theor,
A)Dijishue’s algocithm to find the shonest path fom the vertex a
vertex z of 2 graph G. Let G (wv, E) be 2 simple graph and a, z< Vy.
uppose is the label of Bi S length of
Si L(x) is the Ibel of the vertex which represents the 21
shortest pech from the vertex 2. Weight of an edge ey = (3, v,)
Consider the following steps :
 
 
Step 1: Let P be the set of those vertices which have permanent
and T = set of all vertices of G.
Sal @ = O0L@=<
P=0 adT
labels
   
eTadxeza
 
 
Step 2: Select the venex yin T which has the smallest label. This labe]
'S called the pemenent lebel of v. Also set P as PU {s} and T as
T- fs}.
If v =z then L (2) is the length of th:
Z and stop the procedure.
Step 3: ify Z, then revise the labels of the vertices of T. ie. The
Vertices which do not hav Permanent labels.
The new label of x in T is en by
L(x) = min {old L(x), Liv) = wy, x)}
where w (v, x) is the wei ht of the edge joining v and x. If there is no
edge joining v and x then tke w (v, x) =
 
shortest path from the Vertex a to
  
   
 
  
Step 4: Repect the steps 2
Examples :
Q.30 Use Dijkstra’
and z.
and 3 until z gets the permanent label.
's algorithm to find the shortest path between 2
FSISPPU : May-05, 14, 8 Marks, Dec.-06, 6 Matis!
 
Fig. Q.30.1piscrete Mathemats 3-33 Graph Theory
Ams. =
step 1+ P=, T={abode, fz}
L {a} = 0
L{x} =o, WxreT, x#a
Step 2+ v = a, the permanent label of a is 0
P = {a}, T= {b,c, de, f, z}
L {b} = min {old L (b), L (a) + w (a, b)}
= min {co , 0 + 22} = 22
‘L {c} = min {0 , 0 + 16} = 16
L {d} = min {, 0+ 8} =8
L {e} = min {0 , 0 + 00} = 00
L {f} = min (2, 0 + 2} = 00
L {2} = min {0, 0 + 0} = 00!
i L {4} = 8 is the minimum label.
Step3:  v = d, the permanent label of d is 8.
P = {ad}, T= {b,c ¢, fz}
L {b} = min {old L (b), L @) + w G, b)}
= min {22, 8 + 0} = 22
L {c} = min {16, 8 + 10} = 16
L {e} = min {e, 8+ o} =
L {f} = min {~, 8 + 6} = 14
L {2} = min {0, 8 +o} =
5 L {f} = 14 is the minimum label.
Step 4 ; v = f, the permanent label of f is 14.
P= fad, f}, T= {bc ¢ 2}
L {b} = min {old L (6), L(+ wb, H}
= min (22, 14 +7} =21
L {c} = min {16, 14 + 3} = 16
L {e} = min {oo, 14 + =} = 0
 
A Guide for Engineering Students
—-34
Discrete Mathematics 3
L {2} = min {e, 14+ 9 }= 23
“ L {c} = 16 is the minimum label.
Step 5: v = ¢, the permanent lable of c is 16.
P= {ad,f,c}, T= {bez}
L {b} = min {old L (b), L ( + w (£ b)}
= min (21, 16 + 20} = 21
L {e} = min {o, 16 + 6} = 22
L {2} = min (23, 16 + 10} = 23
. L {b} = 2 is the minimum label.
Step6: vy
 
= b, the permanent label of b is 21.
P= ad, fc, b}, T= fe, z}
L {} = min (old L ©, L &) + we, b)}
= min (22, 21 +2} = 22
L @} = min (23, 21 +2} = 23
* L {c} = 22 is the minimum label,
Step 7: v =e, thé permanent label of ¢ is 22.
P= fa, d, fc, be}, T= {2}
L@ = min fold L @,L ©) + woe, 2}
min’ {23, 22 + 4) = 23 which is the minimum label
Step 8: v = 2, the permanent label of 2 ig 23.
Hence the length of the shortest path from a to Z is 23,
The shortest path is adfe or adfbz,
  
  
 
 
 
Fig. Q.30.1 (a)
 
  
A Guide for EngineeringMathematics 3-35 Graph Theory
perce MOO A35__ Graph Theory
 
Fig. Q.30.1 (b)
Q31 Find the shortest path from a-z in the given graph using
Dijkstra's algorithm. IS [SPPU : May-07, Dec.-07, 15]
 
Fig. 0.31.1
Aus. : Step 1 :
StP=9, T= {a,b,c de, fz}
L {a} = 0
Li} =, vxeT, x#a
Stp2: v= a, the permanent label of a is 0.
P= {a}, T= {b,c,de £2}
1 } = min {old L (), L @ + wb}
= min {00,0 +2} =2
14) = min fo, 0+1}=1 L (a) = min {~,0+4}=4
LG} = min foo, 0+ 00) = eo L {f} = min (0, 0+ =} =o
LG) = min foo, 0 + 00} = o0s.L {c} = 1 is the minimum label.
 
‘A Guide for Engineering StudentsGraph Theory
Discrete Mathematles 3-36
 
Step 3 : v = c, the permanent label of c is 1.
P= {ac}, T= {b,d,e, f, z}
L {b) = min (2,1+2}=2  L {d} = min (4,1+2}=3
L {ec} = min (9, 1+5}=6  L {f} = min {0 1+7}=8
L {2} = min {o, | + 0} = 00+, L {b} = 2 is the minimum label,
Step 4: v= b, the permanent label of b is 2.
P= {acb}, T={de, fz}
HAG) = min 3,240)=3  L fe} = min 6,243} =5
L (8 = min (8,240) =8 L {2} = min {e, 2+ 09} =o
LL {@ =
3 is the minimum label.
Step 5 : v =, the permanent label of d is 3.
P= {ob,d), T= fe £2}
Le) =mng3+e-5 Ley
= min {8,3 + 4} =7
L {2} = min {00, 3 + 09} = coy, L {e}
= 5 is the minimum label,
Step 6: v =e, the Permanent label of e is 5,
P = {a,¢, b, d, e},
L {f} = min (7,5 +} =7
“LQ =
Step 7:
T
{6 2}
L {2} = min {e, 5+ 1} =6
6 is the minimum label,
Vv = gz, the Permanent label of z is 6.
Hence the length of shortest path from a to z is 6.
The shortest path is a b e Ze
    
Fig. Q.31.1 (a)
Q.32 Find the shortest path between a-z for the given graph : usin8
Dijkstra's algorithm.
SS'[SPPU : Dec.-12, 13, 14, May-15, 8 Mars]
AGuide for Encineering StuielFig. Q.32.
 
Step 1: Set P= ©, T = {a, b,c, dye, fg, z}
L{a}=0.
L(x} =o, VxeT, x#a
Step 2: v = a, the permanent label of a is 0.
 
P= {a}, T= {bode fg, z}
L {b} = min {old L (6), L (a) + w @, b)} = min {0+ 2} =2
L{c} = min {@,0+4}=4 —L {d} = min {0 +5} =
Life} = L {fh =L (g}=L Z =
+L {b} = 2 is the minimum label. The permanent label of b is 2.
Step3:v = b
P= {ab}, T={cde fg, 2}
L {c} = min {L (0), L (b) + w {b, c}} = min (4,2 +1) =3
L {4} = min {5,2 + oy =5 L {e} = min {0,2 +3} =5
L {f} = min (2+ 1} =3 L {g} = L {z=
* Lc}
Step 4: y
L {f} = 3 are the minimum labels.
0
corf
Vv = f, permanent label of f is 3.
P= {ab,f}, T= {c, deg, 2}
L(e} = min G,3 +2) =3 L {d) = min (5,3 +1} =4
Le) = min 6,342) =5 L {g} = min {3 +4} =7
1) = min (0,3 +7) = 10
“ (©) = 3 is the minimum label.
A Guide for Engineering StudentsGraph Theo,
+38
Discrete Mathematics 3
Step 5: v = ©, permanent label of c = 3.
P = {a,b, f,c}, T= {d,¢, g, 2}
“L (a) = min (4,342) =4 L {ce} = min 5,3 +o} =5
L {g} = min (7,3 + 0} =7 L {2} = min (10, 3 + 0} = q9
L {d} = 4 is the minimum label.
Step 6: v = d, permanent label of d= 4,
P=
{a, b, fc, d}, T= {e, g, 2}
L {e} = min (5, 4 + 29}
 
L {g} = min {7, 4 +2} =6
L @) = min (10,440) =10-, L {e} = 5 is the minimum
label.
Step 7: v = ¢, permanent label of ¢ is 5,
P=
{a,b fc, 4,6}, T= {g, 2}
L {8} = min (6,5 + 00} =6 L {2} = min {10,5 +3} =g
L {g} = 6 is the minimum label,
Step 8: v = g, permanent label of g is 6.
P= @bfodeg), T= {2}
L {z} = min {8, 6 + 1} = 7. which is the minimim label,
Step9:y =
2, permanent label of z is 7,
Hence the length of shortest path from a to z is 7.
The shortest path is a b f dgz
ne
 
9 i
Sent § J
Fig. 0.32.2
s
A Guide for Engineering Stude™secrete Mathemtatles 3-39
Di
3 Define Eulerian path ang circuit,
a A path is called an Euler
= exactly once in the path,
icuit of a graph which contains eve, ds
AoE Eulerian cirenit, TY edge of graph exactly once is
¢f
Graph Theory
an path if every edge of graph G
A graph which has an Eulerian circuit is called as Eu
lerian graph.
The problem of find Eulerian path is
the same as the Problem of drawing
© Paper and without Tetracing an
a network without lifting the pencil off th
edge:
Consider the following graphs :
   
Fig. Q.33.4
In graph G,, Eulerian circuit is e - €2-€3 -e4 -e5 -e
 
+G, is an Eulerian graph.
In graph G>, Eulerian circuit does not exist,
““G) is not Eulerian graph,
In graph G3, Eulerian path ise; >e, >€3; ey >e, >es but G;
does not have any Eulerian circuit.
“G3 is not Eulerian graph.
Sy is also not an Eulerian graph.
‘xistence of Eulerian paths and circuits in a graph depends upon the
“Eee Of vertices
heorem 4 :
An undirected graph possesses an Eulerian path iff it is
Th “ted and has either zero or two vertices of odd degree.
180)
Conn 2? An undirected graph possesses an Eulerian circuit iff it is
"ected and it
Orem
re)
its vertices are all of even degree. Laer!
SrA directed. graph possesses an Eulerian circuit iff it is
and incoming degree of every vertex is equal to its outgoing
 
A Guide for Engineering StudentsDiscrete Mathematics
 
Examples : onditions Kp,q the complete bipary,,
Find under what conditi
Q.34 a) Jerian circuit.
graph will have an Eul 2 TS |SPPU : Decoy
b) What is the complement of Kn, n?
i eS.
Ans. : a) In K,, , consider the following cas
Case 1: m=n and both m
and n are even :
In this case, degree of each
vertex is even, Hence by . a
theorem I, Kin will have | Fig, 0.34.4
an Eulerian ‘circuit, For
example Ky,» and Kg
Case 2: Ifm=n and m,n are odd : Re
In this case degree of each vertex is odd.
Hence Eulerian circuit will Not exist.
 
K.
Case 3: Ifm ¥n but m and n are even « t at
In this case, degree of each vertex is even. So Fig. Q.34.2
there exists an Eulerian circuit, ee
Case 4: Ifmen and either m is odd orn
is odd or both are odd : Then graph will have
Vertices of odd degree, i i
ig. Q.34.
does not exist. e.g. K3, 3, Fig. 34.3
) The complement of K,,
 
wn #5 the two graphs Ky, and Ky.
9.35 Define Hamiltonian graphs,
Ans. : In this Section, we introduce a class of Braphs which possess ¢
strinking similarity to Eulerian graphs.’
CS |SPPu : Dec.-04, 09, 10, 12, 13)
A circuit in a connected graph G
is called a Hamiltonian circuit if?
contains every vertex of G exactly 0;
nce,
A graph which has a Hamiltonian circuit is called a Hamiltonian Graph.
 
nS
A Guide for Engineering Stupcrete Mathematics 3-41 Graph Theory
consider the following graphs :
 
 
    
iy 2 3 g d x ane
| "
€
2
é 3 4 b a u go 2
6 G, & &
 
Fig. Q.35.1
In graph Gj, Hamiltonian circuit is 1-2-3-4-5-6-1
<.G, is a Hamiltonian graph.
In graph Gp, Hamiltonian path is a-b-c-d but Hamiltonian ‘circuit does not
exist.
=G, is not Hamiltonian graph.
In graph G3, Hamiltonian circuit is x-y-z-u-v-x
:.G; is Hamiltonian graph but it is not Eulerian.
In graph Gs, Hamiltonian path is a-b-c-d-e but Hamiltonian circuit does
not exist.
=-G, is not Hamiltonian but Eulerian graph.
Important theorems :
Theorem 1: Let G be a simple connected graph on n vertices. If the
sum of the degree of each pair of vertices in G is (n — 1) or large then
there exists a Hamiltonian path in G.
Theorem 2: If G (v, E) is a simple connected graph on n vertices and
n . . A
4()=3 sve V then G will contain a Hamiltonian circuit.
This condition is sufficient condition but not necessary.
Theorem 3: Let G (v, E) be a connected simple graph. If G has a
comlonian circuit then for every proper non empty subsets of v, the
: ponents in the graph G-S is less than or equal to the number of
ettices in g,
Theorem 4: a
Hamiltonian graph contains no cut vertices and hence i
2connected, grap! nce is
 
 
 
iconEy
= A Guide for Engineering Studentsoe
Graph 7;
iscrete Mathematics 3-42 heoy
Q.36 Show that the complete bipartite graph K,,,,, Js Hamilto,
for m= n and for m+, Ky,, is not Hamiltonian graph.
Ans. : In a complete bipartite graph Kn form =n ie. Ky 4, degreg
of each vertex is n.
Therefore d (v) 25 for all Ve v (Ky, n)
Mian
By theorem 2, G contains a Hamiltonian circuit.
Hence K,, , is a Hamiltonian graph. |
If m = n, Let Vi and V, be the Partitions of the vertex set of Kan Where
\vil=m and \v2|=n. Without loss of generality assume that m  3 and degree of each
vertex is
n-1l.Asn>3,
d(v) = n-1255VveV«,)
Therefore by theorem 2,
Hamiltonian graph.
Hamiltonian circuit contains all vertices of Braph and length of circuit s
the number of vertices present it. Hence in Ky, the length of t¥
Hamiltonian circuits in Ks-
Kn has a Hamiltonian circuit, Hence Ky is#
a!
Hamiltonian circuit is n and there are op
The complement of K,, is the null graph on n vertices,
Q.38 Find the Hamiltonian path and circuit in K4,3 ?
BS [SPPU : Dec-tl
 
ing suet
A Guide for Engineering St!piscrete, Mathematics ha
Ans? ‘The complete bipartite graph a
js given by
jn Ka,3» 4 #3 Hence it does not contain
amiltonian circuit. Here degree of each
vertex is either 3 or 4.
For x, y any two vertices in
Kq3 dx) + dy) = 7.1 = 6
Hence by theorem 1, the graph Ka has a
Hamiltonian path. It is given by x ay bzew.
9.39 Give an example of the following graphs
Graph Theory
 
 
Fig. Q.38.1
a) Eulerian but not Hamiltonian. b) Hamiltonian but not Eulerian.
¢) Eulerian as well as Hamiltonian. d) Neither Eulerian nor
Hamiltonian.
Ans. : a) Eulerian but not
Hamiltonian graph.
Eulerian circuit: abcdeca
No Hamiltonian circuit.
b) Hamiltonian but not
Eulerian
Hamiltonian circuit : abcdea
No Eulerian circuit because
d(b) =3,
© Eulerian and Hamiltonian
Braph,
Renittonian circuit :
Mba, 1.2.3-4-1
Biletion circuit :
a, 1-2.3.4.1
abeon
   
themattes wed Ph Theory
Jathem
~ ———
ad) Neither Bulerian nor Soe
Hamiltonian Y
No Hamiltonian cireuit and no 30.4 (c)
Bulerian circuit, Fig. 0.30.4 (¢)
Q.40 Determine, if the following
kraphs are having the Homittonian clrewit or path, Justify youy
answer, IS[BPPU ; Dacay
 
a,
Fig. Q.40.1
Ans. : In graph Gy, there are n = 7 vertices,
44) = 4 and all Temaining vertices jg 2.
So to draw Hamiltonian circuit, we have to visit vertex 4 twice. Which is
ROt possible in Hamiltonian path. G, has no Hamiltonian circuit.
Hamiltonian path is 1-2-3-4.5.6-7,
In graph G3,
In graph Gp, a@=$
 
35 xKE VG)
~. By theorem 2, 3 a Hamiltonian circuit
+. Hamiltonian circuit is 1-2-3-4-5-6-1,
Q.41 Which of the following have a Euler cir
cuit or path or
Hamiltonian cycle ? Write the path or circuit,
ISPSPPU : Dec.-10]
 
a
A Guide for Engineering StudeGraph Theory
   
Fig. Q.41.4
gas: In graph G,, degree of each vertex is an evenso3 an Eulerian
Gqeuit which is a-b-c-d-e
hn gaph G, there are 5 vertices and degree sum of every pair of vertices
is 4 or greater than 4. Hence there exists a Hamiltonian path in G, which
is given by a-b-c-d-e. But there is no any Hamiltonian circuit as vertex c
jg a vertex. In graph G2, degree of each vertex is 5 which is odd integer,
 
 
 
so here is no Eulerian path in Go, degree of each vertex is 5 > 5. Hence
ere exixts 2 Hamiltonian circuit which is given by a-b-c-d-a. .
in G;, Eulerian path is a-b-c-d-e-b No Eulerian circuit as d (a) = 1.
Esniltonian path is a-b-c-d-e.
‘No Hamiltonian cyle because b is a cut vertex.
3 Travelling Salesman Problem (TSP)
242 Define the Travelling Salesman Problem (TSP).
Ans. : A salesman is required to travel a number of cities during a tip.
Given the distance among cities, in what order should he travel so that he
taels as minimum distance as possible 2 This is known as Travelling
Slesman Problem (TSP).
1 tems of graph theory, the TSP is to a Hamiltonian circuit with the
ae weight. In the case of K,, the problem can be
ed theoretically by listing all the possible
3 tonian circuits and select one which has least
| .Beht But this method is highly impractical for the
| agh, SaPhs. In fact no efficient algorithm is there 10
rmanglSP Tt is. therefore desirable 10 obisin © Fig, a.42.4
ly good but not an optimal solution.
 
 
E
E
k
 
‘A Guide for Engineering StudentsBig Criph 7,
Math
h is to first find 2 Hari i oe aoe %
chr Haniionan ese of Teser eg. The sple etis
:
follows :
Let C be the Hamiltonian circuit of a graph G.
Let further uv and xy be two no-adjacent edges of C such that ay
vertices u, v, x and y occur in that order in C.
If ux and vy are edges such that v Untwywye-w (uy) + wy (xy
then replace the edges uv and xy in (by and vy). The new
would still be Hamiltonian cycle and w (C) < w (C). This process ¢
continued until one gets a Teasonably good Hamiltonian cycle,
Q.43 Explain nearest neighbour method.
Ans. : In this method, we Start with any arbitrary vertex an
vertex which is nearest to it, Continuing this way end coming back te
starting vertex by travelling through all the vertices exactly once,
get Hamiltonian cycle or circu; it.
Consider the following steps to find Hamiltonian cycle by
Step 1: Start with any arbitrary vertex Say V1, choose the v:
to v; to form an initial path of one edge. Construct this path
different vertices as described in step 2.
Step 2; Let v,, be the latest vertex that was added to
the vertex v,._ 1 Closest tov. from all vertices that ar.
and add this vertex to the path. Select those Vettices which
@ circuit in this stage.
Step 3: Repeat step (2) till all the vertices of G are inched in
path.
Step 4: Lastly form @ circuit by adding the edge comnecting to
the last added vertex, i" a
* The circuit obtained using
required Hamiltonian circuit.
Note : If we start with an arbitrary vertex in TSP then we may or 2
not minimum Hamiltonian circuit, But if we siart with a vertex wie!
incident edge has the minimum weight in
minimum Hamiltonian Circuit as compared wit
For more details see Q.44,
 
  
  
 
  
  
 
 
 
 
the nearest Neighbour method will be 2
 
 
Jaa3-47
 
Graph Theory
 
examples ¢
gas Use nearest neighbour method to find the Hamiltonian circuit
garting from 8 in the following graph. Find its weight,
BSP[SPPU : Dec.-15]
  
   
Fig. Q.44.1
Ans.: Step 1: Let a be the starting r “3
vertex, Vertex a is adjacent to b, c, d, x
¢ But minimum path is {a, d} which
is the initial path.
 
 
Step 2: There are three vertices
adjacent to d. but closest one is C
: The path is {a, d, c}.
 
a
Step 3: There are 4 vertices adjacent
‘0 c. but closest is e
* The path is {a, d, c, e}.
    
Fig. 0.44.1 (c)
A Guide for Engineering Students38
 
7
: e.
ices adjacent t0
are 4 vertices
4: There
josest is b
The path i (2&6 6B)
 
Step 5: Here are all vertices are corered
so to complete Hamiltonian an circuit there
should be a path from b to a.
-. Hamiltonian circuit is {a, d, c, e, b, a}
Weight of the Hamiltonian circuit = 40.
 
Fig. Q.44.1 (e)
4: Planer Graph
245 Explain planar graphs. pa>igppy ; May-06, Dec.-08, 09, 10, 13]
Ans. : Definition : A graph is said to be planar graph if it can be drat
on a plane such that no edges intersect or cross in a point other than the!
end vertices.
A graph G is said to be non-planar if it is not possible to draw graph be
without crossing.
1. Regions : A plane representation of a graph divides the plane inte
Parts or regions. They are also known as faces or windows or meshes.
A region or face is characterised by the set edges forming it’s boundary:
A region is said to be finite if it’s area is finite, A region is said to
infinite or unbounded if it’s area is infinite. Every planer graph has ®
infinite region.
: .
A Guide for Engineering Stte™Mathematics 3-49 Graph Theory
 
e er the graph given below :
 
Fig. 0.45.1
qhe graph G has 6 regions, 7 vertices and 11 edges. Region R; is an
‘pfnte region known as exterior region. We have
R> = {1, 2,3} = Region bounded by e}, e2, €3
R3 = {3,€4) 5,6}
Ry = {€6,¢7}, Re = {e109}.
Iris observed that n= 7,e = 11,r=6
ntr-2=7+6-2=ll=e
Now let us define Euler's formula.
046 State and prove Euler's formula.
 
 
Aus: Statement : For any connected planar graph G, with v number of
vertices, e number of edges and r number of regions
 
v-e+r=2
 
 
 
ove+r-2=e
Proof : Let G be a connected planar graph with v vertices, e edges and
T regions. We shall prove the theorem by induction on e.
Sep 1: For e = 0, we get v 1, Thus
Vretr=1-O0+1=2
Hence result is true for ¢ = 0
 
Bt
de Let e > 1, Assume that the result is true for all connected
Sraphs with less than ¢ edges. Let G be a graph with v vertices,
“ts and r regions,
Stay
% ae Case 1: If G has a pendent vertex say x then G — {x} is a
led graph with v — 1 vertices, e - 1 edges and r regions.
A Guide for Engineering StudentsO™
Graph
= 50 Ph Theo
Discrete Mathematics 2 Sy
Discrete Mathematies 00
So by induction hypothesis
W-N)-@-Y)+rs 2
veetrs2
Case 2: If G has no pendent vertex the G is a ae zee With
circuit. Let ¢, be the edge of a circuit in G. Then G- ae enn
graph with v vertices, e - 1 edges and r — | regions {I VE dye
from a circuit, then it reduces region by 1}.
By induction hypothesis
v-(e-1)+(r-1) = 2
= v-e+r=2
‘Thus by the principle of mathematical induction the result is true for alle,
2.47 If G (V, E) is a simple connected planar graph with v vertice
and e edges then e <3v 6,
Ans. : Proof : Give that, G is a simple planar graph, so each region of
G is bounded by three or more edges,
If G has r number of re
gions then the total number of edges in G is
e234.
Also cach edge of G is included in exactly two regions of G. therefore
2e 234
= %s,
Substitute these values in Euler's theorem, we get
Vre+r=2
2e
~e+ >
v-e 7 22
3v-e 26
es
3v ~ 6 Hence the proof,
Corollary 2: Prove that, K.
graph on 5 vertices) is not ph
Proof: The complete graph on $ vertices
Ks is given below :
5 (the complete
lanar.
Ks has 5 vertices and 10 edges. ie, v= 5
and € = 10,
 
 
nf
A Guide for Engineering Stdpiserete Mathematics 3-51 Graph Theory’
now 3v-6 = 15-6 =9
py corollary 1, & <$3v-6
10. <9 which is impossible,
Therefore Ks is not planar graph.
Ks is the smallest planar graph with respect to number of vertices,
Consider the graph K3 5 |
Here v = 6,e=9, :
3v-6 = 18-6=12>9=e
ie e S$ 3V-6
 
But K;,; is not a planar graph.
«The graph K3,3 is the smallest non planar graph with respect to number
of edges.
The graph Ks is called the Kuratowski's first graph and K3,3 is called
te Kuratowski's second graph.
'n 1930, Kuratowski gave a necessary and sufficient condition for a graph
‘0 be planar,
Kuratowski's Theorem : A-graph G is a planar if G does not contain
“ty subgraph that is isomorphic to within vertices of degree two to either
Ks orks 5
Two graphs are said to be isomorphic to within vertices of degree two if
‘hey are isomorphic or they can be reduced to isomorphic graphs by
"Prated insertion of vertices of degree 2 or by merging the edges which
V€ exactly one common vertex of degree 2.
For example the following graph are isomorphic to within vertices of
¢ 2. (Homeomorphic)
 
A Guide for Engineering Students
SAGraph Ty,
te
Discrete Mathematics ny
moe oN
Insenionofv
G
 
 
Dalotion of x from ¢
Insertion schvatiene erating aha mS,
 
Fig. 0.47.3
 
Q.48 Draw a planar representation of graphs given below if possipi.
SS>[SPPU : May-06, Deg, 09)
 
Fig. Q.48.1
Ans. : The Planar een) ws 6 and Gai is as s follows :
 
Fig. Q.48.1 (a)
Q.49 Identify whether the Braphs are planar or not Justify ?
IS |SPPU ; Dect
  
   
(i)
 
Fig. Q.49.4
 
=
A Guide for Engineerit8fic a
piserete Mathematles 3-53 Grape Tadary
ans )
 
Fig. Q.49.1 (a)
Given graph is planar graph,
ii) Given graph is isomorphic to K3,3 x =
.. Given graph is not planar. Dex]
 
Fig. Q.49.1 (c)
*-Given graph is planar.
250 Show that in a connected planar graph with 6 vertices, 12
edges each of region is bounded by 3 edges. p@>[SPPU : Dec.-10, 13]
Ans, : According to Eulers theorem for planar graphs.
V-e+tr=2
Here v= 6,e=12
S-trs251=8 / ; ,
es know that, each edge contributed twice in a regions we have 12
Res,3-54
_Daserete Mathematics
Grape Pre,
24 edges are distributed among § regions.
So 12N2=2
= 3 edges for each region,
So each region is bounded by 3 edges.
Q.5t Prove that X5,3 is not planar graph.
has 6 vertices and 9 ed
each region has at le;
a
)
 
    
ges. Suppose
is Planar, th
ast
 
 
4 edges because it ig dite
contains no tiangles. Each edge lies on boundary of two regions
:
Therefore, 2e > (the numberof edges in the jt Tegion)
i=l 7
2e > ar
2e 24 -y)
=. © s2-4 Bu e=S9andy=6
eB 9S 12-458 which is impossible.
is not planar graph.
     
 
Graph Colouring
Q.52 Explain coloring of graphs.
iz
Ans. : The coloring of all Vertices of
adjacent vertices have different colors is ¢
coloring or simply a coloring of graphs,
A graph G is said to be properly colored Staph if each vertex of GS
colored according to a Proper coloring.
“8 1) Consider the following graphs with Proper coloring
 
2 connected ore
alled a Proper col
  
 
Gy
Fig. Q.52.4
 
A Guide for Engineerin.
a‘Mathematics 3258
piscrete “Graph Theory
1 chromatic Number of Graph : The chromatic number of a graph G
is denoted by X(G) and defined as the minimum number of colors
required to color the vertices of G so that the adjacent vertices get
different colors.
‘A graph G is said to be K-colorable if all vertices of G can be properly
colored using at most K different colors, Obviously, a K-colorable graph
js K+ colorable.
If G is k-colorable then X (G) 2 vertices,
Theorem 1: 4 graph G is a tree iff there exists a unique path between
every distinct pair of vertices of G.
. is a connected and without Circuits,
We know that a circuit forms two or more paths. But G has NO Circuit 59
N every pair of vertices,
Conversely assume that there is a unique path between every pair of
Wertices in G. This implies that G is a connected and G has no cycles. ie,
G is 2 connected acyclic graph.
Therefore G is a tree,
Theorem 2: 4 graph G on n vertices is a tree iff G is connected and
has exactly nj edges.
Proof : Suppose graph G is a tee. Therefore’ is a connected and acycli
geph. .
It is sufficient to Prove that G has n — 1 edges only.
We can prove this by induction principle on n,
For n = |, the result is obvious
Let n > 1, consider G~e’ for any ¢’ € E(G)
As G is a tree, e’ is an isthmus of G,
~G-eisa disconnected graph with tw
Now G, and G
subgraph of G,
‘© components say G, and G2:
a Gy
‘2 are connected and a cyclic graphs as G, and
 
6
su
A Guide for Engineerin®
4yr
‘Mathematics 3-59 Graph Theory
 
tet Gy bas vertices and mj, edges‘and G2 has n> vertices and mz
edges
induction principle
. By
m = 1-1 and m) =n2-1
erefore the number of edges in G is given by
e = (e+e) +1 = ny-l+ng 141
= nytny-1
e=n-1 Co n= ny+n2)
Heace G has n — 1 edges only.
coaversely assume that G is connected graph and has exactly n - 1
edges.
Cisim : Prove that G is a tree,
Iris suffices to prove that G is noncyclic graph.
Seppose G contains a cycle C.
Let P denote the number of vertices in C
. The number of edges in C = P
4sG is connected graph, the remaining n — P vertices must be connected
vertices in C. To connect each vertex of G which is not in C, we
required n - P edges as each edge of G can connect only one vertex to
te vertices in C.
Hence the total number of edges in G is given by
¢ = (n—P) +P =n= e =n which is contradiction
+ Ghas n~1 edges only.
Thus G is a tree.
Theorem 3: Let G be a graph with n vertices and m edges. If any of
fe following is true then all are true.
) Gisa tee,
") Gis connected and m =n — 1
4) G is acyclic graph and m =n - 1
1) Every edge of G is an isthmus and G is connected.
There is exactly one path between every pair of vertices in G.
    
‘A Guide forGraph
tes 3-60 ee Thy
Discrete Mathemat
eorem non trivial tree contains at least two vertices of q,
Th 4 ivial tree least
A
i ices)
1, (ie. pendent vertics ;
Pr i: Let G be a tree with n vertices,
rool :
: diet; vxeV (G)
By handshaking lemma airs
; Saixy = 2 x Number of edges in G = 2(n-1)
so G is connected.
xe V(G)
Suppose there is no vertex of degree 1.
Then 2ns Sd(x) = 2n-2
xe V(G)
he. 2n $2n-2 = nSn~1 which is impossible.
Thus there is at least one vertex of degree 1.
By a similar argument there is one mote vertex of degree 1.
Hence every tree has at least two pendent vertices,
Q55 Draw all non isomorphic trees on 4 and 5 vertices,
Ans. :
2) Non isomorphic trees on “oN” “~~
4 vertices Moneta :
5) Non isomorphic trees on 5 vertices
At
Q56 Under what conditions trees are the complete bipartite graphs.
Ans. : Suppose T is a tree which is the complete bipartite graph.
Let Te Kin
* T has m +n vertices and (m+n~-
But ky, has mn number
‘Therefore
1) edges,
T of edges,
m= m+n- 1
m-m-n+] = 9
(m-1)@~1) = 9
i?
A Guide for Engineering"ithematics 3-61
 
Mal Graph Theory
m= lorn=1
2
ee m = 1 and anyn or n= 1 and anym
tice Kin and K,,,; are the only complete bipartite graphs. These are
jnown as star graphs.
qhus Tis a star graph,
57 a) Is it possible to draw a tree with 10 vertices which has
vertices either of degree 1 or 3 2
Ifpossible draw tree. Is it possible to draw same type of tree with 13
vertices ?
) For which values of n (number of vertices), such type of tree
exist 7
Ans. : a) Given that tree T has 10 vertices so it must have 9 edges,
Let x and y be the number of vertices of degree 1 and 3 in T
respectively.
2 x+y = 10 ws (QS7.1)
By handshaking lemma
DY d(v) = 2Number of edges in T)
Vev)
x+3y =2x9=18
x+3y = 18 w (Q57.29
Solving equations (Q.57.1) and (Q.57.2) we get
y=4 and’ x=6
Therefore there are 6 vertices of degree 1 and 4 vertices of degree 3.
Such type of graph is given below.
Now consider a tree with 13 vertices and 12 edges.
BY using similar theory, we get (Q57.3)
xty = 13 -(Q51.
we (Q57.4
ee (9574)
 
;Discrete Mathematics soe
Solving (Q573) and (Q57.4), we get ly = l=
| which is impossible.
Therefore it is not possible to draw such type of tree.
b) Let T be a tee with n vertices.
Let x and y be the number of vertices of degree 1 end 3 5. |
 
 
  
respectively. T has
n— 1 edges.
Therefore +
; x n ~~ Qs75
By handshaking lemma x+3y = %n-1)
/ _ Bt3y = 2n-2 ~ (Q574
Equati ion (Q.57.6) — Equation (Q.57.5) = 2y = 2n=2_p
2y =n-2
= = B-2_n
y aoa!
=
er
x=n-y Bvgtlasel
1 These should be non negative integers.
= dition on even number of vertices.
26 13,76, 7, ... Thy are such type of trees.
 
Case 2: If n js ai i
odd then 5 is not an integer there x and y are not ©
integer.
Hence the tequired tree does not exist on odd number of vertices.
A Guide for Engineeringpiscrete. Mathematics 3-63 Graph Theory
0.58 Explain centre of a tree,
‘Ans.: We know that the distance between two vertices in a connected
graph ive. is a length of the shortest path between that vertices, Before
defining centre of a tree first find the distance between vertices of a tree
which is defined as follows :
Eccentricity of a Vertex
Let G be a connected graph G and ve V(G). The eccentricity of a vertex
y is denoted by E(v) or e(v) and defined as the distance from v to the
vertex farthest from v in G.
ie. E(v) or e(v) = max d(v, v;)/Wv; € (G)}
Centre of a Graph
A vertex in a graph G with minimum eccentricity is called a centre of G
and it's eccentricity is called as radius of G. It is denoted by 1(G).
Q.59 Prove that every tree has either one or two centres.
Ans, : . ,
Proof: Let T be a tree. Then e(v) for a vertex v is at a vertex farthest
from v. As T is a tree, it is attained at a pendent vertex.
We know that every non trivial tree has at least two pendent vertices,
Now, delete all pendent vertices from G, we get new graph G’ which is
also.a tree. Moreover as one edge at each pendent vertex is removed, the
Sccentricity of any vertex will be reduced by one. Therefore centres of G
Will still remain centres of G’, We continue the process with G’ until we
ative at Kj or Ky. K3 has two centres and K, has one centre. Hence
the proof,
60 Define cut vertex of a tree.
ANS: We know that the vertex v whose removal from a connected
Saph G, disconnects the graph is called as cut vertex of G.
any tree all vertices except pendent vertices are cut vertices.Q.61 Define rooted tree and binary tree. ee Pee.gy
i directed
yelic, directed graph is called a tree,
Ans. : A connected acyclic, directe a be a directed tree it f°!
other words, a directed graph is sai ee Will
become a tree when the directions of the edges are ignored.
Q.62 Define rooted tree, : |
Ans. : A directed tree is called a rooted tree if there 1S exactly oy
Vertex whose incoming degree is zero and the incoming degrees oy
other vertices are one,
The vertex with incoming degree 0 is called the root of the Footed tree
The vertex whose outgoing degree is zero is called leaf oF terminal noje
A vertex whose Outgoing and incoming degrees are non zero is called
branch note or an internal node, Consider the following example,
Q.63 Define level and height of a tree,
Aus. : A vertex v in a rooted tree is said to be at level n if there is ¢
path of length n from the Toot to the vertex v,
The height of the tree is the
maximum of the levels of its
vertices.
Example
In the given graph G .... ais a
Toot
Vertices b, c, d are at level 1
Vertices e, f, & h and i are at
level 2
 
Vertices j,k, 1 and m are at
level 3
 
Vertices n, 0 and P are at level 4
Vertices q and r are at level 5
The maximum level is 5, Therefore the height of tree is 5.
 
a
4 Guide for Engineers‘Mathematics
 
3-65
 
Graph Theory
for rooted tree : In a rooted tree
< for
Rul
 
f the level of a vertes
i level of vertex v
V< Father}
is greater than
’ then u is below y.
f vertex ui 15 Below vertex v anid there is
If vertex
edge from v to u then uy is
an edg\
 
id)
Said to be
of v (or child of vy ang y is said to
ai the father of u (or parent of uy i.e.
 
Two vertices u and v are said to be
. brothers if they are the sons of the same Vertex.
rothers
) A leaf is a vertex without children,
m 4
) Ep=tavi.va.vs
 
 
   
~~+level 4
evel 2
~Hevel 3
 
From
is father of
Pande lie at level 1. b and c are sons of root a i.e. a
and c lie at level 1. ,
Band c and b and c are brothers.
™) 0 has three sons d, e, f
“P is a father of d, e, £
 
tact
™) ehas two sons i and j
has only one son k
|
SS
 
ering Students
‘A Guide for Engineering Sio 3-88
bro
i
 
¥) i bas no soa j bas two sons J and m. So K and J are
ome son nn has no brother as nis a leaf.
ars a a as eae ee
BR imnant soon
64 Define Subtrees.
Ass : Let T be a rooted mee and xe V(TL
ondary NA NAT decedins is cle Be subi ey
rooted at x.
The subaee corresponding to the ode i i
somspoading fo any ther ode & ealled a proer ates PE
Q&S Define M-ary trees.
aoe gt EB sth even SMsvior node Bas at most m soos
SENSE ES 5 Sold to be regular mary tree o: fll ary i
branch node has enzctly m sons, . Semess
Consider the following examples.
 
  
Beary tree 2-arytree
2 sary tree
 
66 A regular m-ary tree with p interior nodes has mp + 1 nodes
at all. TS ISPPU : Decl
Ans. :
Proof : Let T be a regular m-ary tree with n vertices. Out of n verti
there are p interior vertices or branch nodes,
Therefore there are t = n — P number of sons or leaves in T.
But given graph is regular and p interior nodes.
So the regular m-ary tree will have mp sons.
— ae sat
A Guide for Engineeringeas
jg n0t son.
is
re ave tree has
total (mp + 1) number of vertices
 
mpt+1
 
gat
4 ppl pinary tree. E[SPPU Due, May, 1
ye ary tee is known as binary tree if every branch node has
oot? sons. _. :
pate words, @ tree 1m which there is exactly one vertex of degree 2
pies of the remaining vertices of degree or three, is called a binary
wt
iy tee js called as regular binary tree or full binary tree if
cay branch node has exactly 2 sons or zero sori.
following examples
oe)
 
ii) iy)
   
usd bug
Binary tree Full binary tree \Binary tree Not binary tree
ae tres, instead of referring the first or second subtree of a branch
fa use to the left subtree or tight subtree of the node.
dy a binary tree traversal with examples.
Say gate means visiting or processing all the no
ni et traversal isthe visiting of each node of, @
hy Some sequence.
ae
te "80 types of traversing binary me
Hp
ath
tig traversal ; In this method,
a Proceeds from the root or the
descendent of the first child
Guide for Engineering Students
A
des of a tree. A
tree only onceDiscrete
 
There are three types
A) Pro order traversal + In
is traversal first,
root node is
eft subtree and then the
right subtree as shown below:
B) Post order traversal : If processes
first the left subtree then the right non
subtree and then at the last root of the ,
tree as shown below. i
| ;
C) In order traversal: It processes i 7}
the left subtree first then the root and iG CY 215)
at the last right subtree. L-ubires 3 |
. = subtree
The prefix "in" means root is processed
in between the subtrees. It is shown as below.
 
 
 
   
Consider the following binary tree.
 
    
  
 
 
  
Reet
Root Leh subtree
ii
) Post order traversal
A Guide for Enginee™sport Mathematics 3-69
‘iy order traversal
i
Graph Theory.
   
   
Left subtree Root
 
2) Breadth first traversal: In this traversal, the Processing proceeds
horizontally from the root of all of its children, then to its childre's
children and so on until all the nodes have been processed, That is first
write node of zero level, then all nodes of level 1 then level 2 and so on,
. The breadth first process for the above binary is shown below.
 
 
: ABECDE!
  
Root Level 4 Level 2
 
Q69 Explain conversion of general tree to binary tree.
Ans.: Let us explain the method to convert general tree to binary tree
with the help of the following example.
 
Consider the following steps oes
ee 2) To convert it into binary tree,
© fitst identify the branch from the
Parent to its first or left most child. QO MQ |
se branches from each parent i i
become left pointers in the binary tree. © OOOODiscrete Mathematics
Step 2) Connect sibling,
starting with the left
most or first child, using
8 branch for each sibling
to its right sibling. They
are the right pointers in
Step 3) Now remove all unneeded
‘ranches from the Parent to
children. Therefore remove
ASEB=3p, AF, F5H, Fol
We get the following Tequired binary
tree.
itsyr
sshematles soa
eee Si Fiery
i Graph Theory
The steps involve to convert the given tree j
¢ into bina
ry tree are as
ce
 
Binary tree
ay Co,
Ostruy
us it te the labeled tree of the following ig algebraic expression
(19 + (xx) [@[SPPU : May-10]
 
typ! The ex
oy Pression tree for the given algebraic expression is given
Guide for Engineering Students
AQ.72 Represent
> binary tree.
An
the expression ((a+5)T 4)*(6-(5+9)) using ;
ES ISPPU : Mayq
's. : The binary tree for the given expression is as follows :
 
Q.73 Write and evaluate the expression tree shown below.
; }
IS {SPPU : Deo
7 sd
‘A Guide for Engineering S™«ae Mathematics ahs
en 5 Graph Theory
  
‘Ans. : The algebraic expression of the given binary tree is
(28(5)+ 10/5)) - (7)* (12/4) — (2)
It's value is 2* (5+ 2)—(7*(3-1))= 14-7= 14
Q74 Find the preorder, postorder and inorder traversal of the
following tree. 1S [SPPU : May-10]
 
Ans, : i) Preorder traversal
   
“A Guide for Engineering Students3-4 rap,
Discrete Mathematics 2,
mbdbfktpwv .
ii) Postorder traversal
 
ie. bfdkhpvwtm
iii) Inorder traversal
  
ie. bdfhkmptvw
Out of which 2" are leaves,
Hence internal vertices = (2h! _1)_ 9h
= 2-1-1
= 2h_y
Q.75 Find the maximum of Possible. height of a binary. tree with 3
vertices and draw graph. :
Ans, :
Wehave n= 13
The maximum possible height of the é
binary tree is i
n-1
a.
 
The Tequired graph as shown in
Fig. Q.75.1,
 
Fig. @.78-1
Q.76 Defi
me prefix code and binary search trees. may” i
IS [SPPU 2, 14, 16
      
as
nt
A Guide for Enelsscrete Mathematics 327:
piscrete s Graph Theory
‘Ans. ? | :
1) Aset of sequences is said to be a Prefix cod
le if no sequences in the
set is a prefix of another sequence in the set,
For example the set {000, 001, 01, i0, 1
sequence of symbols is present at the beginning o}
these sequence are distinct,
is a prefix code as no
f another sequences. All
The set {1, 00, 000, 0001} is not a prefix code becau
use the sequence
00 is the prefix of the sequences 000 and 0001, :
A question comes in everyone's mind "How to construct prefix code to a
full binary trees?"
We can solve this question by adding some flavours and binary codes to
2 full binary trees.
For a given full binary tree, we label the two branches incident from each
internal node with 0 and 1. For the left branch we assign 0 and for the
tight branch we assign 1 of every rooted tree or subtree. Consider the
following example of full binary tree.
In given figure root a has 2 sons. Left
som is ab and right is af, so assign 0
to ab and 1 to af. Now b has two
sons. Assign 0 to left son be and | to
Tight son bk. Similarly assign 0 or 1
to every edge of a tree.
Lefside (root) Rightside
 
Now assign to each leaf, a sequence
of O's and I's which is the sequence
Of labels of the edges in the path from the root to the leaf.
For example, d is a leaf and the path a to d is
4~b-—c~d and their respective labels are 0 - 0
°F d is 00.
0 so the prefix code
 
For leaf e, path is a — b - ¢ —€ and labels 0-0-1
* The prefix code of e is 001
Thus the prefix code of above tree is {
Reese “1 Guide for Engineering Students
000, 001, Ol, 10, 110, 111}.