Graph Contraction and Connectivity

Size: px
Start display at page:

Download "Graph Contraction and Connectivity"

Transcription

1 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 re not. For exmple, we sw tht BFS hs some prllelism sine eh level n be explore in prllel, but there ws no prllelism in DFS 1 There ws lso limite prllelism in Dijkstr s lgorithm, but there ws plenty of prllelism in the Bellmn-For lgorithm. In this hpter we will over tehnique lle grph ontrtion tht ws speifilly esigne to be use in prllel lgorithms n llows us to get polylogrithmi spn for ertin grph problems. Also, so fr, we hve been only esribe lgorithms tht o not moify grph, but rther just trverse the grph, or upte vlues ssoite with the verties. As prt of grph ontrtion, in this hpter we will lso stuy tehniques for restruture grphs Preliminries We strt by reviewing n efining some new grph terminology. We will use the following grph s n exmple. Exmple We will use the following unirete grph s n exmple. b e f 1 In relity, there is prllelism in DFS when grphs re ense in prtiulr, lthough verties nee to visite sequentilly, with some re, the eges n be proesse in prllel. 213

2 214 CHAPTER 14. GRAPH CONTRACTION AND CONNECTIVITY Rell tht in grph (either irete or unirete) vertex v is rehble from vertex u if there is pth from u to v. Also rell tht n unirete grph is onnete if ll verties re rehble from ll other verties. Our exmple is onnete. Exmple You n isonnet the grph by eleting two eges, for exmple (, f) n (b, e). b e f When working with grphs it is often useful to refer to prt of grph, whih we will ll subgrph. Question Any intuition bout how we my efine subgrph? A subgrph n be efine s ny subsets of eges n verties s long s the result is well efine grph, n in prtiulr: Definition 14.4 (Subgrph). Let G = (V, E) n H = (V, E ) be two grphs. H is subgrph of if V V n E E. There re mny subgrphs of grph. Question How mny subgrph woul grph with n verties n m eges hve? It is hr to ount the number of possible subgrphs sine we nnot just tke rbitrry subsets of verties n eges beuse the resulting subsets must efine grph. For exmple, we nnot hve n ege between two non-existing verties. One of the most stnr subgrphs of n unirete grph re the so lle onnete omponents of grph. Definition 14.6 ((Connete) Component). Let G = (V, E) be grph. A subgrph H of G is onnete omponent of G if it is mximl onnete subgrph of G.

3 14.1. PRELIMINARIES 215 In the efinition mximl mens we nnot ny more verties or eges from G without isonneting it. In generl when we sy n objet is mximl X, we men we nnot ny more to the objet without violting the property X. Question How mny onnete omponents o our two grphs hve? Our first exmple grph hs one onnete omponent (hene it is onnete), n the seon hs two. It is often useful to fin the onnete omponents of grph, whih les to the following problem: Definition 14.8 (The Grph Connetivity (GC) Problem). Given n unirete grph G = (V, E) return ll of its onnete omponents (mximl onnete subgrphs). When tlking bout subgrphs it is often not neessry to mention ll the verties n eges in the subgrph. For exmple for the grph onnetivity problem it is suffiient to speify the verties in eh omponent, n the eges re then implie they re simply ll eges inient on verties in eh omponent. This les to the importnt notion of inue subgrphs. Definition 14.9 (Vertex-Inue Subgrph). The subgrph of G = (V, E) inue by V V is the grph H = (V, E ) where E = {{u, v} E u V, v V }. Question In Exmple 14.1 wht woul be the subgrph inue by the verties {, b}? How bout {, b,, }? Using inue subgrphs llows us to speify the onnete omponents of grph by simply speifying the verties in eh omponent. The onnete omponents n therefore be efine s prtitioning of the verties. A prtitioning of set mens set of subsets where ll elements re in extly one of the subsets. Exmple Connete omponents on the grph in Exmple 14.2 returns the prtitioning {{, b,, }, {e, f}}. When stuying grph onnetivity sometimes we only re if the grph is onnete or not, or perhps how mny omponents it hs. In grph onnetivity there re no eges between the prtitions, by efinition. More generlly it n be useful to tlk bout prtitions of grph ( prtitioning of its verties) in whih there n be eges between prtitions. In this se some eges re internl eges within the inue subgrphs n some re ross eges between them.

4 216 CHAPTER 14. GRAPH CONTRACTION AND CONNECTIVITY Exmple In Exmple 14.1 the prtitioning of the verties {{, b, }, {}, {e, f}} efines three inue subgrphs. The eges {, b}, {, }, n {e, f} re internl eges, n the eges {, }, {b, }, {b, e} n {, f} re ross eges Grph Contrtion We now return to the topi of the hpter, whih is grph ontrtion. Although grph ontrtion n be use to solve vriety of problems we will first look t how it n be use to solve the grph onnetivity problem esribe in the lst setion. Question Cn you think of wy of solving the grph-onnetivity problem? One wy to solve the grph onnetivity problem is to use grph serh. For exmple, we n strt t ny vertex n serh ll verties rehble from it to rete the first omponent, then move onto the next vertex n if it hs not lrey been serhe serh from it to rete the seon omponent. We then repet until ll verties hve been heke. Question Wht kins of lgorithms n you use to perform the serhes? Either BFS or DFS n be use for the iniviul serhes. Question Woul these pprohes yiel goo prllelism? Wht woul be the spn of the lgorithm? Using BFS n DFS le to perfetly sensible sequentil lgorithms for grph onnetivity, but they re not goo prllel lgorithms. Rell tht DFS hs liner spn. Question How bout BFS? Do you rell the spn of BFS? BFS tkes spn proportionl to the imeter of the grph. In the ontext of our lgorithm the spn woul be the imeter of omponent (the longest istne between two verties). Question How lrge n the imeter of omponent be? Cn you give n exmple? The imeter of omponent n be s lrge s n 1. A hin of n verties will hve imeter n 1

