Grphs CSC 1300 Disrt Struturs Villnov Univrsity
Grphs Grphs r isrt struturs onsis?ng of vr?s n gs tht onnt ths vr?s. Grphs n us to mol: omputr systms/ntworks mthm?l rl?ons logi iruit lyout jos/prosss f Qus%ons n isomorphism n yls/pths n plnrity n oloring
Grphs: Bsi Trminology A grph is fin s G = (V, E) with th st of vr?s V n st of gs E Two vr?s u n v in n unirt grph G r jnt (or nighors) if {u, v} is n g of G. Th g is si to onnt (or to inint with) u n v. orr of grph = numr of vr?s G = ({v 1, v 2,,v 3 }, { 1, 2 }) grph of orr 3 g: g 2 onnts v 2 n v 3 v 2 v 3 2 1 v 1 G
Dirt Grphs By fini?on, th gs of irt grph r orr pirs. In irt grph, if w hv g = (u,v), thn u is si to jnt to v, th trminl vrtx v is si to jnt from u, th ini2l vrtx 1 = (,) 2 = (,) 3 = (,) 4 = (,) 5 = (,)
Typs of Grphs Typ Egs Multipl Egs? Simpl grph Unirt No No Multigrph Unirt Ys No Psuogrph Unirt Ys Ys Dirt grph Dirt No Ys Dirt multigrph Dirt Ys Ys Loops? Trminology vris sur to hk fini?ons whn onsul?ng othr ooks/r?ls
Dgr of vrtx Th gr of vrtx v is th numr of gs inint on v. Dnot g(v) A loop on v ontriuts 2 to th g(v) Exmpl: g() = 3 g() = 1 g() = 5 g() = 0 g() = 1
Hnshking Lmm In n unirt grph, th sum of th grs of th vr?s is twi th numr of gs. Thrfor, th sum of th grs of ll th vr?s is vn. Σ g(v) = 2 E. v V Corollry: An unirt grph hs n vn numr of vr?s of o gr.
Pth A wlk gins t vrtx v 0, follows n g 1 to v 1, follows nothr g to v 2 A wlk is rprsnt without gs whn thr r no prlll gs (v 0, v 1, v 2, v n ) Si to of lngth n A tril from v 0 to v n is wlk with no rpt gs. A pth from v 0 to v n is wlk with no rpt vr?s. A wlk is los if it strts n ns in th sm vrtx; othrwis th wlk is si to opn
Ciruits n yls A iruit is los tril of lngth grtr thn 2. Som yls: (,,,,,) (,,,,,,) (,,,,,,) (,,,,,,) (,,,,,) A yl (or simpl iruit) is iruit from v to v with no rpt vrtx, xpt v. 3-yl or tringl: yl of lngth 3 k-yl: yl of lngth k
Connt Grph A grph G is onnt if givn ny vr?s v 1 n v 2 in G, thr is pth from v 1 to v 2. Connt f Not Connt f onnt omponnts
Bipr?t Grph A simpl grph is ll ipr@t if its vrtx st V n pr??on into 2 isjoint sts V 1 n V 2 suh tht vry g in th grph onnts vrtx in V 1 to vrtx in V 2. Bipr%t V 1 = {,,} V 2 = {,} Not Bipr%t
Ai?onl onpts (s txt) mul?pr?t rig ut- vrtx isonnt onnt omponnt
Spil Grphs Cyl C n Cyl P n Whls W n Complt grph K n Complt Bipr?t K n,m 2-rgulr: ll vr?s hv gr 2 n-rgulr: ll vr?s hv gr n. Tr: onnt grph with no yls Forst: grph with no yls
Complmnt Lt G = (V, E) Th omplmnt G = (V, E ) whr E = {{u,v} u V n v V n {u,v} E} Exmpl: Wht is th omplmnt of G 1? G 1 f
Union Th union of G 1 =(V 1,E 1 ) n G 2 =(V 2,E 2 ) is th grph: Exmpl: G 1 G 2 = (V 1 V 2, E 1 E 2 ) G 1 G 2 f G 1 G 2 f A onnt omponnt of grph is sugrph tht is onnt.
Sugrph H is sugrph of G iff V(H) V(G) n E(H) E(G) Exmpl: G 2 is sugrph of G 1 G H f
Sugrphs H is n inu sugrph of G iff whnvr two vr?s of H r jnt in G, thy r lso jnt in H. in othr wors, H onsists of sust of G s vr?s n ll th gs twn thm A sugrph H of grph G is spnning sugrph of G iff V(H) = V(G).
V Rprsnt?on of Grphs E {{,,,, }, {{,}, {,}, {,}, {,}, {,}, {,}, {,}} 1 2 4 7 5 3 mul?st rprsnt?on (llows rp??on) 6 Ajny list Ajny mtrix :,, :, :, :,, :,, 0 1 1 0 1 1 1 0 0 0 1 0 0 1 0 0 0 1 0 2 1 0 0 2 0
Isomorphism It mns two grphs r ssn?lly th sm (my rwn iffrntly n r-ll) Sm numr of vr?s Sm numr of gs Sm gr squn G 1 f G 2 Som?ms it is hr to tll r ths ssn?lly th sm grph? 2 4 nssry ut NOT suffiint oni?ons 1 6 3 5
Isomorphism Dfini?on: Two grphs G 1, G 2 r isomorphi iff thr xists ij?on h : V(G 1 ) à V(G 2 ) suh tht {v, w} E(G 1 ) iff {h(v), h(w)} E(G 2 ) In othr wors, h is ij?on twn th vr?s of th two grphs tht prsrvs gs In this s, th isomorphism fun?on is th in?ty fun?on. 1 2 5 6 3 4 6 4 5 2 1 3 h(1) = 1 h(2) = 2 h(3) = 3 h(4) = 4 h(5) = 5 h(6) = 6
Isomorphism Dfini?on: Two grphs G 1, G 2 r isomorphi iff thr xists ij?on h : V(G 1 ) à V(G 2 ) suh tht {v, w} E(G 1 ) iff {h(v), h(w)} E(G 2 ) In othr wors, h is ij?on twn th vr?s of th two grphs tht prsrvs gs if w rnumr th vr?s, th grphs r s?ll isomorphi, ut w gt iffrnt isomorphism fun?on 1 2 5 6 3 4 1 4 5 6 2 3 h(1) = 4 h(2) = 3 h(3) = 6 h(4) = 2 h(5) = 1 h(6) = 5
Isomorphism It mns two grphs r ssn?lly th sm (my rwn iffrntly n r-ll) Sm numr of vr?s Sm numr of gs Sm gr squn G 1 Som?ms it is hr to tll r ths ssn?lly th sm grph? f G 2 2 4 nssry ut NOT suffiint oni?ons 1 NO G 1 is 3-rgulr, whrs G 2 is not (g, vrtx 5 hs gr 2) 6 3 5
Isomorphism G 1 Som?ms it is hr to tll r ths ssn?lly th sm grph? f f G 2 YES è Isomorphism fun?on: h() = 5 h() = 3 h() = h() = 6 h() = h(f) = 3 1 2 5 6 4