Copyright 2000, Kevin Wayne 1

Size: px
Start display at page:

Download "Copyright 2000, Kevin Wayne 1"

Transcription

1 Rp: Grphs 80: Algorthm Dsgn n Anlyss Jrmh Blok Puru Unvrsty prng 09 Dfnton of Grph Rprsnttons Any Mtrx Any Lst onntvty, yls Trs (onnt + No yls) Root Trs/Bnry Trs/Bln Bnry Trs Brth Frst rh BF Tr O(m+n) lgorthm Appltons: onnt omponnts, hortst Pth t Tstng Bprttnss Drt Grphs n trong onntvty Announmnt: Homwork rls! Du: Jnury th t :9PM (Grsop) trong onntvty: Algorthm Thorm. n trmn f G s strongly onnt n O(m + n) tm. Pf. Pk ny no s. Run BF from s n G. rvrs orntton of vry g n G Run BF from s n G rv. Rturn tru ff ll nos rh n oth BF xutons. orrtnss follows mmtly from prvous lmm.. DAGs n Topologl Orrng strongly onnt not strongly onnt Drt Ayl Grphs Prn onstrnts Df. An DAG s rt grph tht ontns no rt yls. Prn onstrnts. Eg (v, v ) mns tsk v must our for v. Ex. Prn onstrnts: g (v, v ) mns v must pr v. Df. A topologl orr of rt grph G = (V, E) s n orrng of ts nos s v, v,, v n so tht for vry g (v, v ) w hv <. Appltons. ours prrqust grph: ours v must tkn for v. omplton: moul v must ompl for v. Ppln of omputng os: output of o v n to trmn nput of o v. v v v v v v 7 v v v v v v v v 7 topologl orrng Funton F(V) W:= * V; X:=W + V; Y:=X * W; :=W *W; Z:=Y + V; rturn Z V W X Y Z DAG opyrght 000, Kvn Wyn

2 Drt Ayl Grphs Drt Ayl Grphs Lmm. If G hs topologl orr, thn G s DAG. uppos tht G hs topologl orr v,, v n n tht G lso hs rt yl. Lt's s wht hppns. Lt v th lowst-nx no n, n lt v th no ust for v ; thus (v, v ) s n g. By our ho of, w hv <. On th othr hn, sn (v, v ) s n g n v,, v n s topologl orr, w must hv <, ontrton. Lmm. If G hs topologl orr, thn G s DAG. Q. Dos vry DAG hv topologl orrng? Q. If so, how o w omput on? th rt yl v v v v n th suppos topologl orr: v,, v n 7 8 Drt Ayl Grphs Drt Ayl Grphs Lmm. If G s DAG, thn G hs no wth no nomng gs. uppos tht G s DAG n vry no hs t lst on nomng g. Lt's s wht hppns. Pk ny no v, n gn followng gs kwr from v. n v hs t lst on nomng g (u, v) w n wlk kwr to u. Thn, sn u hs t lst on nomng g (x, u), w n wlk kwr to x. Rpt untl w vst no, sy w, tw. Lt not th squn of nos nountr twn sussv vsts to w. s yl. Lmm. If G s DAG, thn G hs topologl orrng. Pf. (y nuton on n) Bs s: tru f n =. Gvn DAG on n > nos, fn no v wth no nomng gs. G - { v } s DAG, sn ltng v nnot rt yls. By nutv hypothss, G - { v } hs topologl orrng. Pl v frst n topologl orrng; thn ppn nos of G - {v} n topologl orr. Ths s vl sn v hs no nomng gs. ply DAG v w x u v 9 0 Topologl ortng Algorthm: Runnng Tm Thorm. Algorthm fns topologl orr n O(m + n) tm. Pf. Mntn th followng nformton: ount[w] = rmnng numr of nomng gs = st of rmnng nos wth no nomng gs Intlzton: O(m + n) v sngl sn through grph. Upt: to lt v rmov v from rmnt ount[w] for ll gs from v to w, n w to f ount[w] hts 0 ths s O() pr g hptr Gry Algorthms ls y Kvn Wyn. opyrght 00 Prson-Ason Wsly. All rghts rsrv. opyrght 000, Kvn Wyn

3 Intrvl hulng. Intrvl hulng Intrvl shulng. Jo strts t s n fnshs t f. Two os omptl f thy on't ovrlp. Gol: fn mxmum sust of mutully omptl os. f g h Tm Intrvl hulng: Gry Algorthms Intrvl hulng: Gry Algorthms Gry tmplt. onsr os n som nturl orr. Tk h o prov t's omptl wth th ons lry tkn. Gry tmplt. onsr os n som nturl orr. Tk h o prov t's omptl wth th ons lry tkn. [Erlst strt tm] onsr os n snng orr of s. [Erlst fnsh tm] onsr os n snng orr of f. ountrxmpl for rlst strt tm [hortst ntrvl] onsr os n snng orr of f -s. [Fwst onflts] For h o, ount th numr of onfltng os. hul n snng orr of. ountrxmpl for shortst ntrvl ountrxmpl for fwst onflts Intrvl hulng: Gry Algorthm Intrvl hulng: Anlyss Gry lgorthm. onsr os n nrsng orr of fnsh tm. Tk h o prov t's omptl wth th ons lry tkn. ort os y fnsh tms so tht f f... f n. st of os slt A for = to n { f (o omptl wth A) A A {} } rturn A ply Gry: Thorm. Gry lgorthm s optml. Assum gry s not optml, n lt's s wht hppns. Lt,,... k not st of os slt y gry. Lt,,... m not st of os n th optml soluton wth =, =,..., r = r for th lrgst possl vlu of r. o r+ fnshs for r+ r r+... Implmntton. O(n log n). Rmmr o * tht ws lst to A. Jo s omptl wth A f s f *. OPT: r r+ why not rpl o r+ wth o r+? opyrght 000, Kvn Wyn

