13.1 Weighted Graphs and Their Representation

Size: px
Start display at page:

Download "13.1 Weighted Graphs and Their Representation"

Transcription

1 Chpter Shortet Pth In thi hpter we will over prolem involving fining the hortet pth etween vertie in grph with weight (length) on the ege. One oviou pplition i in fining the hortet route from one re to nother, however hortet pth hve mny other pplition. We will look t verion of the prolem uming we re fining itne from ingle oure to ll other vertie in the grph, n two vrint epening on whether we llow negtive ege weight or not. We firt introue weighte grph.. Weighte Grph n Their Repreenttion Mny pplition of grph require oiting weight or other vlue with the ege of grph. Suh grph n e formlly efine follow. Definition. (Weighte n Ege-Lele Grph). A weighte grph or n egelele grph i triple G = (E, V, w) where w : E L i funtion mpping ege or irete ege to their vlue, n L i the et of poile vlue. In grph, if the t oite with the ege re rel numer (L R), we often ue the term weight to refer to the vlue, n ue the term weighte grph to refer to the grph. In the generl e, we ue the term ege lel or ege vlue to refer to the vlue. Weight or other vlue on ege oul repreent mny thing, uh itne, or pity, or the trength of reltionhip. 97

2 98 CHAPTER. SHORTEST PATHS Exmple.. An exmple irete weighte grph Chpter 9 erie three ifferent repreenttion of grph uitle for prllel lgorithm, ege et, jeny tle, n jeny equene. Quetion.. Cn you ee how we n exten thee repreenttion to upport ege vlue? We n exten ll of thee repreenttion to upport ege vlue y eprtely repreenting the funtion from ege to vlue uing tle (mpping) the tle mp eh ege (or r) to it vlue. Thi repreenttion llow looking up the ege vlue of n ege e = (u, v) y uing tle lookup. We ll thi n ege tle. Exmple.4. For the weighte grph in Exmple., the ege tle i: W = {(, ).7, (, 4)., (, 4)., (4, ).} A nie property of n ege tle i tht it work uniformly with ll repreenttion of the truture of grph, n i len ine it eprte the ege vlue from the truturl informtion. However keeping the ege tle eprtely rete reunny, wting pe n poily requiring extr work eing the ege vlue. The reunny n e voie y toring the ege vlue iretly with the ege informtion. For exmple, uing ege tle mke ege et reunnt o there i typilly no nee to keep eprte ege et. Ajeny tle n e extene to inlue the ege vlue y repling the et of neighor of vertex v with tle tht mp eh neighor u to the ege vlue w(v, u). Ajeny equene n e extene y reting equene of neighor-vlue pir for eh out ege of vertex.

3 .. SHORTEST WEIGHTED PATHS 99 Exmple.. For the weighte grph in Exmple., the jeny tle repreenttion i G = { {.7, 4.}, {4.}, 4 {.}}, n the jeny equene repreenttion i (uming equene re e): G = (,.7), (4,.),, (4,.), (,.).. Shortet Weighte Pth Conier weighte grph G = (V, E, w), w : E R. The grph n e either irete or unirete. For onveniene we efine w(u, v) = if (u, v) E. We efine the weight of pth the um of the weight of the ege long tht pth. Exmple.6. In the following grph the weight of the pth,,, e i 6. The weight of the pth,,, i. 7 e 4 6 For weighte grph G(V, E, w) hortet (weighte) pth from vertex u to vertex v i pth from u to v with minimum weight. There might e multiple pth with equl weight, n if o they re ll hortet weighte pth from u to v. We ue σ G (u, v) to inite the weight of hortet pth from u to v. In hortet pth prolem, we re require to fin the hortet (weighte) pth etween vertie, or perhp jut the weight of uh pth. Quetion.7. Wht i the (weighte) hortet pth from to e? In the grph ove, the hortet pth from to e i,,, e with weight 6. Quetion.8. Wht hppen if we hnge the weight of the ege (, ) from 7 to 7? If we hnge the weight of the ege (, ) to 7 the hortet pth etween n e h weight ine pth n keep going roun the yle,,, reuing it weight y 4 eh time

4 CHAPTER. SHORTEST PATHS roun. Rell tht pth llow repete vertie - imple pth oe not. For thi reon, when omputing hortet pth we will nee to e reful out yle of negtive weight. A we will ee, even if there re no negtive weight yle, negtive ege weight mke fining hortet pth more iffiult. We will therefore firt onier the prolem of fining hortet pth when there re no negtive ege weight. Computing hortet pth i importnt in mny prtil pplition. In ft, there re everl vrint of thi prolem uh the ingle oure n the multiple oure verion, oth with or without negtive weight. Prolem.9 (Single-Soure Shortet Pth (SSSP)). Given weighte grph G = (V, E, w) n oure vertex, the ingle-oure hortet pth (SSSP) prolem i to fin hortet weighte pth from to every other vertex in V. Although there n e mny equl weight hortet pth etween two vertie, the prolem only require fining one. Alo ometime we only re out the weight of the hortet pth to eh vertex n not the pth itelf. We will refer to thi vrint of the SSSP prolem the SSSP δ prolem. Exerie.. For weighte grph G = (V, E, w), ume you re given the itne δ G, v for ll vertie V. For prtiulr vertex u, erie how you oul fin hortet pth from to u y only looking t the in neighor of eh vertex on the pth. Hint: trt t u. In Chpter we w how Breth-Firt Serh (BFS) n e ue to olve the ingle-oure hortet pth prolem on grph without ege weight, or, equivlently, where ll ege hve weight. Quetion.. Cn we ue BFS to olve the ingle-oure hortet pth prolem on weighte grph? BFS oe not work on weighte grph, unfortuntely, eue it oe not tke ege weight into ount.

5 .. DIJKSTRA S ALGORITHM Exmple.. To ee why BFS oe not work, onier the following irete grph with vertie: In thi exmple, BFS firt viit n then. When it viit, it ign it n inorret weight of. Sine BFS never viit gin, it will not fin the hortet pth going trough, whih hppen to e horter. Exmple.. Another grph where BFS fil to fin the hortet pth orretly The reon why BFS work on unweighte grph i quite intereting n helpful for unertning other hortet pth lgorithm. The key ie ehin BFS i to viit vertie in orer of their itne from the oure, viiting loet vertie firt, n the next loet, n o on. More peifilly, for eh frontier F i, BFS h the orret itne from the oure to eh vertex in the frontier. It then n etermine the orret itne for unenountere neighor tht re itne one further wy (on the next frontier).. Dijktr Algorithm Dijktr lgorithm olve the SSSP prolem when ll the weight on the ege re non-negtive (i.e. w : E R ). We will refer to thi vrint of SSSP the SSSP + prolem. Dijktr i n importnt lgorithm oth eue it i n effiient lgorithm for n importnt prolem, ut lo eue it i very elegnt exmple of n effiient greey lgorithm tht generte optiml olution on nontrivil tk. In thi etion, we re going to (re-)iover thi lgorithm y tking vntge of propertie of grph n hortet pth. Before going further we note tht ine no ege hve negtive weight, there nnot e negtive weight yle. Therefore one n never mke pth horter y viiting vertex twie i.e. pth tht yle k to vertex nnot hve mller weight thn the pth tht en t the firt viit to the vertex. Thi men we only nee to onier imple pth when erhing for hortet pth.

6 CHAPTER. SHORTEST PATHS Quetion.4. Cn you think of rute-fore lgorithm for fining the hortet? pth. Let trt with rute fore lgorithm for the SSSP + prolem, tht, for eh vertex, onier ll imple pth etween the oure n the vertex n elet the hortet uh pth. Quetion.. How mny imple pth n there e etween two vertie in grph? Unfortuntely there n e n exponentil numer of pth etween ny pir of vertie, o ny lgorithm tht trie to look t ll pth i not likely to le eyon very mll intne. We therefore hve to try to reue the work. Towr thi en we note tht the u-pth of hortet pth mut lo e hortet pth etween their en vertie, n look t how thi n help. Thi u-pth property i key property of hortet pth. Exmple.6. If hortet pth from Pitturgh to Sn Frnio goe through Chigo, then tht hortet pth inlue the hortet pth from Pitturgh to Chigo. Exerie.7. Prove tht the u-pth property hol for ny grph, lo in the preene of negtive weight. We re going to ue thi property oth now to erive Dijktr lgorithm, n lo gin in the next etion to erive Bellmn-For lgorithm for the SSSP prolem on grph tht o llow negtive ege weight. To ee how thi property n e helpful, uppoe n orle h tol you the hortet pth to ll vertie exept for one vertex, v. Quetion.8. Uing the u-pth property, n you fin the hortet pth to v? We n fin the hortet pth to v, eue we know the hortet upth form the oure to the vertex u immeitely efore v. All we nee to o i fin whih u mong the in-neighor of v minimize the weight of the pth to u, i.e. δ G (, u) plu the itionl ege weight to get to v. We note tht thi rgument relie on the ft tht hortet pth mut e imple o nnot go through v itelf.

