Mr Funtins Grphs, Pruts, & Rltins Unirt Grphs An unirt grph is pir f 1. A st f ns 2. A st f gs (whr n g is st f tw ns*) Friy, Sptmr 2, 2011 Ring: Sipsr 0.2 ginning f 0.4; Stughtn 1.1.5 ({,,,,}, {{,}, {,}, {,}, {,}, {,}, {,}}) CS235 Lngugs n Autmt Dprtmnt f Cmputr Sin Wllsly Cllg *This finitin s nt llw s-ll slf-gs frm n t itslf. W ul xtn th finitin t llw slf-gs, ut w wn t tht hr. Grphs, Pruts, & Rltins 3-2 Dgr Th gr f n is th numr gs t tht n. gr() = gr() = gr() = 3 gr() = 2 A Thrm Fr vry grph G, th sum f th grs f ll th ns in G is n vn numr. Sm sy ns Sm nt s sy gr() = 1 sum = 2 + 2 + 2 = 6 sum = 1 + 3 + 3 + 4 + 4 + 2 + (7*1) = 24 Grphs, Pruts, & Rltins 3-3 Grphs, Pruts, & Rltins 3-4
Ptin Grsshppr Right, s ff w g thn Fining prfs tks tim. Cnsir lts f (smll) xmpls t gin intuitin. Cm k t it. Lt th unnsius slf hlp yu. Us simpl, lr piturs n/r txt. B nis. Brvity hlps yu xprss high-lvl is withut gtting lst in th til. Thrm. Fr vry grph G, th sum f th grs f ll th ns in G is n vn numr. Prf. 1. Evry g in G is nnt t tw ns. 2. Eh g ntriuts n t th gr f h n t whih it is nnt. 3. Thrfr h g ntriuts tw t th sum f th grs f ll th ns. 4. Erg, if G ntins gs, thn th sum f th grs f ll th ns f G is 2, whih is n vn numr. Grphs, Pruts, & Rltins 3-5 Grphs, Pruts, & Rltins 3-6 A Prf y Cnstrutin A grph is 3-rgulr iff vry n hs gr 3. Pths A pth is squn f ns nnt y gs. Thrm. Fr h vn numr n grtr thn 2, thr xists 3-rgulr grph with n ns. Prf. Lt n n vn numr grtr thn 2. Cnstrut G = (V, E) with n ns s fllws... On nstrutin tht wrks fr n=8 pth (,,,) pth (,,,,,) Grphs, Pruts, & Rltins 3-7 Grphs, Pruts, & Rltins 3-8
Cyls A yl is pth ginning n ning t th sm n. A simpl yl rpts n ns xpt th first/lst. Cnntnss A grph is nnt iff thr is pth twn vry tw ns. simpl yl (,,,) nnt grph unnnt grph Grphs, Pruts, & Rltins 3-9 Grphs, Pruts, & Rltins 3-10 Trs A tr is nnt grph withut ny simpl yls. On f ths is tr: Pirs n Crss Pruts (, ) nts pir = n (rr) squn f tw lmnts. is th first (r lft) lmnt f th pir: first( (,) ) = is th sn (r right) lmnt f th pir: sn( (,) ) = Fr ny tw sts A n B, A x B = {(,)! A n! B }. This is ll th rss prut r Crtsin prut f A n B. E.g., Supps Sign = {-,0,+} Thn Bl x Sign = { (T, -), (F, -), - T F (T, 0), (F, 0), (T, +), (F, +) } 0 + Th siz f finit st S is writtn S. Wht is A x B in trms f A n B? Grphs, Pruts, & Rltins 3-11 Grphs, Pruts, & Rltins 3-12
Dirt Grphs An irt grph is pir f 1. A st f ns 2. A st f irt gs (whr h g is pir f tw ns*) ( {,,,,}, {(,), (.), (,), (,), (,), (,), (,), (,)} ) *This finitin s llw slf-gs frm n t itslf. Out-Dgr n In-Dgr In irt grph: A n s ut-gr is th numr gs lving it. A n s in-gr is th numr f gs ntring it. ut-gr() = 0 ut-gr() = 1 ut-gr() = ut-gr() = 2 ut-gr() = 3 in-gr() = 0 in-gr() = 1 in-gr() = in-gr() = 2 in-gr() = 3 Grphs, Pruts, & Rltins 2-13 Grphs, Pruts, & Rltins 2-14 Tupls n Gnrl Crss Pruts W n tk th rss prut f ny numr f sts. An lmnt f A 1 x A 2 x x A k is ll k-tupl. Fr smll k, k-tupls hv spil nms: k k-tupl k k-tuipl 0 unit 5 quintupl, pntupl 1 singltn 6 sxtupl, hxtupl 2 pir, upl 7 sptupl 3 tripl 8 tupl 4 qurupl 9 nnupl A k stns fr A x A x x A (k tims). A 1 is nsir synnym fr A. A 0 is nsir synnym fr Unit = {unit} ( 1-lmnt st)! Chrtrs n Strings Fr th tim ing*, w ll fin Chr = {,,,, A, B, C,.., 0, 1, 2, } String = { s s! Chr k fr sm k! Nt} Th lngth f string is th siz f its tupl. Strings r usully writtn using ul-qut nttin r n-qut nttin rthr thn s tupls: tupl ul-qut n-qut lngth (C, S, 2, 3, 5) CS235 CS235 5 () 1 () " 0 * Ltr w ll s tht Strings n prmtriz vr n lpht. Grphs, Pruts, & Rltins 3-15 Grphs, Pruts, & Rltins 3-16
Binry Rltins A inry rltin n A n B is ny sust f A x B. Exmpls: ntinschr = {(s, ) s! String,! Chr, is hr in s} issqrtof = {(i, n) i! Int, n! Nt, i 2 = n} Sm Binry Rltin Dfinitins Th invrs f inry rltin R n A n B is th rltin R -1 = {(,)! B,! A, n (, )! R). E.g. ntinschr -1 qu, 9 issqrtof -1-3 lst = {(, ),! Nt n # 2} smln = {(s, t) s, t! String, lngth(s) = lngth(t)} If R is inry rltin, (, )! R is ftn rvit s R (infix nttin) r R(,) (prfix nttin). E.g. qu ntinschr r ntinschr( qu, ) -3 issqrtof 9 r issqrtof(-3, 9) 5 lst 3 r lst(5, 3) A inry rltin n A is ny sust f A x A. E.g., lst n Nt, smln n String Rltins n gnrliz t ny numr f sts. Grphs, Pruts, & Rltins 3-17 A inry rltin R n A is: rflxiv iff R fr ll!a. symmtri iff x R y implis y R x. trnsitiv iff (x R y n y R z) implis x R z. An quivln rltin is n tht s rflxiv, symmtri, n trnsitiv. Rltin rflxiv? symmtri? trnsitiv? quiv. rl.? = n Int < n Int lst smln Grphs, Pruts, & Rltins 3-18 Clsurs f Binry Rltins Supps R is inry rltin n A. Th rflxiv lsur RC f R is th smllst suprst f R tht s rflxiv: RC = R U {(, )! A}. Th trnsitiv lsur TC f R is th smllst suprst f R tht s trnsitiv. I.., it is th smllst rltin TC suh tht (1) R $ TC n (2) (x, y)! TC n (y, z)! TC implis (x, z)! TC. Th rflxiv trnsitiv lsur f R is th rflxiv lsur f th trnsitiv lsur f R. E.g. Simpl = {(0,5), (5, 3), (3, 8)} (A = {0, 3, 5, 8}) isonlss = {(i, i+1) i! Int} Rltin Rfl. Cls. Trns. Cls. Rfl. Trns. Cls, Simpl isonlss Grphs, Pruts, & Rltins 3-19