5 14.2. GRAPH CONTRACTION 217 Question How bout in ses when the imeter is smll, for exmple when the grph is just isonnete olletion of eges. Even if the imeter of eh omponent is smll, we might hve to iterte over the omponents one by one. Thus the spn in the worst se n be liner in the number of omponents. Contrtion hierrhies. We re intereste in n pproh tht n ientify the omponents in prllel. We lso wish to evelop n lgorithm whose spn is inepenent of the imeter, n ielly polylogrithmi in V. To o this let s give up on the ie of grph serh sine it seems to be inherently limite by the imeter of grph. Inste we will borrow some ies from our lgorithm for the sn opertion. In prtiulr we will use ontrtion. The ie grph ontrtion is to shrink the grph by onstnt frtion, while respeting the onnetivity of the grph. We n then solve the problem on the smller, ontrte grph n from tht result ompute the result for the tul grph. Exmple (A ontrtion hierrhy). The ruil point to remember is tht we wnt to buil the ontrtion hierrhy in wy tht respets n revels the onnetivity of the verties in hierrhil wy. Verties tht re not onnete shoul not beome onnete n vie vers. G log(n) G log(n)-1 b e G1 f This pproh is lle grph ontrtion. It is resonbly simple tehnique n n be

6 218 CHAPTER 14. GRAPH CONTRACTION AND CONNECTIVITY pplie to vriety of problems, beyon just onnetivity, inluing spnning trees n minimum spnning trees. As n nlogy, you n think of grph ontrtion s wy of viewing grph t ifferent levels of etil. For exmple, if you wnt to rive from Pittsburgh to Sn Frniso, you o not onern yourselves with ll the little towns on the ro n ll the ros in between them. Rther you think of highwys n the interesting ples tht you my wnt to visit. As you think of the grph t ifferent levels, however, you ertinly on t wnt to ignore onnetivity. For exmple, you on t wnt to fin yourself hopping on ferry to the UK on your wy to Sn Frniso. Contrting grph, however, is bit more omplite thn just piring up the o n even positione vlues s we i in the lgorithm for sn. Question Any ies bout how we might ontrt grph? When ontrting grph, we wnt to tke subgrphs of the grph n represent them with wht we ll superverties, justing the eges oringly. By seleting the subgrphs refully, we will mintin the onnetivity n t the sme time shrink the grph geometrilly (by onstnt ftor). We then tret the superverties s orinry verties n repet the proess until there re no more eges. The key question is wht kin of subgrphs shoul we ontrt n represent s single vertex. Let s first ignore effiieny for now n just onsier orretness. Question Cn we ontrt subgrph tht re isonnete? We surely shoul not tke isonnete subgrphs sine by repling eh subgrph with vertex, we re essentilly sying tht the verties in the subgrph re onnete. Therefore, the subgrphs tht we hoose shoul be onnete. Question Cn the subgrphs tht we hoose to ontrt overlp with eh other, tht is shre vertex or n ege. Although this might work, for our purposes, we will hoose isjoint subgrphs. We therefore will just onsier prtitions or our input grph where eh prtition is onnete.

7 14.2. GRAPH CONTRACTION 219 Figure 14.1: An illustrtion of grph ontrtion using mps. The ro to key west t three ifferent zoom levels. At first (top) there is just ro (n ege). We then see tht there is n isln (Mrthon) n in ft two highwys (1 n 5). Finlly, we see more of the islns n the ros in between.

8 220 CHAPTER 14. GRAPH CONTRACTION AND CONNECTIVITY Exmple Prtitioning the grph in Exmple 14.1 might generte the prtitioning {{, b, }, {}, {e, f}} s inite by the following she regions: b b e ef f We nme the superverties b,, n ef. Note tht eh of the three prtitions is onnete by eges within the prtition. Prtitioning woul not return {{, b, f}, {, }, {e}}, for exmple, sine the subgrph {, b, f} is not onnete by eges within the omponent. One we hve prtitione the grph we n ontrt eh prtition into single vertex. We note, however, tht we now hve to o something with the eges sine their enpoints re no longer the originl verties, but inste re the new superverties. The internl eges within eh prtition n be thrown wy. For the ross eges we n relbel the enpoints to the new nmes of the superverties. Note, however, this n rete uplite eges (lso lle prllel eges), whih n be remove. Exmple For Exmple ontrting eh prtition n repling the eges. b b e ef f Prtition ientifie b ef b ef Contrte Duplite eges remove We re now rey to esribe grph-ontrtion bse on prtitioning. To simplify things we ssume tht prtitiongrph returns new set of superverties, one per prtition, long with tble tht mps eh of the originl verties to the supervertex to whih it belongs. Exmple For the prtitioning in Exmple 14.23, prtitiongrph returns the pir: ({b,, ef}, { b, b b, b,, e ef, f ef})

