0% ont trouvé ce document utile (0 vote)
20 vues16 pages

Ds Unit4

Le document traite des concepts fondamentaux des graphes, y compris la terminologie, les types de graphes (directs, non directs, pondérés, acycliques), et les méthodes de parcours de graphes. Il explique également les algorithmes de tri, comme le tri rapide, et les structures de données associées, telles que les tas. Les techniques de parcours sont détaillées, y compris les approches en profondeur et en largeur.

Transféré par

sandya.anaveni
Copyright
© © All Rights Reserved
Nous prenons très au sérieux les droits relatifs au contenu. Si vous pensez qu’il s’agit de votre contenu, signalez une atteinte au droit d’auteur ici.
Formats disponibles
Téléchargez aux formats PDF ou lisez en ligne sur Scribd
0% ont trouvé ce document utile (0 vote)
20 vues16 pages

Ds Unit4

Le document traite des concepts fondamentaux des graphes, y compris la terminologie, les types de graphes (directs, non directs, pondérés, acycliques), et les méthodes de parcours de graphes. Il explique également les algorithmes de tri, comme le tri rapide, et les structures de données associées, telles que les tas. Les techniques de parcours sont détaillées, y compris les approches en profondeur et en largeur.

Transféré par

sandya.anaveni
Copyright
© © All Rights Reserved
Nous prenons très au sérieux les droits relatifs au contenu. Si vous pensez qu’il s’agit de votre contenu, signalez une atteinte au droit d’auteur ici.
Formats disponibles
Téléchargez aux formats PDF ou lisez en ligne sur Scribd
© § § “le z FG | + y aphs ee as set 4 vert Pees 4 edges qe) ttis Aejined reas yo set g vere - get eb: ese] a clas sepresent ed by also known aso ptedk oF ines, Connecting 400 circle ee cohere vertices 2) edge axe Te prere! a where els vortices [ tines el canbe |ex2t A bi ap ce aya bie oT @) © tyeelgrap! ° Abul _vertices|nodes | Ai Bien vertices nodes jth idy 28g fo mot edges $e 18) (Bs Faph Terminology: : ®. called were” jalso known CEH a9 b 5. ig o e gs a p 4 sx a 3x.3 2-€dge : esa Connecting Unie bl #0 verti Let sedge ts also are An edg ‘ Lnown a9 are: ae pdiaunt Node t Md og these 12 an <49° bly vertices 04 PB then both AGB axe j 4-40 be adjaent te a ~The M1 ne Te BP dB ts adjacent bad Ave v4 4 2 qe Deqree im ae nd Total noo edges Connected to a vertex ts said to bi s eS | ye an depee of dhat vertex ex: Dia) = 2 . pis =2r pleyea Trndegree + Total no, of Tnloming edges Connected toa wertex Is Catled indegne sd that vertex es Oe Srdegree (6) 2 | dedes &x—O « Cpyes path: "(#)=0 2 path Te a Sequence oF atternate vertices t tht meanr a spoeh with 4 vertiles Cs represen ted using a mahty of 2tze q 4X4 Inthe mabia por sows y columns represent Vert ws , here TB led with eithere o ot |+ where | represents that Ihere Fe an edge from orn vertex te amothey vertex; ABC Dp E vapb a oie Te 8 fe GET So Bilt ood Teh ts D1 8 oes Bld Megeteat sp C Vo ole cao OB cpe fo | \oo 2 3B O OGL te SOO 70 EO: Plover 14 Clo 00 of ae Adjate Usk Spevitalt avy =n this veprenen Fall never vertex of a graph Gites 1 curse of Th adjaant vortices - i . | aay a neers | > |8| 4-e iT -ep | © ¢| > | D| ->[aT oe NET a 4 LX) above example can olbo reprecnted using rey mere 0 a he a eS Noche any ray maph Traversal Methods’ 7 hiiannaen hing vate th a Graph Raversal ts arechniqgue Used for scare gpaph + : >the traversal ts also Used to decide the order of wertdces Te vist ted tr the Search pr cess. an afaph haversak finds the edges to be wed in search Hh out creating loops: process woth ‘ traversal technrgies Tie types °f Graph [des Pepi first search) g- pes preadth fixet Aapeat step 3 until these Ts No new vertex Fo be Ul'st teG Prern the vartex uoht’ch fs at the top of the steele * Ss when there ts no vsew Vetter to visti ethen use back - tracking and pop Om Verkex frOM dhe sbacl 6-Copoat steps 374) 5 unt? (push W on td Whe statk | Nae 2 « \isitany adtjatent vertex g (4) wohich te not vista CB apwh 8 on! the stack 3-Misit any adjacent vetex4 (8) | whitch fs hot visited Co) D> purb ¢ tn to the stack : | Re i 4. visit any ad aus vertex g&) (vise € : push e tn 40 stack i es 5 |B é we ea is visit any adljacent yenbox 42, visit ‘pl ! A push's Indo the stack 2 __) pe | ¢ % 6. as there Ts no naw vattex to be vistted from 0, uxe bark tracking , pop top 4 the stack 4. Viste any adjjeuant vertex (ed which ts not usted CE) “push Fl on to cack a. vEstt any adjacent vertex ‘El whtchi's not visited (4 | Dpush Gi +0 stack ® c => } 2 | La A-Tthere Ts nv nrw vertex +0 be Visited from q , back foack ; > pop ‘4’ 5 5 Rie~> lo There. Ts Ho new vertex to be visited Grom ‘F back track IZ) pep F! ® te OS sa thethere Pe no new verter to be visthed from €, back trek pre RSs : eS Oe) i — > ec ee ithere fsno naw weber to be weet {ror i” badedrack 2 er Beg ree Rowse L there iS pop’b ~~ Size = ipethere Ts no mew vatex to Cg ve vested: prom A 15° use bade de Pans Ve na) 3h Ca gtatk belo e oe Pad joe Oa C 2» BES a C BFs praversal erarh prods | ~<.. a sparing ree an giant 2 ts graph with eae pul tops Creg 2E F Queue data shuckure | 3 a) ec | ec £0 Fined sparmt ng plgorithro ¢ Le petine a queur 2 selec any vortex as tant ny potnt for traversal, visit dat verte cfesert TE to +0 the Quue iste att the mon aketted adjatent varttces 4 the vertex site B+ faite 00. Mee Prom the ver kee Susur © le lett vereeX * ax chasing s | a pe, toe a wee itil t atl the non _vtst ted ae iste eoht ch adjacent vertton 4 A are rok vested | 7 datete A from Ques? be om, Be vistt att be ad aout verlag Wuohtch ts not visited (no vertex) Dbelete v from Quer. 0 Oo-© tervtshe att He adjauot vertics of VI which fs not Uisited cer) ‘ | delete € zp Sevishatl dhe adjacent ver tice 4 ‘Bl, which Te wok visited (no reap vertex) Svetete't NZ bette atl Me abiaceub wrth cy OFA ,cohich ts uot vist tedCq) 5 aad GU to Ouse mS) 7 By joist al ee aijetat vert wa | 4'F whi ch ee not sited (no | rte ) (COTEED a: visih att dhe Neth 4 | woliich Ps cr Visthed Cro verter) _5pelete & RS Finally I) ; pelete fe poles con rae) = UQascesort % > Mute dort bs a sortin algorithm that vee a divi& y Conquer strategy to ot an F 4 ‘a4 & avro4d. ; Zi zt fs useful for corti (age data save time: : Jat Plebs pbcles any one elment as pPvole,then te partiterg the given apray ground the picked pivot element: Algorithm : te Constr atcha « asa givor alow] 2 initialize i! i! tp low Inder, 4! to ar; inde 3-Qrpeat the jotesstng aps unt | tay nis Weep on Trerementing {f) wht le att) < pie gas w " dewemenktng ‘j vr la gtd yaptvor ee th 1d then fle? ate @ tf to) theo gwap (aChI, ptvot) 7 altos) woher 2 ‘ ‘is the padtong glint J s Svample t | gp 3 ok af> 30 20 10 so 60 | ite t Chuk t< } Od ° att)< pivot > s0¢ 0 tr) . atid pivot Tver 2.01) ‘ ed730 es is > a05 80) Aewveane Tnoremeut 1 (2) 2 bpya0lD | vat \ decremut J (3) > 10s30 lt) 5 i i melt C32, 3 sige ae ' Beere mend J (2) er 7 w>30CF) Seep Fi=2) cr) ° stop (5 => op ig i i=?) 20 20 lo so at S | dot tr te Swap Call) ali) else suoap CoS) pio b). 3<2 (x) | tle swap (alr), a (od). ’ now ‘5! poston fe pivar (ont postlion). 0.90 10 50 60 40 | Coos ae i 9 1p 30 30 so 60 40 ey i pena hi vol partion a | Uepaailiewt fa. ckut NO cde: aCe depivot = 10< 10 (x) Ajvor Teveman}t val OK LOCK) sep [bal de jp > 10 Sop ie ° te} etd <0 x ve ase su9aP cacseee? uhere J wt be elements , vight sida) el partition 24 a —T 1 rd so 60 4d 1 pivot cu 14 ai jcpior > @ <5 a) aa.) ewe f + oo © s0(F) stop ot (¥ =) ) uask § ; ; te 1S? swap cact)«0i3) \ 5 te ee 4. \ 2 nen pivot, gaiurepe a (1 I.¢ pl yok the pivot bak (yt we doubt Lemont 9 MLAUA elements ae aCe) ~ 40 ¢s0 lt) ‘Muvemeut 1 (2) stop atfie2) haut werd soted* alid> pik > 40750 FD Es HD BOE SD (FD 03} >pivor 604 50CT) devrenaut-j to) ds 4vrs0 (F) slop atte) ] tea yhe) : eve I> J fue p @Ci3, pier) act), ato) pivot position Ts J © | ebtte Ne por Alot s ff we qt pik low at Wigh aa equal due wean Thal pivot fue teatead pagatw wel ued td dake pastifiont et par hls ona 4 pivot aa libiona yesiealpivor pose a po pit — | peo. ‘ | Heap cot ‘ Heap data ghruchre rs ou spaciali944 biuary clree—bared data goruchere - ' : “ wo fy 3 4 leap data chuchaes % ole (4. Max bea.p (AstemBfvg Cermall J targe)) amin heap ( decensing (large f eval!) i T i Max Max leap fsa kpedalized (2! brnang divee fn whteh every paral nods Coukafug qn ra equal valu than 4s CLF (A wodes- A fo & ee et - ® s ’ ’ ’ > > » , ’ ’ ’ ’ ’ ’ Min lea, wei aba Weed soet Opera tio: —————— tfindtg Martmus (0 Nar heap always tke rook nods ts dhe piderh op ; nan node, 3-Delehoo ’ ’ os = s Hleapi by aathed’ + | lee Lenptfy mulad fo Utuary tree fs te lonwal , the tee tn to, heap data chustire This method use | mocunsten approach tohezapt tq atl He nodes ¢ = b trary tree rp the Complet Linary leap oF a win-Weop deee wll be Converted tn to ether, oe by apply (ug the Lenplly molhed. ager on ex: (0, 80 (3 OLA a2 1, Posed fe 2. (at £0 Ik Cho utd Iaerk left fo Ci! (oe cauac Tt fsa shally piuaory bee pwlieh shoud efit grr le} dork ght A apply bepthy cay Ag fh ts a Marl! fi rise @) a wert 3 o> . 4 Lnsert +0 Ge! Brdvpuiion go B & Leathan Ne gtols Arey Hep y e © Note: gf crouch Obey the propertis 4 qutty btoary free ak Mat (ata loop properties Fog to te selech 90 (gett 4 (©) & & @ & igus om Ts Max leap tree,tle (tard ean ae e (73 ] wo [4 WTR RE SO Deleon + | =" | Belebe 80 {79m | dhoutd be swappe bree meds do be Usapigy wake ft vee | fo rhe 70) abou. Max Leap ;to alert wat usd st ed with lark note 4 patter calettog , Klow lhe anva4 Ps fexofio [3 [4 | 20) > aa ©, ‘ i p pelele 40° (a) ‘apy eo a C6 A B > ql 4 oud be Or & a ( “% pean Tose aH | corP aL 3. Regs é @ eS Puss Tale trims! @ © cial aru Qual \ qivatly goletes, sth ale) te ito sdt tha sorted UPst © clwal ot to © Mead vantages uteksort “vot lane ty paparmene Le Cor Slow ri we Choose port P 2 Regul re cartjel pivot weldion 2+ pecunstus tuys con coke Ma Cock over low ust umten so te avnlde Ose wen (tke (ack > leaps cork 08 not have TH u o ble Un qutt ort Overy tow (08 Ine large datasets) yowich can OCcuY pr > Wap scot Aoant yeguira axha wuemory cola ar quel sor used ertya Meo aileap 204 wont dspend on pivot, sos f medi chable + of acurstue calls + apomante Ys more SHoay 5 cot handles Lange datasets ajitelenty ty all dhe (ase. ead vautages * OT ts more Conuplex to fplerasul alles than the tuserb 6p 4 bubble Sat Tt may cad fo olalvad (0% cmaller dala sets - > Manory aitess fa leap soxt ‘is nol-zequen clad , eh mag lead to Tae} ftcleut use 4 cpu lathe Dtnread Kus wold , ukeles ot cache offi den of pork Noni wg oy kn male t+ (artets expediatty on aud. sinnp let modian bles Chem all. So¥ by ir = External Sorting fs one qd Jke gortin are used cohen the dda to be! govted Ades nok fit shutee tn the main memo’ y (RAM) aud must yatde en external storage, auth wp ahard dake | = these eae miiutdtzes Menary ws Lb adits fe dete Tn Choumles (sual yatkd te dake oO Medel for Le tiunal sothiug j- ine a Teo plane Modal, wolvel_tnvol ves Sorting and bo haud le data a than the avat labe Memory, 4 externa storage anf Ulo [ #6 merge a ode! ensures offiaent use } oaths m os Able Hoy o 0-0. WLialm |

Vous aimerez peut-être aussi