7 .. DIJKSTRA S ALGORITHM Exmple.9. In the following grph G, uppoe tht we hve foun the hortet pth from the oure to ll the other vertie exept for v. The weight of the hortet pth to v i min δ G (, ) +, δ G (, ) + 6, δ G (, ) +. The hortet pth goe through the vertex (,, or ) tht minimize the weight. Viite Set 6 v Let try to generlize the rgument to the e where inte of the orle telling u the hortet pth from to ll ut one of the vertie, it tell u the hortet pth from to ome uet of the vertie X V with X. Alo let efine Y to e the vertie not in X, i.e. V \ X. The quetion i whether we n effiiently etermine the hortet pth to ny vertie in Y. If we oul o thi, then we woul hve rnk to repetely new vertie to X until we re one. A in grph erh, we ll the et of vertie tht re neighor of X ut not in X, i.e. N + (X) \ X, the frontier. It houl e ler tht ny pth tht leve X h to go through frontier vertex on the wy out. Therefore for every v Y the hortet pth from mut trt in X, ine X, n then leve X vi vertex in the frontier. Quetion.. Do you ee how we n ue thi property to ientify vertex v Y tht i t let loe to the oure ny other vertex in Y? Billy the intuition now i tht t let one pth tht goe from X iretly to vertex on the frontier, i n overll hortet pth to ny vertex in Y. Thi i eue ll pth to Y mut go through the frontier when exiting X, n ine ege re non-negtive, upth nnot e longer thn the full pth.

8 4 CHAPTER. SHORTEST PATHS Exmple.. In the following grph uppoe tht we hve foun the hortet pth from the oure to ll the vertie in X (mrke y numer next to the vertie). The hortet pth from ny vertex in X iretly to vertex in Y i the pth to followe y the ege (, v) with weight 9. If ege weight re non-negtive there nnot e ny horter wy to get to v, whtever w(u, v) i, therefore we know tht δ(, v) = 9. X 8 Y= V \ X u? 4 v Thi intuition i formlize in Lemm. long with proof. The Lemm tell u tht one we know the hortet pth to et X we n more vertie to X with their hortet pth. Thi give u rnk tht n hurn out t let one new vertex on eh roun. Note tht thi pproh i tully n intne of priority-firt erh. Quetion.. Do you rell how priority-firt erh work? Rell tht priority-firt erh i grph erh in whih on eh tep we viit the frontier vertie with the highet priority. In our e the viite et i X, n the priority i efine in term of p(v), the hortet-pth weight oniting of pth to x X with n itionl ege from x to v. Thi give u the following rther onie efinition of Dijktr lgorithm. Algorithm.4 (Dijktr Algorithm). For weighte grph G = (V, E, w) n oure, Dijktr lgorithm i priority-firt erh on G trting t with () =, uing priority p(v) = min((x) + w(x, v)) (to e minimize), n etting (v) = p(v) x X when v i viite. Note tht Dijktr lgorithm will viit vertie in non-ereing hortet-pth weight ine on eh tep it viit unviite vertie tht hve the minimum hortet-pth weight from.

9 .. DIJKSTRA S ALGORITHM Lemm. (Dijktr Property). Conier (irete) weighte grph G = (V, E, w), w : E R, n oure vertex V. Conier ny prtitioning of the vertie V into X n Y = V \ X with X, n let then min p(y) = min δ G(, y). y Y y Y p(v) min x X (δ G(, x) + w(x, v)) X Y=V \ X v x v t v m In Englih: The overll hortet-pth weight from vi vertex in X iretly to neighor in Y (in the frontier) i hort ny pth from to ny vertex in Y. Proof. Conier vertex v m Y uh tht δ G (, v m ) = min v Y δ G (, v), n hortet pth from to v m in G. The pth mut go through n ege from vertex v x X to vertex v t in Y (ee the figure). Sine there re no negtive weight ege, n the pth to v t i upth of the pth to v m, δ G (, v t ) nnot e ny greter thn δ G (, v m ) o it mut e equl. We therefore hve min y Y p(y) δ G (, v t ) = δ G (, v m ) = min y Y δ G (, y), ut the leftmot term nnot e le thn the rightmot, o they mut e equl. Implition: Thi give u wy to eily fin δ G (, v) for t let one vertex v Y. In prtiulr for ll v Y where p(v) = min y Y p(y), it mut e the e tht p(v) = δ G (, v) ine there nnot e horter pth. Alo we nee only onier the frontier vertie in lulting p(v), ine for other in Y, p(y) i infinite. Remrk.. It my e tempting to think tht Dijktr lgorithm viit vertie tritly in inreing orer of hortet-pth weight from the oure, viiting vertie with equl hortet-pth weight on the me tep. Thi i not true. To ee thi onier the exmple elow n onvine yourelf tht it oe not ontrit our reoning.

10 6 CHAPTER. SHORTEST PATHS Lemm.6. Dijktr lgorithm return, (v) = δ G (, v) for v rehle from. Proof. We how the invrint for eh tep tht for ll x X (the viite et), (x) = δ G (, x). Thi i true t the trt ine X = {} n () =. On eh tep the erh vertie v tht minimize P (v) = min x X ((x) + w(x, v)). By our umption we hve tht (x) = δ G (, x) for x X. By Lemm., p(v) = δ G (, v), giving (v) = δ G (, v) for the newly e vertie, mintining the invrint. A with ll priority-firt erhe, it will eventully viit ll rehle v. Exerie.7. Argue tht if ll ege in grph hve weight then Dijktr lgorithm erie viit extly the me et of vertie in eh roun BFS oe. Implementing Dijktr Algorithm with Priority Queue We now iu how to implement thi trt lgorithm effiiently uing priority queue to mintin P (v). We ue priority queue tht upport eletemin n inert. The priorityqueue e lgorithm i given in Algorithm.8. Thi vrint of the lgorithm only one vertex t the time even if there re multiple vertie with equl itne tht oul e e in prllel. It n e me prllel y generlizing priority queue, ut we leve thi n exerie. The lgorithm mintin the viite et X tle mpping eh viite vertex u to (u) = δ G (, u). It lo mintin priority queue Q tht keep the frontier prioritize e on the hortet itne from iretly from vertie in X. On eh roun, the lgorithm elet the vertex x with let itne in the priority queue (line 8 in the oe) n, if it hn t lrey een viite, viit it y ing (x ) to the tle of viite vertie (line ), n then ll it neighor v to Q long with the priority (x) + w(x, v) (i.e. the itne to v through x) (line 7 n 8). Note tht neighor might lrey e in Q ine it oul hve een e y nother of it in-neighor. Q n therefore ontin uplite entrie for vertex, ut wht i importnt i tht the minimum itne will lwy e pulle out firt. line hek to ee whether vertex pulle from the priority queue h lrey een viite n ir it if it h. Thi lgorithm i jut onrete implementtion of the previouly erie Dijktr lgorithm. We note tht there re ouple vrint on Dijktr lgorithm uing Priority Queue. Firtly we oul hek inier the relx funtion whether whether u i lrey in X n if o not inert it into the Priority Queue. Thi oe not ffet the ymptoti work oun ut proly woul give ome improvement in prtie. Another vrint i to eree the priority of the neighor inte of ing uplite to the priority queue. Thi require more powerful priority queue tht upport ereekey funtion. Cot of Dijktr Algorithm. We now onier the work of the Priority Queue verion of Dijktr lgorithm. The lgorithm i equentil o the pn i the me. We nlyze the work y ounting up the numer of opertion. In the lgorithm (Figure.8) inlue ox roun