4 Intrvl hulng: Anlyss Thorm. Gry lgorthm s optml. Assum gry s not optml, n lt's s wht hppns. Lt,,... k not st of os slt y gry. Lt,,... m not st of os n th optml soluton wth =, =,..., r = r for th lrgst possl vlu of r.. Intrvl Prttonng o r+ fnshs for r+ Gry: r r+ OPT: r r+... soluton stll fsl n optml, ut ontrts mxmlty of r. 9 Intrvl Prttonng Intrvl Prttonng Intrvl prttonng. Ltur strts t s n fnshs t f. Gol: fn mnmum numr of lssrooms to shul ll lturs so tht no two our t th sm tm n th sm room. Ex: Ths shul uss lssrooms to shul 0 lturs. Intrvl prttonng. Ltur strts t s n fnshs t f. Gol: fn mnmum numr of lssrooms to shul ll lturs so tht no two our t th sm tm n th sm room. Ex: Ths shul uss only. f g h g h f 9 9:0 0 0:0 :0 :0 :0 :0 :0 :0 Tm 9 9:0 0 0:0 :0 :0 :0 :0 :0 :0 Tm Intrvl Prttonng: Lowr Boun on Optml oluton Intrvl Prttonng: Gry Algorthm Df. Th pth of st of opn ntrvls s th mxmum numr tht ontn ny gvn tm. Ky osrvton. Numr of lssrooms n pth. Ex: Dpth of shul low = shul low s optml. Q. Dos thr lwys xst shul qul to pth of ntrvls?,, ll ontn 9:0 9 9:0 0 0:0 :0 :0 :0 :0 f g h :0 :0 Tm Gry lgorthm. onsr lturs n nrsng orr of strt tm: ssgn ltur to ny omptl lssroom. ort ntrvls y strtng tm so tht s s... s n. 0 numr of llot lssrooms for = to n { f (ltur s omptl wth som lssroom k) shul ltur n lssroom k ls llot nw lssroom + shul ltur n lssroom + + } Implmntton. O(n log n). For h lssroom k, mntn th fnsh tm of th lst o. Kp th lssrooms n prorty quu. opyrght 000, Kvn Wyn

5 Intrvl Prttonng: Gry Anlyss Osrvton. Gry lgorthm nvr shuls two nomptl lturs n th sm lssroom.. hortst Pths n Grph Thorm. Gry lgorthm s optml. Pf. Lt = numr of lssrooms tht th gry lgorthm llots. lssroom s opn us w n to shul o, sy, tht s nomptl wth ll - othr lssrooms. Ths os (nlung ) h n ftr s. n w sort y strt tm, ll ths nomptlts r us y lturs tht strt no ltr thn s. Thus, w hv lturs ovrlppng t tm s +. Ky osrvton ll shuls us lssrooms. shortst rout from Wng Hll to Mm Bh hortst Pth Prolm Dkstr's Algorthm hortst pth ntwork. Drt grph G = (V, E). our s, stnton t. Lngth = lngth of g. hortst pth prolm: fn shortst rt pth from s to t. ost of pth s----t = = 0. ost of pth = sum of g osts n pth Dkstr's lgorthm. Mntn st of xplor nos for whh w hv trmn th shortst pth stn (u) from s to u. Intlz = { s }, (s) = 0. Rptly hoos unxplor no v whh mnmzs ( v) mn ( u), ( u, v) : u v to, n st (v) = (v). shortst pth to som u n xplor prt, follow y sngl g (u, v) s s (u) u v 7 t 7 8 Dkstr's Algorthm Dkstr's Algorthm: Proof of orrtnss Dkstr's lgorthm. Mntn st of xplor nos for whh w hv trmn th shortst pth stn (u) from s to u. Intlz = { s }, (s) = 0. Rptly hoos unxplor no v whh mnmzs ( v) mn ( u), ( u, v) : u v to, n st (v) = (v). shortst pth to som u n xplor prt, follow y sngl g (u, v) Invrnt. For h no u, (u) s th lngth of th shortst s-u pth. Pf. (y nuton on ) Bs s: = s trvl. Inutv hypothss: Assum tru for = k. Lt v nxt no to, n lt u-v th hosn g. Th shortst s-u pth plus (u, v) s n s-v pth of lngth (v). onsr ny s-v pth P. W'll s tht t's no shortr thn (v). Lt x-y th frst g n P tht lvs, n lt P' th supth to x. P s lry too long s soon s t lvs. P' x P y s (u) u v s (P) (P') + (x,y) (x) + (x, y) (y) (v) u v nonngtv wghts nutv hypothss fn of (y) Dkstr hos v nst of y 9 0 opyrght 000, Kvn Wyn

6 Dkstr's Algorthm: Implmntton For h unxplor no, xpltly mntn (v) mn (u). (u,v):u Extr ls Nxt no to xplor = no wth mnmum (v). Whn xplorng v, for h nnt g = (v, w), upt (w) mn { (w), (v) }. Effnt mplmntton. Mntn prorty quu of unxplor nos, prortz y (v). ply Prorty Quu PQ Oprton Dkstr Arry Bnry hp -wy Hp F hp Insrt ExtrtMn hngky n n m n n log n log n log n log n log n log n log n IsEmpty n Totl n m log n m log m/n n m + n log n Invul ops r mortz ouns hulng to Mnmzng Ltnss. hulng to Mnmz Ltnss Mnmzng ltnss prolm. ngl rsour prosss on o t tm. Jo rqurs t unts of prossng tm n s u t tm. If strts t tm s, t fnshs t tm f = s + t. Ltnss: = mx { 0, f - }. Gol: shul ll os to mnmz mxmum ltnss L = mx. Ex: t ltnss = ltnss = 0 mx ltnss = = 9 = 8 = = = = Mnmzng Ltnss: Gry Algorthms Mnmzng Ltnss: Gry Algorthms Gry tmplt. onsr os n som orr. Gry tmplt. onsr os n som orr. [hortst prossng tm frst] onsr os n snng orr of prossng tm t. [hortst prossng tm frst] onsr os n snng orr of prossng tm t. [Erlst ln frst] onsr os n snng orr of ln. t ountrxmpl [mllst slk] onsr os n snng orr of slk -t. [mllst slk] onsr os n snng orr of slk -t. t 0 0 ountrxmpl opyrght 000, Kvn Wyn