9 14.2. GRAPH CONTRACTION 221 b b f e ef Roun 1 Roun 3 b b bef ef Roun 2 ef bef b ef Figure 14.2: An exmple grph ontrtion. It ompletes when there re no more eges. We n now write the lgorithm for grph ontrtion s follows. Algorithm (Grph Contrtion). 1 funtion ontrtgrph(g = (V, E)) = 2 if E = 0 then V 3 else let 4 vl (V, P ) = prtitiongrph(v, E) 5 vl E = {(P [u], P [v]) : (u, v) E P [u] P [v]} 6 in 7 ontrtgrph(v, E ) 8 en This lgorithm returns one vertex per onnete omponent. It therefore llows us to ount the number of onnete omponents. An exmple is shown in Figure As in the verbl esription, ontrtgrph ontrts the grph in eh roun. Eh ontrtion on Line 4 returns the set of superverties V n tble P mpping every v V to v V. Line 5 uptes ll eges so tht the two enpoints re in V by looking them up in P : this is wht (P [u], P [v]) is. Seonly it removes ll self eges: this is wht the filter P [u] P [v] oes. One the eges re upte, the lgorithm reurses on the smller grph. The termintion onition is when there re no eges. At this point eh omponent hs shrunk own to singleton vertex. Nming superverties. In our exmple, we gve fresh nmes to superverties. It is often more onvenient to pik representtive from eh prtition s supervertex. We n then represent prtition s mpping from eh vertex to its representtive (supervertex). For exmple, we n return the prtition {{, b, }, {}, {e, f}} s the pir ({,, e}, {, b,,, e e, f e}).

10 222 CHAPTER 14. GRAPH CONTRACTION AND CONNECTIVITY Computing the omponents. Our previous oe just returns one vertex per omponent, n therefore llows us to ount the number of omponents. It turns out we n moify the oe slightly to ompute the omponents themselves inste of returning their ount. Rell thn in the ontrtion bse oe for sn we i work both on the wy own the reursion n on the wy bk up, when we e the results from the reursive ll to the originl elements to generte the o inexe vlues. A similr ie will work here. The ie is to use the lbels of the reursive ll on the superverties, to relbel ll verties. This is implemente by the following lgorithm. Algorithm (Contrtion-bse grph onnetivity). 1 funtion onnetecomponents(g = (V, E)) = 2 if E = 0 then (V, {v v : v V }) 3 else let 4 vl (V, P ) = prtitiongrph(v, E) 5 vl E = {(P [u], P [v]) : (u, v) E P [u] P [v]} 6 vl (V, P ) = onnetecomponents(v, E ) 7 in 8 (V, {v P [P [v]] : v V }) 9 en In ition to returning the set of omponent lbels s returne by ontrtgrph, this lgorithm returns mpping from eh of the initil verties to its omponent. Thus for our exmple grph it might return: ({}, {, b,,, e, f }) sine there is single omponent n ll verties will mp to tht omponent lbel. The only ifferene of this oe from ontrtgrph is tht on the wy bk up the reursion inste of simply returning the result (V ) we lso upte the representtives for V bse on the representtives from V. Consier our exmple grph. As before lets sy the first prtitiongrph returns V = {,, e} P = {, b,,, e e, f e} Sine the grph is onnete the reursive ll to omponents will mp ll verties in V to the sme vertex. Lets sy this vertex is giving: P = {,, e } Now wht Line 8 in the oe oes is for eh vertex v V, it looks for v in P to fin its representtive v V, n then looks for v in P to fin its onnete omponent (will be lbel from V ). This is implemente s P [P [v]]. For exmple vertex f fins e from P n then looks this up in P to fin. The bse se of the omponents lgorithm lbels every vertex with itself.

11 14.2. GRAPH CONTRACTION 223 Prtitioning the Grph. In our isussion so fr, we hve not speifie how to prtition the grph. There ifferent wys to o it, whih orrespons to ifferent forms of grph ontrtion. Question Wht properties re esirble in forming the grph prtitions to ontrt, i.e. the prtitions generte by grphprtition. There re hnful of properties we woul like when generting the prtitions, beyon the requirement tht eh prtition must be onnete. Firstly we woul like to be ble to form the prtitions without too muh work. Seonly we woul like to be ble to form them in prllel. After ll, one of the min gols of grph ontrtion is to prllelize vrious grph lgorithms. Finlly we woul like the number of prtitions to be signifintly smller thn the number of verties. Ielly it shoul be t lest onstnt frtion smller. This will llow us to ontrt the grph in O(log V ) rouns. Here we outline three methos for forming prtitions tht will be esribe in more etil in the following setions. Ege Contrtion: Eh prtition is either single vertex or or two verties with n ege between them. Eh ege will ontrt into single vertex. Str Contrtion: Eh prtition is str, whih onsists of enter vertex v n some number (possibly 0) stellite verties onnete by n ege to v. There n lso be eges mong the stellites. Tree Contrtion: For eh prtition we hve spnning tree Ege Contrtion In ege ontrtion, the ie is to prtition the grph into omponents onsisting of t most two verties n the ege between them. We then ontrt the eges to single vertex.

12 224 CHAPTER 14. GRAPH CONTRACTION AND CONNECTIVITY Exmple The figure below shows n exmple ege ontrtion. e Roun 1 b f e e In the bove exmple, we were ble to reue the size of the grph by ftor of two by ontrting long the selete eges. Remrk Fining set of isjoint eges is lso lle vertex mthing, sine it tries to mth every vertex with nother vertex (monogmously), n is stnr problem in grph theory. In ft fining the vertex mthing with the mximum number of eges is well known problem. Here we re not onerne if it hs mximum number of eges. Question Cn you esribe n lgorithm for fining vertex mthing? One wy to fin vertex mthing is to strt t vertex n pir in up with one of its neighbors. This n be ontinue until there re no longer ny verties to pir up, i.e., ll eges re lrey inient on selete pir. The pirs long with ny unpire verties form the prtition. The problem with this pproh is tht it is sequentil. Question Cn you think of wy to fin vertex mthing in prllel? An lgorithm for forming the pirs in prllel will nee to be ble to mke lol eisions t eh vertex. One possibility is in for eh vertex in prllel to pik one of its neighbors to pir up with.