11 .. DIJKSTRA S ALGORITHM 7 Algorithm.8 (Dijktr Algorithm uing Priority Queue). funtion ijktrpq (G, ) = let % require: 4 (x ) X = δ G (, x) {(, y) Q y V \ X} = {( + w(x, y), y) : (x ) X, y N + (x) \ X} 6 % return: {x δ G (, x) : x R G ()} 7 funtion ijktr (X, Q) = 8 e PQ.eleteMin (Q) of 9 (NONE,_) X (SOME(,v), Q ) if (v, _) X then ijktr (X, Q ) ele 4 let X = X {(v, )} 6 funtion relx (Q, (u, w)) = 7 PQ.inert ( + w, u) Q 8 Q = iter relx Q N G (v) 9 in ijktr (X, Q ) en in ijktr ({}, PQ.inert (, ) {}) en eh opertion on the grph G, the et of viite vertie X, or the priority queue PQ. The PQ.inert in line i lle only one, o we n ignore it. Of the remining opertion, The iter n N G (v) on line 8 re on the grph, line n re on the tle of viite vertie, n line 8 n 7 re on the priority queue. For the priority queue opertion, we hve only iue one ot moel whih, for queue of ize n, require O(log n) work n pn for eh of PQ.inert n PQ.eleteMin. We hve no nee for mel opertion here. For the grph, we n either ue tree-e tle or n rry to e the neighor There i no nee for ingle three rry ine we re not upting the grph. For the tle of itne to viite vertie we n ue tree tle, n rry equene, or ingle three rry equene. The following tle ummrize the ot of the opertion, long with the numer of ll me to eh opertion. There i no prllelim in the lgorithm o we only nee to onier the equentil exeution of the ll. We oul lo ue hh tle, ut we hve not yet iue them.

12 8 CHAPTER. SHORTEST PATHS Exmple.9. An exmple run of Dijktr lgorithm. Note tht fter viiting,, n, the queue Q ontin two itne for orreponing to the two pth from to iovere thu fr. The lgorithm tke the hortet itne n it to X. A imilr itution rie when i viite, ut thi time for. Note tht when i viite, n itionl itne for i e to the priority queue even though it i lrey viite. Reunnt entrie for oth re remove next efore viiting. The vertex e i never viite it i unrehle from. Finlly, notie tht the itne in X never eree. X @ e e e e e e Q e e

13 .4. THE BELLMAN FORD ALGORITHM 9 Opertion Line # of ll PQ Tree Tle Arry ST Arry eletemin 8 O(m) O(log m) inert 7 O(m) O(log m) Priority Q totl O(m log m) fin O(m) - O(log n) O() O() inert O(n) - O(log n) O(n) O() Ditne totl - O(m log n) O(n ) O(m) N G (v) 8 O(n) - O(log n) O() - iter 8 O(m) - O() O() - Grph e totl - O(m + n log n) O(m) - We n lulte the totl numer of ll to eh opertion y noting tht the oy of the let trting on line 4 i only run one for eh vertex. Thi men tht line n N G (v) on line 8 re only lle O(n) time. Everything ele i one one for every ege. Be on the tle one houl note tht when uing either tree tle or ingle three rry the ot i no more thn the ot of the priority queue opertion. Therefore there i no ymptoti vntge of uing one over the other, lthough there might e ontnt ftor peeup tht i not inignifint. One houl lo note tht uing regulr purely funtionl rry i not goo ie ine then the ot i ominte y the inertion n the lgorithm run in Θ(n ) work. The totl work for Dijktr lgorithm uing tree tle O(m log m + m log n + m + n log n) = O(m log n) ine m n..4 The Bellmn For Algorithm We now turn to olving the ingle oure hortet pth prolem in the generl e where we llow negtive weight in the grph. One might k how negtive weight mke ene. If tlking out itne on mp, they proly o not, ut vriou other prolem reue to hortet pth, n in thee reution negtive weight how up. Before proeeing we note tht if there i negtive weight yle (the um of weight on the yle i negtive) rehle from the oure, then there nnot e olution. Thi i eue every time we go roun the yle we get horter pth, o to fin hortet pth we woul jut go roun forever. In the e tht negtive weight yle n e rehe from the oure vertex, we woul like olution to the SSSP prolem to return ome initor tht uh yle exit n terminte. Exerie.. Conier the following urreny exhnge prolem: given the et urrenie, et of exhnge rte etween them, n oure urreny, fin for eh other urreny v the et equene of exhnge to get from to v. Hint: how n you onvert multiplition to ition.

14 CHAPTER. SHORTEST PATHS Exerie.. In your olution to the previou exerie n you get negtive weight yle? If o, wht oe thi men? Quetion.. Why n t we ue Dijktr lgorithm to ompute hortet pth when there re negtive ege? Rell tht in our evelopment of Dijktr lgorithm we ume non-negtive ege weight. Thi oth llowe u to only onier imple pth (with no yle) ut more importntly plye ritil role in rguing the orretne of Dijktr property. To ee where Dijktr property fil with negtive ege weight onier the following very imple exmple: Dijktr lgorithm woul viit then n leve with itne of inte of the orret itne. The prolem i tht the overll hortet pth iretly from the viite et to the frontier i not neerily the hortet pth to tht vertex. There n e horter pth tht firt tep further wy (to in the exmple), n then reue the length with the negtive ege weight. Quetion.. How n we fin hortet pth on grph with negtive weight? Quetion.4. Rell tht for Dijktr lgorithm, we trte with the rute-fore lgorithm n relize key property of hortet pth. Do you rell the property? A property we n till tke vntge of i tht the upth of hortet pth themelve re hortet. Uing thi property, we n uil hortet pth in lightly ifferent wy: y ouning the numer of ege on pth. Quetion.. Suppoe tht you hve ompute the hortet pth with l or le ege from to ll vertie. Cn you ome up with n lgorithm to upte the hortet pth for l + ege?

15 .4. THE BELLMAN FORD ALGORITHM Algorithm.6 (Bellmn For). funtion BellmnFor(G = (V, E), ) = let % require: v V D v = δg k (, v) 4 funtion BF(D, k) = let 6 D = {v min(d v, min u N u + w(u, v))) : v V } G 7 in 8 if (k = V ) then 9 ele if (ll{d v = D v : v V }) then D ele BF (D, k + ) en D = {v if v = then ele : v V } in BF (D, ) en If we hve ompute the hortet pth with l or le ege from to ll vertie, we n omputer the hortet pth for l + ege y oniering extening ll pth y one ege. To o thi ll we nee to o i onier ll inoming ege of eh vertex. Thi i the ie ehin the Bellmn-For lgorithm. We efine the following δg l (, t) = the hortet weighte pth from to t uing t mot l ege. We n trt y etermining δg (, v) for ll v V, whih i infinite for ll vertie exept itelf, for whih it i. Then perhp we n ue thi to etermine δg (, v) for ll v V. In generl we wnt to etermine δ k+ G (, v) e on ll δk G (, v). The quetion i how o we lulte thi. It turn out to e ey ine to etermine the hortet pth with t mot k + ege to vertex v ll tht i neee i the hortet pth with k ege to eh of it in-neighor n then to in the weight of the one itionl ege. Thi give u δ k+ (v) = min(δ k (v), min x N (v) Rememer tht N (v) inite the in-neighor of vertex v. (δ k (x) + w(x, v)) ). Algorithm.6 efine the Bellmn For lgorithm e on thi ie. It ume we hve e zero weight elf loop on the oure vertex. In Line 8 the lgorithm return (unefine) if there i negtive weight yle rehle from. In prtiulr ine no imple pth n e longer thn V, if the itne i till hnging fter V roun, then there mut e negtive weight yle tht w entere y the erh. An illutrtion of the lgorithm over everl tep i hown in Figure.. Theorem.7. Given irete weighte grph G = (V, E, w), w : E R, n oure, the BellmnFor lgorithm return either

16 CHAPTER. SHORTEST PATHS pth length = pth length pth length - - pth length pth length 4 Figure.: Step of the Bellmn For lgorithm. The numer with re qure inite wht hnge on eh tep.. δ G (, v) for ll vertie rehle from, or. if there i negtive weight-yle in the grph rehle from. Proof. By inution on the numer of ege k in pth. The e e i orret ine D =. For ll v V \, on eh tep hortet (, v) pth with up to k + ege mut onit of hortet (, u) pth of up to k ege followe y ingle ege (u, v). Therefore if we tke the minimum of thee we get the overll hortet pth with up to k + ege. For the oure the elf ege will mintin D =. The lgorithm n only proee to n roun if there i rehle negtive-weight yle. Otherwie hortet pth to every v i imple n n onit of t mot n vertie n hene n ege. Cot of Bellmn For. We now nlyze the ot of the lgorithm. Firt we ume the grph i repreente tle of tle, we uggete for the implementtion of Dijktr. We then onier repreenting it equene of equene. For tle of tle we ume the grph G i repreente (R vtxtle) vtxtle, where vtxtle mp vertie to vlue. The R re the rel vlue weight on the ege. We ume the itne D re repreente R vtxtle. Let onier the ot of one ll to BF, not inluing the reurive ll. The only nontrivil omputtion re on line 6 n 9. Line 6 onit of tulte over the vertie. A the ot peifition for tle inite, to lulte the work we tke the um of the work for eh vertex, n for the pn we tke the mximum of the pn, n O(log n). Now onier wht the lgorithm oe for eh vertex. Firt it h to fin the neighor in the grph (uing fin G v). Thi require O(log V )

