DS Graph
DS Graph
Page tlo
Date
Grraphs
Deinition:
A grapb G Consisks cf a set V a
Vextices Chodas) and a set b
e coita G (v,e) y is a tinte and
Vexticas
hon ompty sel
vertias, theiy paxs callecd olgas.
Set o Vextitas
23
Re dizechion s iadicatecd by an a o ,
Gyaph Toyminolagy'
Dinccod q1aph A divock ad graph
is a qanh cohich has Cdored pan of yaaliue
A gsaph is said lo be
3. hleighted raph: A
ceighld is adgan have bon assignad
SOme value
5
Jumba
Page tlo.
Date
path -4
55 kouest Palh.
) 3 +3>4
A Path :
all the intesmediate tai nedes betseor the
izst amd lat hodas na joinadby adges.
Paths
3’4
Stonling hede -l
Ending nedo -1
iorSinple graph: A
A sipla
Simnpla grafh
qraph is a43oph.
LOkich is fsee from gelf leops and panallel
edgas.
Degsec cf goaph: In an Undisecled graph
the hemboy of edger Connckod to a hede s
Called ils degs0Q. The mazi num
hode in a qiaph is callecd tha cdigreaf
the
În diracbed graphethexe aue boo
-degsces af a node ingue and outdagsa
as the Aumbar cf cdge
incidonl cepon Qmd Cukdgzae
hember gadiating t a a Acda.
B
BO
B
Direcled Graph
Juabo
Date
B
|
BQ D B
C
Cindineelad Gnaph
3) B D
D
A
B
Maigitod Cnaph
i) Linkeel Repsesenkabion
Cnkd
Lists is used to gepsesent the aacont hadac
and the daba stuckine is callad adjaccacy
B He| NULL
D E NULL
NULL
Juatn
Page tlo
Date
E- (0,D), (B,A),(B.),C,D),
havexsal of Gaaph:
Meansthal Ono Visiks tho
Trellinga gaaph.
yexticas of a gxaph at laost oho. The papase
of the Lael dependo upon bha ingormation
stoxed ia the graph. Alooadayc to saach og
aidaly used in abifcal
inteligenagroph can be Erayessed in mag
A
LDays bul Chaxe ane Coo popular methodi
ohich iaidaly isacl forseaadking gsapls
BreadE, Fixst TxcNeKsal (BES)
Q Depth Eisst Isawensal (DES)
Juaba
Page tlo
|Date
Qdd Gjacenl at
at Rec on not visil od;
he cenvsitd acliacent
Ccnuisifd alrcnt eaticas
Juabo
Page tio
Date
(V5)
an
hase a e Pale
Fo) iË o hode Aas hek ba visifod.
3 Tribiall the quecco eapty focnt-LPon
LA.mao Algositkm)
Stoating ede iabo kho
2.Delet front lamenk from the
Ond tnçant all ts cenvisitacl he ighbouns
into tho qucue at Yeay ehd and tavese
hem plio veaify he visik od Ngda
Repcak stlep 2 Centll the
tho quea enaty
Jumbo
Page No.
Date
13
(A hot_vsied
D
Visited
BD hot visilod
A Visited
DFc hekvsitadJ
AB aited
hetyihzd
B ABp
B
Xislfed
-Juabo
Page tlo
Date
bol visilocd
[DR DCE
hotvisitedl
B \isited
het vsitad
16
BES Dlgoithm:
ThAS algoithm exeabas a
G baginig at a chtig
Seanch on. a qaph
NOde A
L Tai kiale all nodas to Eho reody (9mus-t)
Queue and
a. Put the staaling hod A in
Change iks status bokke coaibing skate
(STATUSz )
3. Repeal Step 4 ano S cenlil Qaue is empty
Algosithm;
This algovithn exe cutes a deplh frast Saanck
On a goaph G G beginnisg al a stat bede
hode A
H Initiali 20. al nodas to the geody slate(3pnus-)
Q Push the stanting edo A Cnko séack. and
Change its Stalcu bo tho cwaibing stale
Venticasodiacent
S , 3, 5 and b.
Page No, Juabo
Date
VisitodLot s pick Vs
alrady
Page No
Jumbo
Date :
Algonitton
Step I Push stastiog node inko kha skack
Step î : Pop anelemenl foom bhe Skack
(IE oil pop up all yexkicae faom tha
Stack okich do not have adiatonl
Ventitas)
Step u : Noo psh all the
hode f the poped element cn
Stack. push che elemOnt even
n thestack.
cenlil stack
is emplg
Juabo
Page tio
|Date
DES
ip
sinp2
Step5
2
toccE
Stepk.
Step&
D
DCCERED
Page No. -Jumba
Date
Ppplicalions
L Model Cf A : The tooclel of coorld LDida lo!
Can be Teprasenbad by a g3aph Cdinected)
Ohesein Dodas denole ehe documenks, papens
asticlas efo. and tha ecqas Tepaacet the
Dukgoing hypesih ks bebcoecn thom
Site Sy
bo
pages
his hegpaxlink Stauckxe s tho coek
styuctae Sinila to tha coeb creatd by a
Spidox and Aanco the hame. Loorld oida czb.
Rasouto allocakioo qaaph: 2n ordes bo dabeck
and avoid deadlack, the apexaling Sysbem
oaintaias a
hat ane actie lo the Syctem.
Coloaing of mapsi Colouaing f maps is an
interesting pooblam cohen eim è ià dosired thata
bap has to be Colocned in such a fashicn that
Juaba
Page tlo
Date