Graph Theory
Graph:
A graph | i a pan of sels(vE) whee,v "9 4
set of vertices and © 18 @ set of edges «
The pst commen yepreseritation of a graph % @
aeagram with vertices anol edges
Cy The werlices (or) nodes are vepresented as points
Oo omall evelog
@) Eciges are represented as line segments cor) curve
joining of its endl vertices
Mo @r a
eg: Woe,
us
ee ee we en
es €& Us
ae ve 83
fig: Representation of a graph with vertices
and edges
7 Ihe first graph consists of 5 vertices and 5 edors
Ao,
ve tu, 2%, Var Vey ard E> Tei, €2,e3, ey, es}
In the second graph. there are y vertices and &
edges: 50,
ve 1 V2,V5,Vq Y and & fer, er, e3 e405, 6 y
There ave 2 types of graphs They av
ty Directed graph
() Unelirected graph
Scanned with CamScanner|
W Directed graph:
The graph in which the elements of The edge eet
Mie onclered pats of vertices 15 called directed graph
or digraph ,
Here, order pan(vi, Vj) denotes an edge fron wenter
Ve to verter vj+ (Vj, vi) denotes an edge from vy foi
directed graph
Hlere in this graph,” elements eclge, set ove ordered
port of vertites (5,
e,- (da) — e= (ac)
€2 = (aib) e5 + (dib)
ea = (cb)
Undiected graph
A graph in which the elements of the ane
are urprdered pai of vertices (6 called undinert™
graph (non- divected)
Hlere (vi, vj) denotes an edge
Q
pen betaeen Vi,“
ej a
es Not
ce
undirected graph
ah
Scanned with CamScannerThen evs tardy eur tod y
fos taby — es= tody
eo = tciby :
* Null graph
A graph ta which qumber edges ig zero 'S
rf number ef edg
called as Nlull graph
Sw
"5 oy
Noll graph with y vertices and zero edges
* Self loop: .
An edge joining a verte to itself 15 called as
Setflocp
eg; ye
ea,
we MS
A graph with a Selfleop
Tn this graph, edge ¢ i9 o Self loop
% orale! oy multiple edges .
Tn a graph it may be possible te have moe
than one edge wilh a single pair of vertices, such
edges are called porate! edges
= ae
e a bee
c esd
Tn this example €4, 65, 6 ave parallel eclges
Scanned with CamScanner* Simple graph:
AL graph which contains neither selfleop mor paralle
edges i6 called a Simple graph
eg “oa oy
Ns eH
* Complete graph:
“A simple graph in which thee (5 exactly one edep
between each parr of distinct vertices i8 called a
complete graph. Tt is denoted by ‘kn’.
Va 2 Va
The no of edges in completegraph with vertices
= n(net)
= .
eg: find the total number of edges pe Complete 9x0ph
with 50 vertices i .
The total number of edges of a complete graph wilh
50 vertices > s0(50-i) - 1n25
2
» = Muttigraph :
A graph which contain parallel edges & colled
multigraph
eg: wa oy
er
en Y os
y
Scanned with CamScannerx order and size of @ graph:
The number Of vertices in a giaph 4 is eailted order
Of the graph -
Ft is denoted by |vea)|
The number of eclges in a graph 4 & called Size
of the guaph ond Tt es denoted by [EC]
& MI e NB
e hn
ea 5 le:
va 3 va
order of the graph 1 Ivca] = 4
Sze Of the graph 1s 1e@)| -5
+ Degree of vestex in a Non-divected graph and
degree sequence:
The deque of a voter v of a graph G 15 the
number of edges of @, which are incident with v-
The oleqvee of a weer v in & graph @ i denoted by
deg,(v)
Isolated vertex =
A vertex of degree zev0 18 Called a (Solated vertex
Pendant vertex :
A vertex with degree one i$ called pendant verter:
Odd verter :
A verter with odd degree i$ called ocle vertex
Even vertex :
A vertex of even degree San even vertet
NOTE:
CE a of sifting # cme I
Scanned with CamScannerYW, var Wy--Vn ore the vertices of §, then the
Sequence tai, de,dg---doy where ci= degg(vt) #8 the
clegree sequence G4 ‘
eq
degree of verter Y= 1
degree of verter va: 5
degree of verted v3 > 5
dlepee of verter w= 5
degree Ff vertex V5 = 4
degree of vertex oH
Begree sequence of graph i given ey 115/545, 414F
+ Degee of vertex in a directed graph
HAGE umber of ecigee cncident to a verler o called
Inclegree F the vertex fora digraph
Outclegree He
The number of edges fncident from WH es called
cutdlegee for a dtqraph:
by
The éndegree of verter ¥ in a groph 4 te dlenated &
ig denoted &Y
The outolewee of verter v ina graph a ”
alegg-Cv)
Scanned with CamScannerThe decree of a verter is determined by counting
each lop inciolent on it twice and each ether eclge
once:
The minimum of all the degrees of the vertices of O
graph G ts denoted by $4):
The maximum of all the degrees of the vertices of
graph G 16 clenoted by Aq)”
eg:
w NW , V3
ve
degtv) = 4 degtvy) = 6
deg (va) 26 deg(vs)+ 6
clegtvs) = I oa du
ayy cour dé
@ oe hs
d Cc
Degiay = 3 Pegta=!
beq'(b)= | Deqtb) = 2
Degtcc) * > Deg(c)>'
Degtcdy= 1 Deg (a= 3 :
Scanned with CamScanner*
*
Weighted graph:
A graph in which weights ave asstqned to every
edge te called a weighted graph
hy ”
pos
s v3
Le
Hee asus are weights assigned te each edge
respectively
Path
Ina nonctivecled graph g, a sequence «pi of 70”
mpre edges of the form {vowy,! twuvage PL von vat ot
YoY a---Vo 1s called a path from ve to vn+ where
Ve 1S the initial vertex
Vn i the terminal vertex of the * path Pp.
(0 In a path, vertices and edges may be eppentes any
number of times:
@ The number of edges ina pte 15 calledl Length of
the path
Trivial path :
A path f length zero. iS called trivial path
path — length
a-be-d 3
Scanned with CamScanneropen path:
A path i which initial and tewminal vertice
distinct #5 called open path
5 ae
69. A-b-c-d 15 open path
Cloeed path :
A path in which the initial and terminal vertices are
same iS called closed path
6 a, Q-b-a, a-b-c-d-a, Q-b-C-d-b-e-a are
closed paths (Triveal path «§ taken as closed path)
# Simple path :
A path t6 caid to be simple if all the edges and
vertices on path ore olefferent except possibly of the
end portals
eg:
a b 2
a _ c
simple path representation
tere the deffererrt paths are
uy ab-c-a
(2) a-b-c-d-C-4
@) a-b-¢-d-a
MW a-bec-a-b
Here ci) and (3) are Sinnple paths , where as (2)
f
ancl Cyr are not Simple paths /
\
\
Scanned with CamScanner* Qycle graph :
A cycle graph of order ig a connected gidph whpse
edges fowns a cycle of length ‘n/.
Fe denoted by ‘Cn!
(Tao cycle graph of order n’ vertrces will have °
vertices and n edges
©) In ch, degiy= nt Vt and every Cn 78 0 regular
graph:
9: 3 a bg b
Ao
:
us va . ve
VY ’ : :
. TIX 7]
v
vy wa 2 Vs V3
us
7 ()
for the graph tay, the graph(b) i$ an induced subgrap
+ induced by the set of vertices vit {vi,v2,V3,Vsy whereas
The graph cer 1 nol an induced subgraph:
* Edge- disjoirrt and vertex- disjoint subgraphs
let gq be a graph and qi ‘ond @ be kwo subgraphs
of G+ Then:
a Gard Gr me said to be * edge-disjoint® if they
donot have any eommpn ecloe
2) Gand g ae said to be " vertex- disjont’
they donet have any common ectge and ary
commen verter:
Scanned with CamScannerwy
& wt RE
. va
Ve
vs [> fy vy.
s vs Ns
Vy
w co
For The graph cad, the grophs (6) andl (ey are eclgp -disjein
fut not vertex. disjoint subgraphs
x Gomplement of a graph:
Every simple graph Of ordern. i a subgraph ef Ihe
Complete graph. kn - Yf 4.18 a simple graph of order
1", Then the fomplement of q in kn 16) called the
* complement of G'. TL 18 denoted by G-
This, the complement & of a simple graph q with »
vertices iS that graph which i8 obtained by deleting thos
edges of kn. which belongs to q-
Thus,
te)? g coz G
fiom the above, the graph ca) is the complete graph Ke
A simple graph | of orcler y # In graph(e)
The complement § of g@ 16 shown tm Cc)
ky have the game verkers
Observe that 4, & and
ond that the eclges of § axe got by ae eting
edlges from ka wihich belongs to &
> ad
Scanned with CamScanner
those1 il
y Complement of a subgraph
Given a graph G arg a subgraph a of 4, the
subgraph ef « oblained by deleting fom 4 all the
edges That belong to Gi 18 called “complement of qin
Tt 16 denoted by Gq) (or) Gi -
In othewords , ff & 1 the “set of all’ edges: of 4) /Thea
The cornplement of qi in 4 (@ given by ,
Ge 4 G-
)
ca) i) is
For example, consider the graph 4 Shown’ ta Ca)-
41 be the subgraph Of & showin in (by. The
complement of i In G4 gamely Gj tS shown In, graphco-
yep
* Tecmo phism :
Let Gr (ues) and 42% (Gs) be two graphs
A furcton 1 G7 42 1 called an tsomorphisen: Tf
to If f 1 one to one and ento
©) the graph a 8 tsormorphic to G2 Then we unite
Gi 242
properties +
Ty 2 graphs
cay [wean}= [vcs]
ay and 4 me ‘Smouphte then
w) [ecqy)= LEC)!
te) deggv) = deg av)
a '
Scanned with CamScanner=
fe; The degree sequences Ff Gand G2 are the tone
ta FF 2 graphs are Wompiphic then they acljacency
imprtrices are same:
‘for example, tet us consider the gpaphs:
bs ~ [ P 8
oD c IN)
4 9
wy wy :
Consider The, foliewing ene-to-one correspondence between
the vertices oF These 2 graphs
herp ee a 4
Beg
tor
Devs
under this comespondence, the edges im The two grep
corresponds with eachother as indicated below
Taeyerqpsy — focyer tarey
tacy eso thy 1b ey +> {asy
TOY <> tesy. {ey {Ris
The number of vertex in the 2 graphs are sane
fe: vg) -4
veq!)= 4
Veq) = vq)
same
The aumber of edges in the 2 graphs axe Som
te, €CG)=6 ECG)=6
Scanned with CamScannerThe degree sequences of 4 and gare same
dleg tv) = (9,3)3,3)
oleg gv) = (3,330 3)
Tr the 2 graphs, adjacency mertrices are equal er same
A Bc D
gq Fforrt
Bli ot
eft te
oli t 10
PaR os
a Flor it
ali ont
rj!t ior
ee
The given 2 graphs axe Tororphie
¥ Problems: . .
(0 Determine whether the following graphs are /Somprphic
o a
a,
qaby — taey ar gee'y
tady <> tdid'y Te by ey 42,bly
dicy 5
V2) =5
The number of edges io 2 graphs are same
ree &Cq) >>
F CG>)= 4
Eq.) > ECGs)
The degree sequences of au and qr are same
degaiiv) = (253,38, 3,8)
deg ga(v) = (218,3, 213)
In the 2 graphs adjacency matnices are equal or Som
abcde
Gr O@fo | otro
bli o | ot
clo | oll
d}i of 9 1
elo!1 1 0
wr are ot e
blroo 1 ot
clo! o1t
a}ioot e1
eLotrt to
v The given ? graphs are esomorphic °
Scanned with CamScanner* Bes ‘SH
©) Graph ra) Oe cle
graph cq!)
the following one-to-one —conespordence Hw
The vertices of 2 groph
Consicler
axe! “eisdi -
bea gay
Ceo!
d felaly, topy <> tegly
Torey ar teicl'y ted «> quiely
Tofyar voip — they <> telly
Tefy <> taizly Tlify > Tolgty
thay <> farcry — TeS¥ = tatpy
Thicy<> taluy
The number of vertex in 2 graphs are Same
te, v(q) #6
vCgi)- &
veg) = VEG)
The number of edlges in > graphs ave same
ve; eCg)e
ecay =
The clegree sequentes f § ard @ ae same
deg giv) = 03.4 43/4 35)
degay | + (3,473, 4,3,8)
Scanned with CamScannerIn the 2 graphs adjacency matrices are equal ° sme
a bedef
a
G: o loor4
bli ot tor
cjo totort
dio 1 1rort
eft o ® toe
FlLeororryo
ron oot gt 1
rot eg Boil dF
GH FTO 1 oo ty
bhtoo 1 tot
cle to tot
dlo «ft ott
fe} 1 0 o ft ot
yl’ oe baivioa
<. The given 2 graphs ‘ove isomorphic
tw
c tf 8 Net
. 6
lh “NL
sa
0) Graph ca) ®) graphtq)
4) a a b
KP 2s
e
6 Cc .
a) graphed
Scanned with CamScanner+ Walks and their classification : (vertex Degree)
There ave 5 important subgrophs of a gpaph
tn Wlalk
@) Trail
(8) Cereuit
@ Path
4s) cycle
Y Walk :
Conpicler graph and having atieast one edge. In G,
altenpting sequence of verkces and edges of the form
Vi Oj Nig Cfat Meg2 Qja oo eRe
Which begins and enels with vertices anel which
incident er the
ig
such that each edlge in the sequence '5
vertices. such sequence. 19 called a walk:
Jno walk, a verter ov 07 edge (or both) can appee™
more than onte-
The number of edlges present iqa walk ig called as
length-
eg:
In this graph /
yee tete we oe Milk of length
wy The sequen
3 (becouse, thie walk cor!
Jn this walk
ains 3 edges + 1, en,€6)*
ap edge ic repeater
no vertex and
ip a
B45 Ma C2 V3ES Wy Co VE
vertex. ¥S is
@) The sequence Vi ey Vs
walk of lengih 5° Jo thie walk, Th
opectedt 1 but no ecige 16 repeated
Scanned with CamScanner© The sequence Vieivses\/s ea\atys *3 a alk of
length 4. Jn this walk, the eclge > % Yeperted and
the verter vs 1S svepeated «
The verter with whicha walk begins ( called the
“mittal verten" Cor the origin) ef the walk and the
Veter with which a walk ends is called the
* final vertex’ of the ualk-
Closed walk :
A walk that begins and ends at the some verlex
is catled a closed walk:
Openwolk:
A walk thot 18 npt closed (3 called an oper walle
€G: WervresNs eu = closed walk» -
Wiel Vala V5e5 V5 > Open walk
GQ) Trail and cinait :
Trail «
In a walk, vertices and edges may appear mae
than once: Tf in an epen walk ne ectge oppears
moe than ence, then walk iS ealle a trait
Chcuit |
A clesed walk in which no edge ’appears mae han
ore called a ctwuit-
eq: We ey ow ve
%
er
2 WK es 7
ey ee
An ve a
Ww te
cay: Not a tari we Trail
Scanned with CamScannerFrom the
graphy nota trail re; the open walk
we ¢
i 1a CaS C3 V2er Vax because e5 1 repeated» wipe
and graph (b) is trail
ve ow
en No y 15
es
e & Yes e o er
* uke Ne ee MY
vy ey
from the above, the closed walk weivscovs & Vsenvut
sey, i a ermauit
Path and cycle
Path:
A Trail i9 which 90 vertex appears ee than one
is called a path:
cydle: .
A cuit (9 which the ne vertex appears mere in
¢: pt ent wentirel
once “is calle ‘a cycle
el Ne No dle
d es eo
a i 1 wu
vy ‘an ~~”
ates
* " SO
va
cay path tb) Not a path
From the above, the hail % e103 Vs Og Va era fO7
ml
th where as the ail wey ses ee
apn eee t tn this
we pia path (because in
Vaesvs Cove Ute s(2)) PP
frail, VS appears twice)
Scanned with CamScannerve ee
cd): Not a cycle
(0) cyete
The cvtrcwit Va eas es Ve O52 ( grapheey) #5 a eycle where
O8 The circuit vs eivy ey Ve es Vs er Vy Co Ve Cau (9raph4)
15 mot a cycle (becuse in this eitutl Ve appears twice)
s6)
* Euler's ctruits and Euler's trails
Qerper a cenaedled graph §- If the «© a col
- That contains all the edges of q then that
circuit 0 called Eulers cera! (or Eulernan ine or
Eulertous)
Euler trail :
Tf there is a hail in @ that contains all the ey
of G, then that hall 15 called an euler dratl (7
Unieuiaal lene) in q
A connected graph: thet contains an * ‘euler cout ©
Caltedt Eulergraph cor) Eutercan graph
Serni- Euler graph >
A tonnected graph that contains on * eulertratl’
© #5 called a Semi Euler's graph .
9 ae
les
9 er R 8
w)
“4
Scanned with CamScannerIn_ the graph (a), the close walk.
Pei QerRespeySesree Teip
15 A Eulerecreuit
6 6 Dee
The trail AeiBesDesceyAesD tn the’ graph is an
Euler drail- This graph s a sem!-euler graph
* Hamilton cycles and Hamilton paths:
het G be a conneclect graph- Ty there a cytle 9
‘that contains all the verkees of 4) then that cycle S
called a '+tamilton cycle’ in q.
A Hamilton eycle in @ graph of m vertices consists
of exactly n edges: Recause, a cycle with m veittees has
“edlges-
A graph that contains 4 homitlonaycle 1 Called
“Homilbon greiph" (or Hari Fenian graph)
eg: * B
D ec
Ja the above graph, the cycle shown in thick Lines
5 a Homiltoncytle (observe that this cycle cleosno!
anctude the elge 6): The graph cs therefore a
hamilton
Hat ArGiltroverse pain edge tA G oxoctly once strat A
Scanned with CamScannerHamiltonpath «
A path ina eanected graph which eelucles every
verte Cbut not necessarily every edge) of The graph is
called & “homilton/ homilten path in The graph
© [4
Jn the above graph , the path shown in thick line
hamilton path
A Ey
In above geoph the path ARLFEOGHI iS &
hamilton paths We check that this graph cloes et cow?
a hamilton cycle:
Note:
A path with q vertices hab n-1 edlges
4 — Gaph coloring:
Given a planay o7 9o7-plaqar graph a wie assign
colors (eoloura) to its vertices tm guch a way that
have the samme colour, then we
gay that the graph 15 properly co lourecl-
In otherwords, proper eoloning of 0 graph
such, that 04}
wo adjacent vertices
mean®
t
en
assigning colouns to ds vertices RS
vertices hove different colours:
Scanned with CamScannerBlue
green
o fed
ue
Red Red
Gueen Rect
“es Yellow Rect
veers
eed plue
Red
are
from the above graph » the fret 2 graphs
properly coloured whereas the gd graph 1s not properly
coloured:
By examining the prs’ eo
Propaly colored , we note the following
more than one proper coloring
properly colored graph
pst two graphs, which ave
HA graph ean have
ajacent vertices nO
b) Two mone
can have the same colour
Chromatic urbe’
that can be properly colourect
DB. k-chvomatre greiph
with colors bat pt
aT a graph q ke ckpomatic, then k 5
be umber” of G
2 chromatic qumber
ich the graph can be properly
with 1266 than k Colors
called the
~ ohrome
Thus, th of graph #8 the minimen
number of colors with wh
ti -
sora! the chromane number of a graph G 9 usually
denoted by x4)
Scanned with CamScanner') Find The chromatic number of each of the “following
geaphss
Ns
:
MI Ve )
@
() For the graph cay, let us assign a color x to the
vertex vi then, for o proper colouring , we have t
assign © dliffercolour to its neighbours v2) Vu, “7
Since V2, Vu Ve are mutually non acljacent wer tices +
they have the same colour, say ps (which 1 different
frown)» Since va, V5 are not adjacent te Vi, thes
ean have the game colour as Wi, namely of:
Thus, the graph con be property colored with atleas
two colours. with the verh'ces wi, v3-Vs having °°
colour % and ‘Va, Vy, V6 having a dgfferent color p>*
Hence, the ekpomatt number of the graph & >
tay For the graphis), tet us asign the colow a fe
vertex vi then, for a proper colouring , its njeghbou
Va, Neand vq cannot have the colour at but VS
can have the colour d. Furthermore , V2, Va, 4 must
have clifferent colours, say pp, %, 8. Thus , atieost
four colours are required for a proper cdowing We
graph Henke, the chromate number of the graph * *
Scanned with CamScanner«Planar Graphs :
A graph ¢ 18 called plana, if.'t can be drawr on
The plane in such a way that no two edges (0s
each other at any point, except possibly at the comme
endl verters such a drawing is called plane drawing.
eg: : .
ey Consider the graph ad shown in fig
Graph cq)
its plonow graphs ares
A @&
Cay plomar graph( Gr) ter planar graphCd)
Niels
) Graphs F sequiay 0 ve vs
vs ve
(9) Cube
Me
Octahechon,
Scanned with CamScanner% Region (or) face of a graph:
Fp a connected, ploqar graph 1 drawa in The. some)
plane, the plare i9 divided into the eontinguous
regrons called faces. A face is ohovactertzed by the
tycle that forms its boundary
b
|
—e |
7 |
Lo Ass
a ae ,
Face & 19 bounded by the eyels lapncdia)
face Rs is bounded by the cycle (¢, dre,
Face Rs % bounced by the -eycle (evepic) ”
The cutter 7egron ty i9 bounded by’ the cyte
(a1br Cif ed, a) |
Jrufaces , e+ Bedlges, ve b ver Hees
~s olegc es) 4
oe degik) 3
— olegies) = 3 .
~ leg ( eq) = 6 . ae? °
x Galers formula : “
Theorem
oY aoa congected plane graph , then’
Nl lela IR] = 2
wo) /
for any plana graph 4, nurnber of verkices~ number
| eclges + number of regions= 2°
Roof: given a conrected planar graph 4, then any
drawing of G ta the plane,as plane graph will aluay®
from [el = 1E]-|vl42 vegions , inctucling exterior reg"
Scanned with CamScannerHere,
IR} = number of regions
TE| = Nurnber of edtges
IML > Number of vertices:
Fhe formula was cliscovead by Euler hence ther ‘nare
Balers formula Now we will aiscuss This tn detail
Stererment + sone
Fy Ga comedled,groph , then vine] +18 |=
we prove it by frst observing The result for a tee
A tee determines only | region If the number Of
werkices. in a tree are 9, the edges will be n-l- Therefor
The fournula W-lEItIR) + halets goocl for He
Fes Iuf-lelt ted en-Co +
= pfnetitl
eR
Therefore, the results true for r=1, Suppose that the
result 6 true for reyron® and suppose that 4 16 &
Connected plore graph that had K+! negione*
Delete ome eclge common to the bounday of {wo
separate regione
Then the wegulting graph Gi
cl gne fewer 12
vertices, one fewer edge an # 4) -
erlge. rakes ? into one 67?
the deletion of 2”
and {Ri} oe
Thus , if re, [vel
A regions for then
has the scime number of
jon because
regions
vespec tively the numer
of eclge’, vertices rm
Scanned with CamScannerte}= lel
Ii = vl
Iajs IRI-E
Ivif-16) 4 0Ri) > vis (LEI + (ik I-1),
> I= Lela lel
* ti-le}a IR]
we UMel=Le a) t1Ri| = [vp Leba RE
By inductive hypothesis
Wd - TE) tei <2
Lup = le] ete] 2
Thus , the theorem 15 provecl by mathemplical tpduction
|> Dual of © planay Graph :
| Cenpicler a connected planar graph q arpl a plane
drawing - Suppose Ri, Ray Ry ete be the region®
Ciqclucking the extenor region) in this drawing « det 5
new construct a Foph at following the procedur?
given below °
0) Cheose One point ‘insicle each Of the regions F1,%
Ra,-- denotes these ‘point by ut vy veh
These parts will be the vertices of qr.
OH two regions Ri and Ry “are adjacent ie, hv”
@ wmmon edge, Y ek), drow a bye et join
The poinls v¥ and ye tha intersects the comm’
edge ex exactly once
(of Uhpe 19 mow Than one edge common to &r ov
Ry, daow one line tpt Ye the points vt and
Wi" for each common edge ep, intersecting ep exact!)
\ ence
Scanned with CamScanner4) for an ec r
drow we er lying entirely tn one region, Say Rr
Fe al the point vi" Intersect
exactly once i* intersecting er
The gv
, fe sere 4? 80 corshuctedl called ¥ geompl ne
ual” ev just a. “cluat” of q:
eg:
J) Conpicler the graph § Shown in fig
es ey .
the fig, divides the plane into >
we obsewe tat,
of uhich Ry unbounded «
regions Ri, Rand Rs
Wie consbuct the cual @ of 4"
of the construction ©
The step-by- Step descriphon
gen below!
> We choose 3 points vt, St imace the ve6pont
Ri, Ra Ro respectively
> The region’ Ri and Re have a common ecge ne
drow @ |e et joining viand vi that eich
a
es exoclly once
2 common edges él
~ Ihe regions gp ood Re tove .
x
wd er: We draw 7 liqes et, ek Ole yp and v5
: 1
wilh e* ¢7088in9 only e; ond es* crossing} only a
Scanned with CamScannerTrees
Definition + :
bet G- (WE) has be a loop. free, urplirected graph» the
graph G is called a tree gf 4 is \coanected and contains |
re cycles- , |
eg:
The graph 4, is tree, but the graph Go 6 tpt -a
tree because tH contaiqs the taby, tocy, 1ay
G é f
Ga
The graph ga ts pt connected,
‘so it tannot bea te
Spanning trees © . :
4 subgraph aa of a graph 45, called a $
inning free
BF
ca) Hib & tree, onl
() 41 contains all the vertices of g
A spanning tree that is a alivected chee 5 “called &
directed spanning tee of 4
Spanning tree can be generated by
of a grph te Depth first search (DFS) o
both the raver”
yl Breadth po
search +
Scanned with CamScanner4 ‘find all spanning tees for the graph Gad shown in fq
e a
a .
The graph ¢ is conrpcleds Ht has 6 edges and 6 verbies
and hence each Spanning tree have nei edges 10s 6-15
‘O. b =
DIN
Oo by e
as
a b c
Note: tr general, if G % a connected graph with 7 vertees
and mm edges,a Spanning hee of 4 must hove nt edlges
Properties + .
Tf arb ave distinct vertices tr. a tree T= (ye), then
there is a uncque foth that connects these vertices.
©) Tf Ge (ye) 6 @ unelivected graph, then G os connected
ard only f 4 has a spanning bee
%) TH every hee Twe), tv}= left
te; ven, Een
(Gy For every tee TWO, Wwi>2, then + has atleast
tivo _periclant vertices -
ts) meas edges mpst be remover! fiom a congectedt graph
with 9 vertices and m edges to procwe a Sproring
Scanned with CamScannerexample :
W Draw all The spanning trees of The tree graph.
4
1
a b
This graph has m= 5 edges, o- + vertices
e
To obtain a Spanning tree we should vemeve
ments S-Yytl= 2 edges .
d A . 4s d £
. be b Sb a6
rr A de
° & a b ° a b
Graph taversals
Gen a graph qe (we) ond a vertex vin G wel ar
interseted mm visiting all vertices in G that me reachable
from (v) Cies all verhices connected to v)
There ave 2 ways of doing this
ty) Depth -fnst seach (ack tracking)
&) Breadth first search
() Depth first search :
General procedure :
Jet G- (Wie) be & connected guaph of onder 9 jwith
vertices labelled vrjVp----Vn in dame specified ovcler
The DF algorithrn specifies the following step? for
cleber enining @ spanning bee T of 4 where tn the
vorcable V Starels for The vertex being consiclered -
Scanned with CamScannerYr
Hepa:
“Assign the first vertex vi to the vanable V angel
iniftalize T at the tree consisting of just this veret:
step2:
Select the smallest eubscript KM gehen, such that
CiZe E ond ve has not aledy been included so T
Tf no such subsaipt i found, then 99 to step othenuiss
perform the following
t) Attach the edge {wives to T
Ul) Assign YK to Vv
(® Retnn to step2
mr vey , the tree T 16 the spanning tree for the
order specified
Stepy
nt
fpr VEN, backtrack from V- Tf 0 ts the jovent
the verter assigned to v to T, then assign
yetusn to step?
u to vand
crornple
) Obtoin & ope"
DFS algprith
a
aning tee g a following graph using
The PFS spanning ree
a 4, f I j
| J
te bs fe
2 zs
Scanned with CamScanner©) Breadth first search (8FS)
Jn the algorithm a rooted 4vee will be construclai,
and the underiying undirected graph Of this rooted
fowns the spanning tree * The. tea of BFs 6 to visit
all vertices on a given level before going fo The pit
tevel -
Procedure :
Stepa:
choose a verter and lesignate i a3 the roots Then
add all edges incident to this vertex, Such thot The
ccldition of edges does not produce any cycle
Step2:
The new verhes added’ at this stage become the
Werkices at level 1 tn The spanning tree, anbitarily
order them:
Steps
Nett, -for each vertex at level a, visited tnorler*
add each edge incident to This vertex fo the bee
ae tong as tt alocenot progkice any cycle
Steps: (evel!
Arbitarily orler the children of each verter lax
This produces the vertices at (evel 2 inthe tee
Steps:
Qntinue the Same procedure until ail the vertice
in the tree have been added
Steps: 5
The procedure ends Since there ave orty a file
number of edlges in the graph
hove prducat
Stept
TA opanniny tree produced since we
he
tree without cyple corglaining every vertex of th
geoph.
ad
Scanned with CamScannerezarnple®
a) Obtain The spannin
tee of.
BFS algorithm J of: following graph using
t
) Choose the verter ‘od to be the 7oot
“a
Add edges teident with all vertices adgacent #0 2%
9 that edges farey, 12 cy are added
The two verhtces band € are on level! tn the tree
b
ae
c
Cl) Add edges from these vertices
verkves not ailveady io the tree-
15 added» The vertex d 6 th level
at [evelt to aad jocent
tlence the edge jody
c
vela +0, adjccertt vertices et
taey and taigy me
cin Add eye fiom a in le
alseady (0 the 4700 the edtges
“added: Hence © and 9 me in level
Scanned with CamScannerBe oo
WD Add edge fom e at levels to adjacent vertices npt |
already in the tree ard tence terfy is added |
This ig vequived PFS
¥ Spanning Trees
Minimal Spanning trees +
A_ minimal Spanning tree G@ gs a Spanning tree in
“hich the sum of the ‘weights agsecialed with all edyes
fy it 15 rfnienuen, ‘
Algorithm for minimal Spanning trees::
There ave Several methods available for actually feling
a minimal Spanning tee in a given gioph:
Te find a eran spanning tree fora Connected wueig fied
graph, there ave 2 algprithry®
wy Krruskal’s algor'then
©) pris Algovithry
W Kauskal’s Algorithm
The working wile of the kwskals method (usually
tailed kyuskalé algorithm) may be stated as follow’
Steps:
Given @ connectecl , weighted graph G with vee
Hist the edges of G in the onder of mon-decieis®
weights
Step2
Starting with a srpillest weighted edge. proceed
sequentually by selecting one elge at a time
gich that ae eycle is foun
Scanned with CamScannerr
Steps
Stop the process of step2, when mt eciges are
selected - These n-! edges constitute a menial
Spanning tree ‘
y foblems
Find The minimal spanning bee for the following graph
using kyuskals algou'thm +
Werghted graphCa)
thio graph contains 6 vertices and thus we obtain
a Spanning tree with 5 ectges « Now, we anange the
edges of the graph in tereasing order of their wieights
Weights of ectges
Stepa» dist the edges ‘a npn clecreasing orcler of Ther
weights
Cae) (cd) (arb) (bf) leg) (be) (ad) terf)
1 2 3 4 5 6 4 8
edlge
Weiry ht
tag) (be) ed)
9 0 "
Scanned with CamScannerNow, a minimal spanning tree 18 constructed as
Step2:
select the edge (aye) since it has the smallest
weeght, include it tT
a
Steps i
APE select on edge with the next Smallest wetg ht (9.6)
Since it doesnot form tytle with the existing
edges in Ty 60 Include te tT:
e
to
®
b
SPY! select an edge with. the nert smallest weght (
Since it doesnot form cycle with the existing edge”
Ts $0 inctude i on T
oe
3
b
wy
bit Ce
Steps+ select an eclge with the next smallest weg
Since it cloesnot form Cycle with existing eclyes
tr T 60 tactude it in Tt
e
a
3
b c
es
T
ad
Scanned with CamScannerYr
eps *
p select on edge with the next smpllest weight Cor)
Bite # doesnot form cycle with the exsting eges 77
G inelucde it in T
Sie G contain 6 vertices aqd we have choosen §
eclges, we stop the algorithn and the meaimal $pannrg
tree 15 produced -
Mleights of the menimal spanning tree
perp aruts © 15 units ;
® find he minimal spannieg tee of The following 7aPh
48ing_kruskal’s algorithm
q b
is
The graph consists of + vertices and we obtain
8 spanning tree with 6 edges
ee 08 the edges in rpa alecieasing order of their
weights , :
cages cae) Chit) (0g) (be) (AG) (de) (4,2) (ad)
i 2 oS 4 5 6 4 a
Weight
Cab) (aif) Cerf) Gq)
a 10 " In
Scanned with CamScannerStep2s / «|
“select the edlge (acc) since it has the Smallest weight ,
include tt in T-
a
a
Step 3: |
select the adge (cid) with the, next Smallest werght,
singe it doesnot fom cycle with the existing edges int.
30 dude it in T-
a
L
c
4 d
Sepa: select the odge (ae)
b
/
cA
Step5* select an edge (bie)
PORN
cq 4 .
SPE select an eclge (2.9) 7
a 6 °
! aN
e
c+
3
Scanned with CamScannerSteps:
t Select an edge Coif)
, 7 vertices ant we obtain 6 ectges
Siqce q contains
the minimal spanning tree
Ne stop the algorithm and
i6 produced:
The weight of minteral Spanning tree 15
14 2¢ d+ ut 4rlO® 24
Scanned with CamScanner