17 .4. THE BELLMAN FORD ALGORITHM work n pn. Then it involve mp over the neighor. Eh intne of thi mp require fin in the itne tle to get D u n n ition of the weight. The fin tke O(log V ) work n pn. Finlly there i reue tht tke O( + N G (v) ) work n O(log N G (v) ) pn. Uing n = V n m = E, the overll work n pn re therefore W = O log n + N G (v) + ( + log n) v V u N G (v) = O ((n + m) log n) ( ( )) S = O mx log n + log N G (v) + mx ( + log n) v V u N(v) = O(log n) Line 9 i impler to nlyze ine it only involve tulte n reution. It require O(n log n) work n O(log n) pn. Now the numer of ll to BF i oune y n, iue erlier. Thee ll re one equentilly o we n multiply the work n pn for eh ll y the numer of ll giving: W (n, m) = O(nm log n) S(n, m) = O(n log n) Cot of Bellmn For uing Sequene If we ume the vertie re the integer {,,..., V } then we n ue rry equene to implement vtxtle. Inte of uing fin, whih require O(log n) work, we n ue nth requiring only O() work. Thi improvement in ot n e pplie for looking up in the grph to fin the neighor of vertex, n looking up in the itne tle to fin the urrent itne. By uing the improve ot we get: W = O + N G (v) + v V u N G (v) = O(m) ( ( )) S = O mx + log N G (v) + mx v V u N(v) = O(log n) n hene the overll omplexity for BellmnFor with rry equene i: W (n, m) = O(nm) S(n, m) = O(n log n) By uing rry equene we hve reue the work y O(log n) ftor.

18 4 CHAPTER. SHORTEST PATHS.

Chapter 16. Shortest Paths Shortest Weighted Paths

Chapter 16. Shortest Paths Shortest Weighted Paths Chpter 6 Shortet Pth Given grph where ege re lle with weight (or itne) n oure vertex, wht i the hortet pth etween the oure n ome other vertex? Prolem requiring u to nwer uh querie re roly known hortet-pth

More information

Chapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved.

Chapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved. Chpter 9 Greey Tehnique Copyright 2007 Person Aison-Wesley. All rights reserve. Greey Tehnique Construts solution to n optimiztion prolem piee y piee through sequene of hoies tht re: fesile lolly optiml

More information

10.2 Graph Terminology and Special Types of Graphs

10.2 Graph Terminology and Special Types of Graphs 10.2 Grph Terminology n Speil Types of Grphs Definition 1. Two verties u n v in n unirete grph G re lle jent (or neighors) in G iff u n v re enpoints of n ege e of G. Suh n ege e is lle inient with the

More information

V = set of vertices (vertex / node) E = set of edges (v, w) (v, w in V)

V = set of vertices (vertex / node) E = set of edges (v, w) (v, w in V) Definitions G = (V, E) V = set of verties (vertex / noe) E = set of eges (v, w) (v, w in V) (v, w) orere => irete grph (igrph) (v, w) non-orere => unirete grph igrph: w is jent to v if there is n ege from

More information

c s ha2 c s Half Adder Figure 2: Full Adder Block Diagram

c s ha2 c s Half Adder Figure 2: Full Adder Block Diagram Adder Tk: Implement 2-it dder uing 1-it full dder nd 1-it hlf dder omponent (Figure 1) tht re onneted together in top-level module. Derie oth omponent in VHDL. Prepre two implementtion where VHDL omponent

More information

Distance vector protocol

Distance vector protocol istne vetor protool Irene Finohi finohi@i.unirom.it Routing Routing protool Gol: etermine goo pth (sequene of routers) thru network from soure to Grph strtion for routing lgorithms: grph noes re routers

More information

Greedy Algorithm. Algorithm Fall Semester

Greedy Algorithm. Algorithm Fall Semester Greey Algorithm Algorithm 0 Fll Semester Optimiztion prolems An optimiztion prolem is one in whih you wnt to fin, not just solution, ut the est solution A greey lgorithm sometimes works well for optimiztion

More information

Premaster Course Algorithms 1 Chapter 6: Shortest Paths. Christian Scheideler SS 2018

Premaster Course Algorithms 1 Chapter 6: Shortest Paths. Christian Scheideler SS 2018 Premster Course Algorithms Chpter 6: Shortest Pths Christin Scheieler SS 8 Bsic Grph Algorithms Overview: Shortest pths in DAGs Dijkstr s lgorithm Bellmn-For lgorithm Johnson s metho SS 8 Chpter 6 Shortest

More information

Graph Contraction and Connectivity

Graph Contraction and Connectivity Chpter 14 Grph Contrtion n Connetivity So fr we hve mostly overe tehniques for solving problems on grphs tht were evelope in the ontext of sequentil lgorithms. Some of them re esy to prllelize while others

More information

COMMON FRACTIONS. or a / b = a b. , a is called the numerator, and b is called the denominator.

COMMON FRACTIONS. or a / b = a b. , a is called the numerator, and b is called the denominator. COMMON FRACTIONS BASIC DEFINITIONS * A frtion is n inite ivision. or / * In the frtion is lle the numertor n is lle the enomintor. * The whole is seprte into "" equl prts n we re onsiering "" of those

More information

CS 241 Week 4 Tutorial Solutions

CS 241 Week 4 Tutorial Solutions CS 4 Week 4 Tutoril Solutions Writing n Assemler, Prt & Regulr Lnguges Prt Winter 8 Assemling instrutions utomtilly. slt $d, $s, $t. Solution: $d, $s, nd $t ll fit in -it signed integers sine they re 5-it

More information

Outline. CS38 Introduction to Algorithms. Graphs. Graphs. Graphs. Graph traversals

Outline. CS38 Introduction to Algorithms. Graphs. Graphs. Graphs. Graph traversals Outline CS38 Introution to Algorithms Leture 2 April 3, 2014 grph trversls (BFS, DFS) onnetivity topologil sort strongly onnete omponents heps n hepsort greey lgorithms April 3, 2014 CS38 Leture 2 2 Grphs

More information

Shortest Paths in Directed Graphs

Shortest Paths in Directed Graphs Shortet Path in Direted Graph Jonathan Turner January, 0 Thi note i adapted from Data Struture and Network Algorithm y Tarjan. Let G = (V, E) e a direted graph and let length e a real-valued funtion on

More information

Lecture 8: Graph-theoretic problems (again)

Lecture 8: Graph-theoretic problems (again) COMP36111: Advned Algorithms I Leture 8: Grph-theoreti prolems (gin) In Prtt-Hrtmnn Room KB2.38: emil: iprtt@s.mn..uk 2017 18 Reding for this leture: Sipser: Chpter 7. A grph is pir G = (V, E), where V

More information

5 ANGLES AND POLYGONS

5 ANGLES AND POLYGONS 5 GLES POLYGOS urling rige looks like onventionl rige when it is extene. However, it urls up to form n otgon to llow ots through. This Rolling rige is in Pington sin in Lonon, n urls up every Friy t miy.

More information

Tries. Yufei Tao KAIST. April 9, Y. Tao, April 9, 2013 Tries

Tries. Yufei Tao KAIST. April 9, Y. Tao, April 9, 2013 Tries Tries Yufei To KAIST April 9, 2013 Y. To, April 9, 2013 Tries In this lecture, we will discuss the following exct mtching prolem on strings. Prolem Let S e set of strings, ech of which hs unique integer

More information

Table-driven look-ahead lexical analysis

Table-driven look-ahead lexical analysis Tle-riven look-he lexil nlysis WUU YANG Computer n Informtion Siene Deprtment Ntionl Chio-Tung University, HsinChu, Tiwn, R.O.C. Astrt. Moern progrmming lnguges use regulr expressions to efine vli tokens.

More information

Lecture 13: Graphs I: Breadth First Search