7 Mnmzng Ltnss: Gry Algorthm Mnmzng Ltnss: No Il Tm Gry lgorthm. Erlst ln frst. Osrvton. Thr xsts n optml shul wth no l tm. ort n os y ln so tht n = = 0 = t 0 for = to n Assgn o to ntrvl [t, t + t ] s t, f t + t t t + t output ntrvls [s, f ] = = = Osrvton. Th gry shul hs no l tm. mx ltnss = = = 8 = 9 = 9 = = Mnmzng Ltnss: Invrsons Mnmzng Ltnss: Invrsons Df. Gvn shul, n nvrson s pr of os n suh tht: < ut shul for. nvrson f Df. Gvn shul, n nvrson s pr of os n suh tht: < ut shul for. nvrson f for swp for swp [ s for, w ssum os r numr so tht n ] ftr swp f' Osrvton. Gry shul hs no nvrsons. Osrvton. If shul (wth no l tm) hs n nvrson, t hs on wth pr of nvrt os shul onsutvly. lm. wppng two onsutv, nvrt os rus th numr of nvrsons y on n os not nrs th mx ltnss. Pf. Lt th ltnss for th swp, n lt ' t ftrwrs. ' k = k for ll k, ' If o s lt: f f (fnton) ( fnshs t tm f ) f ( ) (fnton) 9 0 Mnmzng Ltnss: Anlyss of Gry Algorthm Gry Anlyss trtgs Thorm. Gry shul s optml. Pf. Dfn * to n optml shul tht hs th fwst numr of nvrsons, n lt's s wht hppns. n ssum * hs no l tm. If * hs no nvrsons, thn = *. If * hs n nvrson, lt - n nt nvrson. swppng n os not nrs th mxmum ltnss n strtly rss th numr of nvrsons ths ontrts fnton of * Gry lgorthm stys h. how tht ftr h stp of th gry lgorthm, ts soluton s t lst s goo s ny othr lgorthm's. truturl. Dsovr smpl "struturl" oun ssrtng tht vry possl soluton must hv rtn vlu. Thn show tht your lgorthm lwys hvs ths oun. Exhng rgumnt. Grully trnsform ny soluton to th on foun y th gry lgorthm wthout hurtng ts qulty. Othr gry lgorthms. Kruskl, Prm, Dkstr, Huffmn, opyrght 000, Kvn Wyn 7

8 Optml Offln hng. Optml hng hng. h wth pty to stor k tms. qun of m tm rqusts,,, m. h ht: tm lry n h whn rqust. h mss: tm not lry n h whn rqust: must rng rqust tm nto h, n vt som xstng tm, f full. Gol. Evton shul tht mnmzs numr of h msss. Ex: k =, ntl h =, r = h mss rqusts:,,,,,,,. Optml vton shul: h msss. rqusts h Optml Offln hng: Frthst-In-Futur Ru Evton huls Frthst-n-futur. Evt tm n th h tht s not rqust untl frthst n th futur. Df. A ru shul s shul tht only nsrts n tm nto th h n stp n whh tht tm s rqust. urrnt h: f futur qurs: g f f g h... h mss t ths on Thorm. [Blly, 90s] FF s optml vton shul. Pf. Algorthm n thorm r ntutv; proof s sutl. Intuton. n trnsform n unru shul nto ru on wth no mor h msss. x x n unru shul ru shul Ru Evton huls Frthst-In-Futur: Anlyss lm. Gvn ny unru shul, n trnsform t nto ru shul ' wth no mor h msss. osn't ntr h t rqust Pf. (y nuton on numr of unru tms) tm uppos rngs nto th h t tm t, wthout rqust. Lt th tm vts whn t rngs nto th h. s : vt t tm t', for nxt rqust for. s : rqust t tm t' for s vt. t t' t t' vt t tm t', for nxt rqust ' t t' t t' rqust t tm t' ' Thorm. FF s optml vton lgorthm. Pf. (y nuton on numr or rqusts ) Invrnt: Thr xsts n optml ru shul tht mks th sm vton shul s FF through th frst + rqusts. Lt ru shul tht stsfs nvrnt through rqusts. W prou ' tht stsfs nvrnt ftr + rqusts. onsr (+) st rqust = +. n n FF hv gr up untl now, thy hv th sm h ontnts for rqust +. s : ( s lry n th h). ' = stsfs nvrnt. s : ( s not n th h n n FF vt th sm lmnt). ' = stsfs nvrnt. s s 7 8 opyrght 000, Kvn Wyn 8

