Round 7: Graphs (part I)
|
|
- Corey Briggs
- 5 years ago
- Views:
Transcription
1 Roun 7: Grphs (prt I) Tommi Junttil Alto Univrsity Shool o Sin Dprtmnt o Computr Sin CS-A40 Dt Struturs n Alorithms Autumn 207 Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn 207 / 55
2 Topis: Grphs Rprsntin rphs Brth-irst srh Dpth-irst srh Topoloil sortin Stronly onnt omponnts Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
3 Mtril in Introution to Alorithms, 3r. (onlin vi Alto li): Stions Extrnl links: MIT OCW vio on rth-irst srh MIT OCW vio on pth-irst srh n topoloil sort Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
4 Dirnt kins o rphs n ntworks r vrywhr: th prossor o omputr is ntwork o loi ts intrnt soil ntworks mps pnny rphs (ours prrquisits t) t n t Grphs s mthmtil struturs r n importnt strtion or rsonin out suh systms Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
5 A prt o th intrnt in 2005: (iur: Mtt Britt, Crtiv Commons-lins, sour) Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
6 Europn E ros: (iur: puli omin, sour) Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
7 Mthmtil prliminris Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
8 Unirt Grphs Rp rom th roun on trs An unirt rph is pir (V,E), whr V is (usully init) st o vrtis (lso ll nos), n E is st o s twn th vrtis, i.. st o pirs o orm {u,v} suh tht u,v V n u v Exmpl Consir th rph (V,E) with th vrtis V = {,,,,,,,h}, n th s E = {{,},{,},{,},{,}, {,},{,},{,},{,},{,}}. It is illustrt rphilly on th riht with vrtis rwn s irls n s s lins twn th vrtis Sl-loops, i.. s twn vrtx n itsl, r orin in unirt rphs hr Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
9 A pth o lnth k rom vrtx v 0 to vrtx v k is squn (v 0,v,...,v k ) o k + vrtis suh tht {v i,v i+ } E or h i = 0,,...k A vrtx v is rhl rom vrtx u i thr is pth rom u to v. Not tht h vrtx is rhl rom itsl s thr is pth o lnth 0 rom th vrtx to itsl A pth is simpl i ll th vrtis in it r istint Th rph is onnt i vry vrtx in it is rhl rom ll th othr vrtis Exmpl Th rph on th riht hs (non-simpl) pth (,,,,,) rom to hs simpl pth (,,) o lnth 2 rom to is onnt ut ltin th {,} woul mk it isonnt Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
10 A yl is pth (v 0,v,...,v k ) with k 3 n v 0 = v k Exmpl A yl (v 0,v,...,v k ) is simpl i v,v 2,...,v k r istint A rph is yli i it os not hv ny simpl yls Th rph on th lt is not yli s it ontins, mon mny othrs, simpl yl (,,,) Th rph on th riht is yli Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
11 Dirt Grphs In irt rphs th s hv irtion A irt rph (or irph), is pir (V,E), whr V is (usully init) st o vrtis, n E V V is st o s twn th vrtis: pir (u,v) E nots n rom th vrtx u to th vrtx v. Exmpl Consir th rph (V,E) with th vrtis V = {,,,,,,,h}, n th s E = {(,),(,),(,), (,),(,),(,),(,),(,),(,), (,),(,)}. It is illustrt rphilly on th riht with vrtis rwn s irls n s s lins with irtion rrows Noti th loop rom th vrtx to itsl n th two s twn th vrtis n Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn 207 / 55
12 Th out-r o vrtx is th numr o s rom it whil th in-r is th numr o s to it A pth o lnht k rom vrtx u to th vrtx u is squn (v 0,v,...,v k ) o k + vrtis suh tht v 0 = u, v k = u n (v i,v i+ ) E or ll i = 0,,...,k A pth is simpl i ll vrtis in it istint A pth (v 0,v,...,v k ) is yl i k n v 0 = v k Exmpl In th rph on th riht, th in-r o is 2 n th out-r is som simpl pths r (), (,,), n (,,) th yls r (,), (,,,), (,,,), (,,) Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
13 Dirt Ayli Grphs (DAGs) A irt yli rph (DAG) is irt rph tht os not ontin ny yls Suh rphs ris in mny pplitions, s.. this wikipi p Exmpl DAGs ris nturlly in mny tim- n orr-rlt rs whr somthin hs to on or somthin ls n on wth pnts trousrs lt jkt ti unrshirt shirt soks shos In suh sitution yl woul mn tht som thins nnot on t ll As toy xmpl, pnny rph twn lothins or rssin up is shown on th riht ht Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
14 Rprsnttions or rphs Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
15 In orr to rson out rphs with lorithms, on hs to rprsnt thm in mmory An unirt rph n hv t most n(n ) n irph t most n 2 2 s A rph is sprs i its numr o s is smll ompr to this mximum numr o possil s, othrwis it is ns Sprsity is not n xtly in onpt Th two ommon rprsnttion mthos r: jny mtris, whih r minly us or ns rphs, n jny lists, th most ommon rprsnttion In oth o ths rprsnttions, th vrtis r usully ssum to th irst intrs {0,,...,n } so tht inxin is sy I mor omplx vrtx nms suh s strins r to us, on n mintin on mp rom ths to smll intrs so tht intrs n us insi th rph lorithm Th xmpls low us symoli nms suh s or ttr humn rility Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
16 Ajny mtris Th jny mtrix o irt rph G = ({0,,...,n },E) is n n inry mtrix A = ( u,v ) suh tht th ntry u,v is i (u,v) E n 0 othrwis Th mtrix is sy to stor in row-y-row it-vtor o lnth n 2 (n rry with n it intrs); th ntry u,v n oun t th inx un + v in th it-vtor Exmpl: A irt rph n its jny mtrix rprsnttion As it-vtor th mtrix is Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
17 Th jny mtrix o n unirt rph G = ({0,,...,n },E) is simply th uppr riht hl o th mtrix With 0 u < v < n, th ntry u,v is i {u,v} E n 0 othrwis I th mtrix is prsnt s row-y-row it-vtor, thn th ntry u,v n oun in th it un u(u+) 2 + (v u ) Exmpl: An unirt rph n its jny mtrix rprsnttion As it vtor th mtrix is n th it or th {,} n oun t th inx 2 7 2(2+) + (6 2 ) = = 4 unr th ) 2 mppin Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
18 Som nlysis: Goo or ns (n smllish) rps Ain or rmovin n tks onstnt tim Ain nw vrtx is xpnsiv Grphs with mny vrtis tk lot o mmory: th jny mtrix or irt rph with million vrtis woul tk ovr 00 iyts o mmory Trvrsin th nihours o vrtx not optiml i th r o th vrtx is low ompr to th numr n o ll vrtis (hv to o throuh ll th O(n) yts mkin th row) Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
19 Ajny lists Eh vrtx is ssoit to list o its nihours Nturlly, n rry or ynmi rry n us inst o th list s wll Exmpl: A irt rph n its jny list rprsnttion Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
20 Exmpl: A irt rph n its jny list rprsnttion in mor ompt orm Th vrtis r now {0,,...,6} Th nihours o vrtx u n oun in th surry s[strt[u],strt[u+]-] or s[strt[u],s.lnth-] or th lst vrtx u = strt s In th rprsnttion mtho ov, th two rrys ontin V + E intrs Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
21 Anlysis: Compt or sprs rphs: mmory us is O( V + E ) inst o O( V 2 ) Ain nw vrtx is n mortiz onstnt-tim oprtion whn ynmi rrys r us Ain n rmovin s linr in th r o th vrtis involv in th worst s whn th list/rry pr vrtx rprsnttion o th irst xmpl is us Itrtin th nihours o vrtx is sy Mor ommonly us s rphs in mny pplitions tn to oth lr n sprs Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
22 Rprsntin vrtx ttriuts In mny rph lorithms, w n to ssoit som t ttriuts to vrtis Thr r multipl wys to hiv this ut s/whn th vrtis r {0,,...,n }, th sist wy is to hv n rry o n lmnts holin th ttriut(s) From now on, w ssum tht ssin n sttin vrtx ttriut n on in onstnt tim Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
23 Brth-irst srh Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
24 An iint trvrsl lorithm tht ins, or th ivn sour vrtx s, ll th vrtis rhl rom s, n shortst simpl pth rom s to h rhl vrtx Th i is to strt rom th sour vrtx s n trvrs its outoin s. Th nihour vrtis tht hv not yt n visit r put in irst-in-irst-out quu. Eh vrtx is tkn out o th quu n its nihours r thn visit in th sm mnnr n put t th n o th quu i not yt visit. Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
25 At h point, vrtx is olor whit i it hs not yt n oun rhl rom s ry i it hs n oun rhl rom s ut not ll its outoin s hv n trvrs lk i it hs n oun rhl rom s n ll its outoin s hv n trvrs In ition, h vrtx t is ssoit with istn ttriut tht tlls th lnth o th shortst pth rom s to t, n prssor ttriut tht stors th nihour rom whih shortst pth th sour to it ws prou Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
26 In psuoo Brth-irst-srh(G, s): or h vrtx v V \ {s}: // Initiliz olors, istns n prssors v.olor WHITE v.ist v.pr NIL Q /0 // Q is FIFO-quu s.olor GRAY // Initiliz th sour vrtx s to ry s.ist 0 s.pr NIL nquu(q, s) whil Q is not mpty: u quu(q) // Tk th rlist ry vrtx rom th quu or h v with {u,v} E: // Trvrs h rom it i v.olor = WHITE: // Th nihour v hs not yt n visit? v.olor GRAY // Color it ry v.ist u.ist + // Stor th istn v.pr u // An th pth rom th sour nquu(q, v) // Put it t th n o th quu u.olor := BLACK // All s rom u trvrs Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
27 Exmpl Brth-irst srh on rph with two onnt omponnts. Th sour vrtx is Eh nnott rph low shows th olors, istns, n BFS-tr s in th innin o h whil loop n t th n o th lorithm (th lst rph). Th nihours r in th quu in n ritrry orr Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
28 For irt rphs on just rpls th lin or h v with {u,v} E with or h v with (u,v) E Exmpl Brth-irst srh on irt rph Th nihours r in th quu in n ritrry orr Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
29 At th n o th lorithm, vrtx is lk i it is rhl rom th sour vrtx is whit i it is not rhl rom th sour Furthrmor, or h lk vrtx th istn ttriut ivs th lnth o th shortst pth(s) rom th sour to th vrtx ollowin th prssor s prous shortst pth to th sour vrtx Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
30 Run-tim nlysis in th worst s: Eh vrtx is in th quu on Eh is onsir twi or unirt rphs; on or h n-point whn it turns rom ry to lk on or irt rphs whn th sour n-point turns rom ry to lk Enquu n quu r onstnt tim oprtions th lorithm runs in tim O( V + E ) On unirt rphs, inin th onnt omponnts is sy with BFS Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
31 Dpth-irst srh Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
32 Anothr systmi mtho or trvrsin rphs Fins ll th vrtis tht r rhl rom vrtx Dos not in th shortst pths or smllst istn rom sour vrtx But rvls som strutur o th rph tht n us in othr lorithm Th i (si vrsion irst): Strt visitin vrtis rom th sour vrtx Rursivly visit th whit nihours o th urrnt vrtx Whn strtin th visit, olor th vrtx ry Whn ll nihours hv n visit, olor th vrtx lk Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
33 In psuo-o Dpth-irst-srh(G, s): or h vrtx v V : v.olor WHITE v.pr NIL visit(u): u.olor GRAY or h v with {u,v} E: i v.olor = WHITE: v.pr u visit(v) u.olor BLACK visit(s) Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
34 Exmpl Dpth-irst srh on n unirt rph Th iurs low show th sitution t th innin o h ll to visit (th visit no is shown in lu) n t th n o th lorithm (th lst iur) Th nihours r in th quu in n ritrry orr Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
35 Ain, or irt rphs on just rpls th lin or h v with {u,v} E with or h v with (u,v) E Exmpl Dpth-irst srh on irt rph Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
36 Worst s run-tim nlysis: Eh vrtx is visit on (it must whit to visit n immitly turns ry whn visit) Whil vrtx is visit, h rom it is trvrs th lorithm runs in tim O( V + E ) Th (rvrs) prssor links iv pth, not nssrily shortst on, rom th sour vrtx to h vrtx rhl rom th sour Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
37 An xtn vrsion Lt us xtn th si vrsion y tthin to h vrtx two visit timstmp ttriuts: th strt timstmp tlls th tim on whih visitin th vrtx strt (th vrtx ws olor to ry), n th inish timstmp tlls th tim whn visitin th vrtx ws omplt (th vrtx ws olor to lk) Th timstmps r snin intrs strtin rom In ition to th timstmps, th lorithm is xtn so tht thr is no sinl sour vrtx or th srh ut nw sour vrtis r tkn (ritrrily or with som strty) or susrhs until ll th vrtis hv n visit Th lorithm now os not in th vrtis rhl rom sinl sour vrtx ut rvls som strutur o th rph Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
38 In psuo-o Dpth-irst-srh(G = (V, E)): or h vrtx v V : v.olor WHITE v.pr NIL tim 0 visit(u): // Innr rursiv untion or trvrsin vrtis tim tim + u.strt = tim u.olor GRAY or h v with {u,v} E: // (u,v) E or irt rphs i v.olor = WHITE: v.pr u visit(v) u.olor BLACK tim tim + u.inish = tim or h vrtx u V : i u.olor = WHITE: visit(u) Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
39 Exmpl Consir th rph on th riht Th susrhs (lls to th visit-untion in th lst lin o th min prour) strt rom th vrtis in lphtil orr hr Th s rom th vrtis r trvrs in n ritrry orr Th s rom th prssor vrtis r hihliht in lu A irt rph: 3/6 2/9 /0 /6 y z s t x w v u 4/5 7/8 2/3 4/5 Th sm rwn irntly: /0 /6 s t Th pir / nxt to vrtx tlls th strt n inish timstmp o th vrtx 2/9 z v 2/3 u 4/5 3/6 y w 7/8 4/5 x Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
40 Th s omin rom th prssor vrtis orm pth-irst orst Formlly, it is th su-rph G pr = (V,E pr ), whr E pr = {(u.pr,u) u V n u.pr NIL} Th pth-irst orst n onsist o svrl pth-irst trs root t th vrtx irst visit in h susrh Th pth-irst orst is not nssrily uniqu or th rph ut pns on trvrsl orr o th pth-irst srh Consir th tim intrvl [u.strt, u.inish] orm y th timstmps ssoit to h vrtx For th intrvls o two isjoint vrtis u n v on o th ollowin hols: [u.strt,u.inish] n [v.strt,v.inish] o not intrst h othr [u.strt,u.inish] is ully ontin in [v.strt,v.inish] [v.strt, v.inish] is ully ontin in [u.strt, u.inish] Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
41 Exmpl Consir th rph on th riht Th s in th pth-irst orst r hihliht in lu A irt rph: 3/6 2/9 y z /0 /6 s t Th vrtis z, y, x n w n rh rom s in th pth-irst orst n thir tim intrvls r ully ontin in th intrvl o s Th intrvls o th vrtis t, v n u lonin to irnt pth-irst tr o not ovrlp with th intrvl o s x w v 4/5 7/8 2/3 Th sm rwn in irnt wy: /0 /6 s t 2/9 z v 2/3 u 4/5 u 4/5 3/6 y w 7/8 4/5 x Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
42 Assum tht pth-irst srh hs n prorm in irt rph Th s o th rph n lssii orin to th srh s ollows: Tr s r th s lonin to th pth-irst orst Bk s r th s tht l rom vrtx to som nstor vrtx in th sm pth-irst tr (this inlus loop-s) Forwr s r th s tht l rom vrtx to som propr snnt vrtx in th sm pth-irst tr Cross s r th rst o th s For unirt rphs k n orwr s r usully onsir to th sm thin, n thr r no ross s Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
43 Exmpl Consir th irt rph n pth-irst srh shown on th riht A irt rph: 3/6 2/9 y z /0 /6 s t Th tr s r hihliht in lu Th k s r: (x,z) n (u,t) Th orwr s r: (s,w) x w v 4/5 7/8 2/3 Th sm rwn in irnt wy: /0 /6 s t u 4/5 Th ross s r: (u,v), (v,s), (v,w) n (w,x) 2/9 z v 2/3 u 4/5 3/6 y w 7/8 4/5 x Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
44 Som o th typs r sy to tt urin th pth-irst srh I th lorithm is in th untion invotion visit(u) n onsirs th (u,v) E, thn tht is tr i v is whit k i v is ry, n ithr orwr or ross i v is lk A irt rph is yli i n only i (ny) pth-irst orst os not ontin k s th yliity o irt rph n tt in tim O( V + E ) Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
45 Topoloil sort Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
46 A topoloil sort, or topoloil orrin, or irt yli rph (V,E) is linr orrin o its vrtis V suh tht or h (u,v) E it hols tht u pprs or v in th orrin Nturlly, irt rphs with yls o not hv suh linr orrins n nnot topoloilly sort Exmpl Rll th DAG rom prvious xmpl shown on th riht pnts trousrs ti unrshirt shirt ht Two topoloil sorts or th DAG r: wth lt soks jkt shos pnts,unrshirt,trousrs,shirt,lt,ti,soks,shos,wth,jkt,ht 2 wth,pnts,soks,trousrs,shos,lt,unrshirt,ht,shirt,ti,jkt Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
47 A topoloil sort n otin sily with pth-irst srh: Prorm pth-irst srh on th rph ut whn vrtx is inish (olor lk), it in th ront o link list t th n, rturn th list Th ky i or th orrtnss o this lorithm is: in DAGs, whn vrtx is olor lk, ll th vrtis rhl rom it r lk n thus ltr in th prou topoloil orrin In DAGs suh rhl vrtis nnot ry us tht woul mn tht th rph hs yl Topoloil sort n on in tim O( V + E ) s th lorithm ov is simpl vrint o DFS Othr lorithms lso xists, s.. this wikipi p Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
48 Exmpl Rll th DAG rom prvious xmpl shown on th riht Th timstmps prou y n ritrry DFS on it r lso shown [9,20] pnts unrshirt [,0] [,6] trousrs [5,6] ti shirt [2,7] ht [8,9] wth [2,3] lt soks [7,8] [2,22] jkt [3,4] shos [4,5] Th topoloil sort prou y th DFS is wth,pnts,soks,trousrs,shos,lt,unrshirt,ht,shirt,ti,jkt Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
49 Stronly Connt Componnts Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
50 Finin stronly onnt omponnts o irt rphs is n nothr lorithm s on pth-irst srh For irt rph G = (V,E), stronly onnt omponnt (SCC) is mximl sust C V suh tht or ll vrtis u,v C it hols tht v is rhl rom u n u is rhl rom v Exmpl Thus h yl o th irt rph is insi n SCC Vrtis tht r not in ny yl orm thir own unit omponnts Consir th rph on th riht y z s t Its stronly onnt omponnts r {s}, {t,u}, {v}, n {w,x,y,z} x w v u Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
51 Th omponnt rph G SCC = (V SCC,E SCC ) o irt rph G is th irt rph whr th vrtis V SCC r th onnt omponnts o G, n thr is n (C,C ) V SCC rom omponnt vrtx C to irnt omponnt vrtx C i (u,v) is n in G or som u C n v C Th omponnt rph is yli. Why? Exmpl Consir in th rph in th prvious xmpl Its omponnt rph is shown on th riht {w, x, y, z} {s} {v} {t, u} Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
52 Computin SCCs Thr r svrl linr, i. O( V + E ), tim lorithms or omputin th SCCs o rph G = (V,E), s.. wikipi rtil Th ollowin prsnts vrint o Kosrju s lorithm It uss pth-irst srh twi: Prorm pth-irst srh on th oriinl rph to otin th visit timstmps 2 Mk th trnspos G T o th rph G = (V,E) y rvrsin th irtions o th s: G T = (V,E T ), whr E T = {(u,v) (v,u) E} 3 Prorm pth-irst srh on th trnspos rph G T ut strt th susrhs rom th vrtis in th rvrs orr o th inish timstmps prou y th irst pth-irst srh Th SCCs r th nos in th pth-irst srh orsts prou y th son pth-irst srh Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
53 Consir th rph on th riht Its stronly onnt omponnts r {s}, {t,u}, {v}, n {w,x,y,z} 3/6 2/9 y z /0 /6 s t Also shown r th timstmps n tr s otin y prormin pth-irst srh on th rph x 4/5 w 7/8 v 2/3 u 4/5 Th trnspos o th rph is shown on th riht y z s t Noti tht th SCCs r th sm An th omponnt rph is in ut trnspos x w v u Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
54 Th rph(s) on th riht show th rsult o pplyin pth-irst srh on th trnspos rph in th rvrs orr o th inish timstmps o th irst DFS Th susrh strtin rom t ins th l omponnt {t, u} Th susrh rom v isovrs th unit omponnt {v} Th susrh rom s isovrs th unit omponnt {s} Th susrh rom z isovrs th root omponnt {w,x,y,z} DFS on th trnspos rph /2 9/6 7/8 /4 y z s t x w v u 3/4 0/5 5/6 2/3 Th sm rwn in irnt orr: /4 5/6 7/8 9/6 t v s z u x 2/3 3/4 y /2 0/5 w Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
55 Why os this lorithm work? Rouh skth (s th ook or th proos): Th irst pth-irst srh ivs, in th inish timstmps, rvrs topoloil sortin or th SCCs in th omponnt rph Th omponnt rph o th trnspos rph is th trnspos o th omponnt rph o th oriinl rph Prormin th son DFS on th trnspos rph in th rvrs topoloil orr ivn y th irst DFS irst ins th omponnts t hiht 0 in th trnspos omponnt rph thn ins th omponnts t hiht in th trnspos omponnt rph (it os not o to th omponnts t hiht 0 s thy r lry visit) n so on Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn / 55
V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}
Introution Computr Sin & Enginring 423/823 Dsign n Anlysis of Algorithms Ltur 03 Elmntry Grph Algorithms (Chptr 22) Stphn Sott (Apt from Vinohnrn N. Vriym) I Grphs r strt t typs tht r pplil to numrous
More informationV={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}
s s of s Computr Sin & Enginring 423/823 Dsign n Anlysis of Ltur 03 (Chptr 22) Stphn Sott (Apt from Vinohnrn N. Vriym) s of s s r strt t typs tht r pplil to numrous prolms Cn ptur ntitis, rltionships twn
More informationCS 241 Analysis of Algorithms
CS 241 Anlysis o Algorithms Prossor Eri Aron Ltur T Th 9:00m Ltur Mting Lotion: OLB 205 Businss HW6 u lry HW7 out tr Thnksgiving Ring: Ch. 22.1-22.3 1 Grphs (S S. B.4) Grphs ommonly rprsnt onntions mong
More informationOutline. 1 Introduction. 2 Min-Cost Spanning Trees. 4 Example
Outlin Computr Sin 33 Computtion o Minimum-Cost Spnnin Trs Prim's Alorithm Introution Mik Joson Dprtmnt o Computr Sin Univrsity o Clry Ltur #33 3 Alorithm Gnrl Constrution Mik Joson (Univrsity o Clry)
More informationCycles and Simple Cycles. Paths and Simple Paths. Trees. Problem: There is No Completely Standard Terminology!
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
More informationlearning objectives learn what graphs are in mathematical terms learn how to represent graphs in computers learn about typical graph algorithms
rp loritms lrnin ojtivs loritms your sotwr systm sotwr rwr lrn wt rps r in mtmtil trms lrn ow to rprsnt rps in omputrs lrn out typil rp loritms wy rps? intuitivly, rp is orm y vrtis n s twn vrtis rps r
More informationCSE 373: More on graphs; DFS and BFS. Michael Lee Wednesday, Feb 14, 2018
CSE 373: Mor on grphs; DFS n BFS Mihl L Wnsy, F 14, 2018 1 Wrmup Wrmup: Disuss with your nighor: Rmin your nighor: wht is simpl grph? Suppos w hv simpl, irt grph with x nos. Wht is th mximum numr of gs
More informationAn undirected graph G = (V, E) V a set of vertices E a set of unordered edges (v,w) where v, w in V
Unirt Grphs An unirt grph G = (V, E) V st o vrtis E st o unorr gs (v,w) whr v, w in V USE: to mol symmtri rltionships twn ntitis vrtis v n w r jnt i thr is n g (v,w) [or (w,v)] th g (v,w) is inint upon
More informationCSE 373. Graphs 1: Concepts, Depth/Breadth-First Search reading: Weiss Ch. 9. slides created by Marty Stepp
CSE 373 Grphs 1: Conpts, Dpth/Brth-First Srh ring: Wiss Ch. 9 slis rt y Mrty Stpp http://www.s.wshington.u/373/ Univrsity o Wshington, ll rights rsrv. 1 Wht is grph? 56 Tokyo Sttl Soul 128 16 30 181 140
More informationCS61B Lecture #33. Administrivia: Autograder will run this evening. Today s Readings: Graph Structures: DSIJ, Chapter 12
Aministrivi: CS61B Ltur #33 Autogrr will run this vning. Toy s Rings: Grph Struturs: DSIJ, Chptr 12 Lst moifi: W Nov 8 00:39:28 2017 CS61B: Ltur #33 1 Why Grphs? For xprssing non-hirrhilly rlt itms Exmpls:
More informationOutline. Computer Science 331. Computation of Min-Cost Spanning Trees. Costs of Spanning Trees in Weighted Graphs
Outlin Computr Sin 33 Computtion o Minimum-Cost Spnnin Trs Prim s Mik Joson Dprtmnt o Computr Sin Univrsity o Clry Ltur #34 Introution Min-Cost Spnnin Trs 3 Gnrl Constrution 4 5 Trmintion n Eiiny 6 Aitionl
More informationCS 461, Lecture 17. Today s Outline. Example Run
Prim s Algorithm CS 461, Ltur 17 Jr Si Univrsity o Nw Mxio In Prim s lgorithm, th st A mintin y th lgorithm orms singl tr. Th tr strts rom n ritrry root vrtx n grows until it spns ll th vrtis in V At h
More information, each of which is a tree, and whose roots r 1. , respectively, are children of r. Data Structures & File Management
nrl tr T is init st o on or mor nos suh tht thr is on sint no r, ll th root o T, n th rminin nos r prtition into n isjoint susts T, T,, T n, h o whih is tr, n whos roots r, r,, r n, rsptivly, r hilrn o
More information5/7/13. Part 10. Graphs. Theorem Theorem Graphs Describing Precedence. Outline. Theorem 10-1: The Handshaking Theorem
Thorm 10-1: Th Hnshkin Thorm Lt G=(V,E) n unirt rph. Thn Prt 10. Grphs CS 200 Alorithms n Dt Struturs v V (v) = 2 E How mny s r thr in rph with 10 vrtis h of r six? 10 * 6 /2= 30 1 Thorm 10-2 An unirt
More informationPaths. Connectivity. Euler and Hamilton Paths. Planar graphs.
Pths.. Eulr n Hmilton Pths.. Pth D. A pth rom s to t is squn o gs {x 0, x 1 }, {x 1, x 2 },... {x n 1, x n }, whr x 0 = s, n x n = t. D. Th lngth o pth is th numr o gs in it. {, } {, } {, } {, } {, } {,
More informationQUESTIONS BEGIN HERE!
Points miss: Stunt's Nm: Totl sor: /100 points Est Tnnss Stt Univrsity Dprtmnt o Computr n Inormtion Sins CSCI 2710 (Trno) Disrt Struturs TEST or Sprin Smstr, 2005 R this or strtin! This tst is los ook
More informationCS200: Graphs. Graphs. Directed Graphs. Graphs/Networks Around Us. What can this represent? Sometimes we want to represent directionality:
CS2: Grphs Prihr Ch. 4 Rosn Ch. Grphs A olltion of nos n gs Wht n this rprsnt? n A omputr ntwork n Astrtion of mp n Soil ntwork CS2 - Hsh Tls 2 Dirt Grphs Grphs/Ntworks Aroun Us A olltion of nos n irt
More informationGraphs. Graphs. Graphs: Basic Terminology. Directed Graphs. Dr Papalaskari 1
CSC 00 Disrt Struturs : Introuon to Grph Thory Grphs Grphs CSC 00 Disrt Struturs Villnov Univrsity Grphs r isrt struturs onsisng o vrs n gs tht onnt ths vrs. Grphs n us to mol: omputr systms/ntworks mthml
More informationQUESTIONS BEGIN HERE!
Points miss: Stunt's Nm: Totl sor: /100 points Est Tnnss Stt Univrsity Dprtmnt of Computr n Informtion Sins CSCI 710 (Trnoff) Disrt Struturs TEST for Fll Smstr, 00 R this for strtin! This tst is los ook
More informationCMSC 451: Lecture 2 Graph Basics Thursday, Aug 31, 2017
Dv Mount CMSC 45: Ltur Grph Bsis Thursy, Au, 07 Rin: Chpt. in KT (Klinr n Tros) n Chpt. in DBV (Dsupt, Ppimitriou, n Vzirni). Som o our trminoloy irs rom our txt. Grphs n Dirphs: A rph G = (V, E) is strutur
More informationExam 1 Solution. CS 542 Advanced Data Structures and Algorithms 2/14/2013
CS Avn Dt Struturs n Algorithms Exm Solution Jon Turnr //. ( points) Suppos you r givn grph G=(V,E) with g wights w() n minimum spnning tr T o G. Now, suppos nw g {u,v} is to G. Dsri (in wors) mtho or
More informationN=4 L=4. Our first non-linear data structure! A graph G consists of two sets G = {V, E} A set of V vertices, or nodes f
lulu jwtt pnlton sin towr ounrs hpl lpp lu Our irst non-linr t strutur! rph G onsists o two sts G = {V, E} st o V vrtis, or nos st o E s, rltionships twn nos surph G onsists o sust o th vrtis n s o G jnt
More informationCSC Design and Analysis of Algorithms. Example: Change-Making Problem
CSC 801- Dsign n Anlysis of Algorithms Ltur 11 Gry Thniqu Exmpl: Chng-Mking Prolm Givn unlimit mounts of oins of nomintions 1 > > m, giv hng for mount n with th lst numr of oins Exmpl: 1 = 25, 2 =10, =
More informationGraphs. CSC 1300 Discrete Structures Villanova University. Villanova CSC Dr Papalaskari
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
More information12/3/12. Outline. Part 10. Graphs. Circuits. Euler paths/circuits. Euler s bridge problem (Bridges of Konigsberg Problem)
12/3/12 Outlin Prt 10. Grphs CS 200 Algorithms n Dt Struturs Introution Trminology Implmnting Grphs Grph Trvrsls Topologil Sorting Shortst Pths Spnning Trs Minimum Spnning Trs Ciruits 1 Ciruits Cyl 2 Eulr
More information5/9/13. Part 10. Graphs. Outline. Circuits. Introduction Terminology Implementing Graphs
Prt 10. Grphs CS 200 Algorithms n Dt Struturs 1 Introution Trminology Implmnting Grphs Outlin Grph Trvrsls Topologil Sorting Shortst Pths Spnning Trs Minimum Spnning Trs Ciruits 2 Ciruits Cyl A spil yl
More information1 Introduction to Modulo 7 Arithmetic
1 Introution to Moulo 7 Arithmti Bor w try our hn t solvin som hr Moulr KnKns, lt s tk los look t on moulr rithmti, mo 7 rithmti. You ll s in this sminr tht rithmti moulo prim is quit irnt rom th ons w
More informationOutline. Binary Tree
Outlin Similrity Srh Th Binry Brnh Distn Nikolus Austn nikolus.ustn@s..t Dpt. o Computr Sins Univrsity o Slzur http://rsrh.uni-slzur.t 1 Binry Brnh Distn Binry Rprsnttion o Tr Binry Brnhs Lowr Boun or
More informationPlanar Upward Drawings
C.S. 252 Pro. Rorto Tmssi Computtionl Gomtry Sm. II, 1992 1993 Dt: My 3, 1993 Sri: Shmsi Moussvi Plnr Upwr Drwings 1 Thorm: G is yli i n only i it hs upwr rwing. Proo: 1. An upwr rwing is yli. Follow th
More informationMAT3707. Tutorial letter 201/1/2017 DISCRETE MATHEMATICS: COMBINATORICS. Semester 1. Department of Mathematical Sciences MAT3707/201/1/2017
MAT3707/201/1/2017 Tutoril lttr 201/1/2017 DISCRETE MATHEMATICS: COMBINATORICS MAT3707 Smstr 1 Dprtmnt o Mtmtil Sins SOLUTIONS TO ASSIGNMENT 01 BARCODE Din tomorrow. univrsity o sout ri SOLUTIONS TO ASSIGNMENT
More informationConstructive Geometric Constraint Solving
Construtiv Gomtri Constrint Solving Antoni Soto i Rir Dprtmnt Llngutgs i Sistms Inormàtis Univrsitt Politèni Ctluny Brlon, Sptmr 2002 CGCS p.1/37 Prliminris CGCS p.2/37 Gomtri onstrint prolm C 2 D L BC
More informationCMPS 2200 Fall Graphs. Carola Wenk. Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk
CMPS 2200 Fll 2017 Grps Crol Wnk Sls ourtsy o Crls Lsrson wt ns n tons y Crol Wnk 10/23/17 CMPS 2200 Intro. to Alortms 1 Grps Dnton. A rt rp (rp) G = (V, E) s n orr pr onsstn o st V o vrts (snulr: vrtx),
More informationMath 61 : Discrete Structures Final Exam Instructor: Ciprian Manolescu. You have 180 minutes.
Nm: UCA ID Numr: Stion lttr: th 61 : Disrt Struturs Finl Exm Instrutor: Ciprin nolsu You hv 180 minuts. No ooks, nots or lultors r llow. Do not us your own srth ppr. 1. (2 points h) Tru/Fls: Cirl th right
More informationModule graph.py. 1 Introduction. 2 Graph basics. 3 Module graph.py. 3.1 Objects. CS 231 Naomi Nishimura
Moul grph.py CS 231 Nomi Nishimur 1 Introution Just lik th Python list n th Python itionry provi wys of storing, ssing, n moifying t, grph n viw s wy of storing, ssing, n moifying t. Bus Python os not
More informationComplete Solutions for MATH 3012 Quiz 2, October 25, 2011, WTT
Complt Solutions or MATH 012 Quiz 2, Otor 25, 2011, WTT Not. T nswrs ivn r r mor omplt tn is xpt on n tul xm. It is intn tt t mor omprnsiv solutions prsnt r will vlul to stunts in stuyin or t inl xm. In
More informationECE 407 Computer Aided Design for Electronic Systems. Circuit Modeling and Basic Graph Concepts/Algorithms. Instructor: Maria K. Michael.
0 Computr i Dsign or Eltroni Systms Ciruit Moling n si Grph Conptslgorithms Instrutor: Mri K. Mihl MKM - Ovrviw hviorl vs. Struturl mols Extrnl vs. Intrnl rprsnttions Funtionl moling t Logi lvl Struturl
More informationb. How many ternary words of length 23 with eight 0 s, nine 1 s and six 2 s?
MATH 3012 Finl Exm, My 4, 2006, WTT Stunt Nm n ID Numr 1. All our prts o this prolm r onrn with trnry strings o lngth n, i.., wors o lngth n with lttrs rom th lpht {0, 1, 2}.. How mny trnry wors o lngth
More informationECE COMBINATIONAL BUILDING BLOCKS - INVEST 13 DECODERS AND ENCODERS
C 24 - COMBINATIONAL BUILDING BLOCKS - INVST 3 DCODS AND NCODS FALL 23 AP FLZ To o "wll" on this invstition you must not only t th riht nswrs ut must lso o nt, omplt n onis writups tht mk ovious wht h
More information(2) If we multiplied a row of B by λ, then the value is also multiplied by λ(here lambda could be 0). namely
. DETERMINANT.. Dtrminnt. Introution:I you think row vtor o mtrix s oorint o vtors in sp, thn th gomtri mning o th rnk o th mtrix is th imnsion o th prlllppi spnn y thm. But w r not only r out th imnsion,
More informationDesigning A Concrete Arch Bridge
This is th mous Shwnh ri in Switzrln, sin y Rort Millrt in 1933. It spns 37.4 mtrs (122 t) n ws sin usin th sm rphil mths tht will monstrt in this lsson. To pro with this lsson, lik on th Nxt utton hr
More informationCS September 2018
Loil los Distriut Systms 06. Loil los Assin squn numrs to msss All ooprtin prosss n r on orr o vnts vs. physil los: rport tim o y Assum no ntrl tim sour Eh systm mintins its own lol lo No totl orrin o
More informationOutline. Circuits. Euler paths/circuits 4/25/12. Part 10. Graphs. Euler s bridge problem (Bridges of Konigsberg Problem)
4/25/12 Outlin Prt 10. Grphs CS 200 Algorithms n Dt Struturs Introution Trminology Implmnting Grphs Grph Trvrsls Topologil Sorting Shortst Pths Spnning Trs Minimum Spnning Trs Ciruits 1 2 Eulr s rig prolm
More information10/30/12. Today. CS/ENGRD 2110 Object- Oriented Programming and Data Structures Fall 2012 Doug James. DFS algorithm. Reachability Algorithms
0/0/ CS/ENGRD 0 Ojt- Orint Prormmin n Dt Strutur Fll 0 Dou Jm Ltur 9: DFS, BFS & Shortt Pth Toy Rhility Dpth-Firt Srh Brth-Firt Srh Shortt Pth Unwiht rph Wiht rph Dijktr lorithm Rhility Alorithm Dpth Firt
More informationProblem solving by search
Prolm solving y srh Tomáš voo Dprtmnt o Cyrntis, Vision or Roots n Autonomous ystms Mrh 5, 208 / 3 Outlin rh prolm. tt sp grphs. rh trs. trtgis, whih tr rnhs to hoos? trtgy/algorithm proprtis? Progrmming
More informationPresent state Next state Q + M N
Qustion 1. An M-N lip-lop works s ollows: I MN=00, th nxt stt o th lip lop is 0. I MN=01, th nxt stt o th lip-lop is th sm s th prsnt stt I MN=10, th nxt stt o th lip-lop is th omplmnt o th prsnt stt I
More information0.1. Exercise 1: the distances between four points in a graph
Mth 707 Spring 2017 (Drij Grinrg): mitrm 3 pg 1 Mth 707 Spring 2017 (Drij Grinrg): mitrm 3 u: W, 3 My 2017, in lss or y mil (grinr@umn.u) or lss S th wsit or rlvnt mtril. Rsults provn in th nots, or in
More informationWhy the Junction Tree Algorithm? The Junction Tree Algorithm. Clique Potential Representation. Overview. Chris Williams 1.
Why th Juntion Tr lgorithm? Th Juntion Tr lgorithm hris Willims 1 Shool of Informtis, Univrsity of Einurgh Otor 2009 Th JT is gnrl-purpos lgorithm for omputing (onitionl) mrginls on grphs. It os this y
More informationGraph Isomorphism. Graphs - II. Cayley s Formula. Planar Graphs. Outline. Is K 5 planar? The number of labeled trees on n nodes is n n-2
Grt Thortil Is In Computr Sin Vitor Amhik CS 15-251 Ltur 9 Grphs - II Crngi Mllon Univrsity Grph Isomorphism finition. Two simpl grphs G n H r isomorphi G H if thr is vrtx ijtion V H ->V G tht prsrvs jny
More informationNumbering Boundary Nodes
Numring Bounry Nos Lh MBri Empori Stt Univrsity August 10, 2001 1 Introution Th purpos of this ppr is to xplor how numring ltril rsistor ntworks ffts thir rspons mtrix, Λ. Morovr, wht n lrn from Λ out
More informationThe University of Sydney MATH2969/2069. Graph Theory Tutorial 5 (Week 12) Solutions 2008
Th Univrsity o Syny MATH2969/2069 Grph Thory Tutoril 5 (Wk 12) Solutions 2008 1. (i) Lt G th isonnt plnr grph shown. Drw its ul G, n th ul o th ul (G ). (ii) Show tht i G is isonnt plnr grph, thn G is
More informationSection 10.4 Connectivity (up to paths and isomorphism, not including)
Toy w will isuss two stions: Stion 10.3 Rprsnting Grphs n Grph Isomorphism Stion 10.4 Conntivity (up to pths n isomorphism, not inluing) 1 10.3 Rprsnting Grphs n Grph Isomorphism Whn w r working on n lgorithm
More informationSeven-Segment Display Driver
7-Smnt Disply Drivr, Ron s in 7-Smnt Disply Drivr, Ron s in Prolm 62. 00 0 0 00 0000 000 00 000 0 000 00 0 00 00 0 0 0 000 00 0 00 BCD Diits in inry Dsin Drivr Loi 4 inputs, 7 outputs 7 mps, h with 6 on
More informationCS 103 BFS Alorithm. Mark Redekopp
CS 3 BFS Aloritm Mrk Rkopp Brt-First Sr (BFS) HIGHLIGHTED ALGORITHM 3 Pt Plnnin W'v sn BFS in t ontxt o inin t sortst pt trou mz? S?? 4 Pt Plnnin W xplor t 4 niors s on irtion 3 3 3 S 3 3 3 3 3 F I you
More informationEE1000 Project 4 Digital Volt Meter
Ovrviw EE1000 Projt 4 Diitl Volt Mtr In this projt, w mk vi tht n msur volts in th rn o 0 to 4 Volts with on iit o ury. Th input is n nlo volt n th output is sinl 7-smnt iit tht tlls us wht tht input s
More informationLecture 20: Minimum Spanning Trees (CLRS 23)
Ltur 0: Mnmum Spnnn Trs (CLRS 3) Jun, 00 Grps Lst tm w n (wt) rps (unrt/rt) n ntrou s rp voulry (vrtx,, r, pt, onnt omponnts,... ) W lso suss jny lst n jny mtrx rprsntton W wll us jny lst rprsntton unlss
More informationGreedy Algorithms, Activity Selection, Minimum Spanning Trees Scribes: Logan Short (2015), Virginia Date: May 18, 2016
Ltur 4 Gry Algorithms, Ativity Sltion, Minimum Spnning Trs Sris: Logn Short (5), Virgini Dt: My, Gry Algorithms Suppos w wnt to solv prolm, n w r l to om up with som rursiv ormultion o th prolm tht woul
More informationAlgorithmic and NP-Completeness Aspects of a Total Lict Domination Number of a Graph
Intrntionl J.Mth. Comin. Vol.1(2014), 80-86 Algorithmi n NP-Compltnss Aspts of Totl Lit Domintion Numr of Grph Girish.V.R. (PES Institut of Thnology(South Cmpus), Bnglor, Krntk Stt, Ini) P.Ush (Dprtmnt
More informationMultipoint Alternate Marking method for passive and hybrid performance monitoring
Multipoint Altrnt Mrkin mtho or pssiv n hyri prormn monitorin rt-iool-ippm-multipoint-lt-mrk-00 Pru, Jul 2017, IETF 99 Giuspp Fiool (Tlom Itli) Muro Coilio (Tlom Itli) Amo Spio (Politnio i Torino) Riro
More informationSimilarity Search. The Binary Branch Distance. Nikolaus Augsten.
Similrity Srh Th Binry Brnh Distn Nikolus Augstn nikolus.ugstn@sg..t Dpt. of Computr Sins Univrsity of Slzurg http://rsrh.uni-slzurg.t Vrsion Jnury 11, 2017 Wintrsmstr 2016/2017 Augstn (Univ. Slzurg) Similrity
More informationAnnouncements. Not graphs. These are Graphs. Applications of Graphs. Graph Definitions. Graphs & Graph Algorithms. A6 released today: Risk
Grphs & Grph Algorithms Ltur CS Spring 6 Announmnts A6 rls toy: Risk Strt signing with your prtnr sp Prlim usy Not grphs hs r Grphs K 5 K, =...not th kin w mn, nywy Applitions o Grphs Communition ntworks
More information12. Traffic engineering
lt2.ppt S-38. Introution to Tltrffi Thory Spring 200 2 Topology Pths A tlommunition ntwork onsists of nos n links Lt N not th st of nos in with n Lt J not th st of nos in with j N = {,,,,} J = {,2,3,,2}
More informationCOMPLEXITY OF COUNTING PLANAR TILINGS BY TWO BARS
OMPLXITY O OUNTING PLNR TILINGS Y TWO RS KYL MYR strt. W show tht th prolm o trmining th numr o wys o tiling plnr igur with horizontl n vrtil r is #P-omplt. W uil o o th rsults o uquir, Nivt, Rmil, n Roson
More informationCOMP108 Algorithmic Foundations
Grdy mthods Prudn Wong http://www.s.liv..uk/~pwong/thing/omp108/01617 Coin Chng Prolm Suppos w hv 3 typs of oins 10p 0p 50p Minimum numr of oins to mk 0.8, 1.0, 1.? Grdy mthod Lrning outoms Undrstnd wht
More informationWeighted graphs -- reminder. Data Structures LECTURE 15. Shortest paths algorithms. Example: weighted graph. Two basic properties of shortest paths
Dt Strutur LECTURE Shortt pth lgorithm Proprti of hortt pth Bllmn-For lgorithm Dijktr lgorithm Chptr in th txtook (pp ). Wight grph -- rminr A wight grph i grph in whih g hv wight (ot) w(v i, v j ) >.
More informationOrganization. Dominators. Control-flow graphs 8/30/2010. Dominators, control-dependence. Dominator relation of CFGs
Orniztion Domintors, ontrol-pnn n SSA orm Domintor rltion o CFGs postomintor rltion Domintor tr Computin omintor rltion n tr Dtlow lorithm Lnur n Trjn lorithm Control-pnn rltion SSA orm Control-low rphs
More informationScientific Programming. Graphs
Sintifi Progrmming Grphs Alrto Montrsor Univrsità i Trnto 08//07 This work is lins unr Crtiv Commons Attriution-ShrAlik 4.0 Intrntionl Lins. Tl of ontnts Introution Exmpls Dfinitions Spifition Rprsnttions
More information1. Determine whether or not the following binary relations are equivalence relations. Be sure to justify your answers.
Mth 0 Exm - Prti Prolm Solutions. Dtrmin whthr or not th ollowing inry rltions r quivln rltions. B sur to justiy your nswrs. () {(0,0),(0,),(0,),(,),(,),(,),(,),(,0),(,),(,),(,0),(,),(.)} on th st A =
More information16.unified Introduction to Computers and Programming. SOLUTIONS to Examination 4/30/04 9:05am - 10:00am
16.unii Introution to Computrs n Prormmin SOLUTIONS to Exmintion /30/0 9:05m - 10:00m Pro. I. Kristin Lunqvist Sprin 00 Grin Stion: Qustion 1 (5) Qustion (15) Qustion 3 (10) Qustion (35) Qustion 5 (10)
More informationStrongly connected components. Finding strongly-connected components
Stronly onnt omponnts Fnn stronly-onnt omponnts Tylr Moor stronly onnt omponnt s t mxml sust o rp wt rt pt twn ny two vrts SE 3353, SMU, Dlls, TX Ltur 9 Som sls rt y or pt rom Dr. Kvn Wyn. For mor normton
More informationNefertiti. Echoes of. Regal components evoke visions of the past MULTIPLE STITCHES. designed by Helena Tang-Lim
MULTIPLE STITCHES Nrtiti Ehos o Rgl omponnts vok visions o th pst sign y Hln Tng-Lim Us vrity o stiths to rt this rgl yt wrl sign. Prt sping llows squr s to mk roun omponnts tht rp utiully. FCT-SC-030617-07
More informationTrees as operads. Lecture A formalism of trees
Ltur 2 rs s oprs In this ltur, w introu onvnint tgoris o trs tht will us or th inition o nroil sts. hs tgoris r gnrliztions o th simpliil tgory us to in simpliil sts. First w onsir th s o plnr trs n thn
More informationCSE 373: AVL trees. Warmup: Warmup. Interlude: Exploring the balance invariant. AVL Trees: Invariants. AVL tree invariants review
rmup CSE 7: AVL trs rmup: ht is n invrint? Mihl L Friy, Jn 9, 0 ht r th AVL tr invrints, xtly? Disuss with your nighor. AVL Trs: Invrints Intrlu: Exploring th ln invrint Cor i: xtr invrint to BSTs tht
More informationDepth First Search. Yufei Tao. Department of Computer Science and Engineering Chinese University of Hong Kong
Dprtmnt o Computr Sn n Ennrn Cns Unvrsty o Hon Kon W v lry lrn rt rst sr (BFS). Toy, w wll suss ts sstr vrson : t pt rst sr (DFS) lortm. Our susson wll on n ous on rt rps, us t xtnson to unrt rps s strtorwr.
More informationAnnouncements. These are Graphs. This is not a Graph. Graph Definitions. Applications of Graphs. Graphs & Graph Algorithms
Grphs & Grph Algorithms Ltur CS Fll 5 Announmnts Upoming tlk h Mny Crrs o Computr Sintist Or how Computr Sin gr mpowrs you to o muh mor thn o Dn Huttnlohr, Prossor in th Dprtmnt o Computr Sin n Johnson
More informationGrade 7/8 Math Circles March 4/5, Graph Theory I- Solutions
ulty o Mtmtis Wtrloo, Ontrio N ntr or ution in Mtmtis n omputin r / Mt irls Mr /, 0 rp Tory - Solutions * inits lln qustion. Tr t ollowin wlks on t rp low. or on, stt wtr it is pt? ow o you know? () n
More information# 1 ' 10 ' 100. Decimal point = 4 hundred. = 6 tens (or sixty) = 5 ones (or five) = 2 tenths. = 7 hundredths.
How os it work? Pl vlu o imls rprsnt prts o whol numr or ojt # 0 000 Tns o thousns # 000 # 00 Thousns Hunrs Tns Ons # 0 Diml point st iml pl: ' 0 # 0 on tnth n iml pl: ' 0 # 00 on hunrth r iml pl: ' 0
More information(Minimum) Spanning Trees
(Mnmum) Spnnn Trs Spnnn trs Kruskl's lortm Novmr 23, 2017 Cn Hrn / Gory Tn 1 Spnnn trs Gvn G = V, E, spnnn tr o G s onnt surp o G wt xtly V 1 s mnml sust o s tt onnts ll t vrts o G G = Spnnn trs Novmr
More informationOpenMx Matrices and Operators
OpnMx Mtris n Oprtors Sr Mln Mtris: t uilin loks Mny typs? Dnots r lmnt mxmtrix( typ= Zro", nrow=, nol=, nm="" ) mxmtrix( typ= Unit", nrow=, nol=, nm="" ) mxmtrix( typ= Int", nrow=, nol=, nm="" ) mxmtrix(
More informationGREEDY TECHNIQUE. Greedy method vs. Dynamic programming method:
Dinition: GREEDY TECHNIQUE Gry thniqu is gnrl lgorithm sign strtgy, uilt on ollowing lmnts: onigurtions: irnt hois, vlus to in ojtiv untion: som onigurtions to ithr mximiz or minimiz Th mtho: Applil to
More informationSpanning Trees. BFS, DFS spanning tree Minimum spanning tree. March 28, 2018 Cinda Heeren / Geoffrey Tien 1
Spnnn Trs BFS, DFS spnnn tr Mnmum spnnn tr Mr 28, 2018 Cn Hrn / Gory Tn 1 Dpt-rst sr Vsts vrts lon snl pt s r s t n o, n tn ktrks to t rst junton n rsums own notr pt Mr 28, 2018 Cn Hrn / Gory Tn 2 Dpt-rst
More informationGarnir Polynomial and their Properties
Univrsity of Cliforni, Dvis Dprtmnt of Mthmtis Grnir Polynomil n thir Proprtis Author: Yu Wng Suprvisor: Prof. Gorsky Eugny My 8, 07 Grnir Polynomil n thir Proprtis Yu Wng mil: uywng@uvis.u. In this ppr,
More informationd e c b a d c b a d e c b a a c a d c c e b
FLAT PEYOTE STITCH Bin y mkin stoppr -- sw trou n pull it lon t tr until it is out 6 rom t n. Sw trou t in witout splittin t tr. You soul l to sli it up n own t tr ut it will sty in pl wn lt lon. Evn-Count
More informationGraph Contraction and Connectivity
Chptr 17 Grph Contrtion n Conntivity So r w hv mostly ovr thniqus or solving prolms on grphs tht wr vlop in th ontxt o squntil lgorithms. Som o thm r sy to prllliz whil othrs r not. For xmpl, w sw tht
More informationS i m p l i f y i n g A l g e b r a SIMPLIFYING ALGEBRA.
S i m p l i y i n g A l g r SIMPLIFYING ALGEBRA www.mthltis.o.nz Simpliying SIMPLIFYING Algr ALGEBRA Algr is mthmtis with mor thn just numrs. Numrs hv ix vlu, ut lgr introus vrils whos vlus n hng. Ths
More informationMinimum Spanning Trees
Minimum Spnning Trs Minimum Spnning Trs Problm A town hs st of houss nd st of rods A rod conncts nd only houss A rod conncting houss u nd v hs rpir cost w(u, v) Gol: Rpir nough (nd no mor) rods such tht:
More informationChapter 18. Minimum Spanning Trees Minimum Spanning Trees. a d. a d. a d. f c
Chptr 8 Minimum Spnning Trs In this hptr w ovr importnt grph prolm, Minimum Spnning Trs (MST). Th MST o n unirt, wight grph is tr tht spns th grph whil minimizing th totl wight o th gs in th tr. W irst
More informationMore Foundations. Undirected Graphs. Degree. A Theorem. Graphs, Products, & Relations
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 ({,,,,}, {{,}, {,},
More informationGraph Theory. Vertices. Vertices are also known as nodes, points and (in social networks) as actors, agents or players.
Stphn P. Borgtti Grph Thory A lthough grph thory is on o th youngr rnhs o mthmtis, it is unmntl to numr o ppli ils, inluing oprtions rsrh, omputr sin, n soil ntwork nlysis. In this hptr w isuss th si onpts
More informationImproving Union. Implementation. Union-by-size Code. Union-by-Size Find Analysis. Path Compression! Improving Find find(e)
POW CSE 36: Dt Struturs Top #10 T Dynm (Equvln) Duo: Unon-y-Sz & Pt Comprsson Wk!! Luk MDowll Summr Qurtr 003 M! ZING Wt s Goo Mz? Mz Construton lortm Gvn: ollton o rooms V Conntons twn t rooms (ntlly
More informationSolutions to Homework 5
Solutions to Homwork 5 Pro. Silvia Frnánz Disrt Mathmatis Math 53A, Fall 2008. [3.4 #] (a) Thr ar x olor hois or vrtx an x or ah o th othr thr vrtis. So th hromati polynomial is P (G, x) =x (x ) 3. ()
More informationAnalysis for Balloon Modeling Structure based on Graph Theory
Anlysis for lloon Moling Strutur bs on Grph Thory Abstrt Mshiro Ur* Msshi Ym** Mmoru no** Shiny Miyzki** Tkmi Ysu* *Grut Shool of Informtion Sin, Ngoy Univrsity **Shool of Informtion Sin n Thnology, hukyo
More informationApplications: The problem has several applications, for example, to compute periods of maximum net expenses for a design department.
A Gntl Introution to Aloritms: Prt III Contnts o Prt I: 1. Mr: (to mr two sort lists into sinl sort list.). Bul Sort 3. Mr Sort: 4. T Bi-O, Bi-Θ, Bi-Ω nottions: symptoti ouns Contnts o Prt II: 5. Bsis
More informationUsing the Printable Sticker Function. Using the Edit Screen. Computer. Tablet. ScanNCutCanvas
SnNCutCnvs Using th Printl Stikr Funtion On-o--kin stikrs n sily rt y using your inkjt printr n th Dirt Cut untion o th SnNCut mhin. For inormtion on si oprtions o th SnNCutCnvs, rr to th Hlp. To viw th
More informationDUET WITH DIAMONDS COLOR SHIFTING BRACELET By Leslie Rogalski
Dut with Dimons Brlt DUET WITH DIAMONDS COLOR SHIFTING BRACELET By Lsli Roglski Photo y Anrw Wirth Supruo DUETS TM from BSmith rt olor shifting fft tht mks your work tk on lif of its own s you mov! This
More informationWeighted Graphs. Weighted graphs may be either directed or undirected.
1 In mny ppltons, o rp s n ssot numrl vlu, ll wt. Usully, t wts r nonntv ntrs. Wt rps my tr rt or unrt. T wt o n s otn rrr to s t "ost" o t. In ppltons, t wt my msur o t lnt o rout, t pty o ln, t nry rqur
More informationDecimals DECIMALS.
Dimls DECIMALS www.mthltis.o.uk ow os it work? Solutions Dimls P qustions Pl vlu o imls 0 000 00 000 0 000 00 0 000 00 0 000 00 0 000 tnths or 0 thousnths or 000 hunrths or 00 hunrths or 00 0 tn thousnths
More informationA Simple Code Generator. Code generation Algorithm. Register and Address Descriptors. Example 3/31/2008. Code Generation
A Simpl Co Gnrtor Co Gnrtion Chptr 8 II Gnrt o for singl si lok How to us rgistrs? In most mhin rhitturs, som or ll of th oprnsmust in rgistrs Rgistrs mk goo tmporris Hol vlus tht r omput in on si lok
More informationSAMPLE PAGES. Primary. Primary Maths Basics Series THE SUBTRACTION BOOK. A progression of subtraction skills. written by Jillian Cockings
PAGES Primry Primry Mths Bsis Sris THE SUBTRACTION BOOK A prorssion o sutrtion skills writtn y Jillin Cokins INTRODUCTION This ook is intn to hlp sur th mthmtil onpt o sutrtion in hilrn o ll s. Th mstry
More informationXML and Databases. Outline. Recall: Top-Down Evaluation of Simple Paths. Recall: Top-Down Evaluation of Simple Paths. Sebastian Maneth NICTA and UNSW
Smll Pth Quiz ML n Dtss Cn you giv n xprssion tht rturns th lst / irst ourrn o h istint pri lmnt? Ltur 8 Strming Evlution: how muh mmory o you n? Sstin Mnth NICTA n UNSW
More informationSolutions for HW11. Exercise 34. (a) Use the recurrence relation t(g) = t(g e) + t(g/e) to count the number of spanning trees of v 1
Solutions for HW Exris. () Us th rurrn rltion t(g) = t(g ) + t(g/) to ount th numr of spnning trs of v v v u u u Rmmr to kp multipl gs!! First rrw G so tht non of th gs ross: v u v Rursing on = (v, u ):
More information