Lecture 13: Graphs I: Breadth First Search Leture 13 Grphs I: BFS 6.006 Fll 2011 Leture 13: Grphs I: Bredth First Serh Leture Overview Applitions of Grph Serh Grph Representtions Bredth-First Serh Rell: Grph G = (V, E) V = set of verties (ritrry

More information

If you are at the university, either physically or via the VPN, you can download the chapters of this book as PDFs.

If you are at the university, either physically or via the VPN, you can download the chapters of this book as PDFs. Lecture 5 Wlks, Trils, Pths nd Connectedness Reding: Some of the mteril in this lecture comes from Section 1.2 of Dieter Jungnickel (2008), Grphs, Networks nd Algorithms, 3rd edition, which is ville online

More information

Introduction. Example

Introduction. Example OMS0 Introution isjoint sets n minimum spnning trees In this leture we will strt by isussing t struture use for mintining isjoint subsets of some bigger set. This hs number of pplitions, inluing to mintining

More information

Introduction to Algebra

Introduction to Algebra INTRODUCTORY ALGEBRA Mini-Leture 1.1 Introdution to Alger Evlute lgeri expressions y sustitution. Trnslte phrses to lgeri expressions. 1. Evlute the expressions when =, =, nd = 6. ) d) 5 10. Trnslte eh

More information

Graph theory Route problems

Graph theory Route problems Bhelors thesis Grph theory Route prolems Author: Aolphe Nikwigize Dte: 986 - -5 Sujet: Mthemtis Level: First level (Bhelor) Course oe: MAE Astrt In this thesis we will review some route prolems whih re

More information

Solids. Solids. Curriculum Ready.

Solids. Solids. Curriculum Ready. Curriulum Rey www.mthletis.om This ooklet is ll out ientifying, rwing n mesuring solis n prisms. SOM CUES The Som Cue ws invente y Dnish sientist who went y the nme of Piet Hein. It is simple 3 # 3 #

More information

Calculus Differentiation

Calculus Differentiation //007 Clulus Differentition Jeffrey Seguritn person in rowot miles from the nerest point on strit shoreline wishes to reh house 6 miles frther down the shore. The person n row t rte of mi/hr nd wlk t rte

More information

MITSUBISHI ELECTRIC RESEARCH LABORATORIES Cambridge, Massachusetts. Introduction to Matroids and Applications. Srikumar Ramalingam

MITSUBISHI ELECTRIC RESEARCH LABORATORIES Cambridge, Massachusetts. Introduction to Matroids and Applications. Srikumar Ramalingam Cmrige, Msshusetts Introution to Mtrois n Applitions Srikumr Rmlingm MERL mm//yy Liner Alger (,0,0) (0,,0) Liner inepenene in vetors: v, v2,..., For ll non-trivil we hve s v s v n s, s2,..., s n 2v2...

More information

3D convex hulls. Convex Hull in 3D. convex polyhedron. convex polyhedron. The problem: Given a set P of points in 3D, compute their convex hull

3D convex hulls. Convex Hull in 3D. convex polyhedron. convex polyhedron. The problem: Given a set P of points in 3D, compute their convex hull Convex Hull in The rolem: Given set P of oints in, omute their onvex hull onvex hulls Comuttionl Geometry [si 3250] Lur Tom Bowoin College onvex olyheron 1 2 3 olygon olyheron onvex olyheron 4 5 6 Polyheron

More information

Section 2.3 Functions. Definition: Let A and B be sets. A function (mapping, map) f from A to B, denoted f :A B, is a subset of A B such that

Section 2.3 Functions. Definition: Let A and B be sets. A function (mapping, map) f from A to B, denoted f :A B, is a subset of A B such that Setion 2.3 Funtions Definition: Let n e sets. funtion (mpping, mp) f from to, enote f :, is suset of suh tht x[x y[y < x, y > f ]] n [< x, y 1 > f < x, y 2 > f ] y 1 = y 2 Note: f ssoites with eh x in

More information

Computational geometry

Computational geometry Leture 23 Computtionl geometry Supplementl reding in CLRS: Chpter 33 exept 33.3 There re mny importnt prolems in whih the reltionships we wish to nlyze hve geometri struture. For exmple, omputtionl geometry

More information

COMP108 Algorithmic Foundations

COMP108 Algorithmic Foundations Grph Theory Prudene Wong http://www.s.liv..uk/~pwong/tehing/omp108/201617 How to Mesure 4L? 3L 5L 3L ontiner & 5L ontiner (without mrk) infinite supply of wter You n pour wter from one ontiner to nother

More information

Internet Routing. Reminder: Routing. CPSC Network Programming

Internet Routing. Reminder: Routing. CPSC Network Programming PS 360 - Network Progrmming Internet Routing Mihele Weigle eprtment of omputer Siene lemson University mweigle@s.lemson.eu pril, 00 http://www.s.lemson.eu/~mweigle/ourses/ps360 Reminer: Routing Internet

More information

Advanced Programming Handout 5. Enter Okasaki. Persistent vs. Ephemeral. Functional Queues. Simple Example. Persistent vs.

Advanced Programming Handout 5. Enter Okasaki. Persistent vs. Ephemeral. Functional Queues. Simple Example. Persistent vs. Avne Progrmming Hnout 5 Purel Funtionl Dt Strutures: A Cse Stu in Funtionl Progrmming Persistent vs. Ephemerl An ephemerl t struture is one for whih onl one version is ville t time: fter n upte opertion,

More information

Lesson 4.4. Euler Circuits and Paths. Explore This

Lesson 4.4. Euler Circuits and Paths. Explore This Lesson 4.4 Euler Ciruits nd Pths Now tht you re fmilir with some of the onepts of grphs nd the wy grphs onvey onnetions nd reltionships, it s time to egin exploring how they n e used to model mny different

More information

Bayesian Networks: Directed Markov Properties (Cont d) and Markov Equivalent DAGs

Bayesian Networks: Directed Markov Properties (Cont d) and Markov Equivalent DAGs Byesin Networks: Direte Mrkov Properties (Cont ) n Mrkov Equivlent DAGs Huizhen Yu jney.yu@s.helsinki.fi Dept. Computer Siene, Univ. of Helsinki Proilisti Moels, Spring, 2010 Huizhen Yu (U.H.) Byesin Networks:

More information

6.045J/18.400J: Automata, Computability and Complexity. Quiz 2: Solutions. Please write your name in the upper corner of each page.

6.045J/18.400J: Automata, Computability and Complexity. Quiz 2: Solutions. Please write your name in the upper corner of each page. 6045J/18400J: Automt, Computbility nd Complexity Mrh 30, 2005 Quiz 2: Solutions Prof Nny Lynh Vinod Vikuntnthn Plese write your nme in the upper orner of eh pge Problem Sore 1 2 3 4 5 6 Totl Q2-1 Problem

More information

Ma/CS 6b Class 1: Graph Recap

Ma/CS 6b Class 1: Graph Recap M/CS 6 Clss 1: Grph Recp By Adm Sheffer Course Detils Adm Sheffer. Office hour: Tuesdys 4pm. dmsh@cltech.edu TA: Victor Kstkin. Office hour: Tuesdys 7pm. 1:00 Mondy, Wednesdy, nd Fridy. http://www.mth.cltech.edu/~2014-15/2term/m006/

More information

Class Overview. Database Design. Database Design Process. Database Design. Introduction to Data Management CSE 414

Class Overview. Database Design. Database Design Process. Database Design. Introduction to Data Management CSE 414 Introution to Dt Mngement CSE 44 Unit 6: Coneptul Design E/R Digrms Integrity Constrints BCNF Introution to Dt Mngement CSE 44 E/R Digrms ( letures) CSE 44 Autumn 08 Clss Overview Dtse Design Unit : Intro

More information

Announcements. CS 188: Artificial Intelligence Fall Recap: Search. Today. Example: Pancake Problem. Example: Pancake Problem

Announcements. CS 188: Artificial Intelligence Fall Recap: Search. Today. Example: Pancake Problem. Example: Pancake Problem Announcements Project : erch It s live! Due 9/. trt erly nd sk questions. It s longer thn most! Need prtner? Come up fter clss or try Pizz ections: cn go to ny, ut hve priority in your own C 88: Artificil

More information

Today. CS 188: Artificial Intelligence Fall Recap: Search. Example: Pancake Problem. Example: Pancake Problem. General Tree Search.

Today. CS 188: Artificial Intelligence Fall Recap: Search. Example: Pancake Problem. Example: Pancake Problem. General Tree Search. CS 88: Artificil Intelligence Fll 00 Lecture : A* Serch 9//00 A* Serch rph Serch Tody Heuristic Design Dn Klein UC Berkeley Multiple slides from Sturt Russell or Andrew Moore Recp: Serch Exmple: Pncke

More information

COMP 423 lecture 11 Jan. 28, 2008

COMP 423 lecture 11 Jan. 28, 2008 COMP 423 lecture 11 Jn. 28, 2008 Up to now, we hve looked t how some symols in n lphet occur more frequently thn others nd how we cn sve its y using code such tht the codewords for more frequently occuring