9 Frthst-In-Futur: Anlyss Frthst-In-Futur: Anlyss Pf. (ontnu) s : ( s not n th h; FF vts ; vts f ). gn onstruton of ' from y vtng nst of f sm f sm f ' + sm sm f ' now ' grs wth FF on frst + rqusts; w show tht hvng lmnt f n h s no wors thn hvng lmnt Lt ' th frst tm ftr + tht n ' tk ffrnt ton, n lt g tm rqust t tm '. must nvolv or f (or oth) ' sm sm f ' s : g =. n't hppn wth Frthst-In-Futur sn thr must rqust for f for. s : g = f. Elmnt f n't n h of, so lt ' th lmnt tht vts. f ' =, ' sss f from h; now n ' hv sm h f ', ' vts ' n rngs nto th h; now n ' hv th sm h Not: ' s no longr ru, ut n trnsform nto ru shul tht grs wth FF through stp Frthst-In-Futur: Anlyss hng Prsptv Lt ' th frst tm ftr + tht n ' tk ffrnt ton, n lt g tm rqust t tm '. must nvolv or f (or oth) ' s : g, f. must vt. Mk ' vt f; now n ' hv th sm h. ' sm sm f ' othrws ' woul tk th sm ton sm g sm g ' Onln vs. offln lgorthms. Offln: full squn of rqusts s known pror. Onln (rlty): rqusts r not known n vn. hng s mong most funmntl onln prolms n. LIFO. Evt pg rought n most rntly. LRU. Evt pg whos most rnt ss ws rlst. Thorm. FF s optml offln vton lgorthm. Provs ss for unrstnng n nlyzng onln lgorthms. LRU s k-ompttv. [ton.8] LIFO s rtrrly. FF wth rton of tm rvrs! on hngng on hngng Gol. Gvn urrny nomntons:,, 0,, 00, vs mtho to py mount to ustomr usng fwst numr of ons. Ex:. Gr s goo. Gr s rght. Gr works. Gr lrfs, uts through, n pturs th ssn of th volutonry sprt. - Goron Gko (Mhl Dougls) shr's lgorthm. At h trton, on of th lrgst vlu tht os not tk us pst th mount to p. Ex: $.89. opyrght 000, Kvn Wyn 9

10 on-hngng: Gry Algorthm on-hngng: Anlyss of Gry Algorthm shr's lgorthm. At h trton, on of th lrgst vlu tht os not tk us pst th mount to p. ort ons nomntons y vlu: < < < n. ons slt whl (x 0) { lt k lrgst ntgr suh tht k x f (k = 0) rturn "no soluton foun" x x - k {k} } rturn Q. Is shr's lgorthm optml? Thorm. Gr s optml for U.. ong:,, 0,, 00. Pf. (y nuton on x) onsr optml wy to hng k x < k+ : gry tks on k. W lm tht ny optml soluton must lso tk on k. f not, t ns nough ons of typ,, k- to up to x tl low nts no optml soluton n o ths Prolm rus to on-hngng x - k nts, whh, y nuton, s optmlly solv y gry lgorthm. k All optml solutons k must stsfy P N 0 N + D 00 Q no lmt Mx vlu of ons,,, k- n ny OPT - + = = 7 + = 99 on-hngng: Anlyss of Gry Algorthm Osrvton. Gry lgorthm s su-optml for U postl nomntons:, 0,,, 70, 00, 0,, 00. ltng Brkponts ountrxmpl. 0. Gry: 00,,,,,,,. Optml: 70, ltng Brkponts ltng Brkponts: Gry Algorthm ltng rkponts. Ro trp from Prnton to Plo Alto long fx rout. Rfulng sttons t rtn ponts long th wy. Ful pty =. Gol: mks s fw rfulng stops s possl. Gry lgorthm. Go s fr s you n for rfulng. Prnton Plo Alto Truk rvr's lgorthm. ort rkponts so tht: 0 = 0 < < <... < n = L {0} rkponts slt x 0 urrnt loton whl (x n ) lt p lrgst ntgr suh tht p x + f ( p = x) rturn "no soluton" x p {p} rturn 7 Implmntton. O(n log n) Us nry srh to slt h rkpont p. 9 0 opyrght 000, Kvn Wyn 0

11 ltng Brkponts: orrtnss ltng Brkponts: orrtnss Thorm. Gry lgorthm s optml. Assum gry s not optml, n lt's s wht hppns. Lt 0 = g 0 < g <... < g p = L not st of rkponts hosn y gry. Lt 0 = f 0 < f <... < f q = L not st of rkponts n n optml soluton wth f 0 = g 0, f = g,..., f r = g r for lrgst possl vlu of r. Not: g r+ > f r+ y gry ho of lgorthm. Thorm. Gry lgorthm s optml. Assum gry s not optml, n lt's s wht hppns. Lt 0 = g 0 < g <... < g p = L not st of rkponts hosn y gry. Lt 0 = f 0 < f <... < f q = L not st of rkponts n n optml soluton wth f 0 = g 0, f = g,..., f r = g r for lrgst possl vlu of r. Not: g r+ > f r+ y gry ho of lgorthm. g 0 g g g r g r+ g 0 g g g r g r+ Gry: Gry: OPT:... OPT:... f 0 f f f r f r+ f q why osn't optml soluton rv lttl furthr? f 0 f f f r f q nothr optml soluton hs on mor rkpont n ommon ontrton Esgr W. Dkstr Th quston of whthr omputrs n thnk s lk th quston of whthr sumrns n swm. Do only wht only you n o. In thr pty s tool, omputrs wll ut rppl on th surf of our ultur. In thr pty s ntlltul hllng, thy r wthout prnt n th ulturl hstory of mnkn. Th us of OBOL rppls th mn; ts thng shoul, thrfor, rgr s rmnl offn. APL s mstk, rr through to prfton. It s th lngug of th futur for th progrmmng thnqus of th pst: t rts nw gnrton of ong ums. opyrght 000, Kvn Wyn

Copyright 2000, Kevin Wayne 1

Copyright 2000, Kevin Wayne 1 Chptr. Intrvl Shulng Gry Algorthms Sls y Kvn Wyn. Copyrght 005 Prson-Ason Wsly. All rghts rsrv. Intrvl Shulng Intrvl Shulng: Gry Algorthms Intrvl shulng. Jo strts t s n fnshs t f. Two os omptl f thy on't

More information

Copyright 2000, Kevin Wayne 1

Copyright 2000, Kevin Wayne 1 Chptr 4 4. Intrvl hulng Gry Algorthms ls y Kvn Wyn. Copyrght 005 Prson-Ason Wsly. All rghts rsrv. Intrvl hulng Intrvl hulng: Gry Algorthms Intrvl shulng. Jo strts t s n fnshs t f. Two os omptl f thy on't

More information