13 14.2. GRAPH CONTRACTION 225 Question Wht is the problem with this pproh? The problem with this pproh is tht it is not possible to ensure isjointness. We nee wy to brek the symmetry tht rises when two verties try to pir up with the sme vertex. Question Cn you think of wy to use rnomiztion to brek this symmetry? We n use rnomiztion to brek the symmetry. One pproh is to flip oin for eh ege n pik the ege if the ege (u, v) flips hes n ll the eges inient on u n v flip tils. Question Cn you see how mny verties we woul pir up in our yle grph exmple? Lets nlyze this pproh on grph tht is yle. Let R e be n initor rnom vrible enoting whether e is selete or not, tht is R e = 1 if e is selete n 0 otherwise. The expettion of initor rnom vribles is the sme s the probbility it hs vlue 1 (true). Sine the oins re flippe inepenently t rnom, the probbility tht vertex piks hes n its two neighboring eges pik tils is = 1. Therefore we hve E[R e] = 1/8. Thus summing over ll eges, we onlue tht expete number of eges elete is m 8 (note, m = n). In the hpter on rnomize lgorithms Setion 8.3 we rgue tht if eh roun of n lgorithm shrinks the size by onstnt frtion in expettion, n if the rnom hoies in the rouns re inepenent, then the lgorithm will finish in O(log n) rouns with high probbility. Rell tht ll we neee to o is multiply the expete frtion tht remin ross rouns n then use Mrkov s inequlity to show tht fter some k log n rouns the probbility tht the problem size is lest 1 is very smll. For yle grph, this tehnique les to n lgorithm for grph ontrtion with liner work n O(log 2 n) spn. Question Cn you think of wy to improve the expete number of eges ontrte? We n improve the probbility tht we remove n ege by letting eh ege pik rnom number in some rnge n then selet n ege if it is the lol mximum, i.e., it pike the highest number mong ll the eges inient on its en points. This inreses the expete number of eges ontrte in yle to m 3. Question So fr in our exmple, we hve onsiere simple yle grph. Do you think this tehnique woul work s effetively for rbitrry grphs?

14 226 CHAPTER 14. GRAPH CONTRACTION AND CONNECTIVITY v Ege ontrtion oes not work with generl grphs. The problem is tht if the vertex tht n ege is inient on hs high egree, then it is highly unlikely for the vertex to be pike. In ft, mong ll the eges inient n vertex only one n be pike for ontrtion. Thus in generl, using ege ontrtion, we n shrink the grph only by smll mount. As n exmple, onsier str grph: Definition (Str). A str grph G = (V, E) is n unirete grph with enter vertex v V, n set of eges E = {{v, u} : u V \ {v}}. In wors, str grph is grph me up of single vertex v in the mile (lle the enter) n ll the other verties hnging off of it; these verties re onnete only to the enter. It is not iffiult to onvine ourselves tht on str grph with n + 1 verties 1 enter n n stellites ny ege ontrtion lgorithm will tke Ω(n) rouns. To fix this problem we nee to be ble to form prtitions tht re more thn just eges Str Contrtion We now onsier more ggressive form of ontrtion. The ie is to prtition the grph into set of str grphs, onsisting of enter n stellites, n ontrt eh str into vertex in one roun. Exmple In the grph below (left), we n fin 2 isjoint strs (right). The enters re olore blue n the neighbors re green. The question is how to ientify the isjoint strs to form the prtitioning.

15 14.3. STAR CONTRACTION 227 Question How n we fin isjoint strs? Similr to ege ontrtion, it is possible to to onstrut strs sequentilly pik n rbitrry vertex, tth ll its neighbors to the str, remove the str from the grph, n repet. However, gin, we wnt prllel lgorithm tht mkes lol eisions. As in ege ontrtion when mking lol eisions, we nee wy to brek the symmetry between two verties tht wnt to beome the enter of the str. Question Cn you think of rnomize pproh for seleting strs (enters n stellites)? As with ege ontrtion we n use rnomiztion to ientify strs. An lgorithm n use oin flips to eie whih verties will be enters n whih ones will be stellites, n n then eie how to pir up eh stellite with enter. To etermine the enters, the lgorithm n flip oin for eh vertex. If it omes up hes, tht vertex is str enter, n if it omes up tils, then it is potentil stellite it is only potentil stellite beuse quite possibly, none of its neighbors flippe he so it hs no enter to hook to. At this point, we hve etermine every vertex s potentil role, but we ren t one: for eh stellite vertex, we still nee to eie whih enter it will join. For our purposes, we re only intereste in ensuring tht the strs re isjoint, so it oesn t mtter whih enter stellite joins. We will mke eh stellite rbitrrily hoose ny enter mong its neighbors. Exmple An exmple str prtition. Coin flips turne up s inite in the figure. H T T H T T H T T H T H T H T b e b e b e oin flips (hes(v,i)) fin potentil enters (TH) ompute "hook" eges (P) Before esribing the lgorithm for prtitioning grph into strs, we nee to sy ouple wors bout the soure of rnomness. Wht we will ssume is tht eh vertex is given (potentilly infinite) sequene of rnom n inepenent oin flips. The i th element of the sequene n be esse hes(v, i) : vertex int bool.

