# 10/30/12. Today. CS/ENGRD 2110 Object- Oriented Programming and Data Structures Fall 2012 Doug James. DFS algorithm. Reachability Algorithms

Size: px
Start display at page:

Download "10/30/12. Today. CS/ENGRD 2110 Object- Oriented Programming and Data Structures Fall 2012 Doug James. DFS algorithm. Reachability Algorithms"

Transcription

1 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 Srh (DFS) Explor no y oin pr n pr into th rph. U k trkin to try irnt pth (u tk). Brth Firt Srh (BFS) Explor th no in n orrly mnnr. Look t th no tht r lot to th our. Thn look t thir nihor, t. (u quu) DFS lorithm Lt R th t o vrti rhl rom trtin no x. Lt S tk. DFS(vrtx x){ S.puh(x) whil (S i not mpty){ u =.pop() i (u i not in R) { put u into R or ll (u,v) in E { S.puh(v) // n whil Not: no n n up in th tk mor thn on. Ruriv DFS DFS (vrtx x){ put x into R or ll (x,y) in E i (y i not in R) DFS (y) BFS lorithm Lt R th t o vrti rhl rom trtin no x. Lt Q quu. BFS(vrtx x){ Q.nquu(x) whil (Q i not mpty){ u = Q.quu() i (u i not in R) { put u into R or ll (u,v) in E { Q.nquu(v) // n whil

2 0/0/ Shortt Pth in Grph Finin th hortt (min- ot) pth in rph i prolm tht our oln Bt liht rom Ith, NY to Dulor, Grmny? How loly r two popl onnt on Fook? Drivin irwon rom Ith, NY to Qun, NY? AI pth plnnin in roow Rult pn on our nowon o ot Numr o hop Lt mil Lt Wm Chpt Lt orin All o th ot n rprnt wiht How o w in hortt pth? Sinl Sour, Shortt Pth Prolm: Givn rph G=(V,E) omput th itn o h vrtx x rom our vrtx, whr itn i th lnth o th hortt pth. Unwiht Grph Wiht Grph it[] = 0; it[] = 0;. it[y] = it[x] +, it[y]= it[x]+w(x,y) whr (x,y) in E whr (x,y) in E Brut For Clim: Th hortt pth i impl pth. (i, no vrtx i rpt in th lit) Clim: Thr r only init numr o impl pth in ivn rph. Enumrt ll impl pth trtin t. For h trt vrtx t, ollt ll impl pth with trt t. Comput thir ot, trmin th min. B I Evn in n yli rph, th numr o impl pth my xponntil in n. Exri: trmin th numr o pth to t. Sinl Sour, Shortt Pth Unwiht rph: BFS Moii to kp trk o urrnt itn rom t

3 0/0/ Sinl Sour, Shortt Pth Sinl Sour, Shortt Pth BFS BFS Firt, viit ll no t itn Firt, viit ll no t itn Thn, itn Sinl Sour, Shortt Pth Sinl Sour, Shortt Pth BFS Firt, viit ll no t itn Thn, itn Thn, Not: w hv tully lult hortt pth rom to vry no in rph Not jut rom to In nrl, omputin hortt pth rom to vry othr no i jut xpniv omputin th hortt pth twn ny ivn pir o no BFS or hortt pth or h vrtx x it[x] = ininity; // will rprnt itn rom to x Q.nquu(); it[] = 0; whil ( Q.mpty()) x = Q.quu(); or ll (x,y) in E i (it[y] = ininity) it[y] = it[x] + ; Q.nquu(y); Clim: O(n + m) runtim Will DFS work in thi ontxt? Conir wiht rph whr ll wiht r qul. U th m BFS lorithm. Wht out rph with irnt wiht on?

4 0/0/ Brth- Firt Srh or Shortt Pth Unwiht Grph Input: trt no, WnWon no t Put trt no into quu n mrk viit. Whil quu not mpty Poll n o quu. FOR ll (unmrk) uor n o n IF n qul t THEN rturn pth Put n into quu Mrk n viit. Tim omplxity: O(m) Wm Why o BFS in Shortt Pth? Any no in itn i viit or ny no t hop, or ny no t itn hop, Whnvr no i t th top o th quu or th irt Wm, w mut hv ohn thr with th minimum numr o hop. How o w kp trk o th pth tht ot BFS thr? Stor pror no on pth or h no in rph. 8 Wiht E, Shortt Pth BFS lorithm i only rlvnt or unwiht rph Wht out wiht rph? SFO 7 LAX 86 6 DFW 80 ORD MIA JFK 96 8 BWI 87 BOS 090 PVD 8 Brth- Firt Srh or Shortt Pth Wiht Grph Input: trt no, WnWon no t Put trt (,0,null) into min- priority quu. IniWliz mpty iwonry pth. Whil quu not mpty Poll minimum lmnt (n,,prv) o quu. Mrk n on in pth y torin prv. IF n qul t THEN rturn pth IF n i not yt on FOR ll uor n o n tht r not on Put (n,+wiht(n,n ),n) into priority quu Tim omplxity: O(m lo m) Wm uin hp n jny lit Cn improv Gnrl Rul Prototyp Alorithm W mintin n rry it[x]: - initilly it[] = 0, it[x] = or ll othr vrti - t ny tim urin th lorithm, w tor th ot o rl pth rom to x in it[x] (ut not nrily th ot o th hortt pth, w my hv n ovrtimt). - (x,y) rquir ttntion i it[y] > it[x] + ot(x,y) Whn n rom x to y rquir ttntion w rlx it, uptin th timt or it[y]: it[y] = it[x] + ot(x,y) Thu w now hv ttr timt or th hortt pth rom to x. Thi prou prototyp lorithm: initiliz it[]; whil( om (x,y) rquir ttntion ) rlx (x,y);

5 0/0/ Dijktr' Alorithm Dijktr' Alorithm Th prolm i to hoo th riht to rlx. Dijktr' lorithm lwy pik th (x,y) uh tht it[x] i miniml ut work on h x only on. initiliz it[]; inrt ll v in V into PQ; // prioritiz y it whil( PQ not mpty ) x = PQ.ltMin(); orll (x,y) in E o i( (x,y) rquir ttntion ) rlx Dijktr' Alorithm Dijktr lorithm initiliz it[]; inrt ll v in V into PQ; // prioritiz y it whil( PQ not mpty ) x = PQ.ltMin(); orll (x,y) in E o i( it[y] > it[x] + ot[x,y] ) // rlx - upt our urrnt timt // o itn rom to y it[y] = it[x] + ot[x,y]; PQ.promot( y ); // Optionl: ror t pth to y w rom x Initiliztion. St it() = 0. For ll vrti v V, v, t it(v) =. Inrt ll vrti into priority quu P, uin itn th ky 0 P Dijktr lorithm Dijktr lorithm Pro Pro (D = 0) 0

6 0/0/ Dijktr lorithm Dijktr lorithm Pro (D = 0) (D = ) Pro (D = 0) (D = ) (D = ) 6 6 Dijktr lorithm Dijktr lorithm Pro (D = 0) (D = ) (D = ) (D = ) Pro (D = 0) (D = ) (D = ) (D = ) (D = ) Dijktr lorithm Dijktr Alorithm i ry Pro (D = 0) (D = ) (D = ) (D = ) (D = ) (D = 6) (D = 6) (D = ). Optimiztion prolm O th mny il olution, in th optiml (minimum or mximum) olution.. Cn only pro in t no irt olution vill. Gry-hoi proprty: A lolly optiml (ry) hoi will l to lolly optiml olution. Hr, th ltmin tp i th ry hoi Sinl our, hortt itn. Optiml utrutur: An optiml olution ontin within it optiml olution to uprolm 6

7 0/0/ Ftur o Dijktr Alorithm Eh vrtx i pro xtly on (whn it om th top o th priority quu) Eh i pro xtly on Ditn my rvi multipl tim: urrnt vlu rprnt t u on our orvtion o r On vrtx i pro w r urnt to hv oun th hortt pth to tht vrtx. why? Prormn (uin hp) Initiliztion: O(n) Viittion loop: n ll ltmin(): O(lo n) Eh i onir only on urin ntir xution, or totl o m upt o th priority quu, h O(lo n) Ovrll ot: O( (n+m) lo n ) Ai Hp i u unvnly: n lt-min ut m promot oprtion. Cn xploit y uin ttr t trutur (Fioni hp) to t runnin tim O(n lo n + m). Rprntin hortt pth W now hv n lorithm to omput th lnth o th hortt pth twn n x. But wht i w tully wnt to in th vrti on th hortt pth? Ft: i = 0,,..., n =x i th hortt pth rom to x, thn = 0,,..., n- i th hortt pth rom to n-. I: With h it(x), rmmr th prviou no prv(x) = n- in th hortt pth. Thouht Prolm: Ntiv Wiht Wht i th minimum ot itn twn n? Thouht Prolm: Ntiv Wiht Wht o w o whn thr r ntiv wiht? Othr i n lorithm my n

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

Dt Strutur LECTURE Shortt pth lgorithm Proprti of hortt pth Bllmn-For lgorithm Dijktr lgorithm Chptr in th txtook (pp ). Wight grph -- rminr A wight grph i grph in whih g hv wight (ot) w(v i, v j ) >.

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

CSE 373 Grphs 1: Conpts, Dpth/Brth-First Srh ring: Wiss Ch. 9 slis rt y Mrty Stpp http://www.s.wshington.u/373/ Univrsity o Wshington, ll rights rsrv. 1 Wht is grph? 56 Tokyo Sttl Soul 128 16 30 181 140

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

Outlin Computr Sin 33 Computtion o Minimum-Cost Spnnin Trs Prim's Alorithm Introution Mik Joson Dprtmnt o Computr Sin Univrsity o Clry Ltur #33 3 Alorithm Gnrl Constrution Mik Joson (Univrsity o Clry)

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

CSE 373: Mor on grphs; DFS n BFS Mihl L Wnsy, F 14, 2018 1 Wrmup Wrmup: Disuss with your nighor: Rmin your nighor: wht is simpl grph? Suppos w hv simpl, irt grph with x nos. Wht is th mximum numr of gs

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

Outlin Computr Sin 33 Computtion o Minimum-Cost Spnnin Trs Prim s Mik Joson Dprtmnt o Computr Sin Univrsity o Clry Ltur #34 Introution Min-Cost Spnnin Trs 3 Gnrl Constrution 4 5 Trmintion n Eiiny 6 Aitionl

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

Prim s Algorithm CS 461, Ltur 17 Jr Si Univrsity o Nw Mxio In Prim s lgorithm, th st A mintin y th lgorithm orms singl tr. Th tr strts rom n ritrry root vrtx n grows until it spns ll th vrtis in V At h

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

Introution Computr Sin & Enginring 423/823 Dsign n Anlysis of Algorithms Ltur 03 Elmntry Grph Algorithms (Chptr 22) Stphn Sott (Apt from Vinohnrn N. Vriym) I Grphs r strt t typs tht r pplil to numrous

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

Unirt Grphs An unirt grph G = (V, E) V st o vrtis E st o unorr gs (v,w) whr v, w in V USE: to mol symmtri rltionships twn ntitis vrtis v n w r jnt i thr is n g (v,w) [or (w,v)] th g (v,w) is inint upon

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

s s of s Computr Sin & Enginring 423/823 Dsign n Anlysis of Ltur 03 (Chptr 22) Stphn Sott (Apt from Vinohnrn N. Vriym) s of s s r strt t typs tht r pplil to numrous prolms Cn ptur ntitis, rltionships twn

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

CS Avn Dt Struturs n Algorithms Exm Solution Jon Turnr //. ( points) Suppos you r givn grph G=(V,E) with g wights w() n minimum spnning tr T o G. Now, suppos nw g {u,v} is to G. Dsri (in wors) mtho or

### Problem solving by search

Prolm solving y srh Tomáš voo Dprtmnt o Cyrntis, Vision or Roots n Autonomous ystms Mrh 5, 208 / 3 Outlin rh prolm. tt sp grphs. rh trs. trtgis, whih tr rnhs to hoos? trtgy/algorithm proprtis? Progrmming

### CS 241 Analysis of Algorithms

CS 241 Anlysis o Algorithms Prossor Eri Aron Ltur T Th 9:00m Ltur Mting Lotion: OLB 205 Businss HW6 u lry HW7 out tr Thnksgiving Ring: Ch. 22.1-22.3 1 Grphs (S S. B.4) Grphs ommonly rprsnt onntions mong

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

Thorm 10-1: Th Hnshkin Thorm Lt G=(V,E) n unirt rph. Thn Prt 10. Grphs CS 200 Alorithms n Dt Struturs v V (v) = 2 E How mny s r thr in rph with 10 vrtis h of r six? 10 * 6 /2= 30 1 Thorm 10-2 An unirt

### N=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

### 14 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

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

CSC 801- Dsign n Anlysis of Algorithms Ltur 11 Gry Thniqu Exmpl: Chng-Mking Prolm Givn unlimit mounts of oins of nomintions 1 > > m, giv hng for mount n with th lst numr of oins Exmpl: 1 = 25, 2 =10, =

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

Pths.. Eulr n Hmilton Pths.. Pth D. A pth rom s to t is squn o gs {x 0, x 1 }, {x 1, x 2 },... {x n 1, x n }, whr x 0 = s, n x n = t. D. Th lngth o pth is th numr o gs in it. {, } {, } {, } {, } {, } {,

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

Outlin Computr Sin 331, Spnnin, n Surphs Mik Joson Dprtmnt o Computr Sin Univrsity o Clry Ltur #30 1 Introution 2 3 Dinition 4 Spnnin 5 6 Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 1 / 20 Mik

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

Intrntionl J.Mth. Comin. Vol.1(2014), 80-86 Algorithmi n NP-Compltnss Aspts of Totl Lit Domintion Numr of Grph Girish.V.R. (PES Institut of Thnology(South Cmpus), Bnglor, Krntk Stt, Ini) P.Ush (Dprtmnt

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

Aministrivi: CS61B Ltur #33 Autogrr will run this vning. Toy s Rings: Grph Struturs: DSIJ, Chptr 12 Lst moifi: W Nov 8 00:39:28 2017 CS61B: Ltur #33 1 Why Grphs? For xprssing non-hirrhilly rlt itms Exmpls:

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

nrl tr T is init st o on or mor nos suh tht thr is on sint no r, ll th root o T, n th rminin nos r prtition into n isjoint susts T, T,, T n, h o whih is tr, n whos roots r, r,, r n, rsptivly, r hilrn o

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

Nm: UCA ID Numr: Stion lttr: th 61 : Disrt Struturs Finl Exm Instrutor: Ciprin nolsu You hv 180 minuts. No ooks, nots or lultors r llow. Do not us your own srth ppr. 1. (2 points h) Tru/Fls: Cirl th right

### COMP108 Algorithmic Foundations

Grdy mthods Prudn Wong http://www.s.liv..uk/~pwong/thing/omp108/01617 Coin Chng Prolm Suppos w hv 3 typs of oins 10p 0p 50p Minimum numr of oins to mk 0.8, 1.0, 1.? Grdy mthod Lrning outoms Undrstnd wht

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

MATH 3012 Finl Exm, My 4, 2006, WTT Stunt Nm n ID Numr 1. All our prts o this prolm r onrn with trnry strings o lngth n, i.., wors o lngth n with lttrs rom th lpht {0, 1, 2}.. How mny trnry wors o lngth

### CS September 2018

Loil los Distriut Systms 06. Loil los Assin squn numrs to msss All ooprtin prosss n r on orr o vnts vs. physil los: rport tim o y Assum no ntrl tim sour Eh systm mintins its own lol lo No totl orrin o

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

12/3/12 Outlin Prt 10. Grphs CS 200 Algorithms n Dt Struturs Introution Trminology Implmnting Grphs Grph Trvrsls Topologil Sorting Shortst Pths Spnning Trs Minimum Spnning Trs Ciruits 1 Ciruits Cyl 2 Eulr

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

Prt 10. Grphs CS 200 Algorithms n Dt Struturs 1 Introution Trminology Implmnting Grphs Outlin Grph Trvrsls Topologil Sorting Shortst Pths Spnning Trs Minimum Spnning Trs Ciruits 2 Ciruits Cyl A spil yl

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

### 1 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

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

Grphs & Grph Algorithms Ltur CS Spring 6 Announmnts A6 rls toy: Risk Strt signing with your prtnr sp Prlim usy Not grphs hs r Grphs K 5 K, =...not th kin w mn, nywy Applitions o Grphs Communition ntworks

### QUESTIONS BEGIN HERE!

Points miss: Stunt's Nm: Totl sor: /100 points Est Tnnss Stt Univrsity Dprtmnt of Computr n Informtion Sins CSCI 710 (Trnoff) Disrt Struturs TEST for Fll Smstr, 00 R this for strtin! This tst is los ook

### CMSC 451: Lecture 2 Graph Basics Thursday, Aug 31, 2017

Dv Mount CMSC 45: Ltur Grph Bsis Thursy, Au, 07 Rin: Chpt. in KT (Klinr n Tros) n Chpt. in DBV (Dsupt, Ppimitriou, n Vzirni). Som o our trminoloy irs rom our txt. Grphs n Dirphs: A rph G = (V, E) is strutur

### ECE COMBINATIONAL BUILDING BLOCKS - INVEST 13 DECODERS AND ENCODERS

C 24 - COMBINATIONAL BUILDING BLOCKS - INVST 3 DCODS AND NCODS FALL 23 AP FLZ To o "wll" on this invstition you must not only t th riht nswrs ut must lso o nt, omplt n onis writups tht mk ovious wht h

### learning 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

### Jonathan 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

### Planar Upward Drawings

C.S. 252 Pro. Rorto Tmssi Computtionl Gomtry Sm. II, 1992 1993 Dt: My 3, 1993 Sri: Shmsi Moussvi Plnr Upwr Drwings 1 Thorm: G is yli i n only i it hs upwr rwing. Proo: 1. An upwr rwing is yli. Follow th

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

4/25/12 Outlin Prt 10. Grphs CS 200 Algorithms n Dt Struturs Introution Trminology Implmnting Grphs Grph Trvrsls Topologil Sorting Shortst Pths Spnning Trs Minimum Spnning Trs Ciruits 1 2 Eulr s rig prolm

### QUESTIONS BEGIN HERE!

Points miss: Stunt's Nm: Totl sor: /100 points Est Tnnss Stt Univrsity Dprtmnt o Computr n Inormtion Sins CSCI 2710 (Trno) Disrt Struturs TEST or Sprin Smstr, 2005 R this or strtin! This tst is los ook

### Solutions 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 ):

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

CS2: Grphs Prihr Ch. 4 Rosn Ch. Grphs A olltion of nos n gs Wht n this rprsnt? n A omputr ntwork n Astrtion of mp n Soil ntwork CS2 - Hsh Tls 2 Dirt Grphs Grphs/Ntworks Aroun Us A olltion of nos n irt

### Graph Isomorphism. Graphs - II. Cayley s Formula. Planar Graphs. Outline. Is K 5 planar? The number of labeled trees on n nodes is n n-2

Grt Thortil Is In Computr Sin Vitor Amhik CS 15-251 Ltur 9 Grphs - II Crngi Mllon Univrsity Grph Isomorphism finition. Two simpl grphs G n H r isomorphi G H if thr is vrtx ijtion V H ->V G tht prsrvs jny

### Minimum Spanning Trees

Minimum Spnning Trs Minimum Spnning Trs Problm A town hs st of houss nd st of rods A rod conncts nd only houss A rod conncting houss u nd v hs rpir cost w(u, v) Gol: Rpir nough (nd no mor) rods such tht:

### Dominator 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

### Round 7: Graphs (part I)

Roun 7: Grphs (prt I) Tommi Junttil Alto Univrsity Shool o Sin Dprtmnt o Computr Sin CS-A40 Dt Struturs n Alorithms Autumn 207 Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn 207 / 55 Topis: Grphs

### (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,

### Grade 7/8 Math Circles March 4/5, Graph Theory I- Solutions

ulty o Mtmtis Wtrloo, Ontrio N ntr or ution in Mtmtis n omputin r / Mt irls Mr /, 0 rp Tory - Solutions * inits lln qustion. Tr t ollowin wlks on t rp low. or on, stt wtr it is pt? ow o you know? () n

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

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

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

### EE1000 Project 4 Digital Volt Meter

Ovrviw EE1000 Projt 4 Diitl Volt Mtr In this projt, w mk vi tht n msur volts in th rn o 0 to 4 Volts with on iit o ury. Th input is n nlo volt n th output is sinl 7-smnt iit tht tlls us wht tht input s

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

Mth 707 Spring 2017 (Drij Grinrg): mitrm 3 pg 1 Mth 707 Spring 2017 (Drij Grinrg): mitrm 3 u: W, 3 My 2017, in lss or y mil (grinr@umn.u) or lss S th wsit or rlvnt mtril. Rsults provn in th nots, or in

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

Why th Juntion Tr lgorithm? Th Juntion Tr lgorithm hris Willims 1 Shool of Informtis, Univrsity of Einurgh Otor 2009 Th JT is gnrl-purpos lgorithm for omputing (onitionl) mrginls on grphs. It os this y

### Integration 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

### Designing A Concrete Arch Bridge

This is th mous Shwnh ri in Switzrln, sin y Rort Millrt in 1933. It spns 37.4 mtrs (122 t) n ws sin usin th sm rphil mths tht will monstrt in this lsson. To pro with this lsson, lik on th Nxt utton hr

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

CSC 00 Disrt Struturs : Introuon to Grph Thory Grphs Grphs CSC 00 Disrt Struturs Villnov Univrsity Grphs r isrt struturs onsisng o vrs n gs tht onnt ths vrs. Grphs n us to mol: omputr systms/ntworks mthml

### Outline. Binary Tree

Outlin Similrity Srh Th Binry Brnh Distn Nikolus Austn nikolus.ustn@s..t Dpt. o Computr Sins Univrsity o Slzur http://rsrh.uni-slzur.t 1 Binry Brnh Distn Binry Rprsnttion o Tr Binry Brnhs Lowr Boun or

### Greedy 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

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

Moul grph.py CS 231 Nomi Nishimur 1 Introution Just lik th Python list n th Python itionry provi wys of storing, ssing, n moifying t, grph n viw s wy of storing, ssing, n moifying t. Bus Python os not

### ECE 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

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

A Simpl Co Gnrtor Co Gnrtion Chptr 8 II Gnrt o for singl si lok How to us rgistrs? In most mhin rhitturs, som or ll of th oprnsmust in rgistrs Rgistrs mk goo tmporris Hol vlus tht r omput in on si lok

### Organization. Dominators. Control-flow graphs 8/30/2010. Dominators, control-dependence. Dominator relation of CFGs

Orniztion Domintors, ontrol-pnn n SSA orm Domintor rltion o CFGs postomintor rltion Domintor tr Computin omintor rltion n tr Dtlow lorithm Lnur n Trjn lorithm Control-pnn rltion SSA orm Control-low rphs

### Multipoint Alternate Marking method for passive and hybrid performance monitoring

Multipoint Altrnt Mrkin mtho or pssiv n hyri prormn monitorin rt-iool-ippm-multipoint-lt-mrk-00 Pru, Jul 2017, IETF 99 Giuspp Fiool (Tlom Itli) Muro Coilio (Tlom Itli) Amo Spio (Politnio i Torino) Riro

### Lecture 20: Minimum Spanning Trees (CLRS 23)

Ltur 0: Mnmum Spnnn Trs (CLRS 3) Jun, 00 Grps Lst tm w n (wt) rps (unrt/rt) n ntrou s rp voulry (vrtx,, r, pt, onnt omponnts,... ) W lso suss jny lst n jny mtrx rprsntton W wll us jny lst rprsntton unlss

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

Th Univrsity o Syny MATH2969/2069 Grph Thory Tutoril 5 (Wk 12) Solutions 2008 1. (i) Lt G th isonnt plnr grph shown. Drw its ul G, n th ul o th ul (G ). (ii) Show tht i G is isonnt plnr grph, thn G is

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

Grphs CSC 1300 Disrt Struturs Villnov Univrsity Grphs Grphs r isrt struturs onsis?ng of vr?s n gs tht onnt ths vr?s. Grphs n us to mol: omputr systms/ntworks mthm?l rl?ons logi iruit lyout jos/prosss f

### Section 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

### Walk Like a Mathematician Learning Task:

Gori Dprtmnt of Euction Wlk Lik Mthmticin Lrnin Tsk: Mtrics llow us to prform mny usful mthmticl tsks which orinrily rquir lr numbr of computtions. Som typs of problms which cn b on fficintly with mtrics

### GREEDY 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

### Paths, 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

### Trees as operads. Lecture A formalism of trees

Ltur 2 rs s oprs In this ltur, w introu onvnint tgoris o trs tht will us or th inition o nroil sts. hs tgoris r gnrliztions o th simpliil tgory us to in simpliil sts. First w onsir th s o plnr trs n thn

### Decimals DECIMALS.

Dimls DECIMALS www.mthltis.o.uk ow os it work? Solutions Dimls P qustions Pl vlu o imls 0 000 00 000 0 000 00 0 000 00 0 000 00 0 000 tnths or 0 thousnths or 000 hunrths or 00 hunrths or 00 0 tn thousnths

### Section 3: Antiderivatives of Formulas

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

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

CMPS 2200 Fll 2017 Grps Crol Wnk Sls ourtsy o Crls Lsrson wt ns n tons y Crol Wnk 10/23/17 CMPS 2200 Intro. to Alortms 1 Grps Dnton. A rt rp (rp) G = (V, E) s n orr pr onsstn o st V o vrts (snulr: vrtx),

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

### Constructive Geometric Constraint Solving

Construtiv Gomtri Constrint Solving Antoni Soto i Rir Dprtmnt Llngutgs i Sistms Inormàtis Univrsitt Politèni Ctluny Brlon, Sptmr 2002 CGCS p.1/37 Prliminris CGCS p.2/37 Gomtri onstrint prolm C 2 D L BC

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

How os it work? Pl vlu o imls rprsnt prts o whol numr or ojt # 0 000 Tns o thousns # 000 # 00 Thousns Hunrs Tns Ons # 0 Diml point st iml pl: ' 0 # 0 on tnth n iml pl: ' 0 # 00 on hunrth r iml pl: ' 0

### Seven-Segment Display Driver

7-Smnt Disply Drivr, Ron s in 7-Smnt Disply Drivr, Ron s in Prolm 62. 00 0 0 00 0000 000 00 000 0 000 00 0 00 00 0 0 0 000 00 0 00 BCD Diits in inry Dsin Drivr Loi 4 inputs, 7 outputs 7 mps, h with 6 on

### 12. Traffic engineering

lt2.ppt S-38. Introution to Tltrffi Thory Spring 200 2 Topology Pths A tlommunition ntwork onsists of nos n links Lt N not th st of nos in with n Lt J not th st of nos in with j N = {,,,,} J = {,2,3,,2}

### 16.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)

### Complete Solutions for MATH 3012 Quiz 2, October 25, 2011, WTT

Complt Solutions or MATH 012 Quiz 2, Otor 25, 2011, WTT Not. T nswrs ivn r r mor omplt tn is xpt on n tul xm. It is intn tt t mor omprnsiv solutions prsnt r will vlul to stunts in stuyin or t inl xm. In

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

1 In mny ppltons, o rp s n ssot numrl vlu, ll wt. Usully, t wts r nonntv ntrs. Wt rps my tr rt or unrt. T wt o n s otn rrr to s t "ost" o t. In ppltons, t wt my msur o t lnt o rout, t pty o ln, t nry rqur

### Numbering 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

### Instructions for Section 1

Instructions for Sction 1 Choos th rspons tht is corrct for th qustion. A corrct nswr scors 1, n incorrct nswr scors 0. Mrks will not b dductd for incorrct nswrs. You should ttmpt vry qustion. No mrks

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

POW CSE 36: Dt Struturs Top #10 T Dynm (Equvln) Duo: Unon-y-Sz & Pt Comprsson Wk!! Luk MDowll Summr Qurtr 003 M! ZING Wt s Goo Mz? Mz Construton lortm Gvn: ollton o rooms V Conntons twn t rooms (ntlly

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

CSE303 - Introduction to th Thory of Computing Smpl Solutions for Exrciss on Finit Automt Exrcis 2.1.1 A dtrministic finit utomton M ccpts th mpty string (i.., L(M)) if nd only if its initil stt is finl

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

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

### Yehuda Lindell Bar-Ilan University

Wintr Shool on Sur Computtion n iiny Br-Iln Unirsity, Isrl 3//2-/2/2 Br Iln Unirsity Dpt. o Computr Sin Yhu Linll Br-Iln Unirsity Br Iln Unirsity Dpt. o Computr Sin Protool or nrl sur to-prty omputtion

### Graph Contraction and Connectivity

Chptr 17 Grph Contrtion n Conntivity So r w hv mostly ovr thniqus or solving prolms on grphs tht wr vlop in th ontxt o squntil lgorithms. Som o thm r sy to prllliz whil othrs r not. For xmpl, w sw tht

### Similarity 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

### TOPIC 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

### NP-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

### Garnir Polynomial and their Properties

Univrsity of Cliforni, Dvis Dprtmnt of Mthmtis Grnir Polynomil n thir Proprtis Author: Yu Wng Suprvisor: Prof. Gorsky Eugny My 8, 07 Grnir Polynomil n thir Proprtis Yu Wng mil: uywng@uvis.u. In this ppr,

### MAT3707. Tutorial letter 201/1/2017 DISCRETE MATHEMATICS: COMBINATORICS. Semester 1. Department of Mathematical Sciences MAT3707/201/1/2017

MAT3707/201/1/2017 Tutoril lttr 201/1/2017 DISCRETE MATHEMATICS: COMBINATORICS MAT3707 Smstr 1 Dprtmnt o Mtmtil Sins SOLUTIONS TO ASSIGNMENT 01 BARCODE Din tomorrow. univrsity o sout ri SOLUTIONS TO ASSIGNMENT

### (Minimum) Spanning Trees

(Mnmum) Spnnn Trs Spnnn trs Kruskl's lortm Novmr 23, 2017 Cn Hrn / Gory Tn 1 Spnnn trs Gvn G = V, E, spnnn tr o G s onnt surp o G wt xtly V 1 s mnml sust o s tt onnts ll t vrts o G G = Spnnn trs Novmr

### Graphs Depth First Search

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

### Minimum Spanning Trees (CLRS 23)

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

### The Shortest Path Problem Graph Algorithms - 3

Algorithm Deign nd Anli Vitor Admhik C - pring Leture Feb, Crnegie Mellon Univerit The hortet Pth Problem Grph Algorithm - The hortet Pth Problem Given poitivel weighted grph G with oure verte, find the

### The Z transform techniques

h Z trnfor tchniqu h Z trnfor h th rol in dicrt yt tht th Lplc trnfor h in nlyi of continuou yt. h Z trnfor i th principl nlyticl tool for ingl-loop dicrt-ti yt. h Z trnfor h Z trnfor i to dicrt-ti yt

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

rmup CSE 7: AVL trs rmup: ht is n invrint? Mihl L Friy, Jn 9, 0 ht r th AVL tr invrints, xtly? Disuss with your nighor. AVL Trs: Invrints Intrlu: Exploring th ln invrint Cor i: xtr invrint to BSTs tht