4.1 Interval Scheduling. Chapter 4. Greedy Algorithms. Interval Scheduling: Greedy Algorithms. Interval Scheduling. Interval scheduling.

4.1 Interval Scheduling. Chapter 4. Greedy Algorithms. Interval Scheduling: Greedy Algorithms. Interval Scheduling. Interval scheduling. Cptr 4 4 Intrvl Suln Gry Alortms Sls y Kvn Wyn Copyrt 005 Prson-Ason Wsly All rts rsrv Intrvl Suln Intrvl Suln: Gry Alortms Intrvl suln! Jo strts t s n nss t! Two os omptl ty on't ovrlp! Gol: n mxmum sust

More information

Chapter Interval Scheduling. Greedy Algorithms. What is a Greedy Algorithm? Interval Scheduling

Chapter Interval Scheduling. Greedy Algorithms. What is a Greedy Algorithm? Interval Scheduling Wht s Grdy Algorthm? Chptr Grdy Algorthms Grdy lgorthm Hrd to gv prs dfnton It ulds up soluton n smll stps, hoosng dson t h stp to optmz som undrlyng rtron Mk lol dsons, nd mglly gt glol optmum Vry ffnt

More information

Greedy Algorithms. Greedy Algorithms. Piyush Kumar

Greedy Algorithms. Greedy Algorithms. Piyush Kumar Gree s goo. Gree s rght. Gree works. Gree lrfes, uts through, n ptures the essene of the evolutonry sprt. - Goron Geko (Mhel Dougls) Anlyss of Algorthms Pyush Kumr (Leture 4: Greey Algorthms) Welome to

More information

Lecture 20: Minimum Spanning Trees (CLRS 23)

Lecture 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 information

Strongly connected components. Finding strongly-connected components

Strongly 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 information

Weighted Graphs. Weighted graphs may be either directed or undirected.

Weighted 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 information

Minimum Spanning Trees

Minimum Spanning Trees Mnmum Spnnng Trs Spnnng Tr A tr (.., connctd, cyclc grph) whch contns ll th vrtcs of th grph Mnmum Spnnng Tr Spnnng tr wth th mnmum sum of wghts 1 1 Spnnng forst If grph s not connctd, thn thr s spnnng

More information

Depth First Search. Yufei Tao. Department of Computer Science and Engineering Chinese University of Hong Kong

Depth 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 information

Preview. Graph. Graph. Graph. Graph Representation. Graph Representation 12/3/2018. Graph Graph Representation Graph Search Algorithms

Preview. Graph. Graph. Graph. Graph Representation. Graph Representation 12/3/2018. Graph Graph Representation Graph Search Algorithms /3/0 Prvw Grph Grph Rprsntton Grph Srch Algorthms Brdth Frst Srch Corrctnss of BFS Dpth Frst Srch Mnmum Spnnng Tr Kruskl s lgorthm Grph Drctd grph (or dgrph) G = (V, E) V: St of vrt (nod) E: St of dgs

More information

The University of Sydney MATH 2009

The 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 information

Spanning Trees. BFS, DFS spanning tree Minimum spanning tree. March 28, 2018 Cinda Heeren / Geoffrey Tien 1

Spanning 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 information

5/1/2018. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees

5/1/2018. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees /1/018 W usully no strns y ssnn -lnt os to ll rtrs n t lpt (or mpl, 8-t on n ASCII). Howvr, rnt rtrs our wt rnt rquns, w n sv mmory n ru trnsmttl tm y usn vrl-lnt non. T s to ssn sortr os to rtrs tt our

More information

CSC Design and Analysis of Algorithms. Example: Change-Making Problem

CSC 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 information

(Minimum) Spanning Trees

(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 information

Paths. Connectivity. Euler and Hamilton Paths. Planar graphs.

Paths. 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 information

Improving Union. Implementation. Union-by-size Code. Union-by-Size Find Analysis. Path Compression! Improving Find find(e)

Improving 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 information

Lecture II: Minimium Spanning Tree Algorithms

Lecture II: Minimium Spanning Tree Algorithms Ltur II: Mnmum Spnnn Tr Alortms Dr Krn T. Hrly Dprtmnt o Computr Sn Unvrsty Coll Cork Aprl 0 KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5 Mnmum Spnnn Trs Mnmum Spnnn Trs Spnnn Tr tr orm rom rp s

More information

CMPS 2200 Fall Graphs. Carola Wenk. Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk

CMPS 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 information

An undirected graph G = (V, E) V a set of vertices E a set of unordered edges (v,w) where v, w in V

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 information

CSE 373: More on graphs; DFS and BFS. Michael Lee Wednesday, Feb 14, 2018

CSE 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 information

Graph 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

Graph 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 information

COMP108 Algorithmic Foundations

COMP108 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 information

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}

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 information

Minimum Spanning Trees (CLRS 23)

Minimum Spanning Trees (CLRS 23) Mnmum Spnnn Trs (CLRS 3) T prolm Rll t nton o spnnn tr: Gvn onnt, unrt rp G = (V, E), sust o s o G su tt ty onnt ll vrts n G n orm no yls s ll spnnn tr (ST) o G. Any unrt, onnt rp s spnnn tr. Atully, rp

More information

12/3/12. Outline. Part 10. Graphs. Circuits. Euler paths/circuits. Euler s bridge problem (Bridges of Konigsberg Problem)

12/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 information

5/9/13. Part 10. Graphs. Outline. Circuits. Introduction Terminology Implementing Graphs

5/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

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}