16 228 CHAPTER 14. GRAPH CONTRACTION AND CONNECTIVITY Algorithm (Str Prtition). 1 % requires: n unirete grph G = (V, E) n roun number i 2 % returns: V = remining verties fter ontrtion, 3 % P = mpping from V to V 4 funtion strprtition(g = (V, E), i) = 5 let 6 % selet eges tht go from til to he 7 vl TH = {(u, v) E hes(u, i) hes(v, i)} 8 % mke mpping from tils to hes, removing uplites 9 vl P = (u,v) TH {u v} 10 % remove verties tht hve been remppe 11 vl V = V \ omin(p ) 12 % Mp remining verties to themselves 13 vl P = {u u : u V } P 14 in (V, P ) en The funtion returns true if the i th flip on vertex v is hes n flse otherwise. Sine most mhines on t hve true soures of rnomness, in prtie this n be implemente with pseuornom number genertor or even with goo hsh funtion. The lgorithm for str ontrtion is given in Algorithm In our exmple grph, the funtion hes(v, i) on roun i gives oin flip for eh vertex, whih re shown on the left. Line 7 selets the eges tht go from til to he, whih re shown in the mile s rrows n orrespon to the set TH = {(, ), (, b), (e, b)}. Notie tht some potentil stellites (verties tht flippe tils) re jent to multiple enters (verties tht flippe hes). For exmple, vertex is jent to verties n b, both of whih got hes. A vertex like this will hve to hoose whih enter to join. This is sometimes lle hooking n is eie on Line 13, whih removes uplites for til using union, giving P = { b, e b}. In this exmple, is hooke up with b, leving enter without ny stellite. Line 11 tkes the verties V n removes from them ll the verties in the omin of P, i.e. those tht hve been remppe. In our exmple omin(p ) = {, e} so we re left with V = {, b, }. In generl, V is the set of verties whose oin flippe hes or whose oin flippe tils but in t hve neighboring enter. Finlly we mp ll verties in V to themselves n union this in with the hooks giving P = {, b b, b,, e b}. Anlysis of Str Contrtion. When we ontrt these strs foun by strcontrt, eh str beomes one vertex, so the number of verties remove is the size of P. In expettion, how big is P? The following lemm shows tht on grph with n non-isolte verties, the size of P or the number of verties remove in one roun of str ontrtion is t lest n/4.

17 14.3. STAR CONTRACTION 229 Lemm For grph G with n non-isolte verties, let X n be the rnom vrible initing the number of verties remove by strcontrt(g, r). Then, E [X n ] n/4. Proof. Consier ny non-isolte vertex v V (G). Let H v be the event tht vertex v omes up hes, T v tht it omes up tils, n R v tht v omin(p ) (i.e, it is remove). By efinition, we know tht non-isolte vertex v hs t lest one neighbor u. So, we hve tht T v H u implies R v sine if v is til n u is he v must either join u s str or some other str. Therefore, Pr [R v ] Pr [T v ] Pr [H u ] = 1/4. By the linerity of expettion, we hve tht the number of remove verties is [ ] E I {R v } = E [I {R v }] n/4 v:v non-isolte sine we hve n verties tht re non-isolte. v:v non-isolte Exerise Wht is the probbility tht vertex with egree is remove. Cost Speifition (Str Contrtion). Using ArrySequene n STArrySequene, we n implement strcontrt resonbly effiiently in O(n + m) work n O(log n) spn for grph with n verties n m eges Returning to Connetivity Now lets nlyze the ost of the lgorithm for ounting the number of onnete omponents we esribe erlier when using str ontrtion for ontrt. Let n be the number of nonisolte verties. Notie tht one vertex beomes isolte (ue to ontrtion), it stys isolte until the finl roun (ontrtion only removes eges). Therefore, we hve the following spn reurrene (we ll look t work lter): S(n) = S(n ) + O(log n) where n = n X n n X n is the number of verties remove (s efine erlier in the lemm bout strcontrt). But E [X n ] = n/4 so E [n ] = 3n/4. This is fmilir reurrene, whih we know solves to O(log 2 n). As for work, ielly, we woul like to show tht the overll work is liner sine we might hope tht the size is going own by onstnt frtion on eh roun. Unfortuntely, this is not the se. Although we hve shown tht we n remove onstnt frtion of the non-isolte verties on one str ontrt roun, we hve not shown nything bout the number of eges. We n rgue tht the number of eges remove is t lest equl to the number of verties sine

18 230 CHAPTER 14. GRAPH CONTRACTION AND CONNECTIVITY removing vertex lso removes the ege tht tthes it to its str s enter. But this oes not help symptotilly boun the number of eges remove. Consier the following sequene of rouns: roun verties eges 1 n m 2 n/2 m n/2 3 n/4 m 3n/4 4 n/8 m 7n/8 In this exmple, it is ler tht the number of eges oes not rop below m n, so if there re m > 2n eges to strt with, the overll work will be O(m log n). Inee, this is the best boun we n show symptotilly. Hene, we hve the following work reurrene: W (n, m) W (n, m) + O(n + m), where n is the remining number of non-isolte verties s efine in the spn reurrene. This solves to E [W (n, m)] = O(n + m log n). Altogether, this gives us the following theorem: Theorem For grph G = (V, E), numcomponents using strcontrt grph ontrtion with n rry sequene works in O( V + E log V ) work n O(log 2 V ) spn Tree Contrtion Tree ontrtion tkes set of isjoint trees n ontrts them. When ontrting tree, we n use str ontrtion s before but we n show tighter boun on work beuse the number of eges erese geometrilly (the number of eges in tree is boune by the number of verties). Therefore the number of eges must go own geometrilly from step to step, n the overll ost of tree ontrtion is O(m) work n O(log 2 n) spn using n rry sequene. When ontrting grph, we n lso use prtition funtion tht selet isjoint trees (str ontrtion is speil se). As in str ontrtion, we woul pik the subgrph inue by the verties in eh tree n ontrt them.

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

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

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

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

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

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

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

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

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

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

CS553 Lecture Introduction to Data-flow Analysis 1

