Weighted graphs -- reminder. Data Structures LECTURE 15. Shortest paths algorithms. Example: weighted graph. Two basic properties of shortest paths
|
|
- Felicia Hubbard
- 6 years ago
- Views:
Transcription
1 Dt Strutur LECTURE Shortt pth lgorithm Proprti of hortt pth Bllmn-For lgorithm Dijktr lgorithm Chptr in th txtook (pp ). Wight grph -- rminr A wight grph i grph in whih g hv wight (ot) w(v i, v j ) >. A grph i wight grph in whih ll ot r. Two vrti with no g (pth) twn thm n thought of hving n g (pth) with wight. Th ot of pth i th um of th ot of it g: k w p w v i, v i i Exmpl: wight grph Two i proprti of hortt pth Tringl inqulity Lt G=(V,E) wight irt grph, w: E R wight funtion n V our vrtx. Thn, for ll g =(u,v) E: (,v) (,u) + w(u,v) Optiml utrutur of hortt pth Lt p = <v,.. v k > th hortt pth twn v n v k. Th u-pth twn v i n v j, whr i,j k, p ij = <v i,.. v j > i hortt pth. Ngtiv-wight g Shortt pth r wll-fin long thr r no ngtiv-wight yl. In uh yl, th longr th pth, th lowr th vlu th hortt pth h n infinit numr of g! - - Allow ngtiv-wight g, ut illow (or tt) ngtiv-wight yl! Shortt pth n yl Th hortt pth twn ny two vrti h no poitiv-wight yl. Th rprnttion for hortt pth twn vrtx n ll othr vrti i th m th on u in th unwigth BFS: rth-firt tr: G = (V,E ) uh tht V = {v V: [v] null} {} n E = {( [v],v), v V {}} W will prov tht rth-firt tr i hortt-pth tr for it root in whih vrti rhl from r in it n th uniqu impl pth from to v i hortt.
2 Exmpl: hortt-pth tr Exmpl: hortt-pth tr Etimt itn from our A for BFS on unwight grph, w kp ll whih i th urrnt t timt of th hortt itn twn n v. Initilly, it[] = n it[v] = for ll v, n [v] = null. At ll tim uring th lgorithm, it[v] (,v). At th n, it[v] = (,v) n ( [v],v) E Eg rlxtion Th pro of rlxing n g (u,v) onit of tting whthr it n improv th hortt pth from to v o fr y going through u. Rlx(u,v) if it[v] > it[u] + w(u,v) thn it[v] it[u] + w(u,v) [v] u Proprti of hortt pth n rlxtion Tringl inqulity = (u,v) E: (,v) (,u) + w(u,v) Uppr-ounry proprty v V: it[v] (,v) t ll tim, n it kp ring. No-pth proprty if thr i no pth from to v, thn it[v]= (,v) = Proprti of hortt pth n rlxtion Convrgn proprty if u v i hortt pth in G for om u n v, n it[u]= (,u) t ny tim prior to rlxing g (u,v), thn it[v]= (,v) t ll tim ftrwr. Pth-rlxtion proprty Lt p = <v,.. v k > th hortt pth twn v n v k. Whn th g r rlx in th orr (v, v ), (v, v ), (v k-, v k ), thn it[v k ]= (,v k ). Pror u-grph proprty on it[v]= (,v) v V, th pror ugrph i hortt-pth tr root t.
3 Two hortt-pth lgorithm. Bllmnn-For lgorithm. Dijktr lgorithm Gnrliztion of BFS Bllmn-For lgorithm: ovrviw Allow ngtiv wight. If thr i ngtiv yl, rturn ngtiv yl xit. Th i: Thr i hortt pth from to ny othr vrtx tht o not ontin non-ngtiv yl (n limint to prou hortr pth). Th mximl numr of g in uh pth with no yl i V, u it n hv t mot V no on th pth if thr i no yl. it i nough to hk pth of up to V g. Bllmn-For lgorithm Bllmn - For( G, ) Initiliz( G, ) for i to V for h g u, v E o if it[v] it[u] w u, v it[ v ] it[ u] w( u, v ) [ v ] u for h g u, v E if it v u w u, v rturn " ngtiv yl" Exmpl: Bllmn-For lgorithm () Eg orr (,) (,) (,) (,) (,) (,) (,) (,) (,) (,) Exmpl: Bllmn-For lgorithm () Exmpl: Bllmn-For lgorithm () Eg Eg orr orr - (,) - (,) (,) (,) - (,) - (,) - (,) (,) (,) - (,) (,) (,) (,) (,) (,) (,) (,) (,) (,) (,)
4 Exmpl: Bllmn-For lgorithm () Eg orr (,) (,) (,) (,) (,) (,) (,) (,) (,) (,) Exmpl: Bllmn-For lgorithm () Eg orr - (,) (,) - (,) (,) - (,) (,) (,) (,) (,) - (,) Bllmn-For lgorithm: proprti Th firt p ovr th g only nighor of r fft (-g pth). All hortt pth with on g r foun. Th on p hortt pth with g r foun. Aftr V - p, ll poil pth r hk. Clim: w n to upt ny vrtx in th lt p if n only if thr i ngtiv yl rhl from in G. Bllmn For lgorithm: proof () On irtion w lry know: if w n to upt n g in th lt itrtion thn thr i ngtiv yl, u w prov for tht if thr r no ngtiv yl, n th hortt pth r wll fin, w fin thm in th V itrtion. W lim tht if thr i ngtiv yl, w will iovr prolm in th lt itrtion. Bu, uppo thr i ngtiv yl v,... vk, vk v But th lgorithm o not fin ny prolm in th lt itrtion, whih mn tht for ll g, w hv tht it [v] it[u] w( u, v) for ll g in th yl. Bllmn For lgorithm: proof () Proof y ontrition: for ll g in th yl it[v] it[v] w v, v it[v ] it[v ] w v, v... it[vk ] it[vk- ] w vk, vk k k k it[ vi ] it[ vi] w( vi, vi ) i i i Aftr umming up ovr ll g in th yl, w iovr tht th trm on th lft i qul to th firt trm on th right (jut iffrnt orr of ummtion). W n utrt thm, n w gt tht th yl i tully poitiv, whih i ontrition. Bllmn-For lgorithm: omplxity Viit V vrti O( V ) Prform vrtx rlxtion on ll g O( E ) Ovrll, O( V. E ) tim n O( V + E ) p.
5 Bllmn-For on DAG Exmpl: Bllmn-For on DAG () For Dirt Ayli Grph (DAG), O( V + E ) rlxtion r uffiint whn th vrti r viit in topologilly ort orr: DAG-Shortt-Pth(G). Topologilly ort th vrti in G. Initiliz G (it[v] n (v)) with our.. for h vrtx u in topologilly ort orr o. for h vrtx v inint to u o. Rlx(u,v) - Vrti ort from lft to right - Exmpl: Bllmn-For on DAG () Exmpl: Bllmn-For on DAG () Exmpl: Bllmn-For on DAG () Exmpl: Bllmn-For on DAG ()
6 Exmpl: Bllmn-For on DAG () Exmpl: Bllmn-For on DAG () Bllmn-For on DAG: orrtn Pth-rlxtion proprty Lt p = <v,.. v k > th hortt pth twn v n v k. Whn th g r rlx in th orr (v, v ), (v, v ), (v k-, v k ), thn it[v k ]= (,v k ). In DAG, w hv th orrt orring! Thrfor, th omplxity i O( V + E ). Dijktr lgorithm: ovrviw I: Do th m BFS for unwight grph, with two iffrn: u th ot th itn funtion u minimum priority quu int of impl quu. Th BFS lgorithm BFS(G, ) ll[] urrnt; it[] = ; [] = null for ll vrti u in V {} o ll[u] not_viit; it[u] = ; [u] = null EnQuu(Q,) whil Q i not mpty o u DQuu(Q) for h v tht i nighor of u o if ll[v] = not_viit thn ll[v] urrnt it[v] it[u] + ; [v] u EnQuu(Q,v) ll[u] viit Exmpl: BFS lgorithm
7 Exmpl: Dijktr lgorithm Dijktr lgorithm Dijktr(G, ) ll[] urrnt; it[] = ; [u] = null for ll vrti u in V {} o ll[u] not_viit; it[u] = ; [u] = null Q whil Q i not mpty o u Extrt-Min(Q) for h v tht i nighor of u o if ll[v] = not_viit thn ll[v] urrnt if [v] > [u] + w(u,v) thn [v] [u] + w(u,v); [v] = u Inrt-Quu(Q,v) Dt Strutur, ll[u] Spring L. = Jokowiz viit Exmpl: Dijktr lgorithm () Exmpl: Dijktr lgorithm () Exmpl: Dijktr lgorithm () Exmpl: Dijktr lgorithm ()
8 Exmpl: Dijktr lgorithm () Exmpl: Dijktr lgorithm () Dijktr lgorithm: orrtn () Thorm: Upon trmintion of th Dijktr lgorithm, for h it[v] = (,v) for h vrtx v V, Dfinition: pth from to v i i to pil pth if it i th hortt pth from to v in whih ll vrti (xpt my for v) r ini S. Lmm: At th n of h itrtion of th whil loop, th following two proprti hol:. For h w S, it[w] i th lngth of th hortt pth from to w whih ty ini S.. For h w V S, it(w) i th lngth of th hortt pil pth from to w. Dijktr lgorithm: orrtn () Proof: y inution on th iz of S. For S =, it i lrly tru: it[v] = xpt for th nighor of, whih ontin th lngth of th hortt pil pth. Inution tp: uppo tht in th lt itrtion no v w to S. By th inution umption, it[v] i th lngth of th hortt pil pth to v. It i lo th lngth of th gnrl hortt pth to v, in if thr i hortr pth to v ping through no of S, n x i th firt no of S in tht pth, thn x woul hv n lt n not v. So th firt proprty till hol. Th Dt Strutur, thorm Spring L. Jokowiz follow whn S = V. Dijktr lgorithm: orrtn () Proprty : Lt x S. Conir th hortt nw pil pth to w If it on t inlu v, it[x] i th lngth of tht pth y th inution umption from th lt itrtion in it[x] i not hng in th finl itrtion. If it o inlu v, thn v n ithr no in th mil or th lt no for x. Not tht v nnot no in th mil in thn th pth woul p from to v to y in S, ut y proprty, th hortt pth to y woul hv n ini S v n not inlu. If v i th lt no for x on th pth, thn it[x] ontin th itn of tht pth, y th utitution it[x] = it[v] + w(v,x) in th lgorithm. Dijktr lgorithm: omplxity Th lgorithm prform V Extrt-Min oprtion n E Inrt-Quu oprtion. Whn th priority quu i implmnt hp, inrt tk O(lg V ) n Extrt-Min tk O(lg( V ). Th totl tim i O( V lg V ) + O( E lg V ) = O( E lg V ) Whn E = O( V ), thi i not optiml. In thi, thr r mny mor inrt thn xtrt oprtion. Solution: Implmnt th priority quu n rry! Inrt will tk O() n Extrt-Min O( V ) O( V ) + O( E ) = O( V ) whih i ttr thn th hp long E i O( V /lg ( V )).
9 Applition: iffrn ontrint Givn ytm of m iffrn ontrint ovr n vril, fin olution if on xit. x i x j k for i, j n n k m Contrint grph G: h vril x i i vrtx, h ontrint x i x j k i irt g from x i to x j with wight k. Whn G o not hv ngtiv yl, th minimum pth itn of th vrti r th olution to th ytm of ontrint iffrn. Exmpl: iffrn ontrint () x x x x - x x x x x x x x - x x - x x - Solution: x = (-,-,,-,-) x - x - - x x - x Exmpl: iffrn ontrint Solution: x = (-,-,,-,-) x x x x x Why o thi work? Thorm: Lt Ax t of m iffrn ontrint ovr n vril, n G=(V,E) it orrponing ontrint grph. If G h no ngtiv wight yl, thn x = ( (v,v ), (v,v ),, (v,v n )) i fil olution for th ytm. If G h ngtiv yl, thn thr i no fil olution. Proof outlin: For ll g (v i,v j ) in E: (v,v j ) (v,v i ) + w(v i,v j ) (v,v j ) (v,v i ) w(v i,v j ) x j x j w(v i,v j ) Summry Solving th hortt-pth prolm on wight grph i prform y rlxtion, on th pth tringl inqulity: for ll g =(u,v) E: (,v) (,u) + w(u,v) Two lgorithm for olving th prolm: Bllmn For: for h vrtx, rlxtion on ll g. Tk O( E. V ) tim. Work on grph with nonngtiv yl. Dijktr: BFS-lik, tk O( E lg V ) tim.
10/30/12. Today. CS/ENGRD 2110 Object- Oriented Programming and Data Structures Fall 2012 Doug James. DFS algorithm. Reachability Algorithms
0/0/ CS/ENGRD 0 Ojt- Orint Prormmin n Dt Strutur Fll 0 Dou Jm Ltur 9: DFS, BFS & Shortt Pth Toy Rhility Dpth-Firt Srh Brth-Firt Srh Shortt Pth Unwiht rph Wiht rph Dijktr lorithm Rhility Alorithm Dpth Firt
More informationCSC Design and Analysis of Algorithms. Example: Change-Making Problem
CSC 801- Dsign n Anlysis of Algorithms Ltur 11 Gry Thniqu Exmpl: Chng-Mking Prolm Givn unlimit mounts of oins of nomintions 1 > > m, giv hng for mount n with th lst numr of oins Exmpl: 1 = 25, 2 =10, =
More information14 Shortest Paths (November 8)
CS G Ltur : Shortt Pth Fll 5 Shortt Pth (Novmr ). Introution Givn wight irt grph G = (V, E, w) with two pil vrti, our n trgt t, w wnt to in th hortt irt pth rom to t. In othr wor, w wnt to in th pth p
More informationV={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}
s s of s Computr Sin & Enginring 423/823 Dsign n Anlysis of Ltur 03 (Chptr 22) Stphn Sott (Apt from Vinohnrn N. Vriym) s of s s r strt t typs tht r pplil to numrous prolms Cn ptur ntitis, rltionships twn
More informationV={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}
Introution Computr Sin & Enginring 423/823 Dsign n Anlysis of Algorithms Ltur 03 Elmntry Grph Algorithms (Chptr 22) Stphn Sott (Apt from Vinohnrn N. Vriym) I Grphs r strt t typs tht r pplil to numrous
More informationCOMP108 Algorithmic Foundations
Grdy mthods Prudn Wong http://www.s.liv..uk/~pwong/thing/omp108/01617 Coin Chng Prolm Suppos w hv 3 typs of oins 10p 0p 50p Minimum numr of oins to mk 0.8, 1.0, 1.? Grdy mthod Lrning outoms Undrstnd wht
More informationCSE 373. Graphs 1: Concepts, Depth/Breadth-First Search reading: Weiss Ch. 9. slides created by Marty Stepp
CSE 373 Grphs 1: Conpts, Dpth/Brth-First Srh ring: Wiss Ch. 9 slis rt y Mrty Stpp http://www.s.wshington.u/373/ Univrsity o Wshington, ll rights rsrv. 1 Wht is grph? 56 Tokyo Sttl Soul 128 16 30 181 140
More informationCSE 373: More on graphs; DFS and BFS. Michael Lee Wednesday, Feb 14, 2018
CSE 373: Mor on grphs; DFS n BFS Mihl L Wnsy, F 14, 2018 1 Wrmup Wrmup: Disuss with your nighor: Rmin your nighor: wht is simpl grph? Suppos w hv simpl, irt grph with x nos. Wht is th mximum numr of gs
More informationExam 1 Solution. CS 542 Advanced Data Structures and Algorithms 2/14/2013
CS Avn Dt Struturs n Algorithms Exm Solution Jon Turnr //. ( points) Suppos you r givn grph G=(V,E) with g wights w() n minimum spnning tr T o G. Now, suppos nw g {u,v} is to G. Dsri (in wors) mtho or
More informationAn undirected graph G = (V, E) V a set of vertices E a set of unordered edges (v,w) where v, w in V
Unirt Grphs An unirt grph G = (V, E) V st o vrtis E st o unorr gs (v,w) whr v, w in V USE: to mol symmtri rltionships twn ntitis vrtis v n w r jnt i thr is n g (v,w) [or (w,v)] th g (v,w) is inint upon
More informationb. How many ternary words of length 23 with eight 0 s, nine 1 s and six 2 s?
MATH 3012 Finl Exm, My 4, 2006, WTT Stunt Nm n ID Numr 1. All our prts o this prolm r onrn with trnry strings o lngth n, i.., wors o lngth n with lttrs rom th lpht {0, 1, 2}.. How mny trnry wors o lngth
More informationPaths, cycles and flows in graphs
Chptr 6 Pth, yl n flow in grph Suppo you wnt to fin hortt pth from givn trting point to givn tintion. Thi i ommon nrio in rivr itn ytm (GPS) n n mol on of th mot i omintoril optimiztion prolm, th hortt
More informationMath 61 : Discrete Structures Final Exam Instructor: Ciprian Manolescu. You have 180 minutes.
Nm: UCA ID Numr: Stion lttr: th 61 : Disrt Struturs Finl Exm Instrutor: Ciprin nolsu You hv 180 minuts. No ooks, nots or lultors r llow. Do not us your own srth ppr. 1. (2 points h) Tru/Fls: Cirl th right
More informationOutline. 1 Introduction. 2 Min-Cost Spanning Trees. 4 Example
Outlin Computr Sin 33 Computtion o Minimum-Cost Spnnin Trs Prim's Alorithm Introution Mik Joson Dprtmnt o Computr Sin Univrsity o Clry Ltur #33 3 Alorithm Gnrl Constrution Mik Joson (Univrsity o Clry)
More informationAlgorithmic and NP-Completeness Aspects of a Total Lict Domination Number of a Graph
Intrntionl J.Mth. Comin. Vol.1(2014), 80-86 Algorithmi n NP-Compltnss Aspts of Totl Lit Domintion Numr of Grph Girish.V.R. (PES Institut of Thnology(South Cmpus), Bnglor, Krntk Stt, Ini) P.Ush (Dprtmnt
More informationCS 461, Lecture 17. Today s Outline. Example Run
Prim s Algorithm CS 461, Ltur 17 Jr Si Univrsity o Nw Mxio In Prim s lgorithm, th st A mintin y th lgorithm orms singl tr. Th tr strts rom n ritrry root vrtx n grows until it spns ll th vrtis in V At h
More informationPaths. Connectivity. Euler and Hamilton Paths. Planar graphs.
Pths.. Eulr n Hmilton Pths.. Pth D. A pth rom s to t is squn o gs {x 0, x 1 }, {x 1, x 2 },... {x n 1, x n }, whr x 0 = s, n x n = t. D. Th lngth o pth is th numr o gs in it. {, } {, } {, } {, } {, } {,
More informationCS200: Graphs. Graphs. Directed Graphs. Graphs/Networks Around Us. What can this represent? Sometimes we want to represent directionality:
CS2: Grphs Prihr Ch. 4 Rosn Ch. Grphs A olltion of nos n gs Wht n this rprsnt? n A omputr ntwork n Astrtion of mp n Soil ntwork CS2 - Hsh Tls 2 Dirt Grphs Grphs/Ntworks Aroun Us A olltion of nos n irt
More informationCS 241 Analysis of Algorithms
CS 241 Anlysis o Algorithms Prossor Eri Aron Ltur T Th 9:00m Ltur Mting Lotion: OLB 205 Businss HW6 u lry HW7 out tr Thnksgiving Ring: Ch. 22.1-22.3 1 Grphs (S S. B.4) Grphs ommonly rprsnt onntions mong
More informationOutline. Computer Science 331. Computation of Min-Cost Spanning Trees. Costs of Spanning Trees in Weighted Graphs
Outlin Computr Sin 33 Computtion o Minimum-Cost Spnnin Trs Prim s Mik Joson Dprtmnt o Computr Sin Univrsity o Clry Ltur #34 Introution Min-Cost Spnnin Trs 3 Gnrl Constrution 4 5 Trmintion n Eiiny 6 Aitionl
More informationMinimum Spanning Trees
Minimum Spnning Trs Minimum Spnning Trs Problm A town hs st of houss nd st of rods A rod conncts nd only houss A rod conncting houss u nd v hs rpir cost w(u, v) Gol: Rpir nough (nd no mor) rods such tht:
More informationGraph Isomorphism. Graphs - II. Cayley s Formula. Planar Graphs. Outline. Is K 5 planar? The number of labeled trees on n nodes is n n-2
Grt Thortil Is In Computr Sin Vitor Amhik CS 15-251 Ltur 9 Grphs - II Crngi Mllon Univrsity Grph Isomorphism finition. Two simpl grphs G n H r isomorphi G H if thr is vrtx ijtion V H ->V G tht prsrvs jny
More informationGarnir Polynomial and their Properties
Univrsity of Cliforni, Dvis Dprtmnt of Mthmtis Grnir Polynomil n thir Proprtis Author: Yu Wng Suprvisor: Prof. Gorsky Eugny My 8, 07 Grnir Polynomil n thir Proprtis Yu Wng mil: uywng@uvis.u. In this ppr,
More informationCS61B Lecture #33. Administrivia: Autograder will run this evening. Today s Readings: Graph Structures: DSIJ, Chapter 12
Aministrivi: CS61B Ltur #33 Autogrr will run this vning. Toy s Rings: Grph Struturs: DSIJ, Chptr 12 Lst moifi: W Nov 8 00:39:28 2017 CS61B: Ltur #33 1 Why Grphs? For xprssing non-hirrhilly rlt itms Exmpls:
More information12/3/12. Outline. Part 10. Graphs. Circuits. Euler paths/circuits. Euler s bridge problem (Bridges of Konigsberg Problem)
12/3/12 Outlin Prt 10. Grphs CS 200 Algorithms n Dt Struturs Introution Trminology Implmnting Grphs Grph Trvrsls Topologil Sorting Shortst Pths Spnning Trs Minimum Spnning Trs Ciruits 1 Ciruits Cyl 2 Eulr
More information5/9/13. Part 10. Graphs. Outline. Circuits. Introduction Terminology Implementing Graphs
Prt 10. Grphs CS 200 Algorithms n Dt Struturs 1 Introution Trminology Implmnting Grphs Outlin Grph Trvrsls Topologil Sorting Shortst Pths Spnning Trs Minimum Spnning Trs Ciruits 2 Ciruits Cyl A spil yl
More informationGraphs. CSC 1300 Discrete Structures Villanova University. Villanova CSC Dr Papalaskari
Grphs CSC 1300 Disrt Struturs Villnov Univrsity Grphs Grphs r isrt struturs onsis?ng of vr?s n gs tht onnt ths vr?s. Grphs n us to mol: omputr systms/ntworks mthm?l rl?ons logi iruit lyout jos/prosss f
More informationWhy the Junction Tree Algorithm? The Junction Tree Algorithm. Clique Potential Representation. Overview. Chris Williams 1.
Why th Juntion Tr lgorithm? Th Juntion Tr lgorithm hris Willims 1 Shool of Informtis, Univrsity of Einurgh Otor 2009 Th JT is gnrl-purpos lgorithm for omputing (onitionl) mrginls on grphs. It os this y
More informationOutline. Circuits. Euler paths/circuits 4/25/12. Part 10. Graphs. Euler s bridge problem (Bridges of Konigsberg Problem)
4/25/12 Outlin Prt 10. Grphs CS 200 Algorithms n Dt Struturs Introution Trminology Implmnting Grphs Grph Trvrsls Topologil Sorting Shortst Pths Spnning Trs Minimum Spnning Trs Ciruits 1 2 Eulr s rig prolm
More informationGraphs. Graphs. Graphs: Basic Terminology. Directed Graphs. Dr Papalaskari 1
CSC 00 Disrt Struturs : Introuon to Grph Thory Grphs Grphs CSC 00 Disrt Struturs Villnov Univrsity Grphs r isrt struturs onsisng o vrs n gs tht onnt ths vrs. Grphs n us to mol: omputr systms/ntworks mthml
More informationSection 10.4 Connectivity (up to paths and isomorphism, not including)
Toy w will isuss two stions: Stion 10.3 Rprsnting Grphs n Grph Isomorphism Stion 10.4 Conntivity (up to pths n isomorphism, not inluing) 1 10.3 Rprsnting Grphs n Grph Isomorphism Whn w r working on n lgorithm
More informationModule graph.py. 1 Introduction. 2 Graph basics. 3 Module graph.py. 3.1 Objects. CS 231 Naomi Nishimura
Moul grph.py CS 231 Nomi Nishimur 1 Introution Just lik th Python list n th Python itionry provi wys of storing, ssing, n moifying t, grph n viw s wy of storing, ssing, n moifying t. Bus Python os not
More information5/7/13. Part 10. Graphs. Theorem Theorem Graphs Describing Precedence. Outline. Theorem 10-1: The Handshaking Theorem
Thorm 10-1: Th Hnshkin Thorm Lt G=(V,E) n unirt rph. Thn Prt 10. Grphs CS 200 Alorithms n Dt Struturs v V (v) = 2 E How mny s r thr in rph with 10 vrtis h of r six? 10 * 6 /2= 30 1 Thorm 10-2 An unirt
More informationProblem solving by search
Prolm solving y srh Tomáš voo Dprtmnt o Cyrntis, Vision or Roots n Autonomous ystms Mrh 5, 208 / 3 Outlin rh prolm. tt sp grphs. rh trs. trtgis, whih tr rnhs to hoos? trtgy/algorithm proprtis? Progrmming
More informationQUESTIONS BEGIN HERE!
Points miss: Stunt's Nm: Totl sor: /100 points Est Tnnss Stt Univrsity Dprtmnt of Computr n Informtion Sins CSCI 710 (Trnoff) Disrt Struturs TEST for Fll Smstr, 00 R this for strtin! This tst is los ook
More informationAnnouncements. Not graphs. These are Graphs. Applications of Graphs. Graph Definitions. Graphs & Graph Algorithms. A6 released today: Risk
Grphs & Grph Algorithms Ltur CS Spring 6 Announmnts A6 rls toy: Risk Strt signing with your prtnr sp Prlim usy Not grphs hs r Grphs K 5 K, =...not th kin w mn, nywy Applitions o Grphs Communition ntworks
More informationA Simple Code Generator. Code generation Algorithm. Register and Address Descriptors. Example 3/31/2008. Code Generation
A Simpl Co Gnrtor Co Gnrtion Chptr 8 II Gnrt o for singl si lok How to us rgistrs? In most mhin rhitturs, som or ll of th oprnsmust in rgistrs Rgistrs mk goo tmporris Hol vlus tht r omput in on si lok
More informationThe University of Sydney MATH2969/2069. Graph Theory Tutorial 5 (Week 12) Solutions 2008
Th Univrsity o Syny MATH2969/2069 Grph Thory Tutoril 5 (Wk 12) Solutions 2008 1. (i) Lt G th isonnt plnr grph shown. Drw its ul G, n th ul o th ul (G ). (ii) Show tht i G is isonnt plnr grph, thn G is
More informationNumbering Boundary Nodes
Numring Bounry Nos Lh MBri Empori Stt Univrsity August 10, 2001 1 Introution Th purpos of this ppr is to xplor how numring ltril rsistor ntworks ffts thir rspons mtrix, Λ. Morovr, wht n lrn from Λ out
More informationJonathan Turner Exam 2-10/28/03
CS Algorihm n Progrm Prolm Exm Soluion S Soluion Jonhn Turnr Exm //. ( poin) In h Fioni hp ruur, u wn vrx u n i prn v u ing u v i v h lry lo hil in i l m hil o om ohr vrx. Suppo w hng hi, o h ing u i prorm
More informationCSE 373: AVL trees. Warmup: Warmup. Interlude: Exploring the balance invariant. AVL Trees: Invariants. AVL tree invariants review
rmup CSE 7: AVL trs rmup: ht is n invrint? Mihl L Friy, Jn 9, 0 ht r th AVL tr invrints, xtly? Disuss with your nighor. AVL Trs: Invrints Intrlu: Exploring th ln invrint Cor i: xtr invrint to BSTs tht
More informationPlanar Upward Drawings
C.S. 252 Pro. Rorto Tmssi Computtionl Gomtry Sm. II, 1992 1993 Dt: My 3, 1993 Sri: Shmsi Moussvi Plnr Upwr Drwings 1 Thorm: G is yli i n only i it hs upwr rwing. Proo: 1. An upwr rwing is yli. Follow th
More information12. Traffic engineering
lt2.ppt S-38. Introution to Tltrffi Thory Spring 200 2 Topology Pths A tlommunition ntwork onsists of nos n links Lt N not th st of nos in with n Lt J not th st of nos in with j N = {,,,,} J = {,2,3,,2}
More informationSimilarity Search. The Binary Branch Distance. Nikolaus Augsten.
Similrity Srh Th Binry Brnh Distn Nikolus Augstn nikolus.ugstn@sg..t Dpt. of Computr Sins Univrsity of Slzurg http://rsrh.uni-slzurg.t Vrsion Jnury 11, 2017 Wintrsmstr 2016/2017 Augstn (Univ. Slzurg) Similrity
More informationPage 1. Question 19.1b Electric Charge II Question 19.2a Conductors I. ConcepTest Clicker Questions Chapter 19. Physics, 4 th Edition James S.
ConTst Clikr ustions Chtr 19 Physis, 4 th Eition Jms S. Wlkr ustion 19.1 Two hrg blls r rlling h othr s thy hng from th iling. Wht n you sy bout thir hrgs? Eltri Chrg I on is ositiv, th othr is ngtiv both
More information(a) v 1. v a. v i. v s. (b)
Outlin RETIMING Struturl optimiztion mthods. Gionni D Mihli Stnford Unirsity Rtiming. { Modling. { Rtiming for minimum dly. { Rtiming for minimum r. Synhronous Logi Ntwork Synhronous Logi Ntwork Synhronous
More information0.1. Exercise 1: the distances between four points in a graph
Mth 707 Spring 2017 (Drij Grinrg): mitrm 3 pg 1 Mth 707 Spring 2017 (Drij Grinrg): mitrm 3 u: W, 3 My 2017, in lss or y mil (grinr@umn.u) or lss S th wsit or rlvnt mtril. Rsults provn in th nots, or in
More informationCycles and Simple Cycles. Paths and Simple Paths. Trees. Problem: There is No Completely Standard Terminology!
Outlin Computr Sin 331, Spnnin, n Surphs Mik Joson Dprtmnt o Computr Sin Univrsity o Clry Ltur #30 1 Introution 2 3 Dinition 4 Spnnin 5 6 Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 1 / 20 Mik
More information(2) If we multiplied a row of B by λ, then the value is also multiplied by λ(here lambda could be 0). namely
. DETERMINANT.. Dtrminnt. Introution:I you think row vtor o mtrix s oorint o vtors in sp, thn th gomtri mning o th rnk o th mtrix is th imnsion o th prlllppi spnn y thm. But w r not only r out th imnsion,
More informationCOMPLEXITY OF COUNTING PLANAR TILINGS BY TWO BARS
OMPLXITY O OUNTING PLNR TILINGS Y TWO RS KYL MYR strt. W show tht th prolm o trmining th numr o wys o tiling plnr igur with horizontl n vrtil r is #P-omplt. W uil o o th rsults o uquir, Nivt, Rmil, n Roson
More informationSolutions for HW11. Exercise 34. (a) Use the recurrence relation t(g) = t(g e) + t(g/e) to count the number of spanning trees of v 1
Solutions for HW Exris. () Us th rurrn rltion t(g) = t(g ) + t(g/) to ount th numr of spnning trs of v v v u u u Rmmr to kp multipl gs!! First rrw G so tht non of th gs ross: v u v Rursing on = (v, u ):
More informationS i m p l i f y i n g A l g e b r a SIMPLIFYING ALGEBRA.
S i m p l i y i n g A l g r SIMPLIFYING ALGEBRA www.mthltis.o.nz Simpliying SIMPLIFYING Algr ALGEBRA Algr is mthmtis with mor thn just numrs. Numrs hv ix vlu, ut lgr introus vrils whos vlus n hng. Ths
More informationCS September 2018
Loil los Distriut Systms 06. Loil los Assin squn numrs to msss All ooprtin prosss n r on orr o vnts vs. physil los: rport tim o y Assum no ntrl tim sour Eh systm mintins its own lol lo No totl orrin o
More informationChapter 18. Minimum Spanning Trees Minimum Spanning Trees. a d. a d. a d. f c
Chptr 8 Minimum Spnning Trs In this hptr w ovr importnt grph prolm, Minimum Spnning Trs (MST). Th MST o n unirt, wight grph is tr tht spns th grph whil minimizing th totl wight o th gs in th tr. W irst
More informationNP-Completeness. CS3230 (Algorithm) Traveling Salesperson Problem. What s the Big Deal? Given a Problem. What s the Big Deal? What s the Big Deal?
NP-Compltnss 1. Polynomil tim lgorithm 2. Polynomil tim rution 3.P vs NP 4.NP-ompltnss (som slis y P.T. Um Univrsity o Txs t Dlls r us) Trvling Slsprson Prolm Fin minimum lngth tour tht visits h ity on
More informationN=4 L=4. Our first non-linear data structure! A graph G consists of two sets G = {V, E} A set of V vertices, or nodes f
lulu jwtt pnlton sin towr ounrs hpl lpp lu Our irst non-linr t strutur! rph G onsists o two sts G = {V, E} st o V vrtis, or nos st o E s, rltionships twn nos surph G onsists o sust o th vrtis n s o G jnt
More informationThe Cost Optimal Solution of the Multi-Constrained Multicast Routing Problem
Pulition Intrn l IRISA ISSN : 2102-6327 PI 1957 Otor 2010 Th Cot Optiml Solution of th Multi-Contrin Multit Routing Prolm Mikló Molnár *, Ali Bll **, Smr Lhou *** miklo.molnr@lirmm.fr, li.ll@iri.fr, mr.lhou@iri.fr
More informationCSE303 - Introduction to the Theory of Computing Sample Solutions for Exercises on Finite Automata
CSE303 - Introduction to th Thory of Computing Smpl Solutions for Exrciss on Finit Automt Exrcis 2.1.1 A dtrministic finit utomton M ccpts th mpty string (i.., L(M)) if nd only if its initil stt is finl
More informationAnnouncements. These are Graphs. This is not a Graph. Graph Definitions. Applications of Graphs. Graphs & Graph Algorithms
Grphs & Grph Algorithms Ltur CS Fll 5 Announmnts Upoming tlk h Mny Crrs o Computr Sintist Or how Computr Sin gr mpowrs you to o muh mor thn o Dn Huttnlohr, Prossor in th Dprtmnt o Computr Sin n Johnson
More informationCSI35 Chapter 11 Review
1. Which of th grphs r trs? c f c g f c x y f z p q r 1 1. Which of th grphs r trs? c f c g f c x y f z p q r . Answr th qustions out th following tr 1) Which vrtx is th root of c th tr? ) wht is th hight
More informationFSA. CmSc 365 Theory of Computation. Finite State Automata and Regular Expressions (Chapter 2, Section 2.3) ALPHABET operations: U, concatenation, *
CmSc 365 Thory of Computtion Finit Stt Automt nd Rgulr Exprssions (Chptr 2, Sction 2.3) ALPHABET oprtions: U, conctntion, * otin otin Strings Form Rgulr xprssions dscri Closd undr U, conctntion nd * (if
More information1 Introduction to Modulo 7 Arithmetic
1 Introution to Moulo 7 Arithmti Bor w try our hn t solvin som hr Moulr KnKns, lt s tk los look t on moulr rithmti, mo 7 rithmti. You ll s in this sminr tht rithmti moulo prim is quit irnt rom th ons w
More informationTOPIC 5: INTEGRATION
TOPIC 5: INTEGRATION. Th indfinit intgrl In mny rspcts, th oprtion of intgrtion tht w r studying hr is th invrs oprtion of drivtion. Dfinition.. Th function F is n ntidrivtiv (or primitiv) of th function
More informationRegister Allocation. Register Allocation. Principle Phases. Principle Phases. Example: Build. Spills 11/14/2012
Rgistr Allotion W now r l to o rgistr llotion on our intrfrn grph. W wnt to l with two typs of onstrints: 1. Two vlus r liv t ovrlpping points (intrfrn grph) 2. A vlu must or must not in prtiulr rhitturl
More informationGreedy Algorithms, Activity Selection, Minimum Spanning Trees Scribes: Logan Short (2015), Virginia Date: May 18, 2016
Ltur 4 Gry Algorithms, Ativity Sltion, Minimum Spnning Trs Sris: Logn Short (5), Virgini Dt: My, Gry Algorithms Suppos w wnt to solv prolm, n w r l to om up with som rursiv ormultion o th prolm tht woul
More informationDUET WITH DIAMONDS COLOR SHIFTING BRACELET By Leslie Rogalski
Dut with Dimons Brlt DUET WITH DIAMONDS COLOR SHIFTING BRACELET By Lsli Roglski Photo y Anrw Wirth Supruo DUETS TM from BSmith rt olor shifting fft tht mks your work tk on lif of its own s you mov! This
More informationWeighted Matching and Linear Programming
Wightd Mtching nd Linr Progrmming Jonthn Turnr Mrch 19, 01 W v sn tht mximum siz mtchings cn b found in gnrl grphs using ugmnting pths. In principl, this sm pproch cn b pplid to mximum wight mtchings.
More informationINTEGRALS. Chapter 7. d dx. 7.1 Overview Let d dx F (x) = f (x). Then, we write f ( x)
Chptr 7 INTEGRALS 7. Ovrviw 7.. Lt d d F () f (). Thn, w writ f ( ) d F () + C. Ths intgrls r clld indfinit intgrls or gnrl intgrls, C is clld constnt of intgrtion. All ths intgrls diffr y constnt. 7..
More informationConstructive Geometric Constraint Solving
Construtiv Gomtri Constrint Solving Antoni Soto i Rir Dprtmnt Llngutgs i Sistms Inormàtis Univrsitt Politèni Ctluny Brlon, Sptmr 2002 CGCS p.1/37 Prliminris CGCS p.2/37 Gomtri onstrint prolm C 2 D L BC
More informationIntegration Continued. Integration by Parts Solving Definite Integrals: Area Under a Curve Improper Integrals
Intgrtion Continud Intgrtion y Prts Solving Dinit Intgrls: Ar Undr Curv Impropr Intgrls Intgrtion y Prts Prticulrly usul whn you r trying to tk th intgrl o som unction tht is th product o n lgric prssion
More informationECE COMBINATIONAL BUILDING BLOCKS - INVEST 13 DECODERS AND ENCODERS
C 24 - COMBINATIONAL BUILDING BLOCKS - INVST 3 DCODS AND NCODS FALL 23 AP FLZ To o "wll" on this invstition you must not only t th riht nswrs ut must lso o nt, omplt n onis writups tht mk ovious wht h
More informationUsing the Printable Sticker Function. Using the Edit Screen. Computer. Tablet. ScanNCutCanvas
SnNCutCnvs Using th Printl Stikr Funtion On-o--kin stikrs n sily rt y using your inkjt printr n th Dirt Cut untion o th SnNCut mhin. For inormtion on si oprtions o th SnNCutCnvs, rr to th Hlp. To viw th
More informationScientific Programming. Graphs
Sintifi Progrmming Grphs Alrto Montrsor Univrsità i Trnto 08//07 This work is lins unr Crtiv Commons Attriution-ShrAlik 4.0 Intrntionl Lins. Tl of ontnts Introution Exmpls Dfinitions Spifition Rprsnttions
More information16.unified Introduction to Computers and Programming. SOLUTIONS to Examination 4/30/04 9:05am - 10:00am
16.unii Introution to Computrs n Prormmin SOLUTIONS to Exmintion /30/0 9:05m - 10:00m Pro. I. Kristin Lunqvist Sprin 00 Grin Stion: Qustion 1 (5) Qustion (15) Qustion 3 (10) Qustion (35) Qustion 5 (10)
More informationGraph Search (6A) Young Won Lim 5/18/18
Grp Sr (6A) Youn Won Lm Copyrt () 2015 2018 Youn W. Lm. Prmon rnt to opy, trut n/or moy t oumnt unr t trm o t GNU Fr Doumntton Ln, Vron 1.2 or ny ltr vron pul y t Fr Sotwr Founton; wt no Invrnt Ston, no
More informationGREEDY TECHNIQUE. Greedy method vs. Dynamic programming method:
Dinition: GREEDY TECHNIQUE Gry thniqu is gnrl lgorithm sign strtgy, uilt on ollowing lmnts: onigurtions: irnt hois, vlus to in ojtiv untion: som onigurtions to ithr mximiz or minimiz Th mtho: Applil to
More informationMULTIPLE-LEVEL LOGIC OPTIMIZATION II
MUTIPE-EVE OGIC OPTIMIZATION II Booln mthos Eploit Booln proprtis Giovnni D Mihli Don t r onitions Stnfor Univrsit Minimition of th lol funtions Slowr lgorithms, ttr qulit rsults Etrnl on t r onitions
More informationConstruction 11: Book I, Proposition 42
Th Visul Construtions of Euli Constrution #11 73 Constrution 11: Book I, Proposition 42 To onstrut, in givn rtilinl ngl, prlllogrm qul to givn tringl. Not: Equl hr mns qul in r. 74 Constrution # 11 Th
More informationECE 407 Computer Aided Design for Electronic Systems. Circuit Modeling and Basic Graph Concepts/Algorithms. Instructor: Maria K. Michael.
0 Computr i Dsign or Eltroni Systms Ciruit Moling n si Grph Conptslgorithms Instrutor: Mri K. Mihl MKM - Ovrviw hviorl vs. Struturl mols Extrnl vs. Intrnl rprsnttions Funtionl moling t Logi lvl Struturl
More informationWeighted Graphs. Weighted graphs may be either directed or undirected.
1 In mny ppltons, o rp s n ssot numrl vlu, ll wt. Usully, t wts r nonntv ntrs. Wt rps my tr rt or unrt. T wt o n s otn rrr to s t "ost" o t. In ppltons, t wt my msur o t lnt o rout, t pty o ln, t nry rqur
More informationChapter 16. 1) is a particular point on the graph of the function. 1. y, where x y 1
Prctic qustions W now tht th prmtr p is dirctl rltd to th mplitud; thrfor, w cn find tht p. cos d [ sin ] sin sin Not: Evn though ou might not now how to find th prmtr in prt, it is lws dvisl to procd
More informationSolutions to Homework 5
Solutions to Homwork 5 Pro. Silvia Frnánz Disrt Mathmatis Math 53A, Fall 2008. [3.4 #] (a) Thr ar x olor hois or vrtx an x or ah o th othr thr vrtis. So th hromati polynomial is P (G, x) =x (x ) 3. ()
More informationMCQ For Geometry. Similarity
MQ For Gomtry Similrity. E F EA FB AE A EB B t G ) ) ) In right ngl tringl, if BD A thn BD AD D n Th ro of r of two imilr tringl i l to r of th ro of thir orrpg i. A ( ) B A A ( ) Q P l Propr of imilr
More informationMore Foundations. Undirected Graphs. Degree. A Theorem. Graphs, Products, & Relations
Mr Funtins Grphs, Pruts, & Rltins Unirt Grphs An unirt grph is pir f 1. A st f ns 2. A st f gs (whr n g is st f tw ns*) Friy, Sptmr 2, 2011 Ring: Sipsr 0.2 ginning f 0.4; Stughtn 1.1.5 ({,,,,}, {{,}, {,},
More informationFundamental Algorithms for System Modeling, Analysis, and Optimization
Fundmntl Algorithms for Sstm Modling, Anlsis, nd Optimiztion Edwrd A. L, Jijt Rohowdhur, Snjit A. Sshi UC Brkl EECS 144/244 Fll 2011 Copright 2010-11, E. A. L, J. Rohowdhur, S. A. Sshi, All rights rsrvd
More informationSection 3: Antiderivatives of Formulas
Chptr Th Intgrl Appli Clculus 96 Sction : Antirivtivs of Formuls Now w cn put th is of rs n ntirivtivs togthr to gt wy of vluting finit intgrls tht is ct n oftn sy. To vlut finit intgrl f(t) t, w cn fin
More informationLecture 20: Minimum Spanning Trees (CLRS 23)
Ltur 0: Mnmum Spnnn Trs (CLRS 3) Jun, 00 Grps Lst tm w n (wt) rps (unrt/rt) n ntrou s rp voulry (vrtx,, r, pt, onnt omponnts,... ) W lso suss jny lst n jny mtrx rprsntton W wll us jny lst rprsntton unlss
More information13. Binary tree, height 4, eight terminal vertices 14. Full binary tree, seven vertices v 7 v13. v 19
0. Spnning Trs n Shortst Pths 0. Consir th tr shown blow with root v 0.. Wht is th lvl of v 8? b. Wht is th lvl of v 0? c. Wht is th hight of this root tr?. Wht r th chilrn of v 0?. Wht is th prnt of v
More informationCoalitional Manipulation for Schulze s Rule
Colitionl Mnipultion for Shulz s Rul Srg Gsprs UNSW n NICTA Syny, Austrli srgg@s.unsw.u.u Thoms Klinowski Univrsity of Rostok Rostok, Grmny thoms.klinowski@unirostok. Toy Wlsh NICTA n UNSW Syny, Austrli
More informationDominator Tree Certification and Independent Spanning Trees
Domintor Tr Crtiition n Inpnnt Spnnin Tr Louk Gorii 1 Rort E. Trjn 2 rxiv:1210.8303v3 [.DS] 7 Mr 2013 Otor 29, 2018 Atrt How o on vriy tht th output o omplit prorm i orrt? On n ormlly prov tht th prorm
More informationO n t h e e x t e n s i o n o f a p a r t i a l m e t r i c t o a t r e e m e t r i c
O n t h x t n s i o n o f p r t i l m t r i t o t r m t r i Alin Guénoh, Bruno Llr 2, Vlimir Mkrnkov 3 Institut Mthémtiqus Luminy, 63 vnu Luminy, F-3009 MARSEILLE, FRANCE, gunoh@iml.univ-mrs.fr 2 Cntr
More informationCS 103 BFS Alorithm. Mark Redekopp
CS 3 BFS Aloritm Mrk Rkopp Brt-First Sr (BFS) HIGHLIGHTED ALGORITHM 3 Pt Plnnin W'v sn BFS in t ontxt o inin t sortst pt trou mz? S?? 4 Pt Plnnin W xplor t 4 niors s on irtion 3 3 3 S 3 3 3 3 3 F I you
More informationBinomials and Pascal s Triangle
Binomils n Psl s Tringl Binomils n Psl s Tringl Curriulum R AC: 0, 0, 08 ACS: 00 www.mthltis.om Binomils n Psl s Tringl Bsis 0. Intif th prts of th polnomil: 8. (i) Th gr. Th gr is. (Sin is th highst
More information1 Finite Automata and Regular Expressions
1 Fini Auom nd Rgulr Exprion Moivion: Givn prn (rgulr xprion) for ring rching, w migh wn o convr i ino drminiic fini uomon or nondrminiic fini uomon o mk ring rching mor fficin; drminiic uomon only h o
More informationPolygons POLYGONS.
Polgons PLYGNS www.mthltis.o.uk ow os it work? Solutions Polgons Pg qustions Polgons Polgon Not polgon Polgon Not polgon Polgon Not polgon Polgon Not polgon f g h Polgon Not polgon Polgon Not polgon Polgon
More informationlearning objectives learn what graphs are in mathematical terms learn how to represent graphs in computers learn about typical graph algorithms
rp loritms lrnin ojtivs loritms your sotwr systm sotwr rwr lrn wt rps r in mtmtil trms lrn ow to rprsnt rps in omputrs lrn out typil rp loritms wy rps? intuitivly, rp is orm y vrtis n s twn vrtis rps r
More informationLast time: introduced our first computational model the DFA.
Lctur 7 Homwork #7: 2.2.1, 2.2.2, 2.2.3 (hnd in c nd d), Misc: Givn: M, NFA Prov: (q,xy) * (p,y) iff (q,x) * (p,) (follow proof don in clss tody) Lst tim: introducd our first computtionl modl th DFA. Tody
More informationThis chapter covers special properties of planar graphs.
Chptr 21 Plnr Grphs This hptr ovrs spil proprtis of plnr grphs. 21.1 Plnr grphs A plnr grph is grph whih n b rwn in th pln without ny gs rossing. Som piturs of plnr grph might hv rossing gs, but it s possibl
More informationWORKSHOP 6 BRIDGE TRUSS
WORKSHOP 6 BRIDGE TRUSS WS6-2 Workshop Ojtivs Lrn to msh lin gomtry to gnrt CBAR lmnts Bom fmilir with stting up th CBAR orinttion vtor n stion proprtis Lrn to st up multipl lo ss Lrn to viw th iffrnt
More information1. Determine whether or not the following binary relations are equivalence relations. Be sure to justify your answers.
Mth 0 Exm - Prti Prolm Solutions. Dtrmin whthr or not th ollowing inry rltions r quivln rltions. B sur to justiy your nswrs. () {(0,0),(0,),(0,),(,),(,),(,),(,),(,0),(,),(,),(,0),(,),(.)} on th st A =
More information