More information

Generic Traverse. CS 362, Lecture 19. DFS and BFS. Today s Outline

Generic Traverse. CS 362, Lecture 19. DFS and BFS. Today s Outline Generic Travere CS 62, Lecture 9 Jared Saia Univerity of New Mexico Travere(){ put (nil,) in bag; while (the bag i not empty){ take ome edge (p,v) from the bag if (v i unmarked) mark v; parent(v) = p;

More information

Lecture 14: Minimum Spanning Tree I

Lecture 14: Minimum Spanning Tree I COMPSCI 0: Deign and Analyi of Algorithm October 4, 07 Lecture 4: Minimum Spanning Tree I Lecturer: Rong Ge Scribe: Fred Zhang Overview Thi lecture we finih our dicuion of the hortet path problem and introduce

More information

Paradigm 5. Data Structure. Suffix trees. What is a suffix tree? Suffix tree. Simple applications. Simple applications. Algorithms

Paradigm 5. Data Structure. Suffix trees. What is a suffix tree? Suffix tree. Simple applications. Simple applications. Algorithms Prdigm. Dt Struture Known exmples: link tble, hep, Our leture: suffix tree Will involve mortize method tht will be stressed shortly in this ourse Suffix trees Wht is suffix tree? Simple pplitions History

More information

Cutting a Cornered Convex Polygon Out of a Circle

Cutting a Cornered Convex Polygon Out of a Circle 4 JOURNAL OF COMUTERS, VOL. 5, NO. 1, JANUARY 2010 Cutting Cornered Conve olygon Out of Cirle Syed Ihtique Ahmed, Md. Ariful Ilm nd Mud Hn Deprtment of Computer Siene nd Engineering Bngldeh Univerity of

More information

2 Computing all Intersections of a Set of Segments Line Segment Intersection

2 Computing all Intersections of a Set of Segments Line Segment Intersection 15-451/651: Design & Anlysis of Algorithms Novemer 14, 2016 Lecture #21 Sweep-Line nd Segment Intersection lst chnged: Novemer 8, 2017 1 Preliminries The sweep-line prdigm is very powerful lgorithmic design

More information

Problem Final Exam Set 2 Solutions

Problem Final Exam Set 2 Solutions CSE 5 5 Algoritms nd nd Progrms Prolem Finl Exm Set Solutions Jontn Turner Exm - //05 0/8/0. (5 points) Suppose you re implementing grp lgoritm tt uses ep s one of its primry dt strutures. Te lgoritm does

More information

Containers: Queue and List

Containers: Queue and List Continers: Queue n List Queue A ontiner in whih insertion is one t one en (the til) n eletion is one t the other en (the he). Also lle FIFO (First-In, First-Out) Jori Cortell n Jori Petit Deprtment of

More information

A Tautology Checker loosely related to Stålmarck s Algorithm by Martin Richards

A Tautology Checker loosely related to Stålmarck s Algorithm by Martin Richards A Tutology Checker loosely relted to Stålmrck s Algorithm y Mrtin Richrds mr@cl.cm.c.uk http://www.cl.cm.c.uk/users/mr/ University Computer Lortory New Museum Site Pemroke Street Cmridge, CB2 3QG Mrtin

More information

CMPUT101 Introduction to Computing - Summer 2002

CMPUT101 Introduction to Computing - Summer 2002 CMPUT Introdution to Computing - Summer 22 %XLOGLQJ&RPSXWHU&LUFXLWV Chpter 4.4 3XUSRVH We hve looked t so fr how to uild logi gtes from trnsistors. Next we will look t how to uild iruits from logi gtes,

More information

Pattern Matching. Pattern Matching. Pattern Matching. Review of Regular Expressions

Pattern Matching. Pattern Matching. Pattern Matching. Review of Regular Expressions Pttern Mthing Pttern Mthing Some of these leture slides hve een dpted from: lgorithms in C, Roert Sedgewik. Gol. Generlize string serhing to inompletely speified ptterns. pplitions. Test if string or its

More information

Describing Combinational circuits in BSV

Describing Combinational circuits in BSV Decriing Comintionl circuit in BSV Arvind Computer Science & Artificil Intelligence L. Mchuett Intitute of Technology Ferury 13, 2018 http://cg.cil.mit.edu/6.s084 L03-1 Three imple comintionl circuit NOT

More information

10.5 Graphing Quadratic Functions

10.5 Graphing Quadratic Functions 0.5 Grphing Qudrtic Functions Now tht we cn solve qudrtic equtions, we wnt to lern how to grph the function ssocited with the qudrtic eqution. We cll this the qudrtic function. Grphs of Qudrtic Functions

More information

WORKSHOP 9 HEX MESH USING SWEEP VECTOR

WORKSHOP 9 HEX MESH USING SWEEP VECTOR WORKSHOP 9 HEX MESH USING SWEEP VECTOR WS9-1 WS9-2 Prolem Desription This exerise involves importing urve geometry from n IGES file. The urves re use to rete other urves. From the urves trimme surfes re

More information

1 Disjoint-set data structure.

1 Disjoint-set data structure. CS 124 Setion #4 Union-Fin, Greey Algorithms 2/20/17 1 Disjoint-set ata struture. 1.1 Operations Disjoint-set ata struture enale us to effiiently perform operations suh as plaing elements into sets, querying

More information

Typing with Weird Keyboards Notes

Typing with Weird Keyboards Notes Typing with Weird Keyords Notes Ykov Berchenko-Kogn August 25, 2012 Astrct Consider lnguge with n lphet consisting of just four letters,,,, nd. There is spelling rule tht sys tht whenever you see n next

More information

Giving credit where credit is due

Giving credit where credit is due JEP 84H Foundtion of omputer tem Proceor rchitecture II: ogic eign r. teve Goddrd goddrd@ce.unl.edu Giving credit where credit i due Mot of lide for thi lecture re ed on lide creted r. rnt, rnegie Mellon

More information

Pipeline Example: Cycle 1. Pipeline Example: Cycle 2. Pipeline Example: Cycle 4. Pipeline Example: Cycle 3. 3 instructions. 3 instructions.

Pipeline Example: Cycle 1. Pipeline Example: Cycle 2. Pipeline Example: Cycle 4. Pipeline Example: Cycle 3. 3 instructions. 3 instructions. ipeline Exmple: Cycle 1 ipeline Exmple: Cycle X X/ /W X X/ /W $3,$,$1 lw $,0($5) $3,$,$1 3 instructions 8 9 ipeline Exmple: Cycle 3 ipeline Exmple: Cycle X X/ /W X X/ /W sw $6,($7) lw $,0($5) $3,$,$1 sw

More information

CS 340, Fall 2016 Sep 29th Exam 1 Note: in all questions, the special symbol ɛ (epsilon) is used to indicate the empty string.

CS 340, Fall 2016 Sep 29th Exam 1 Note: in all questions, the special symbol ɛ (epsilon) is used to indicate the empty string. CS 340, Fll 2016 Sep 29th Exm 1 Nme: Note: in ll questions, the speil symol ɛ (epsilon) is used to indite the empty string. Question 1. [10 points] Speify regulr expression tht genertes the lnguge over

More information

Ma/CS 6b Class 1: Graph Recap

Ma/CS 6b Class 1: Graph Recap M/CS 6 Clss 1: Grph Recp By Adm Sheffer Course Detils Instructor: Adm Sheffer. TA: Cosmin Pohot. 1pm Mondys, Wednesdys, nd Fridys. http://mth.cltech.edu/~2015-16/2term/m006/ Min ook: Introduction to Grph

More information

12/9/14. CS151 Fall 20124Lecture (almost there) 12/6. Graphs. Seven Bridges of Königsberg. Leonard Euler

12/9/14. CS151 Fall 20124Lecture (almost there) 12/6. Graphs. Seven Bridges of Königsberg. Leonard Euler CS5 Fll 04Leture (lmost there) /6 Seven Bridges of Königserg Grphs Prof. Tny Berger-Wolf Leonrd Euler 707-783 Is it possile to wlk with route tht rosses eh ridge e Seven Bridges of Königserg Forget unimportnt

More information

Width and Bounding Box of Imprecise Points

Width and Bounding Box of Imprecise Points Width nd Bounding Box of Impreise Points Vhideh Keikh Mrten Löffler Ali Mohdes Zhed Rhmti Astrt In this pper we study the following prolem: we re given set L = {l 1,..., l n } of prllel line segments,

More information

Shortest Paths Problem. CS 362, Lecture 20. Today s Outline. Negative Weights

Shortest Paths Problem. CS 362, Lecture 20. Today s Outline. Negative Weights Shortet Path Problem CS 6, Lecture Jared Saia Univerity of New Mexico Another intereting problem for graph i that of finding hortet path Aume we are given a weighted directed graph G = (V, E) with two

More information

What are suffix trees?

What are suffix trees? Suffix Trees 1 Wht re suffix trees? Allow lgorithm designers to store very lrge mount of informtion out strings while still keeping within liner spce Allow users to serch for new strings in the originl

More information

Outline. Motivation Background ARCH. Experiment Additional usages for Input-Depth. Regular Expression Matching DPI over Compressed HTTP

Outline. Motivation Background ARCH. Experiment Additional usages for Input-Depth. Regular Expression Matching DPI over Compressed HTTP ARCH This work ws supported y: The Europen Reserh Counil, The Isreli Centers of Reserh Exellene, The Neptune Consortium, nd Ntionl Siene Foundtion wrd CNS-119748 Outline Motivtion Bkground Regulr Expression

More information

Internet Routing. IP Packet Format. IP Fragmentation & Reassembly. Principles of Internet Routing. Computer Networks 9/29/2014.

Internet Routing. IP Packet Format. IP Fragmentation & Reassembly. Principles of Internet Routing. Computer Networks 9/29/2014. omputer Networks 9/29/2014 IP Pket Formt Internet Routing Ki Shen IP protool version numer heder length (words) for qulity of servie mx numer remining hops (deremented t eh router) upper lyer protool to

More information

Today s Outline. CS 561, Lecture 23. Negative Weights. Shortest Paths Problem. The presence of a negative cycle might mean that there is

Today s Outline. CS 561, Lecture 23. Negative Weights. Shortest Paths Problem. The presence of a negative cycle might mean that there is Today Outline CS 56, Lecture Jared Saia Univerity of New Mexico The path that can be trodden i not the enduring and unchanging Path. The name that can be named i not the enduring and unchanging Name. -

More information

Convex Hull Algorithms. Convex hull: basic facts

Convex Hull Algorithms. Convex hull: basic facts CG Leture D Conve Hull Algorithms Bsi fts Algorithms: Nïve, Gift wrpping, Grhm sn, Quik hull, Divide-nd-onquer Lower ound 3D Bsi fts Algorithms: Gift wrpping, Divide nd onquer, inrementl Conve hulls in

More information

A matching algorithm for measuring the structural similarity between an XML document and a DTD and its applications $

A matching algorithm for measuring the structural similarity between an XML document and a DTD and its applications $ Informtion Systems 29 (2004) 23 46 A mthing lgorithm for mesuring the struturl similrity etween n XML oument n DTD n its pplitions $ Elis Bertino, Giovnn Guerrini, Mro Mesiti, * Diprtimento i Informti

More information

Duality in linear interval equations

Duality in linear interval equations Aville online t http://ijim.sriu..ir Int. J. Industril Mthemtis Vol. 1, No. 1 (2009) 41-45 Dulity in liner intervl equtions M. Movhedin, S. Slhshour, S. Hji Ghsemi, S. Khezerloo, M. Khezerloo, S. M. Khorsny

More information

In the last lecture, we discussed how valid tokens may be specified by regular expressions.

In the last lecture, we discussed how valid tokens may be specified by regular expressions. LECTURE 5 Scnning SYNTAX ANALYSIS We know from our previous lectures tht the process of verifying the syntx of the progrm is performed in two stges: Scnning: Identifying nd verifying tokens in progrm.

More information

UTMC APPLICATION NOTE UT1553B BCRT TO INTERFACE PSEUDO-DUAL-PORT RAM ARCHITECTURE INTRODUCTION ARBITRATION DETAILS DESIGN SELECTIONS

UTMC APPLICATION NOTE UT1553B BCRT TO INTERFACE PSEUDO-DUAL-PORT RAM ARCHITECTURE INTRODUCTION ARBITRATION DETAILS DESIGN SELECTIONS UTMC APPLICATION NOTE UT1553B BCRT TO 80186 INTERFACE INTRODUCTION The UTMC UT1553B BCRT is monolithi CMOS integrte iruit tht provies omprehensive Bus Controller n Remote Terminl funtions for MIL-STD-

More information

Hyperbolas. Definition of Hyperbola

Hyperbolas. Definition of Hyperbola CHAT Pre-Clculus Hyperols The third type of conic is clled hyperol. For n ellipse, the sum of the distnces from the foci nd point on the ellipse is fixed numer. For hyperol, the difference of the distnces

More information

Asurveyofpractical algorithms for suffix tree construction in external memory

Asurveyofpractical algorithms for suffix tree construction in external memory Asurveyofprtil lgorithms for suffix tree onstrution in externl memory M. Brsky,, U. Stege n A. Thomo University of Vitori, PO Box, STN CSC Vitori, BC, VW P, Cn SUMMAY The onstrution of suffix trees in

More information

Lecture 12 : Topological Spaces

Lecture 12 : Topological Spaces Leture 12 : Topologil Spes 1 Topologil Spes Topology generlizes notion of distne nd loseness et. Definition 1.1. A topology on set X is olletion T of susets of X hving the following properties. 1. nd X

More information

Uninformed Search Complexity. Informed Search. Search Revisited. Day 2/3 of Search

Uninformed Search Complexity. Informed Search. Search Revisited. Day 2/3 of Search Informed Search ay 2/3 of Search hap. 4, Ruel & Norvig FS IFS US PFS MEM FS IS Uninformed Search omplexity N = Total number of tate = verage number of ucceor (branching factor) L = Length for tart to goal

More information

Distance-Vector Algorithms for Distributed Shortest Paths on Dynamic Power-Law Networks

Distance-Vector Algorithms for Distributed Shortest Paths on Dynamic Power-Law Networks Article Ditnce-Vector Algorithm for Ditriuted Shortet Pth on Dynmic Power-Lw Network Mtti D Emidio 1, * nd Dniele Frigioni 2, * 1 Grn So Science Intitute (GSSI), Vile Frnceco Cripi, I 67100 L Aquil, Itly

More information

Contents. shortest paths. Notation. Shortest path problem. Applications. Algorithms and Networks 2010/2011. In the entire course:

Contents. shortest paths. Notation. Shortest path problem. Applications. Algorithms and Networks 2010/2011. In the entire course: Content Shortet path Algorithm and Network 21/211 The hortet path problem: Statement Verion Application Algorithm (for ingle ource p problem) Reminder: relaxation, Dijktra, Variant of Dijktra, Bellman-Ford,

More information

An Efficient Algorithm for the Physical Mapping of Clustered Task Graphs onto Multiprocessor Architectures

An Efficient Algorithm for the Physical Mapping of Clustered Task Graphs onto Multiprocessor Architectures An Effiient Algorithm for the Physil Mpping of Clustere Tsk Grphs onto Multiproessor Arhitetures Netrios Koziris Pnyiotis Tsnks Mihel Romesis George Ppkonstntinou Ntionl Tehnil University of Athens Dept.

More information

Declarative Routing: Extensible Routing with Declarative Queries

Declarative Routing: Extensible Routing with Declarative Queries elrtive Routing: Extensile Routing with elrtive Queries Boon Thu Loo 1 Joseph M. Hellerstein 1,2, Ion toi 1, Rghu Rmkrishnn3, 1 University of Cliforni t Berkeley, 2 Intel Reserh Berkeley, 3 University

More information

Adjacency. Adjacency Two vertices u and v are adjacent if there is an edge connecting them. This is sometimes written as u v.

Adjacency. Adjacency Two vertices u and v are adjacent if there is an edge connecting them. This is sometimes written as u v. Terminology Adjeny Adjeny Two verties u nd v re djent if there is n edge onneting them. This is sometimes written s u v. v v is djent to nd ut not to. 2 / 27 Neighourhood Neighourhood The open neighourhood

More information

LINX MATRIX SWITCHERS FIRMWARE UPDATE INSTRUCTIONS FIRMWARE VERSION

LINX MATRIX SWITCHERS FIRMWARE UPDATE INSTRUCTIONS FIRMWARE VERSION Overview LINX MATRIX SWITCHERS FIRMWARE UPDATE INSTRUCTIONS FIRMWARE VERSION 4.4.1.0 Due to the omplex nture of this updte, plese fmilirize yourself with these instrutions nd then ontt RGB Spetrum Tehnil

More information

CICS Application Design

CICS Application Design CICS Applition Design In orer to lern whih questions hve een nswere orretly: 1. Print these pges. 2. Answer the questions. 3. Sen this ssessment with the nswers vi:. FAX to (212) 967-3498. Or. Mil the

More information

Solving Problems by Searching. CS 486/686: Introduction to Artificial Intelligence Winter 2016

Solving Problems by Searching. CS 486/686: Introduction to Artificial Intelligence Winter 2016 Solving Prolems y Serching CS 486/686: Introduction to Artificil Intelligence Winter 2016 1 Introduction Serch ws one of the first topics studied in AI - Newell nd Simon (1961) Generl Prolem Solver Centrl

More information

COMPUTER EDUCATION TECHNIQUES, INC. (WEBLOGIC_SVR_ADM ) SA:

COMPUTER EDUCATION TECHNIQUES, INC. (WEBLOGIC_SVR_ADM ) SA: In orer to lern whih questions hve een nswere orretly: 1. Print these pges. 2. Answer the questions. 3. Sen this ssessment with the nswers vi:. FAX to (212) 967-3498. Or. Mil the nswers to the following

More information

Structure in solution spaces: Three lessons from Jean-Claude

Structure in solution spaces: Three lessons from Jean-Claude Struture in solution spes: Three lessons from Jen-Clue Dvi Eppstein Computer Siene Deprtment, Univ. of Cliforni, Irvine Conferene on Meningfulness n Lerning Spes: A Triute to the Work of Jen-Clue Flmgne

More information

AlphaGo Overview. Overview. Digression: Zero sum, alternating move games. Original AlphaGo approach. Recent AlphaGo Zero approach 10/24/17

AlphaGo Overview. Overview. Digression: Zero sum, alternating move games. Original AlphaGo approach. Recent AlphaGo Zero approach 10/24/17 AlphGo Overview Ron Prr CompSci 590.2 Duke Univerity Overview Digreion: Zero um, lternting move gme Originl AlphGo pproch Recent AlphGo Zero pproch 1 2 Alternting move, zero-um, 2-plyer gme Ordinry bellmn

More information

Today s Outline. CS 362, Lecture 19. DFS and BFS. Generic Traverse. BFS and DFS Wrapup Shortest Paths. Jared Saia University of New Mexico

Today s Outline. CS 362, Lecture 19. DFS and BFS. Generic Traverse. BFS and DFS Wrapup Shortest Paths. Jared Saia University of New Mexico Today Outline CS 362, Lecture 9 Jared Saia Univerity of New Mexico BFS and DFS Wrapup Shortet Path Generic Travere DFS and BFS Travere(){ put (nil,) in bag; while (the bag i not empty){ take ome edge (p,v)

More information

Honors Thesis: Investigating the Algebraic Properties of Cayley Digraphs

Honors Thesis: Investigating the Algebraic Properties of Cayley Digraphs Honors Thesis: Investigting the Algebri Properties of Cyley Digrphs Alexis Byers, Wittenberg University Mthemtis Deprtment April 30, 2014 This pper utilizes Grph Theory to gin insight into the lgebri struture

More information

Neo-Flex Slide-out Keyboard Tray Wall Mount

Neo-Flex Slide-out Keyboard Tray Wall Mount User's Guie Neo-Flex Slie-out Keyor Try Wll Mount For the ltest User Instlltion Guie plese visit: www.ergotron.om User's Guie - English Guí el usurio - Espñol Mnuel e l utilisteur - Frnçis Geruikersgis

More information

Final Exam Review F 06 M 236 Be sure to look over all of your tests, as well as over the activities you did in the activity book

Final Exam Review F 06 M 236 Be sure to look over all of your tests, as well as over the activities you did in the activity book inl xm Review 06 M 236 e sure to loo over ll of your tests, s well s over the tivities you did in the tivity oo 1 1. ind the mesures of the numered ngles nd justify your wor. Line j is prllel to line.

More information

AI Adjacent Fields. This slide deck courtesy of Dan Klein at UC Berkeley

AI Adjacent Fields. This slide deck courtesy of Dan Klein at UC Berkeley AI Adjcent Fields Philosophy: Logic, methods of resoning Mind s physicl system Foundtions of lerning, lnguge, rtionlity Mthemtics Forml representtion nd proof Algorithms, computtion, (un)decidility, (in)trctility

More information

ΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών

ΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών ΕΠΛ323 - Θωρία και Πρακτική Μταγλωττιστών Lecture 3 Lexicl Anlysis Elis Athnsopoulos elisthn@cs.ucy.c.cy Recognition of Tokens if expressions nd reltionl opertors if è if then è then else è else relop

More information

Today. Search Problems. Uninformed Search Methods. Depth-First Search Breadth-First Search Uniform-Cost Search

Today. Search Problems. Uninformed Search Methods. Depth-First Search Breadth-First Search Uniform-Cost Search Uninformed Serch [These slides were creted by Dn Klein nd Pieter Abbeel for CS188 Intro to AI t UC Berkeley. All CS188 mterils re vilble t http://i.berkeley.edu.] Tody Serch Problems Uninformed Serch Methods

More information

Rolling Back Remote Provisioning Changes. Dell Command Integration for System Center

Rolling Back Remote Provisioning Changes. Dell Command Integration for System Center Rolling Bk Remote Provisioning Chnges Dell Commn Integrtion for System Center Notes, utions, n wrnings NOTE: A NOTE inites importnt informtion tht helps you mke etter use of your prout. CAUTION: A CAUTION

More information

F. R. K. Chung y. University ofpennsylvania. Philadelphia, Pennsylvania R. L. Graham. AT&T Labs - Research. March 2,1997.

F. R. K. Chung y. University ofpennsylvania. Philadelphia, Pennsylvania R. L. Graham. AT&T Labs - Research. March 2,1997. Forced convex n-gons in the plne F. R. K. Chung y University ofpennsylvni Phildelphi, Pennsylvni 19104 R. L. Grhm AT&T Ls - Reserch Murry Hill, New Jersey 07974 Mrch 2,1997 Astrct In seminl pper from 1935,

More information

Lecture 17: Shortest Paths

Lecture 17: Shortest Paths Lecture 7: Shortet Path CSE 373: Data Structure and Algorithm CSE 373 9 WI - KASEY CHAMPION Adminitrivia How to Ace the Technical Interview Seion today! - 6-8pm - Sieg 34 No BS CS Career Talk Thurday -

More information

FEEDBACK: The standard error of a regression is not an unbiased estimator for the standard deviation of the error in a multiple regression model.

FEEDBACK: The standard error of a regression is not an unbiased estimator for the standard deviation of the error in a multiple regression model. Introutory Eonometris: A Moern Approh 6th Eition Woolrige Test Bnk Solutions Complete ownlo: https://testbnkre.om/ownlo/introutory-eonometris-moern-pproh-6th-eition-jeffreym-woolrige-test-bnk/ Solutions

More information

1.1. Interval Notation and Set Notation Essential Question When is it convenient to use set-builder notation to represent a set of numbers?

1.1. Interval Notation and Set Notation Essential Question When is it convenient to use set-builder notation to represent a set of numbers? 1.1 TEXAS ESSENTIAL KNOWLEDGE AND SKILLS Prepring for 2A.6.K, 2A.7.I Intervl Nottion nd Set Nottion Essentil Question When is it convenient to use set-uilder nottion to represent set of numers? A collection

More information

CS 151. Graph Algorithms. Wednesday, November 28, 12

CS 151. Graph Algorithms. Wednesday, November 28, 12 CS 151 Graph Algorithm 1 Unweighted Shortet Path Problem input: a graph G=(V,E) and a tart vertex goal: determine the length of the hortet path from to every vertex in V (and while you re at it, compute

More information

CSCI 104. Rafael Ferreira da Silva. Slides adapted from: Mark Redekopp and David Kempe

CSCI 104. Rafael Ferreira da Silva. Slides adapted from: Mark Redekopp and David Kempe CSCI 0 fel Ferreir d Silv rfsilv@isi.edu Slides dpted from: Mrk edekopp nd Dvid Kempe LOG STUCTUED MEGE TEES Series Summtion eview Let n = + + + + k $ = #%& #. Wht is n? n = k+ - Wht is log () + log ()

More information

Basics of Logic Design Arithmetic Logic Unit (ALU)

Basics of Logic Design Arithmetic Logic Unit (ALU) Bsics of Logic Design Arithmetic Logic Unit (ALU) CPS 4 Lecture 9 Tody s Lecture Homework #3 Assigned Due Mrch 3 Project Groups ssigned & posted to lckord. Project Specifiction is on We Due April 9 Building

More information