CS553 Lecture Introduction to Data-flow Analysis 1 ! Ide Introdution to Dt-flow nlysis!lst Time! Implementing Mrk nd Sweep GC!Tody! Control flow grphs! Liveness nlysis! Register llotion CS553 Leture Introdution to Dt-flow Anlysis 1 Dt-flow Anlysis! Dt-flow

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

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

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

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

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

CS453 INTRODUCTION TO DATAFLOW ANALYSIS

CS453 INTRODUCTION TO DATAFLOW ANALYSIS CS453 INTRODUCTION TO DATAFLOW ANALYSIS CS453 Leture Register llotion using liveness nlysis 1 Introdution to Dt-flow nlysis Lst Time Register llotion for expression trees nd lol nd prm vrs Tody Register

More information

MATH 25 CLASS 5 NOTES, SEP

MATH 25 CLASS 5 NOTES, SEP MATH 25 CLASS 5 NOTES, SEP 30 2011 Contents 1. A brief diversion: reltively prime numbers 1 2. Lest common multiples 3 3. Finding ll solutions to x + by = c 4 Quick links to definitions/theorems Euclid

More information

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

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

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

9 Graph Cutting Procedures

9 Graph Cutting Procedures 9 Grph Cutting Procedures Lst clss we begn looking t how to embed rbitrry metrics into distributions of trees, nd proved the following theorem due to Brtl (1996): Theorem 9.1 (Brtl (1996)) Given metric

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

13.1 Weighted Graphs and Their Representation

13.1 Weighted Graphs and Their Representation 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

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

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

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

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

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

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

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

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

Hash-based Subgraph Query Processing Method for Graph-structured XML Documents

Hash-based Subgraph Query Processing Method for Graph-structured XML Documents Hsh-bse Subgrph Query Proessing Metho for Grph-struture XML Douments Hongzhi Wng Hrbin Institute of Teh. wngzh@hit.eu.n Jinzhong Li Hrbin Institute of Teh. lijzh@hit.eu.n Jizhou Luo Hrbin Institute of

More information

Line The set of points extending in two directions without end uniquely determined by two points. The set of points on a line between two points

Line The set of points extending in two directions without end uniquely determined by two points. The set of points on a line between two points Lines Line Line segment Perpendiulr Lines Prllel Lines Opposite Angles The set of points extending in two diretions without end uniquely determined by two points. The set of points on line between two

More information

CS 551 Computer Graphics. Hidden Surface Elimination. Z-Buffering. Basic idea: Hidden Surface Removal

CS 551 Computer Graphics. Hidden Surface Elimination. Z-Buffering. Basic idea: Hidden Surface Removal CS 55 Computer Grphis Hidden Surfe Removl Hidden Surfe Elimintion Ojet preision lgorithms: determine whih ojets re in front of others Uses the Pinter s lgorithm drw visile surfes from k (frthest) to front

More information

Distributed Systems Principles and Paradigms. Chapter 11: Distributed File Systems

Distributed Systems Principles and Paradigms. Chapter 11: Distributed File Systems Distriuted Systems Priniples nd Prdigms Mrten vn Steen VU Amsterdm, Dept. Computer Siene steen@s.vu.nl Chpter 11: Distriuted File Systems Version: Deemer 10, 2012 2 / 14 Distriuted File Systems Distriuted

More information

Distributed Systems Principles and Paradigms

Distributed Systems Principles and Paradigms Distriuted Systems Priniples nd Prdigms Christoph Dorn Distriuted Systems Group, Vienn University of Tehnology.dorn@infosys.tuwien..t http://www.infosys.tuwien..t/stff/dorn Slides dpted from Mrten vn Steen,

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

Unit #9 : Definite Integral Properties, Fundamental Theorem of Calculus

Unit #9 : Definite Integral Properties, Fundamental Theorem of Calculus Unit #9 : Definite Integrl Properties, Fundmentl Theorem of Clculus Gols: Identify properties of definite integrls Define odd nd even functions, nd reltionship to integrl vlues Introduce the Fundmentl

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

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

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

Section 3.1: Sequences and Series

Section 3.1: Sequences and Series Section.: Sequences d Series Sequences Let s strt out with the definition of sequence: sequence: ordered list of numbers, often with definite pttern Recll tht in set, order doesn t mtter so this is one

More information

PROBLEM OF APOLLONIUS

PROBLEM OF APOLLONIUS PROBLEM OF APOLLONIUS In the Jnury 010 issue of Amerin Sientist D. Mkenzie isusses the Apollonin Gsket whih involves fining the rius of the lrgest irle whih just fits into the spe etween three tngent irles

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

INTRODUCTION TO SIMPLICIAL COMPLEXES

INTRODUCTION TO SIMPLICIAL COMPLEXES INTRODUCTION TO SIMPLICIAL COMPLEXES CASEY KELLEHER AND ALESSANDRA PANTANO 0.1. Introduction. In this ctivity set we re going to introduce notion from Algebric Topology clled simplicil homology. The min

More information

Solutions to Tutorial 2 (Week 9)

Solutions to Tutorial 2 (Week 9) The University of Syney Shool of Mathematis an Statistis Solutions to Tutorial (Week 9) MATH09/99: Disrete Mathematis an Graph Theory Semester, 0. Determine whether eah of the following sequenes is the

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

A decision support system prototype for fuzzy multiple objective optimization

A decision support system prototype for fuzzy multiple objective optimization EUSFLAT - LFA A eision support system prototype for fuzzy multiple ojetive optimiztion Fengjie Wu Jie Lu n Gungqun Zhng Fulty of Informtion Tehnology University of Tehnology Syney Austrli E-mil: {fengjiewjieluzhngg}@it.uts.eu.u

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

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

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

