Chapter 18. Minimum Spanning Trees Minimum Spanning Trees. a d. a d. a d. f c
|
|
- Phyllis Griffin
- 5 years ago
- Views:
Transcription
1 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 in spnning tr n minimum spnning trs prisly n thn prsnt two squntil lgorithm n on prlll lgorithm, whih r rsptivly Kruskl s, Prim s, n Borůvk s. All o ths lgorithms utiliz n importnt ut proprty, whih w lso sri. 8. Minimum Spnning Trs Rll tht w sy tht n unirt grph is orst i it hs no yls n tr i it is lso onnt. Givn onnt, unirt grph, w might wnt to intiy sust o th gs tht orm tr, whil touhing ll th vrtis. W ll suh tr spnning tr. Dinition 8.. For onnt unirt grph G = (V, E), spnning tr is tr T = (V, E ) with E E. Not tht grph n hv mny spnning trs, ut ll hv V vrtis n V gs. Exmpl 8.2. A grph on th lt, n two possil spnning trs. 35
2 3 CHAPTER 8. MINIMUM SPANNING TREES Qustion 8.3. Dsign n lgorithm or ining spnning tr o onnt, unirt grph? On wy to gnrt spnning tr is simply to o grph srh. For xmpl th DFStr o DFS is spnnig tr, s it ins pth rom sour to ll th vrtis. Similrly, w n onstrut spnning tr s on BFS, y ing h g tht ls to th isovry o n unvisit vrtx to th tr. DFS n BFS r work-iint lgorithms or omputing spnning trs ut s w isuss thy r not goo prlll lgorithms. Qustion 8.4. Cn you think o n lgorithm with polylogrithmi spn or ining spnning tr o onnt unirt grph? Anothr wy to gnrt spnning tr is to us grph ontrtion, whih s w hv sn n on in prlll. Th i is to us str ontrtion n ll th gs tht r slt to in th strs throughout th lgorithm to th spnning tr. Rll tht grph hs mny spnning trs. In wight grphs, w my intrst in ining th spnning tr with th smllst totl wight (i.. sum o th wights o its gs). Dinition 8.5. Givn onnt, unirt wight grph G = (V, E, w), th minimum (wight) spnning tr (MST) prolm rquirs ining spnning tr o minimum wight, whr th wight o tr T is in s: w(t ) = w(). E(T ) Exmpl 8.. A grph (lt) n its MST (right)
3 8.2. ALGORITHMS FOR MINIMUM SPANNING TREES 37 Exmpl 8.7. Minimum spnning trs hv mny intrsting pplitions. On xmpl onrns th sign o ntwork. Suppos tht you r wiring uiling so tht ll th rooms r onnt vi iirtionl ommunition wirs. Suppos tht you n onnt ny two rooms t th ost o th wir onnting th rooms, whih pns on th spiis o th uiling n th rooms ut is lwys positiv rl numr. W n rprsnt th possil onntion twn rooms s grph, whr vrtis rprsnt rooms n wight gs rprsnt possil onntions long with thir ost (wight). To minimiz th ost o th wiring, you oul in minimum spnning tr o th grph. 8.2 Algorithms or Minimum Spnning Trs Thr r svrl lgorithms or omputing minimum spnning trs. Thy ll, howvr, r s on th sm unrlying proprty out uts in grph, whih w will rr to s th light-g proprty. Intuitivly, th light-g proprty (prisly in low) stts tht i you prtition th grph into two, th minimum g twn th two prts hs to in th MST. Th light-g proprty givs wy to intiy lgorithmilly th gs o n MST. In our isussion w will ssum tht ll gs hv istint wights. This ssumption uss no loss-o-gnrlity, us light-g proprty llows us to rk tis ritrrily, whih w n tk vntg o y or xmpl rking tis s on som ritrry orring o gs suh s thir position in th input. Qustion 8.8. Consir grph whr h g hs istint wight, how mny MST s n th grph hv? A simpliying onsqun o this ssumption is tht th MST o grph with istint g wigths uniqu. Dinition 8.9. For grph G = (V, E), ut is in in trms o non-mpty propr sust U V. This st U prtitions th grph into (U, V \ U), n w rr to th gs twn th two prts s th ut gs writtn E(U, U), whr U = V \ U. Th sust U us in th inition o ut might inlu singl vrtx v, in whih s th ut gs woul ll gs inint on v. But th sust U must propr sust o V (i.., U V ). W somtims sy tht ut g rosss th ut.
4 38 CHAPTER 8. MINIMUM SPANNING TREES Lmm 8. (Light-Eg Proprty). Lt G = (V, E, w) onnt unirt wight grph with istint g wights. For ny ut o G, th minimum wight g tht rosss th ut is in th minimum spnning tr MST(G) o G. U u v V\U Proo. Th proo is y ontrition. Assum th minimum-wight g = (u, v) is not in th MST. Sin th MST spns th grph, thr must som simpl pth P onnting u n v in th MST (i.., onsisting o just gs in th MST). Th pth must ross th ut twn U n V \ U t lst on sin u n v r on opposit sis. Lt n g in P tht rosss th ut. By ssumption th wight o is lrgr thn tht o. Now, insrt into th grph this givs us yl tht inlus oth n n rmov rom th grph to rk th only yl n otin spnning tr gin. Now, sin th wight o is lss thn tht o, th rsulting spnning tr hs smllr wight. This is ontrition n thus must hv n in th tr. Exmpl 8.0. Two xmpl uts. For h ut, w n in th lightst g tht rosss tht ut, whih r th gs with wight 2 (lt) n 4 (right) rsptivly W now stt n prov th light-g proprty (Lmm 8.). An importnt implition o Lmm 8. is tht ny minimum-wight g tht rosss ut n immitly to th MST. In t, ll o th thr lgorithms tht w will onsir in this hptr tk vntg o this implition. For xmpl, Kruskl s lgorithm onstruts th MST y grily ing th ovrll minimum g. Prim s lgorithm grows n MST inrmntlly y onsiring ut twn th urrnt MST n th rst o grph. Borůvk s lgorithm onstruts tr in prlll y onsiring th ut in y h n
5 8.2. ALGORITHMS FOR MINIMUM SPANNING TREES 39 vry vrtx. In th nxt stion, w rily rviw Kruskl s n Prim s lgorithm n spn most o our tim on prlll vrint o Borůvk s lgorithm. Rmrk 8.2. Evn though Borůvk s lgorithm is th only prlll lgorithm, it ws th rlist, invnt in 92, s mtho or onstruting n iint ltriity ntwork in Morvi in th Czh Rpuli. It ws r-invnt mny tims ovr Kruskl s Algorithm As sri in Kruskl s originl ppr, th lgorithm is: Prorm th ollowing stp s mny tims s possil: Among th gs o G not yt hosn, hoos th shortst g whih os not orm ny loops with thos gs lry hosn [Kruskl, 95] In mor morn trminology w woul rpl shortst with lightst n loops with yls. Kruskl s lgorithm is orrt sin it mintins th invrint on h stp tht th gs hosn so r r in th MST o G. This is tru t th strt. Now on h stp, ny g tht orms yl with th lry hosn gs nnot in th MST. This is us ing it woul woul violt th tr proprty o n MST n w know, y th invrint, tht ll th othr gs on th yl r in th MST. Now onsiring th gs tht o not orm yl, th minimum wight g must light g sin it is th lst wight g tht onnts th onnt sugrph t ithr npoint to th rst o th grph. Finlly w hv to rgu tht ll th MST gs hv n. Wll w onsir ll gs, n only toss th ons tht w oul prov wr not in th MST (i.. orm yls with MST gs). W oul inish our isussion o Kruskl s lgorithm hr, ut w wors on how to implmnt th i iintly r wrrnt. In prtiulr hking i n g orms yl might xpnsiv i w r not rul. In it ws not until mny yrs tr Kruskl s originl ppr tht n iint pproh to th lgorithm ws vlop. Not tht to hk i n g (u, v) orms yl, ll on ns to o is tst i u n v r in th sm onnt omponnt s in y th gs lry hosn. On wy to o this is y ontrting n g (u, v) whnvr it is i.., ollps th g n th vrtis u n v into singl suprvrtx. Howvr, i w implmnt this s sri in th lst hptr w woul n to upt ll th othr gs inint on u n v. This n xpnsiv sin n g might n to upt mny tims. To gt roun ths prolm it is possil to upt th gs lzily. Wht w mn y lzily is tht gs inint on ontrt vrtx r not upt immitly, ut rthr ltr whn th g is pross. At tht point th g ns to trmin wht suprvrtis (omponnts) its npoints r in. This i n implmnt with so-ll union-in t typ.
6 320 CHAPTER 8. MINIMUM SPANNING TREES Algorithm 8.3 (Union-Fin Kruskl). untion kruskl(g = (V, E, w)) = 2 lt 3 vl U = itr UF.insrt UF. V % insrt vrtis into union in strutur 4 vl E = sort(e, w) % sort th gs 5 untion Eg((U, T ), = (u, v)) = lt 7 vl u = UF.in(U, u) 8 vl v = UF.in(U, v) 9 in 0 i (u = v ) thn (U, T ) % i u n v r lry onnt thn skip ls (UF.union(U, u, v ), T ) % ontrt g in U n to T 2 n 3 in 4 itr Eg (U, ) E 5 n Th ADT supports th ollowing oprtions on union-in typ U: insrt(u, v) insrts th vrtx v, union(u, (u, v)) joins th two lmnts u n v into singl suprvrtx, in(u, v) rturns th suprvrtx in whih v longs, possily itsl, n quls(u, v) rturns tru i u n v r th sm suprvrtx. Now w n simply pross th gs in inrsing orr. This i givs Algorithm 8.3. Qustion 8.4. Wht is th work n th spn o Kruskl s lgorithm s on unionin? To nlyz th work n spn o th lgorithm w irst not tht thr is no prlllism, so th spn quls th work. To nlyz th work w n prtition it into th work rquir or sorting th gs n thn th work rquir to itrt ovr th gs using union n in. Th sort rquirs O(m log n) work. Th union n in oprtions n implmnt in O(log n) work h rquiring nothr O(m log n) work sin thy r ll O(m) tims. Th ovrll work is thror O(m log n). It turns out tht th union n in oprtions n tully implmnt with lss thn O(log n) mortiz work, ut this os not ru th ovrll work sin w still hv to sort Prim s Algorithm Prim s lgorithm prorms priority-irst srh to onstrut th minimum spnning tr. Th i is tht i w hv lry visit st X, thn y th light-g proprty th minimum wight g with on o its npoint in X n th othr in V \ X must in th MST (it is
7 8.2. ALGORITHMS FOR MINIMUM SPANNING TREES 32 minimum ross g rom X to V \ X). W n thror it to th MST n inlu th othr npoint in X. This ls to th ollowing inition o Prim s lgorithm: Algorithm 8.5 (Prim s Algorithm). For wight unirt grph G = (V, E, w) n sour s, Prim s lgorithm is priority-irst srh on G strting t n ritrry s V with T =, using priority p(v) = min w(x, v) (to minimiz), n stting x X T = T {(u, v)} whn visiting v whr w(u, v) = p(v). Whn th lgorithm trmints, T is th st o gs in th MST. Exmpl 8.. A stp o Prim s lgorithm. Sin th g (, ) hs minimum wight ross th ut (X, Y ), th lgorithm will visit ing (, ) to T n to X. X 3 Y= V \ X s 5 Exris 8.7. Crully prov th orrtnss o Prim s lgorithm y inution. Intrstingly this lgorithm is quit similr to Dijkstr s lgorithm or shortst pths. Th only irns r () w strt t n ritrry vrtx inst o t sour, (2) tht p(v) = min x X (x, v) inst o min x X ((x) + w(x, v)), n (3) w mintin tr T inst o tl o istns (v). Bus o th similrity w n silly us th sm priority-quu implmnttion s in Dijkstr s lgorithm n it runs with th sm O(m log n) work ouns. Rmrk 8.8. Prim s lgorithm ws invnt in 930 y Czh mthmtiin Vojth Jrnik n ltr inpnntly in 957 y omputr sintist Rort Prim. Esgr Dijkstr s risovr it in 959 in th sm ppr h sri his mous shortst pth lgorithm.
8 322 CHAPTER 8. MINIMUM SPANNING TREES Borůvk s Algorithm As isuss in prvious stions, Kruskl n Prim s lgorithm r squntil lgorithms. In this stion, w prsnt n MST lgorithm tht runs iintly in prlll using grph ontrtion. This prlll lgorithm is s on n pproh y Borůvk. As Kruskl s n Prim s, Borůvk s lgorithm onstruts th MST y insrting light gs ut unlik thm, it insrts mny light gs t on. To s how w n slt multipl light gs, rll thn ll light gs tht ross ut must in th MST. Qustion 8.9. Wht is th most trivil ut you n think o? Wht gs ross it? Consir now ut tht is in y vrtx v n th rst o th vrtis in th grph. Th gs tht ross this ut r xtly th gs inint on v. Thror, y th light g rul, or v, th minimum wight g twn it n its nighors is in th MST. Sin this rgumnt pplis to ll vrtis t th sm tim, th minimum wight gs inint n ny vrtx is in th MST. W ll suh gs vrtx-joinrs. Exmpl Th vrtx joinrs o th grph r highlight. Th vrtis n oth pik g {, }, piks {, }, n pik {, }, n piks {, } Qustion 8.2. Hv w oun ll th MST gs? Cn w stop? Somtims just on roun o piking vrtx-joinrs will slt ll th MST gs n woul gnrt omplt solution. Howvr, in most ss, th minimum-wight gs on thir own o not orm spnning tr. In th xmpl ov, w th g (, ) is not slt (nithr nor pik it). Qustion Givn tht w hv oun som o th gs, how n w pro, n w limint som gs rom onsirtion?
9 8.2. ALGORITHMS FOR MINIMUM SPANNING TREES 323 To s how w n pro, not tht th vrtx joinrs in prtitoning o th grph ll th vrtis r in prtition. Consir now th gs tht rmin intrnl to prtition. Suh n g is nnot in th MST, us insrting it into th MST woul rt yl. Th gs tht ross th prtitions, howvr, must onsir s thy n in in th MST. Qustion How n w limint th intrnl gs? On wy to limint th intrnl gs rom onsirtion, whil kping th ross gs is to prorm grph ontrtion s on th prtitioning in y th vrtx joinrs. Rll tht in grph ontrtion, ll w n is prtitioning o th grph into isjoint onnt sugrphs. Givn suh prtitioning, w thn rpl h sugrph (prtition) with suprvrtx n rll th gs. This is rpt until no gs rmin. Exmpl Contrtion long th minimum gs. Not tht thr r runnt gs twn th two prtitions ? Whn prorming grph ontrtion, w hv to rul out runnt gs. In our isussion o grph ontrtion in Chptr 7, us unwight grphs, w mntion tht w my trt runnt gs irntly s on th pplition. In unwight grphs, th tsk is usully simpl us w n just kp ny on o th runnt gs, n it usully os not mttr whih on. Whn th gs hv wights, howvr, w hv to i to kp ll th gs or slt som o th gs to kp. Qustion Whih g shoul w kp or omputing th MST? For th purposs o MST, in prtiulr, w n kp ll th gs or kp just th g with th minimum wight, us th othrs, nnot in th MST. In th xmpl ov, w woul kp th g with wight 4. Wht w just ovr is xtly Borůvk s i. H i not isuss implmnting th ontrtion in prlll. At th tim, thr wr not ny omputrs lt lon prlll ons. W r gl tht h hs lt us somthing to o. In summry, Borůvk s lgorithm n sri s ollows.
10 324 CHAPTER 8. MINIMUM SPANNING TREES Algorithm 8.2 (Borůvk). Whil thr r gs rmining: () slt th minimum wight g out o h vrtx n ontrt h onnt omponnt in y ths gs into vrtx; (2) rmov sl gs, n whn thr r runnt gs kp th minimum wight g; n (3) ll slt gs to th MST. Cost o Borůvk y using tr ontrtion. W now onsir th iiny o this lgorithm. W irst ous on th numr o rouns o ontrtion n thn onsir how to implmnt th ontrtion. Qustion Suppos tht w pik k minimum-wight gs, how mny vrtis will w rmov? Sin ontrting n g rmovs xtly on vrtx (ontrtion o n g n viw s oling on npoint into th othr), i k gs r slt thn k vrtis r rmov. Qustion Cn w thn rmov ll th vrtis? It is possil or k = n n to rmov ll th vrtis ut k will gnrlly lss thn n, us two vrtis n slt th sm g. Qustion At lst how mny vrtis n rmov? Thror thr must t lst n/2 gs n thus n/2 vrtis will rmov. Consquntly, Borůvk s lgorithm will tk t most log 2 n rouns o slting vrtx-joinrs n ontrting s on th prtitioning in y thm. Qustion How n prorm roun o ontrtion s on th prtitioning in y th vrtx-joinrs? Cn w us g ontrtion or str ontrtion? To ontrt th prtition in y th vrtx joinrs, w nnot us g or str ontrtion, us th prtitions my not orrspon to g or str prtitions. In gnrl h prtition intii y slting th vrtx joinrs r nithr singl gs nor singl strs.
11 8.2. ALGORITHMS FOR MINIMUM SPANNING TREES 325 Exmpl 8.3. An xmpl whr minimum-wight gs giv non-str tr. Not tht w hv in t pik minimum spnning tr y just slting th minimumwight gs It turns out, th minimum-wight gs will orm orst ( st o trs). Thror, th prtitions r in y gnrl trs n thus w wnt to ontrt trs. By rmoving ll gs tht r not vrtx joinrs, w n ontrt prtition y pplying str ontrtion to th prtition. Furthrmor sin whn oing str ontrtion on tr, it rmins tr on h stp, th numr o gs gos own with th numr o vrtis. Thror th totl work to ontrt ll th prtitions is oun y O(n) i using rry squns. Th spn rmins O(log 2 n). Atr ontrting h tr, w hv to upt th gs. As isuss rlir or runnt gs w wnt to kp th minimum wight suh g. Thr r vrious wys to o this, inluing kping th runnt gs. Kping th gs turns out to n tiv solution, n llows th upting th gs to on in O(m) work. Assuming runnt gs, th minimum into h omponnt n still on with O(m) work, s sri low. Sin thr r t most log n rouns, Borůvk s lgorithm will run in O(m log n) work n O(log 3 n) spn. Cost o Borůvk y using str ontrtion. W now sri how to improv th spn o Borůvk y logrithmi tor y intrlving stps o str ontrtion with stps o ining th vrtx joinrs, inst o ully ontrting th trs in y th vrtx-joinrs. Th i is to pply rnomiz str ontrtion on th sugrph inu y th vrtx joinrs, inst o onsiring th whol grph s in onvntionl str ontrtion. Intuitivly, this is orrt us w only hv to r out vrtx joinrs (ll othr gs nnot in th MST). As w will show, on h roun, w will still l to ru th numr o vrtis y onstnt tor (in xpttion), ling to logrithmi numr o totl rouns. Consquntly, w will ru th ovrll spn or ining th MST rom O(log 3 n) to O(log 2 n) n mintin th sm work.
12 32 CHAPTER 8. MINIMUM SPANNING TREES Exmpl An xmpl o Borůvk with str ontrtion. H 7 T 5 H 2 H 4 3 T H H 7 T 5 H 2 H 4 3 T H For st o vrtx-joinrs je, onsir th sugrph H = (V, je) o G n pply on stp o th str ontrtion on H. To pply str ontrtion, w n moiy our strcontrt routin so tht tr lipping oins, th tils only hook ross thir minimum-wight g. Th moii lgorithm or str ontrtion is s ollows. In th o w stns or th wight o th g (u, v). Algorithm 8.33 (Str Contrtion long Vrtx Joinrs). un joinrstrcontrt(g = (V, E), i) = 2 lt 3 vl je = vrtxjoinrs(g) 4 vl P = {u (v, w) je hs(u, i) hs(v, i)} 5 vl V = V \ omin(p ) in (V, P ) n whr vrtxjoinrs(g) ins th vrtx joinrs out o h vrtx v. Bor w go into tils out how w might kp trk o th MST n othr inormtion, lt us try to unrstn wht ts this hng hs on th numr o vrtis ontrt wy. I w hv n non-isolt vrtis, th ollowing lmm shows tht th lgorithm still rmovs n/4 vrtis in xpttion on h stp:
13 8.2. ALGORITHMS FOR MINIMUM SPANNING TREES 327 Lmm For grph G with n non-isolt vrtis, lt X n th rnom vril initing th numr o vrtis rmov y joinrstrcontrt(g, r). Thn, E [X n ] n/4. Proo. Th proo is prtty muh intil to our proo or strcontrt xpt hr w r not working with th whol g st, only rstrit on je. Lt v V (G) non-isolt vrtx. Lik or, lt H v th vnt tht v oms up hs, T v tht it oms up tils, n R v tht v omin(p ) (i., it is rmov). Sin v is non-isolt vrtx, v hs nighors n on o thm hs th minimum wight, so thr xists vrtx u suh tht (v, u) mine. Thn, w hv tht T v H u implis R v sin i v is til n u is h, thn v must join u. Thror, Pr [R v ] Pr [T v ] Pr [H u ] = /4. By th linrity o xpttion, w hv tht th numr o rmov vrtis is [ ] E I {R v } = E [I {R v }] n/4 v:v non-isolt sin w hv n vrtis tht r non-isolt. v:v non-isolt This mns tht this MST lgorithm will tk only O(log n) rouns, just lik our othr grph ontrtion lgorithms. Finl Things. Thr is littl it o trikinss sin, s th grph ontrts, th npoints o h g hngs. Thror, i w wnt to rturn th gs o th minimum spnning tr, thy might not orrspon to th originl npoints. To l with this, w ssoit uniqu ll with vry g n rturn th tr s st o lls (i.. th lls o th gs in th spnning tr). W lso ssoit th wight irtly with th g. Th typ o h g is thror (vrtx vrtx wight ll), whr th two vrtx npoints n hng s th grph ontrts ut th wight n ll stys ix. This ls to th slightlyupt vrsion o joinrstrcontrt tht pprs in Algorithm Th untion vrtxjoinr(g) in Lin ins th minimum g out o h vrtx v n mps v to th pir onsisting o th nighor long th g n th g ll. By Lmm 8., sin ll ths gs r minimum out o th vrtx, thy r s to to th MST. Lin 2 thn piks rom ths gs th gs tht go rom til to h, n thror gnrts mpping rom tils to hs long minimum gs, rting strs. Finlly, Lin 3 rmovs ll vrtis tht r in this mpping to str ntrs. This is ry to us in th MST o, similr to th grphcontrt o stui lst tim, xpt w rturn th st o lls or th MST gs inst o th rmining vrtis. Th o is givn in Algorithm 8.35 Th MST lgorithm is ll y running MST(G,, r). As n si, w know tht T is spnning orst on th ontrt nos. Finlly w sri how to implmnt minegs(g), whih rturns or h vrtx th minimum g inint on tht vrtx. Thr r vrious wys to o this. On wy is to mk
14 328 CHAPTER 8. MINIMUM SPANNING TREES Algorithm 8.35 (Borůvk s s on Str Contrtion). untion vrtxjoinrs (E) = 2 lt 3 ET = {(u, v, w, l) {u (v, w, l)} : (u, v, w, l) E} 4 untion joinegs((v, w, l ), (v 2, w 2, l 2 )) = 5 i (w w 2 ) thn (v, w, l ) ls (v 2, w 2, l 2 ) in 7 ru (mrg joinegs) {} ET 8 n 9 untion joinrstrcontrt(g = (V, E), i) 0 lt mine = vrtxjoinrs(g) 2 P = {(u (v, w, l)) mine hs(u, i) hs(v, i)} 3 V = V \ omin(p ) 4 in (V, P ) n 5 untion MST((V, E), T, i) = i ( E = 0) thn T 7 ls lt 8 (V, P T ) = joinrstrcontrt((v, E), i) 9 P = {u v : u (v, w, l) P T } {v v : v V } 20 T = {l : u (v, w, l) P T } 2 E = {(P [u], P [v], w, l) : (u, v, w, l) E P [u] P [v]} 22 in 23 MST((V, E ), T T, i + ) 24 n singlton tl or h g n thn mrg ll th tls with n pproprit untion to rsolv ollisions. Algorithm 8.35 givs o tht mrgs gs y tking th on with lightr g wight. I using squns or th gs n vrtis n vn simplr wy is to prsort th gs y rsing wight n thn us injt. Rll tht whn thr r ollisions t th sm lotion injt will lwys tk th lst vlu, whih will th on with minimum wight. 8.3 Minimum Spnning Trs n th Trvl Slsprson Prolm Bouning TSP with MST. Thr is n intrsting onntion twn minimum spnning trs n th symmtri Trvling Slsprson Prolm (TSP), n NP-hr prolm. Rll
15 8.3. MINIMUM SPANNING TREES AND THE TRAVEL SALESPERSON PROBLEM329 tht in TSP prolm, w r givn st o n itis (vrtis) n r intrst in ining tour tht visits ll th vrtis xtly on n rturns to th origin. For th symmtri s th gs r unirt (or quivlntly th istn is th sm in h irtion). For th TSP prolm, w usully onsir omplt grphs, whr thr is n g twn ny two vrtis. Evn i grph is not omplt, w n typilly omplt it y insrting gs with lrg wights tht mk sur tht th g nvr pprs in solution. Hr w lso ssum th g wights r non-ngtiv. Qustion 8.3. Cn you think o wy to oun th solution to TSP prolm on n unirt onnt grph using minimum spnning trs. Sin th solution to th TSP prolm visits vry vrtx on (rturning to th origin), it spns th grph. It is howvr not tr ut yl. Sin h vrtx is visit on, howvr, ropping ny g woul yil spnning tr. Thus solution to th TSP prolm nnot hv lss totl wight thn tht o minimum spnning tr. In othr wors, th wight o MST yils lowr oun on th solution to th symmtri TSP prolm or grphs with non-ngtiv g wights. Approximting TSP with MST. It turns out tht minimum spnning trs n lso us to in n pproximt solutions to th TSP prolm, tivly ining n uppr oun. This, howvr, rquirs on mor onition on th MST prolm. In prtiulr in ition to rquiring tht wights r non-ngtiv w rquir tht ll istns stisy th tringl inqulity i.., or ny thr vrtis,, n, w(, ) w(, ) + w(, ). This rstrition hols or most pplitions o th TSP prolm n is rrr to s th mtri TSP prolm. It lso implis tht g wights r non-ngtiv. W woul now lik wy to us th MST to gnrt pth to tk s n pproximt solution to th TSP prolm. To o this w irst onsir pth s on th MST tht n visit vrtx multipl tims, n thn tk shortuts to nsur w only visit h vrtx on. Qustion Givn n unirt grph G, suppos tht you omput minimum spnning tr T. Cn you us th tr to visit h vrtx in th grph rom givn origin? Givn minimum spnning tr T w n strt t ny vrtx s n tk pth s on th pth-irst srh on th tr rom s. In prtiulr whnvr w visit nw vrtx v rom vrtx u w trvrs th g rom u to v n whn w r on visiting vrything rhl rom v w thn k up on this sm g, trvrsing it rom v to u. This wy vry g in our pth is trvrs xtly twi, n w n th pth t our initil vrtx. I w viw h unirt g s two irt gs, thn this pth is so-ll Eulr tour o th tr i.. yl in grph tht visits vry g xtly on. Sin T spns th grph, th Eulr tour will visit vry vrtx t lst on, ut possily multipl tims.
16 330 CHAPTER 8. MINIMUM SPANNING TREES Exmpl Th igur on th right shows n Eulr tour o th tr on th lt. Strting t, th tour visits,,,,,,,,,,. Now, rll tht in th TSP prolm it is ssum tht thr is n g twn vry pir o vrtis. Qustion Cn you in wy to riv non-optiml solution to TSP using th prtiulr pproh to visiting vrtis? Lt s irst try to limint multipl visits. Sin it is possil to tk n g rom ny vrtx to ny othr, w n tk shortuts to voi visiting vrtis multipl tims. Mor prisly wht w n o is whn out to go k to vrtx tht th tour hs lry visit, inst in th nxt vrtx in th tour tht hs not n visit n go irtly to it. W ll this shortut g. Exmpl Th igur on th right shows solution to TSP with shortuts, rwn in r. Strting t, w n visit,,,,,,. Qustion 8.4. Assuming tht gs r istns twn itis, n w sy nything out th lngths o th shortut gs? By th tringl inqulity th shortut gs r no longr thn th pths tht thy rpl. Thus y tking shortuts, th totl istn is not inrs.
17 8.4. EXERCISES AND PROBLEMS 33 Qustion Wht n you sy out th wight o th TSP tht w otin in this wy? Sin th Eulr tour trvrss h g in th minimum spnning tr twi (on in h irtion), th totl wight o th pth is xtly twi th wight o th TSP. With shortuts, w otin solution to th TSP prolm tht is t most th wight o th Eulr tour, n hn t most twi th wight o th MST. Sin th wight o th MST is lso lowr oun on th TSP, th solution w hv oun is within tor o 2 o optiml. This mns our pproh is n pproximtion lgorithm or TSP tht pproximts th solution within tor o 2. This n summriz s: W (MST(G)) W (TSP(G)) 2W (MST(G)). Rmrk It is possil to ru th pproximtion tor to.5 using wll known lgorithm vlop y Nios Christois t CMU in 97. Th lgorithm is lso s on th MST prolm, ut is ollow y ining vrtx mthing on th vrtis in th MST with o-gr, ing ths to th tr, ining n Eulr tour o th omin grph, n gin shortutting. Christois lgorithm ws on o th irst pproximtion lgorithms n it took ovr 40 yrs to improv on th rsult, n only vry slightly. 8.4 Exriss n Prolms Exris Prov tht ny tr with n vrtis hs n gs. Exris Work out th tils o th lgorithm or spnning trs using grph ontrtion with str prtitions (s mntion in Stion 8.) n prov tht it prous spnning tr. Exris 8.4. Prov tht th ntwork with th minimum ost in Exmpl 8.7 is in n MST o th grph. Exris Writ out th psuoo or Priority Quu s implmnttion o Prim s lgorithm tht runs in O(m log n) work. Prolm Prov tht grph with istint g wights hs uniqu minimum spnning tr.
18 332 CHAPTER 8. MINIMUM SPANNING TREES Prolm Prov tht th vrtx-joinrs slt in ny roun Borůvk s lgorithm orm orst. Rll tht w r ssuming tht no two g wights r qul.
An 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 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 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 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 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 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 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 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 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 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 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 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 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 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 informationV={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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 informationNP-Completeness. CS3230 (Algorithm) Traveling Salesperson Problem. What s the Big Deal? Given a Problem. What s the Big Deal? What s the Big Deal?
NP-Compltnss 1. Polynomil tim lgorithm 2. Polynomil tim rution 3.P vs NP 4.NP-ompltnss (som slis y P.T. Um Univrsity o Txs t Dlls r us) Trvling Slsprson Prolm Fin minimum lngth tour tht visits h ity on
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 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 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 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 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 informationPage 1. Question 19.1b Electric Charge II Question 19.2a Conductors I. ConcepTest Clicker Questions Chapter 19. Physics, 4 th Edition James S.
ConTst Clikr ustions Chtr 19 Physis, 4 th Eition Jms S. Wlkr ustion 19.1 Two hrg blls r rlling h othr s thy hng from th iling. Wht n you sy bout thir hrgs? Eltri Chrg I on is ositiv, th othr is ngtiv both
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 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 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 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 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 informationRegister Allocation. Register Allocation. Principle Phases. Principle Phases. Example: Build. Spills 11/14/2012
Rgistr Allotion W now r l to o rgistr llotion on our intrfrn grph. W wnt to l with two typs of onstrints: 1. Two vlus r liv t ovrlpping points (intrfrn grph) 2. A vlu must or must not in prtiulr rhitturl
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 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 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 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 informationChapter 9. Graphs. 9.1 Graphs
Chptr 9 Grphs Grphs r vry gnrl lss of ojt, us to formliz wi vrity of prtil prolms in omputr sin. In this hptr, w ll s th sis of (finit) unirt grphs, inluing grph isomorphism, onntivity, n grph oloring.
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 informationA 4-state solution to the Firing Squad Synchronization Problem based on hybrid rule 60 and 102 cellular automata
A 4-stt solution to th Firing Squ Synhroniztion Prolm s on hyri rul 60 n 102 llulr utomt LI Ning 1, LIANG Shi-li 1*, CUI Shung 1, XU Mi-ling 1, ZHANG Ling 2 (1. Dprtmnt o Physis, Northst Norml Univrsity,
More informationCSI35 Chapter 11 Review
1. Which of th grphs r trs? c f c g f c x y f z p q r 1 1. Which of th grphs r trs? c f c g f c x y f z p q r . Answr th qustions out th following tr 1) Which vrtx is th root of c th tr? ) wht is th hight
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 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 informationFSA. CmSc 365 Theory of Computation. Finite State Automata and Regular Expressions (Chapter 2, Section 2.3) ALPHABET operations: U, concatenation, *
CmSc 365 Thory of Computtion Finit Stt Automt nd Rgulr Exprssions (Chptr 2, Sction 2.3) ALPHABET oprtions: U, conctntion, * otin otin Strings Form Rgulr xprssions dscri Closd undr U, conctntion nd * (if
More informationIntegration Continued. Integration by Parts Solving Definite Integrals: Area Under a Curve Improper Integrals
Intgrtion Continud Intgrtion y Prts Solving Dinit Intgrls: Ar Undr Curv Impropr Intgrls Intgrtion y Prts Prticulrly usul whn you r trying to tk th intgrl o som unction tht is th product o n lgric prssion
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 informationCSE303 - Introduction to the Theory of Computing Sample Solutions for Exercises on Finite Automata
CSE303 - Introduction to th Thory of Computing Smpl Solutions for Exrciss on Finit Automt Exrcis 2.1.1 A dtrministic finit utomton M ccpts th mpty string (i.., L(M)) if nd only if its initil stt is finl
More informationJonathan Turner Exam 2-10/28/03
CS Algorihm n Progrm Prolm Exm Soluion S Soluion Jonhn Turnr Exm //. ( poin) In h Fioni hp ruur, u wn vrx u n i prn v u ing u v i v h lry lo hil in i l m hil o om ohr vrx. Suppo w hng hi, o h ing u i prorm
More informationRAM Model. I/O Model. Real Machine Example: Nehalem : Algorithms in the Real World 4/9/13
4//3 RAM Mol 5-853: Algorithms in th Rl Worl Lolity I: Ch-wr lgorithms Introution Sorting List rnking B-trs Bur trs Stnr thortil mol or nlyzing lgorithms: Ininit mmory siz Uniorm ss ost Evlut n lgorithm
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 informationConstruction 11: Book I, Proposition 42
Th Visul Construtions of Euli Constrution #11 73 Constrution 11: Book I, Proposition 42 To onstrut, in givn rtilinl ngl, prlllogrm qul to givn tringl. Not: Equl hr mns qul in r. 74 Constrution # 11 Th
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 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 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 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 informationRegister Allocation. How to assign variables to finitely many registers? What to do when it can t be done? How to do so efficiently?
Rgistr Allotion Rgistr Allotion How to ssign vrils to initly mny rgistrs? Wht to o whn it n t on? How to o so iintly? Mony, Jun 3, 13 Mmory Wll Disprity twn CPU sp n mmory ss sp improvmnt Mony, Jun 3,
More informationSelf-Adjusting Top Trees
Th Polm Sl-jsting Top Ts ynmi ts: ol: mintin n n-tx ost tht hngs o tim. link(,w): ts n g twn tis n w. t(,w): lts g (,w). pplition-spii t ssoit with gs n/o tis. ont xmpls: in minimm-wight g in th pth twn
More informationThis chapter covers special properties of planar graphs.
Chptr 21 Plnr Grphs This hptr ovrs spil proprtis of plnr grphs. 21.1 Plnr grphs A plnr grph is grph whih n b rwn in th pln without ny gs rossing. Som piturs of plnr grph might hv rossing gs, but it s possibl
More information(a) v 1. v a. v i. v s. (b)
Outlin RETIMING Struturl optimiztion mthods. Gionni D Mihli Stnford Unirsity Rtiming. { Modling. { Rtiming for minimum dly. { Rtiming for minimum r. Synhronous Logi Ntwork Synhronous Logi Ntwork Synhronous
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 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 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 informationThe University of Sydney MATH 2009
T Unvrsty o Syny MATH 2009 APH THEOY Tutorl 7 Solutons 2004 1. Lt t sonnt plnr rp sown. Drw ts ul, n t ul o t ul ( ). Sow tt s sonnt plnr rp, tn s onnt. Du tt ( ) s not somorp to. ( ) A onnt rp s on n
More informationModule 2 Motion Instructions
Moul 2 Motion Instrutions CAUTION: Bor you strt this xprimnt, unrstn tht you r xpt to ollow irtions EXPLICITLY! Tk your tim n r th irtions or h stp n or h prt o th xprimnt. You will rquir to ntr t in prtiulr
More information