V={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 information

Graph Search (6A) Young Won Lim 5/18/18

Graph Search (6A) Young Won Lim 5/18/18 Grp Sr (6A) Youn Won Lm Copyrt () 2015 2018 Youn W. Lm. Prmon rnt to opy, trut n/or moy t oumnt unr t trm o t GNU Fr Doumntton Ln, Vron 1.2 or ny ltr vron pul y t Fr Sotwr Founton; wt no Invrnt Ston, no

More information

Interval Scheduling. Chapter 4. Greedy Algorithms. Interval Scheduling: Greedy Algorithms. Interval Scheduling

Interval Scheduling. Chapter 4. Greedy Algorithms. Interval Scheduling: Greedy Algorithms. Interval Scheduling hptr Intrvl huling Gry Algorithms lis y Kvin Wyn. opyright 00 Prson-Aison Wsly. All rights rsrv. Th originl vrsion n offiil vrsions r t http://www.s.printon.u/~wyn/ Intrvl huling Intrvl huling: Gry Algorithms

More information

CSE 373. Graphs 1: Concepts, Depth/Breadth-First Search reading: Weiss Ch. 9. slides created by Marty Stepp

CSE 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 information

Spanning Tree. Preview. Minimum Spanning Tree. Minimum Spanning Tree. Minimum Spanning Tree. Minimum Spanning Tree 10/17/2017.

Spanning Tree. Preview. Minimum Spanning Tree. Minimum Spanning Tree. Minimum Spanning Tree. Minimum Spanning Tree 10/17/2017. 0//0 Prvw Spnnng Tr Spnnng Tr Mnmum Spnnng Tr Kruskl s Algorthm Prm s Algorthm Corrctnss of Kruskl s Algorthm A spnnng tr T of connctd, undrctd grph G s tr composd of ll th vrtcs nd som (or prhps ll) of

More information

Outline. Circuits. Euler paths/circuits 4/25/12. Part 10. Graphs. Euler s bridge problem (Bridges of Konigsberg Problem)

Outline. 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 information

Exam 1 Solution. CS 542 Advanced Data Structures and Algorithms 2/14/2013

Exam 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 information

Shortest Paths in Graphs. Paths in graphs. Shortest paths CS 445. Alon Efrat Slides courtesy of Erik Demaine and Carola Wenk

Shortest Paths in Graphs. Paths in graphs. Shortest paths CS 445. Alon Efrat Slides courtesy of Erik Demaine and Carola Wenk S 445 Shortst Paths n Graphs lon frat Sls courtsy of rk man an arola Wnk Paths n raphs onsr a raph G = (V, ) wth -wht functon w : R. Th wht of path p = v v v k s fn to xampl: k = w ( p) = w( v, v + ).

More information

Outline. Computer Science 331. Computation of Min-Cost Spanning Trees. Costs of Spanning Trees in Weighted Graphs

Outline. 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 information

Minimum Spanning Trees

Minimum 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 information

CS 241 Analysis of Algorithms

CS 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 information

Graphs. CSC 1300 Discrete Structures Villanova University. Villanova CSC Dr Papalaskari

Graphs. 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 information

Applications of trees

Applications of trees Trs Apptons o trs Orgnzton rts Attk trs to syst Anyss o tr ntworks Prsng xprssons Trs (rtrv o norton) Don-n strutur Mutstng Dstnton-s orwrng Trnsprnt swts Forwrng ts o prxs t routrs Struturs or nt pntton

More information

(2) If we multiplied a row of B by λ, then the value is also multiplied by λ(here lambda could be 0). namely

(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 information

Minimum Spanning Trees (CLRS 23)

Minimum Spanning Trees (CLRS 23) Mnmum Spnnn Trs (CLRS 3) T prolm Gvn onnt, unrt rp G = (V, E), sust o s o G su tt ty onnt ll vrts n G n orm no yls s ll spnnn tr (ST) o G. Clm: Any unrt, onnt rp s spnnn tr (n nrl rp my v mny spnnn trs).

More information

Outline. 1 Introduction. 2 Min-Cost Spanning Trees. 4 Example

Outline. 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 information

CS 461, Lecture 17. Today s Outline. Example Run

CS 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

Graphs. Graphs. Graphs: Basic Terminology. Directed Graphs. Dr Papalaskari 1

Graphs. 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 information

b. How many ternary words of length 23 with eight 0 s, nine 1 s and six 2 s?

b. 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 information

CMSC 451: Lecture 4 Bridges and 2-Edge Connectivity Thursday, Sep 7, 2017

CMSC 451: Lecture 4 Bridges and 2-Edge Connectivity Thursday, Sep 7, 2017 Rn: Not ovr n or rns. CMSC 451: Ltr 4 Brs n 2-E Conntvty Trsy, Sp 7, 2017 Hr-Orr Grp Conntvty: (T ollown mtrl ppls only to nrt rps!) Lt G = (V, E) n onnt nrt rp. W otn ssm tt or rps r onnt, t somtms t

More information

5/7/13. Part 10. Graphs. Theorem Theorem Graphs Describing Precedence. Outline. Theorem 10-1: The Handshaking Theorem

5/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 information

Cycles and Simple Cycles. Paths and Simple Paths. Trees. Problem: There is No Completely Standard Terminology!

Cycles 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 information

minimize c'x subject to subject to subject to

minimize c'x subject to subject to subject to z ' sut to ' M ' M N uostrd N z ' sut to ' z ' sut to ' sl vrls vtor of : vrls surplus vtor of : uostrd s s s s s s z sut to whr : ut ost of :out of : out of ( ' gr of h food ( utrt : rqurt for h utrt

More information

CS200: Graphs. Graphs. Directed Graphs. Graphs/Networks Around Us. What can this represent? Sometimes we want to represent directionality:

CS200: 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 information

Theorem 1. An undirected graph is a tree if and only if there is a unique simple path between any two of its vertices.

Theorem 1. An undirected graph is a tree if and only if there is a unique simple path between any two of its vertices. Cptr 11: Trs 11.1 - Introuton to Trs Dnton 1 (Tr). A tr s onnt unrt rp wt no sp ruts. Tor 1. An unrt rp s tr n ony tr s unqu sp pt twn ny two o ts vrts. Dnton 2. A root tr s tr n w on vrtx s n snt s t

More information

In which direction do compass needles always align? Why?

In which direction do compass needles always align? Why? AQA Trloy Unt 6.7 Mntsm n Eltromntsm - Hr 1 Complt t p ll: Mnt or s typ o or n t s stronst t t o t mnt. Tr r two typs o mnt pol: n. Wrt wt woul ppn twn t pols n o t mnt ntrtons low: Drw t mnt l lns on

More information

Math 61 : Discrete Structures Final Exam Instructor: Ciprian Manolescu. You have 180 minutes.

Math 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

Weighted graphs -- reminder. Data Structures LECTURE 15. Shortest paths algorithms. Example: weighted graph. Two basic properties of shortest paths

Weighted 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 information

Algorithmic and NP-Completeness Aspects of a Total Lict Domination Number of a Graph

Algorithmic 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 information

DUET WITH DIAMONDS COLOR SHIFTING BRACELET By Leslie Rogalski

DUET 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 information

ECE COMBINATIONAL BUILDING BLOCKS - INVEST 13 DECODERS AND ENCODERS

ECE 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

CS September 2018

CS 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 information

Problem solving by search

Problem 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 information

Why the Junction Tree Algorithm? The Junction Tree Algorithm. Clique Potential Representation. Overview. Chris Williams 1.

Why 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 information

b.) v d =? Example 2 l = 50 m, D = 1.0 mm, E = 6 V, " = 1.72 #10 $8 % & m, and r = 0.5 % a.) R =? c.) V ab =? a.) R eq =?

b.) v d =? Example 2 l = 50 m, D = 1.0 mm, E = 6 V,  = 1.72 #10 $8 % & m, and r = 0.5 % a.) R =? c.) V ab =? a.) R eq =? xmpl : An 8-gug oppr wr hs nomnl mtr o. mm. Ths wr rrs onstnt urrnt o.67 A to W lmp. Th nsty o r ltrons s 8.5 x 8 ltrons pr u mtr. Fn th mgntu o. th urrnt nsty. th rt vloty xmpl D. mm,.67 A, n N 8.5" 8

More information

CS61B Lecture #33. Administrivia: Autograder will run this evening. Today s Readings: Graph Structures: DSIJ, Chapter 12

CS61B 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 information

Planar Upward Drawings

Planar 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 information

Graph Search Algorithms

Graph Search Algorithms Grp Sr Aortms 1 Grp 2 No ~ ty or omputr E ~ ro or t Unrt or Drt A surprsny r numr o omputton proms n xprss s rp proms. 3 Drt n Unrt Grps () A rt rp G = (V, E), wr V = {1,2,3,4,5,6} n E = {(1,2), (2,2),

More information

Module graph.py. 1 Introduction. 2 Graph basics. 3 Module graph.py. 3.1 Objects. CS 231 Naomi Nishimura

Module 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 information

CSE303 - Introduction to the Theory of Computing Sample Solutions for Exercises on Finite Automata

CSE303 - 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 information

, each of which is a tree, and whose roots r 1. , respectively, are children of r. Data Structures & File Management

, 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 information

Section 3: Antiderivatives of Formulas

Section 3: Antiderivatives of Formulas Chptr Th Intgrl Appli Clculus 96 Sction : Antirivtivs of Formuls Now w cn put th is of rs n ntirivtivs togthr to gt wy of vluting finit intgrls tht is ct n oftn sy. To vlut finit intgrl f(t) t, w cn fin

More information

Exam 2 Solutions. Jonathan Turner 4/2/2012. CS 542 Advanced Data Structures and Algorithms

Exam 2 Solutions. Jonathan Turner 4/2/2012. CS 542 Advanced Data Structures and Algorithms CS 542 Avn Dt Stutu n Alotm Exm 2 Soluton Jontn Tun 4/2/202. (5 ont) Con n oton on t tton t tutu n w t n t 2 no. Wt t mllt num o no tt t tton t tutu oul ontn. Exln you nw. Sn n mut n you o u t n t, t n

More information

Closed Monochromatic Bishops Tours

Closed Monochromatic Bishops Tours Cos Monoromt Bsops Tours Jo DMo Dprtmnt o Mtmts n Sttsts Knnsw Stt Unvrsty, Knnsw, Gor, 0, USA mo@nnsw.u My, 00 Astrt In ss, t sop s unqu s t s o to sn oor on t n wt or. Ts ms os tour n w t sop vsts vry

More information

QUESTIONS BEGIN HERE!

QUESTIONS 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 information

Weighted Target Set Selection on Social Networks

Weighted Target Set Selection on Social Networks Wght Trgt St Slton on Sol Ntworks S. Rghvn Th Rort H. Smth Shool of Busnss n Insttut for Systms Rsrh, Unvrsty of Mryln, Mryln 07, USA rghvn@um.u Ru Zhng Ls Shool of Busnss, Unvrsty of Coloro, Boulr, Coloro

More information

0.1. Exercise 1: the distances between four points in a graph

0.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 information

H NT Z N RT L 0 4 n f lt r h v d lt n r n, h p l," "Fl d nd fl d " ( n l d n l tr l t nt r t t n t nt t nt n fr n nl, th t l n r tr t nt. r d n f d rd n t th nd r nt r d t n th t th n r lth h v b n f

More information

CSE 332. Data Structures and Parallelism

CSE 332. Data Structures and Parallelism Am Blnk Ltur 20 Wntr 2017 CSE 332 Dt Struturs n Prlllsm CSE 332: Dt Struturs n Prlllsm Grps 1: Wt s Grp? DFS n BFS LnkLsts r to Trs s Trs r to... 1 Wr W v Bn Essntl ADTs: Lsts, Stks, Quus, Prorty Quus,

More information

CSE 332. Graphs 1: What is a Graph? DFS and BFS. Data Abstractions. CSE 332: Data Abstractions. A Graph is a Thingy... 2

CSE 332. Graphs 1: What is a Graph? DFS and BFS. Data Abstractions. CSE 332: Data Abstractions. A Graph is a Thingy... 2 Am Blnk Ltur 19 Summr 2015 CSE 332: Dt Astrtons CSE 332 Grps 1: Wt s Grp? DFS n BFS Dt Astrtons LnkLsts r to Trs s Trs r to... 1 A Grp s Tny... 2 Wr W v Bn Essntl ADTs: Lsts, Stks, Quus, Prorty Quus, Hps,

More information

Announcements. Not graphs. These are Graphs. Applications of Graphs. Graph Definitions. Graphs & Graph Algorithms. A6 released today: Risk

Announcements. 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 information

Divided. diamonds. Mimic the look of facets in a bracelet that s deceptively deep RIGHT-ANGLE WEAVE. designed by Peggy Brinkman Matteliano

Divided. diamonds. Mimic the look of facets in a bracelet that s deceptively deep RIGHT-ANGLE WEAVE. designed by Peggy Brinkman Matteliano RIGHT-ANGLE WEAVE Dv mons Mm t look o ts n rlt tt s ptvly p sn y Py Brnkmn Mttlno Dv your mons nto trnls o two or our olors. FCT-SCON0216_BNB66 2012 Klm Pulsn Co. Ts mtrl my not rprou n ny orm wtout prmsson

More information

Page 1. Question 19.1b Electric Charge II Question 19.2a Conductors I. ConcepTest Clicker Questions Chapter 19. Physics, 4 th Edition James S.

Page 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 information

More Foundations. Undirected Graphs. Degree. A Theorem. Graphs, Products, & Relations

More 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 information

Single Source Shortest Paths (with Positive Weights)

Single Source Shortest Paths (with Positive Weights) Snl Sour Sortst Pts (wt Postv Wts) Yuf To ITEE Unvrsty of Qunslnd In ts ltur, w wll rvst t snl sour sortst pt (SSSP) problm. Rll tt w v lrdy lrnd tt t BFS lortm solvs t problm ffntly wn ll t ds v t sm

More information

Using the Printable Sticker Function. Using the Edit Screen. Computer. Tablet. ScanNCutCanvas

Using 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 information

12. Traffic engineering

12. 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 information

Constructive Geometric Constraint Solving

Constructive 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 information

# 1 ' 10 ' 100. Decimal point = 4 hundred. = 6 tens (or sixty) = 5 ones (or five) = 2 tenths. = 7 hundredths.

# 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

CSE 373: AVL trees. Warmup: Warmup. Interlude: Exploring the balance invariant. AVL Trees: Invariants. AVL tree invariants review

CSE 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 information

2 Trees and Their Applications

2 Trees and Their Applications Trs n Tr Appltons. Proprts o trs.. Crtrzton o trs Dnton. A rp s ll yl (or orst) t ontns no yls. A onnt yl rp s ll tr. Quston. Cn n yl rp v loops or prlll s? Notton. I G = (V, E) s rp n E, tn G wll not

More information

A Simple Code Generator. Code generation Algorithm. Register and Address Descriptors. Example 3/31/2008. Code Generation

A 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 information

The R-Tree. Yufei Tao. ITEE University of Queensland. INFS4205/7205, Uni of Queensland

The R-Tree. Yufei Tao. ITEE University of Queensland. INFS4205/7205, Uni of Queensland Yu To ITEE Unvrsty o Qunsln W wll stuy nw strutur ll t R-tr, w n tout o s mult-mnsonl xtnson o t B-tr. T R-tr supports ntly vrty o qurs (s w wll n out ltr n t ours), n s mplmnt n numrous ts systms. Our

More information

Graphs Depth First Search

Graphs Depth First Search Grp Dpt Frt Sr SFO 337 LAX 1843 1743 1233 802 DFW ORD - 1 - Grp Sr Aort - 2 - Outo Ø By unrtnn t tur, you ou to: q L rp orn to t orr n w vrt r ovr, xpor ro n n n pt-rt r. q Cy o t pt-rt r tr,, orwr n ro

More information

a b c cat CAT A B C Aa Bb Cc cat cat Lesson 1 (Part 1) Verbal lesson: Capital Letters Make The Same Sound Lesson 1 (Part 1) continued...

a b c cat CAT A B C Aa Bb Cc cat cat Lesson 1 (Part 1) Verbal lesson: Capital Letters Make The Same Sound Lesson 1 (Part 1) continued... Progrssiv Printing T.M. CPITLS g 4½+ Th sy, fun (n FR!) wy to tch cpitl lttrs. ook : C o - For Kinrgrtn or First Gr (not for pr-school). - Tchs tht cpitl lttrs mk th sm souns s th littl lttrs. - Tchs th

More information

A general N-dimensional vector consists of N values. They can be arranged as a column or a row and can be real or complex.

A general N-dimensional vector consists of N values. They can be arranged as a column or a row and can be real or complex. Lnr lgr Vctors gnrl -dmnsonl ctor conssts of lus h cn rrngd s column or row nd cn rl or compl Rcll -dmnsonl ctor cn rprsnt poston, loct, or cclrton Lt & k,, unt ctors long,, & rspctl nd lt k h th componnts

More information

The University of Sydney MATH2969/2069. Graph Theory Tutorial 5 (Week 12) Solutions 2008

The 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 information

EE1000 Project 4 Digital Volt Meter

EE1000 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 information

Garnir Polynomial and their Properties

Garnir 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 information

23 Minimum Spanning Trees

23 Minimum Spanning Trees 3 Mnmum Spnnn Trs Eltron rut sns otn n to mk t pns o svrl omponnts ltrlly quvlnt y wrn tm totr. To ntronnt st o n pns, w n us n rrnmnt o n wrs, onntn two pns. O ll su rrnmnts, t on tt uss t lst mount o

More information

Register Allocation. Register Allocation. Principle Phases. Principle Phases. Example: Build. Spills 11/14/2012

Register 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 information

S 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 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 information