Very sad code. Abstraction, List, & Cons. CS61A Lecture 7. Happier Code. Goals. Constructors. Constructors 6/29/2011. Selectors.

Very sad code. Abstraction, List, & Cons. CS61A Lecture 7. Happier Code. Goals. Constructors. Constructors 6/29/2011. Selectors. 6/9/ Abstrction, List, & Cons CS6A Lecture 7-6-9 Colleen Lewis Very sd code (define (totl hnd) (if (empty? hnd) (+ (butlst (lst hnd)) (totl (butlst hnd))))) STk> (totl (h c d)) 7 STk> (totl (h ks d)) ;;;EEEK!

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

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

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

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

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

CSc 453 Compilers and Systems Software. 6 : Top-Down Parsing I

CSc 453 Compilers and Systems Software. 6 : Top-Down Parsing I C 45 Compilers n ystems oftwre 6 : op-down Prsing I Christin Collberg Deprtment of Computer iene University of rizon ollberg@gmil.om Copyright 2009 Christin Collberg eptember 14, 2009 1 Overview 2 Compiler

More information

Answer Key Lesson 6: Workshop: Angles and Lines

Answer Key Lesson 6: Workshop: Angles and Lines nswer Key esson 6: tudent Guide ngles nd ines Questions 1 3 (G p. 406) 1. 120 ; 360 2. hey re the sme. 3. 360 Here re four different ptterns tht re used to mke quilts. Work with your group. se your Power

More information

GENG2140 Modelling and Computer Analysis for Engineers

GENG2140 Modelling and Computer Analysis for Engineers GENG4 Moelling n Computer Anlysis or Engineers Letures 9 & : Gussin qurture Crete y Grn Romn Joles, PhD Shool o Mehnil Engineering, UWA GENG4 Content Deinition o Gussin qurture Computtion o weights n points

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

Bruce McCarl's GAMS Newsletter Number 37

Bruce McCarl's GAMS Newsletter Number 37 Bruce McCrl's GAMS Newsletter Number 37 This newsletter covers 1 Uptes to Expne GAMS User Guie by McCrl et l.... 1 2 YouTube vieos... 1 3 Explntory text for tuple set elements... 1 4 Reing sets using GDXXRW...

More information

Section 10.4 Hyperbolas

Section 10.4 Hyperbolas 66 Section 10.4 Hyperbols Objective : Definition of hyperbol & hyperbols centered t (0, 0). The third type of conic we will study is the hyperbol. It is defined in the sme mnner tht we defined the prbol

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

WORKSHOP 19 GLOBAL/LOCAL MODELING USING FEM FIELDS

WORKSHOP 19 GLOBAL/LOCAL MODELING USING FEM FIELDS WORKSHOP 19 GLOBAL/LOCAL MODELING USING FEM FIELDS WS19-1 WS19-2 Prolem Desription This exerise is use to emonstrte how to mp isplement results from the nlysis of glol(overll) moel onto the perimeter of

More information

Parallelization Optimization of System-Level Specification

Parallelization Optimization of System-Level Specification Prlleliztion Optimiztion of System-Level Speifition Luki i niel. Gjski enter for Emedded omputer Systems University of liforni Irvine, 92697, US {li, gjski} @es.ui.edu strt This pper introdues the prlleliztion

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

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

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

CS311H: Discrete Mathematics. Graph Theory IV. A Non-planar Graph. Regions of a Planar Graph. Euler s Formula. Instructor: Işıl Dillig

CS311H: Discrete Mathematics. Graph Theory IV. A Non-planar Graph. Regions of a Planar Graph. Euler s Formula. Instructor: Işıl Dillig CS311H: Discrete Mthemtics Grph Theory IV Instructor: Işıl Dillig Instructor: Işıl Dillig, CS311H: Discrete Mthemtics Grph Theory IV 1/25 A Non-plnr Grph Regions of Plnr Grph The plnr representtion of

More information

CS201 Discussion 10 DRAWTREE + TRIES

CS201 Discussion 10 DRAWTREE + TRIES CS201 Discussion 10 DRAWTREE + TRIES DrwTree First instinct: recursion As very generic structure, we could tckle this problem s follows: drw(): Find the root drw(root) drw(root): Write the line for the

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

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

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

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

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

Comparison-based Choices

Comparison-based Choices Comprison-se Choies John Ugner Mngement Siene & Engineering Stnfor University Joint work with: Jon Kleinerg (Cornell) Senhil Mullinthn (Hrvr) EC 17 Boston June 28, 2017 Preiting isrete hoies Clssi prolem:

More information

Math 464 Fall 2012 Notes on Marginal and Conditional Densities October 18, 2012

