Outlin Computr Sin 331, Spnnin, n Surphs Mik Joson Dprtmnt o Computr Sin Univrsity o Clry Ltur #30 1 Introution 2 3 Dinition 4 Spnnin 5 6 Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 1 / 20 Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 2 / 20 Introution, Spnnin n Surphs Pths n Simpl Pths Dinition: A pth in n unirt rph G = (V, E) is squn o zro or mor s in G Gols or th Ltur: W will introu prtiulr typ o rph (r) tr tht will us in initions o rph prolms, n rph lorithms, throuhout th rst o this ours Aitionl importnt initions n rph proprtis will lso introu (v 0, v 1 ), (v 1, v 2 ), (v 2, v 3 ),..., (v k 1, v k ) whr th son vrtx (shown) in h is th irst vrtx (shown) in th nxt. Th pth shown ov is pth rom v 0 (th irst vrtx in th irst ) to v k (th son vrtx in th inl ). This is simpl pth i v 0, v 1,..., v k r istint. Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 3 / 20 Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 4 / 20
Pths n Simpl Pths Cyls n Simpl Cyls Dinition: A yl (in n unirt rph G = (V, E)) is pth with lnth rtr thn zro rom som vrtx to itsl: Dinition: Th lnth o pth is th lnth o th squn o s in it. Thus th pth shown in th prvious sli hs lnth k. Dinition: An unirt rph G = (V, E) is onnt rph i thr is pth rom u to v, or vry pir o vrtis u, v V. A yl (v 0, v 1 ), (v 1, v 2 ),..., (v k 2, v k 1 ), (v k 1, v 0 ) is simpl yl i v 0, v 1,..., v k 1 r istint. A rph G = (V, E) is yli i it os not hv ny yls. Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 5 / 20 Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 6 / 20 Dinition Prolm: Thr is No Compltly Stnr Trminoloy! Prolm with Trminoloy Dirnt rrns tn to us ths trms irntly! For xmpl, in som txtooks, simpl yl is onsir to kin o simpl pth, n th inition o yl ivn is th sm s th inition o simpl yl ivn ov Othr rrns only ll somthin pth i it is simpl pth, s in ov; thy only ll somthin yl i it is simpl yl; n thy us th trm wlk to rr to th mor nrl kin o pth tht is in in ths nots Consqun: You shoul hk th initions o ths trms in ny othr rrns tht you us! Dinition: A r tr is onnt yli rph. Frquntly w just ll r tr tr. I w intiy on vrtx s th root, thn th rsult is th kin o root tr w hv sn or. Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 7 / 20 Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 8 / 20
1 2 Consir rph G = (V, E): 1 I G is onnt thn E V 1 2 I G is yli thn E V 1 3 I G is onnt n yli thn E = V 1 S th ltur supplmnt or proos. Consir rph G = (V, E). W will us th ollowin proprtis to hrtriz trs: 1 I G is tr thn it hs V 1 s 2 An yli rph with V 1 s is tr 3 A onnt rph with V 1 s is tr S th ltur supplmnt or proos. Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 9 / 20 Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 10 / 20 Spnnin Spnnin Spnnin Suppos G = (V, E) is s ollows. I G = (V, E) is onnt unirt rph, thn spnnin tr o G is surph Ĝ = ( V, Ê) o G suh tht V = V (so tht Ĝ inlus ll th vrtis in G) Ê E Ĝ is tr. Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 11 / 20 Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 12 / 20
Spnnin Spnnin Tr 1 Tr 2 Is th ollowin rph G 1 = (V 1, E 1 ) spnnin tr o G? Ys! Is th ollowin rph G 2 = (V 2, E 2 ) lso spnnin tr o G? Ys! Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 13 / 20 Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 14 / 20 Tr 3 Spnnin Is th ollowin rph G 3 = (V 3, E 3 ) is lso spnnin tr o G? No! Dosn t spn G (vrtx missin) Suppos G = (V, E) is rph. Ĝ = ( V, Ê) is surph o G i Ĝ is rph suh tht V V n Ê E G = (Ṽ, Ẽ) is n inu surph o G i G is surph o G n, urthrmor { (u, v) E u, v Ṽ Ẽ = tht it possily oul }, tht is, G inlus ll th s rom G Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 15 / 20 Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 16 / 20
G 2 is n inu surph o G 1. G 3 is surph o G 1, ut G 3 is not n inu surph o G 1. G 1 G 2 G 3 Lt G = (V, E) n lt s V. Construt sust V p o V, sust E p o E, n untion π : V V {NIL} s ollows. Initilly, V p = {s}, E p =, n π(v) = NIL or vry vrtx v V. Th ollowin stp is prorm, twn 0 n V 1 tims: Pik som vrtx u rom th st V p. Pik som vrtx v V suh tht v / V p n (u, v) E. (Th pross must n i this is not possil to o.) St π(v) to u, th vrtx v to th st V p, n th (u, v) = (π(v), v) to E p Not tht V p V, E p E, n h in E p onnts pirs o vrtis tht h lons to V p h tim th ov (intrior) stp is prorm so tht G p = (V p, E p ) is lwys surph o G. Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 17 / 20 Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 18 / 20 Prssor Surph Proprty h i h i π NIL h Th rph G p = (V p, E p ) tht hs n onstrut is ll prssor surph. Clim: Lt G p = (V p, E p ) prssor surph o n unirt rph G. ) G p is surph o G n G p is tr. ) I V p = V thn G p is spnnin tr o G. Proo. Prt () is tru us E p = V p 1, y th onstrution o V p n o E p, n G p is lwys onnt, so G p is tr, s wll s surph o G. Prt () now ollows y th t tht E p is sust o E, so tht G p is surph o G, n y th t tht V p = V. Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 19 / 20 Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 20 / 20