0% found this document useful (0 votes)
5 views15 pages

Unit 2 Graph Notes

The document discusses various types of graphs, including complete graphs, directed graphs, and weighted graphs, along with their properties such as adjacency, degree, and connectivity. It also covers graph representations like adjacency matrices and lists, and traversal methods including breadth-first search and depth-first search. Additionally, it explains concepts like articulation points, bridges, and the classification of graphs as simple, multi, or regular.

Uploaded by

pk890q
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
0% found this document useful (0 votes)
5 views15 pages

Unit 2 Graph Notes

The document discusses various types of graphs, including complete graphs, directed graphs, and weighted graphs, along with their properties such as adjacency, degree, and connectivity. It also covers graph representations like adjacency matrices and lists, and traversal methods including breadth-first search and depth-first search. Additionally, it explains concepts like articulation points, bridges, and the classification of graphs as simple, multi, or regular.

Uploaded by

pk890q
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
vabh Eyaph! > Grabbh. 1s @ collectrem_ of vertices Sand edges: Grabh terminology.) > z ((—= N Graph? > which hac no edges, ; 3 contain only verter.a is § callec_Nvlt } Graph 8 bi D> A Graph G ts satel to be_complete 1f every node +tn_Ci_ts. amie every other node tn G._A__complete __grabh nodes voll + have _n(n-1) J2_ eclges. SS J mseighiel Graph! > _A Grabh Is satel to be Qwerghted graph. rf all | the edges. In rt axe Labelle with same = Numbers: _ _——s berets ? 7 xf the pas of Lees ed a ee called au ice ra he » ar: toate re con be gepresented as (viva) 01 Wary) also— Fo hes ee r Bl v(ay= 9 ¥.2,3)4,5, 6,70 =e If the parr of vertices ane Ee ir erclered then grab G_ts_called. Directed _ q(rabb.- Fak tsa, elivected graph pot of vertaees C12, ,U2) where 19) 1's the toil_and_W2 ts the Read ot Jheeclge - In this fig= 8 7 = st Is fost of sabh 1s 0. qrabh. which hasoxderet (eli O | le vows £23, 41,58 eCa)= $ C1-2),C2,5), C542, C42) 03,4)03.)3 3 opi- _1f there fs an ene whose | starting and end vertices ane some thot te (uw ,wi2) 1s_an edge. then 1¢ i is calied a seit tapp- ‘ paralle| ectgesis Tf hene Qne_mave thar ge“ ‘me edge between the same paly_of vertices then they ave fawn as _payallel edges following “hrg~ Shows the self loop Qnel_ paralle’ edges - a Nz a Na, 4 Sdjacent vertices > A_vertex 1s adjacent i> ——— to other vertex 12 fF shee Is An_edge from u to 12 > dn_undtrectecl grabh if Ginam ( v, ; wo SS an_edlge then g ws Apa incl Bets _adljacent tp 12), * > Ln_a, oltvected Grabh "FC, 82) V5 an then is 0 gad: ABPadjacent tp 13.10" % andl ree of vertex. a the at ae of edlgex é ( he : ; 14 ‘tool _q7apb_»the numer , 0 eae onmeced, © é node 1s called she clegree__of hat node : Considen_the grabh, as shown fn fa- 4 o-—® R 2 Here, for the vertex 2 _ the olegree. ts_2. : because 3 edges ane inciclent to the se ape vertex 2. _ a Ly In_a_diagrabh, there ore te clegree for_everg. node 2. Ie ree ‘ Tl 2 ciate . i g Ln-clegree of a_vertex' > he _jndegree 3 Of A. vertex t fs he _numbe ny i ao n Of edges coming +o butt degree of a vertex! > ee. outdleqree the number sat ver tee gpa that side fiom of ek edges gory. @ 6 Here, the vertex 2, the tndegree 1S 2 ae the vextexa, the outdlegree 152 Simple pyabhi> A ques ot cltrected ftabh — *" which eloes not “Rave omly self mb Gr fanalle| edges 1's callecl a Stmple graph. Pu fathi> A graph which hag eithez 2 a self -loop_or_parallel edges or both_ts called multi - 9 raph: peo: Regular 9raphi> A grabh ts creqular iF eee every node rs” adjacent ato _+he some numberof nodes les 4 ‘ ( R Pannier. planer graph! > qa to —blonnan_ vf planer oP con! pe —cluaunn 10 a plane without ang 720 edges intersecting Ina grabb, 4uoo vertices. —“ 19, and “vz ane sald to be connecteo_1F “yhere 1s a path _t'n G =% om 5 to Ba, tr_1s2 40 18 A 1a ph 18 Tod to be connected rp Yhene 1s 0. “a path from any mode of graph toon 4 other node, — 1. for every pati Of i oustinct vertices tn Gy there "ea both ig ectedl_g1abh (@) connected graph. Up, Not connected. te fra rab. P (0) _stong ly Connected Griabh > A dwiel = aa venta ts tn a ae s _connected Toph rp ee tee a olistinet aS ae 2 (weakly connectedt ; 1{ foonectedl _arabh. > y fe culleh nenkie iasey a nate i of pe ar ae a fal of a path cone al 7 11/02/26 Pee ation _batnt!> 1F on memaving a becames node fiom the graph, the raph eel ri hat ae te called the aytticulation point Bordge!> Tf om nemoving an edge ; from the grabb the grabh — becomes _ oli’s connectecl_ then ges f Mallecl the Bridge Biconnected graph) > page no = Ss axticuldtion _pa‘nts — 1 allect a _Riconnecteel_grabh- Representation of Guabb hh many eons: = ba, + Set Representation 2 Sequential Representation aC. poate (y— Enciclence! —dinked representation A_grabh can be peered ie ® 5 qa this svebresentatin tation cet Represent ap gets one mainland, hey. ane: ; re 7 wo © cet of De cehieh rete subset _of (i set of edges Fy VxV. por the fiQ- ul : ’ 5 a : + 4 VEG) = 12,8, 4,565 — z Cod = $C 42) C2,a) C89), C48)s CIS 7 ae 9 (prom the memory point of view tt Is most efficient method =a +_pis advantage!= i 2 |: Fhis_ tebresentation_cloes not alleco the 4 | _ storing allel eck b aay : 4 ne pa: es tn a multigaa}h ication _ of grahs olf feadt: 2 Adjancey pee 11/02/26 Pi Adjancency- Matrix’= | mae ie eee NS i | Geen mre | yo. o } une Vell 1 ° 1 ° melt \ o ee | vs | 0 o ° ! o f 1. ptei Manipulatin of +he grab with this —tefnesentation_s very ease . 2" OF allows” stéring™ of ~ paralle| edges i a] Dis gelvontage. > | shoce fg wasted : 2 Insertion and oleletion operations ane not_that much easy when combaxel to +the Ainked _ nebresentatton. dist 5) node Adljancenc’ a ae 2 uy a B.S ; ti A 2 a 24 ie ¢& ‘# D jac iz Advanjage:=|> 9+ sa sbace_- sn sing 3 tts olynamuc nature et a "Ot allows stoxing of paralle| eolges. 4 Lnsettion ,eleletion “ant. omer oped, we ety "eben ope Operations 11/02/26 cia pis [Link] phe \ potnten “fields fields tn addition ane used as extia to. the clata fields 2 jhere_1 no faster coay~ than to search fhe —entive Lost fx th presence of the ts (i) Lncicence_Matrix! > Suppose. the gor a as. -follows!~ al = « 5 a Sor versing. & 9 4 { \- 4 a Afi traversal nea Rese de of a qrab A chienahc ajpecod There ane +wo qa | methods != a fo ena Pirst_ Search sy tu) Debth. Plust Search a isiting all a visit 4. no n- Traversal * \, $i wv | Fhere ts np -first_node_or woot _ndde in 1 a. gate hence the +raversal can stash __ 3 node. ed 2: ‘fone os im, 2 Tn hee of List when we start traversing 1 om. the first node, all the —nocles_ ane 3: troversed but tn graph_only. hose nodes 2 * will be traverseol dohich_ yeoch able qrom the starting. So ff we esant to -feaverw all 4he %eachable nodes we again have to 5 select another starting node “fm +1 the temeine rode ef ge In tree dk list cohile . never encounter q eae at ee but while traversh f7abh, there may be ossi bility that we! seach a node’ etka once - So fo ensure that each ade is & if owe we Fave to keeb the 4 Status of ” eoch node usheather rt has been = 7 ae ane dust we have unique traversal. Wwe - fin_eq =f we ane eS ine = ee in _tnorcler_+here_can be ot ae sequence 1p ahich nodes one pass per tn giabh, fur the same_technique 1 qe there’ can be oliffereut sequence —[n hic! nodes can be visited: Breadth earch, a 4 Initialize all nodes to the neady state Cstatus = 1) 7 2: put the staxting node_in the. queue i Ond change ts ‘status to the wathng State Cstatus = 2) és 3 _gebeat step4 anc stebstumti| Queue embif!- 4 Remove the font EN of Sucue- process Nand change the status of N € to +the processed state Cstatus = 3) ts Add to +he near of Queue all the —_nelahbot's_of N that ane tn the stead _— ‘state Cstatus= 1) , andl change their status 3 +o the ae State (status = 2) — End of _steb\3 Ett ote Dy cL ze pt eh vertex. - Adjaaency list 4 a 8, oD 8 DE i ag ai a i: D E * into flys = a i: a a Pe ot ‘) Alg[e] SEL ofl e fay Toverse. A B.C, DE abe 1. Initialize all nodes to the neady state Cstatus= 4) nede Aon to stack ancl 2. Push the stonting- change | tts status. to the malting. state (status = 2) 3: Rebeat steb4 and S until stack I's empty 4 pop’ the top node N of stack process Nand change tts status to the pmcéssed. state Cstatus = 3) Be push onio stack all the neighbors ee ane_étill_tn_the_oead 4¢- state (siatus= 1), and change “thely |) status tothe “aling sla H Cstatus = 2) , 4 (End of “step3J Eouit

You might also like