Math 464 Fall 2012 Notes on Marginal and Conditional Densities October 18, 2012 Mth 464 Fll 2012 Notes on Mrginl nd Conditionl Densities klin@mth.rizon.edu October 18, 2012 Mrginl densities. Suppose you hve 3 continuous rndom vribles X, Y, nd Z, with joint density f(x,y,z. The mrginl

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

EECS 281: Homework #4 Due: Thursday, October 7, 2004

EECS 281: Homework #4 Due: Thursday, October 7, 2004 EECS 28: Homework #4 Due: Thursdy, October 7, 24 Nme: Emil:. Convert the 24-bit number x44243 to mime bse64: QUJD First, set is to brek 8-bit blocks into 6-bit blocks, nd then convert: x44243 b b 6 2 9

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

XML and Databases. Sebastian Maneth NICTA and UNSW. Lecture 2 Memory Representations for XML: Space vs Access Speed. -- Semester 1, 2010

XML and Databases. Sebastian Maneth NICTA and UNSW. Lecture 2 Memory Representations for XML: Space vs Access Speed. -- Semester 1, 2010 1 XML n Dtbses Leture 2 Memory Representtions for XML: Spe vs Aess Spee Sebstin Mneth NICTA n UNSW CSE@UNSW -- Semester 1, 2010 2 XML n Dtbses Leture 2 Memory Representtions for XML: Spe vs Aess Spee Sebstin

More information

COMBINATORIAL PATTERN MATCHING

COMBINATORIAL PATTERN MATCHING COMBINATORIAL PATTERN MATCHING Genomic Repets Exmple of repets: ATGGTCTAGGTCCTAGTGGTC Motivtion to find them: Genomic rerrngements re often ssocited with repets Trce evolutionry secrets Mny tumors re chrcterized

More information

Looking up objects in Pastry

Looking up objects in Pastry Review: Pstry routing tbles 0 1 2 3 4 7 8 9 b c d e f 0 1 2 3 4 7 8 9 b c d e f 0 1 2 3 4 7 8 9 b c d e f 0 2 3 4 7 8 9 b c d e f Row0 Row 1 Row 2 Row 3 Routing tble of node with ID i =1fc s - For ech

More information

CSCI 446: Artificial Intelligence

CSCI 446: Artificial Intelligence CSCI 446: Artificil Intelligence Serch Instructor: Michele Vn Dyne [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.]

More information

MATH 2530: WORKSHEET 7. x 2 y dz dy dx =

MATH 2530: WORKSHEET 7. x 2 y dz dy dx = MATH 253: WORKSHT 7 () Wrm-up: () Review: polr coordintes, integrls involving polr coordintes, triple Riemnn sums, triple integrls, the pplictions of triple integrls (especilly to volume), nd cylindricl

More information

Algorithm Design (5) Text Search

Algorithm Design (5) Text Search Algorithm Design (5) Text Serch Tkshi Chikym School of Engineering The University of Tokyo Text Serch Find sustring tht mtches the given key string in text dt of lrge mount Key string: chr x[m] Text Dt:

More information

MA1008. Calculus and Linear Algebra for Engineers. Course Notes for Section B. Stephen Wills. Department of Mathematics. University College Cork

MA1008. Calculus and Linear Algebra for Engineers. Course Notes for Section B. Stephen Wills. Department of Mathematics. University College Cork MA1008 Clculus nd Liner Algebr for Engineers Course Notes for Section B Stephen Wills Deprtment of Mthemtics University College Cork s.wills@ucc.ie http://euclid.ucc.ie/pges/stff/wills/teching/m1008/ma1008.html

More information

Error Numbers of the Standard Function Block

Error Numbers of the Standard Function Block A.2.2 Numers of the Stndrd Funtion Blok evlution The result of the logi opertion RLO is set if n error ours while the stndrd funtion lok is eing proessed. This llows you to rnh to your own error evlution

More information

Loop Shifting and Compaction for the High-Level Synthesis of Designs with Complex Control Flow

Loop Shifting and Compaction for the High-Level Synthesis of Designs with Complex Control Flow Shifting n Comption for the High-Level Synthesis of Designs with Complex Control low Sumit Gupt Nikil Dutt Rjesh Gupt Alexnru Niolu Center for Emee Computer Systems Shool of Informtion n Computer Siene

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

Stained Glass Design. Teaching Goals:

Stained Glass Design. Teaching Goals: Stined Glss Design Time required 45-90 minutes Teching Gols: 1. Students pply grphic methods to design vrious shpes on the plne.. Students pply geometric trnsformtions of grphs of functions in order to

More information

Misrepresentation of Preferences

Misrepresentation of Preferences Misrepresenttion of Preferences Gicomo Bonnno Deprtment of Economics, University of Cliforni, Dvis, USA gfbonnno@ucdvis.edu Socil choice functions Arrow s theorem sys tht it is not possible to extrct from

More information

CSCI1950 Z Computa4onal Methods for Biology Lecture 2. Ben Raphael January 26, hhp://cs.brown.edu/courses/csci1950 z/ Outline

CSCI1950 Z Computa4onal Methods for Biology Lecture 2. Ben Raphael January 26, hhp://cs.brown.edu/courses/csci1950 z/ Outline CSCI1950 Z Comput4onl Methods for Biology Lecture 2 Ben Rphel Jnury 26, 2009 hhp://cs.brown.edu/courses/csci1950 z/ Outline Review of trees. Coun4ng fetures. Chrcter bsed phylogeny Mximum prsimony Mximum

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

4452 Mathematical Modeling Lecture 4: Lagrange Multipliers

4452 Mathematical Modeling Lecture 4: Lagrange Multipliers Mth Modeling Lecture 4: Lgrnge Multipliers Pge 4452 Mthemticl Modeling Lecture 4: Lgrnge Multipliers Lgrnge multipliers re high powered mthemticl technique to find the mximum nd minimum of multidimensionl

More information

4.3 Balanced Trees. let us assume that we can manipulate them conveniently and see how they can be put together to form trees.

4.3 Balanced Trees. let us assume that we can manipulate them conveniently and see how they can be put together to form trees. 428 T FOU 4.3 Blned Trees T BT GOIT IN T VIOU setion work well for wide vriety of pplitions, ut they hve poor worst-se performne. s we hve noted, files lredy in order, files in reverse order, files with

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

12-B FRACTIONS AND DECIMALS

12-B FRACTIONS AND DECIMALS -B Frctions nd Decimls. () If ll four integers were negtive, their product would be positive, nd so could not equl one of them. If ll four integers were positive, their product would be much greter thn

More information