Algorithms. Algorithms 4.4 S HORTEST P ATHS. APIs shortest-paths properties. Dijkstra's algorithm edge-weighted DAGs negative weights

Size: px
Start display at page:

Download "Algorithms. Algorithms 4.4 S HORTEST P ATHS. APIs shortest-paths properties. Dijkstra's algorithm edge-weighted DAGs negative weights"

Transcription

1 Algorithm Shortet path in an edge-weighted digraph R OBERT S EDGEWICK K EVIN W AYNE Given an edge-weighted digraph, find the hortet path from to t. edge-weighted digraph ->. ->. ->7.7 -> >.28 ->.2 ->.8 ->2.2 7->. ->.2 2->7. ->2. ->.2 ->.8 ->.. S HORTEST P ATHS API hortet-path propertie Algorithm F O U R T H E D I T I O N R OBERT S EDGEWICK K EVIN W AYNE Dijktra' algorithm edge-weighted DAG negative weight hortet path from to ->2 2->7 7-> -> An edge-weighted digraph and a hortet path 2 Google map Shortet path application PERT/CPM. Map routing. Seam carving. Texture mapping. Robot navigation. Typeetting in TeX. Urban traffic planning. Optimal pipelining of VLSI chip. Telemarketer operator cheduling. Routing of telecommunication meage. Network routing protocol (OSPF, BGP, RIP). Exploiting arbitrage opportunitie in currency exchange. Optimal truck routing through given traffic congetion pattern. Reference: Network Flow: Theory, Algorithm, and Application, R. K. Ahuja, T. L. Magnanti, and J. B. Orlin, Prentice Hall,.

2 Shortet path variant Which vertice? Single ource: from one vertex to every other vertex. Single ink: from every vertex to one vertex t. Source-ink: from one vertex to another t. All pair: between all pair of vertice.. SHORTEST PATHS Retriction on edge weight? Nonnegative weight. Euclidean weight. Cycle? Arbitrary weight. No directed cycle. No "negative cycle." which variant? Algorithm ROBERT SEDGEWICK KEVIN WAYNE API hortet-path propertie Dijktra' algorithm edge-weighted DAG negative weight Simplifying aumption. Shortet path from to each vertex v exit. Weighted directed edge API Weighted directed edge: implementation in Java Similar to Edge for undirected graph, but a bit impler. public cla DirectedEdge DirectedEdge(int v, int w, double weight) weighted edge v w int from() vertex v int to() vertex w double weight() weight of thi edge String tostring() tring repreentation public cla DirectedEdge private final int v, w; private final double weight; public DirectedEdge(int v, int w, double weight) thi.v = v; thi.w = w; thi.weight = weight; v weight w public int from() return v; public int to() return w; from() and to() replace either() and other() Idiom for proceing an edge e: int v = e.from(), w = e.to(); public int weight() return weight; 7 8

3 Edge-weighted digraph API Edge-weighted digraph: adjacency-lit repreentation public cla EdgeWeightedDigraph EdgeWeightedDigraph(int V) edge-weighted digraph with V vertice EdgeWeightedDigraph(In in) edge-weighted digraph from input tream void addedge(directededge e) add weighted directed edge e Iterable<DirectedEdge> adj(int v) edge pointing from v int V() number of vertice int E() number of edge Iterable<DirectedEdge> edge() all edge String tostring() tring repreentation V tinyewd.txt 8 E adj Bag object reference to a DirectedEdge object Convention. Allow elf-loop and parallel edge. Edge-weighted digraph: adjacency-lit implementation in Java Single-ource hortet path API Same a EdgeWeightedGraph except replace Graph with Digraph. Goal. Find the hortet path from to every other vertex. public cla EdgeWeightedDigraph private final int V; private final Bag<DirectedEdge>[] adj; public EdgeWeightedDigraph(int V) thi.v = V; adj = (Bag<DirectedEdge>[]) new Bag[V]; for (int v = ; v < V; v++) adj[v] = new Bag<DirectedEdge>(); public void addedge(directededge e) int v = e.from(); adj[v].add(e); public Iterable<DirectedEdge> adj(int v) return adj[v]; add edge e = v w to only v' adjacency lit public cla SP SP p = new SP(G, ); for (int v = ; v < G.V(); v++) StdOut.printf("%d to %d (%.2f): ",, v, p.ditto(v)); for (DirectedEdge e : p.pathto(v)) StdOut.print(e + " "); StdOut.println(); SP(EdgeWeightedDigraph G, int ) hortet path from in graph G double ditto(int v) length of hortet path from to v Iterable <DirectedEdge> pathto(int v) hortet path from to v boolean hapathto(int v) i there a path from to v? 2

4 Single-ource hortet path API Goal. Find the hortet path from to every other vertex. public cla SP % java SP tinyewd.txt to (.): SP(EdgeWeightedDigraph G, int ) to (.): ->.8 ->. ->.2 to 2 (.2): ->2.2 to (.): ->2.2 2->7. 7->. to (.8): ->.8 to (.7): ->.8 ->. to (.): ->2.2 2->7. 7->. ->.2 to 7 (.): ->2.2 2->7. hortet path from in graph G double ditto(int v) length of hortet path from to v Iterable <DirectedEdge> pathto(int v) hortet path from to v boolean hapathto(int v) i there a path from to v? Algorithm ROBERT SEDGEWICK KEVIN WAYNE SHORTEST PATHS API hortet-path propertie Dijktra' algorithm edge-weighted DAG negative weight Data tructure for ingle-ource hortet path Data tructure for ingle-ource hortet path Goal. Find the hortet path from to every other vertex. Goal. Find the hortet path from to every other vertex. Obervation. A hortet-path tree (SPT) olution exit. Why? Obervation. A hortet-path tree (SPT) olution exit. Why? Conequence. Can repreent the SPT with two vertex-indexed array: ditto[v] i length of hortet path from to v. edgeto[v] i lat edge on hortet path from to v. Conequence. Can repreent the SPT with two vertex-indexed array: ditto[v] i length of hortet path from to v. edgeto[v] i lat edge on hortet path from to v. hortet-path tree from edgeto[] ditto[] null -> > >.7.7 ->.8.8 ->..7 -> >7.. parent-link repreentation public double ditto(int v) return ditto[v]; public Iterable<DirectedEdge> pathto(int v) Stack<DirectedEdge> path = new Stack<DirectedEdge>(); for (DirectedEdge e = edgeto[v]; e!= null; e = edgeto[e.from()]) path.puh(e); return path;

5 Edge relaxation Edge relaxation Relax edge e = v w. ditto[v] i length of hortet known path from to v. ditto[w] i length of hortet known path from to w. edgeto[w] i lat edge on hortet known path from to w. If e = v w give horter path to w through v, update both ditto[w] and edgeto[w]. Relax edge e = v w. ditto[v] i length of hortet known path from to v. ditto[w] i length of hortet known path from to w. edgeto[w] i lat edge on hortet known path from to w. If e = v w give horter path to w through v, update both ditto[w] and edgeto[w]. v w uccefully relaxe private void relax(directededge e) v. int v = e.from(), w = e.to(); if (ditto[w] > ditto[v] + e.weight()). ditto[w] = ditto[v] + e.weight(); w 7.2. edgeto[w] = e; black edge are in edgeto[] 7 8 Shortet-path optimality condition Shortet-path optimality condition Propoition. Let G be an edge-weighted digraph. Then ditto[] are the hortet path ditance from iff: ditto[] =. For each vertex v, ditto[v] i the length of ome path from to v. For each edge e = v w, ditto[w] ditto[v] + e.weight(). Pf. [ neceary ] Suppoe that ditto[w] > ditto[v] + e.weight() for ome edge e = v w. Then, e give a path from to w (through v) of length le than ditto[w]. v.. w ditto[v] 7.2 ditto[w] Propoition. Let G be an edge-weighted digraph. Then ditto[] are the hortet path ditance from iff: ditto[] =. For each vertex v, ditto[v] i the length of ome path from to v. For each edge e = v w, ditto[w] ditto[v] + e.weight(). Pf. [ ufficient ] Suppoe that = v v v2 vk = w i a hortet path from to w. Then, ditto[v] ditto[v] + e.weight() ditto[v2] ditto[v] + e2.weight()... ei = i th edge on hortet path from to w ditto[vk] ditto[vk-] + ek.weight() Add inequalitie; implify; and ubtitute ditto[v] = ditto[] = : ditto[w] = ditto[vk] e.weight() + e2.weight() + + ek.weight() weight of hortet path from to w Thu, ditto[w] i the weight of hortet path to w.! weight of ome path from to w 2

6 Generic hortet-path algorithm Generic hortet-path algorithm Generic algorithm (to compute SPT from ) Initialize ditto[] = and ditto[v] = for all other vertice. Repeat until optimality condition are atified: - Relax any edge. Generic algorithm (to compute SPT from ) Initialize ditto[] = and ditto[v] = for all other vertice. Repeat until optimality condition are atified: - Relax any edge. Propoition. Generic algorithm compute SPT (if it exit) from. Pf ketch. The entry ditto[v] i alway the length of a imple path from to v. Each ucceful relaxation decreae ditto[v] for ome v. The entry ditto[v] can decreae at mot a finite number of time.! Efficient implementation. How to chooe which edge to relax? Ex. Dijktra' algorithm (nonnegative weight). Ex 2. Topological ort algorithm (no directed cycle). Ex. Bellman-Ford algorithm (no negative cycle) Edger W. Dijktra: elect quote Do only what only you can do.. SHORTEST PATHS In their capacity a a tool, computer will be but a ripple on the urface of our culture. In their capacity a intellectual challenge, they are without precedent in the cultural hitory of mankind. Algorithm ROBERT SEDGEWICK KEVIN WAYNE API hortet-path propertie Dijktra' algorithm edge-weighted DAG negative weight The ue of COBOL cripple the mind; it teaching hould, therefore, be regarded a a criminal offence. It i practically impoible to teach good programming to tudent that have had a prior expoure to BASIC: a potential programmer they are mentally mutilated beyond hope of regeneration. Edger W. Dijktra Turing award 72 APL i a mitake, carried through to perfection. It i the language of the future for the programming technique of the pat: it create a new generation of coding bum. 2

7 Edger W. Dijktra: elect quote Dijktra' algorithm demo Conider vertice in increaing order of ditance from (non-tree vertex with the lowet ditto[] value). Add vertex to tree and relax all edge pointing from that vertex an edge-weighted digraph Dijktra' algorithm demo Dijktra' algorithm viualization Conider vertice in increaing order of ditance from (non-tree vertex with the lowet ditto[] value). Add vertex to tree and relax all edge pointing from that vertex. v ditto[] edgeto[] hortet-path tree from vertex 27 28

8 Dijktra' algorithm viualization Dijktra' algorithm: correctne proof Propoition. Dijktra' algorithm compute a SPT in any edge-weighted digraph with nonnegative weight. Pf. Each edge e = v w i relaxed exactly once (when vertex v i relaxed), leaving ditto[w] ditto[v] + e.weight(). Inequality hold until algorithm terminate becaue: ditto[w] cannot increae ditto[] value are monotone decreaing ditto[v] will not change we chooe lowet ditto[] value at each tep (and edge weight are nonnegative) Thu, upon termination, hortet-path optimality condition hold.! 2 Dijktra' algorithm: Java implementation Dijktra' algorithm: Java implementation public cla DijktraSP private DirectedEdge[] edgeto; private double[] ditto; private IndexMinPQ<Double> pq; public DijktraSP(EdgeWeightedDigraph G, int ) edgeto = new DirectedEdge[G.V()]; ditto = new double[g.v()]; pq = new IndexMinPQ<Double>(G.V()); for (int v = ; v < G.V(); v++) ditto[v] = Double.POSITIVE_INFINITY; ditto[] =.; pq.inert(,.); while (!pq.iempty()) int v = pq.delmin(); for (DirectedEdge e : G.adj(v)) relax(e); relax vertice in order of ditance from private void relax(directededge e) int v = e.from(), w = e.to(); if (ditto[w] > ditto[v] + e.weight()) ditto[w] = ditto[v] + e.weight(); edgeto[w] = e; if (pq.contain(w)) pq.decreaekey(w, ditto[w]); ele pq.inert (w, ditto[w]); update PQ 2

9 Dijktra' algorithm: which priority queue? Computing a panning tree in a graph Depend on PQ implementation: V inert, V delete-min, E decreae-key. PQ implementation inert delete-min decreae-key total unordered array V V 2 binary heap log V log V log V E log V d-way heap log d V d log d V log d V E log E/V V Dijktra' algorithm eem familiar? Prim' algorithm i eentially the ame algorithm. Both are in a family of algorithm that compute a panning tree. Main ditinction: Rule ued to chooe next vertex for the tree. Prim: Cloet vertex to the tree (via an undirected edge). Dijktra: Cloet vertex to the ource (via a directed path). Fibonacci heap log V E + V log V amortized Bottom line. Array implementation optimal for dene graph. Binary heap much fater for pare graph. -way heap worth the trouble in performance-critical ituation. Fibonacci heap bet in theory, but not worth implementing. Note: DFS and BFS are alo in thi family of algorithm. Acyclic edge-weighted digraph Q. Suppoe that an edge-weighted digraph ha no directed cycle. I it eaier to find hortet path than in a general digraph? Algorithm ROBERT SEDGEWICK KEVIN WAYNE SHORTEST PATHS API hortet-path propertie Dijktra' algorithm edge-weighted DAG negative weight A. Ye!

10 Acyclic hortet path demo Conider vertice in topological order. Relax all edge pointing from that vertex. Acyclic hortet path demo Conider vertice in topological order. Relax all edge pointing from that vertex v ditto[] edgeto[] an edge-weighted DAG 7. hortet-path tree from vertex Shortet path in edge-weighted DAG Shortet path in edge-weighted DAG Propoition. Topological ort algorithm compute SPT in any edgeweighted DAG in time proportional to E + V. Pf. Each edge e = v w i relaxed exactly once (when vertex v i relaxed), leaving ditto[w] ditto[v] + e.weight(). Inequality hold until algorithm terminate becaue: ditto[w] cannot increae ditto[] value are monotone decreaing ditto[v] will not change edge weight can be negative! becaue of topological order, no edge pointing to v will be relaxed after v i relaxed Thu, upon termination, hortet-path optimality condition hold.! public cla AcyclicSP private DirectedEdge[] edgeto; private double[] ditto; public AcyclicSP(EdgeWeightedDigraph G, int ) edgeto = new DirectedEdge[G.V()]; ditto = new double[g.v()]; for (int v = ; v < G.V(); v++) ditto[v] = Double.POSITIVE_INFINITY; ditto[] =.; Topological topological = new Topological(G); for (int v : topological.order()) for (DirectedEdge e : G.adj(v)) relax(e); topological order

11 Content-aware reizing Content-aware reizing Seam carving. [Avidan and Shamir] Reize an image without ditortion for Seam carving. [Avidan and Shamir] Reize an image without ditortion for diplay on cell phone and web brower. diplay on cell phone and web brower. In the wild. Photohop CS, Imagemagick, GIMP, Content-aware reizing Content-aware reizing To find vertical eam: To find vertical eam: Grid DAG: vertex = pixel; edge = from pixel to downward neighbor. Weight of pixel = energy function of 8 neighboring pixel. Seam = hortet path (um of vertex weight) from top to bottom. Grid DAG: vertex = pixel; edge = from pixel to downward neighbor. Weight of pixel = energy function of 8 neighboring pixel. Seam = hortet path (um of vertex weight) from top to bottom. eam

12 Content-aware reizing Content-aware reizing To remove vertical eam: Delete pixel on eam (one in each row). To remove vertical eam: Delete pixel on eam (one in each row). eam Longet path in edge-weighted DAG Longet path in edge-weighted DAG: application Formulate a a hortet path problem in edge-weighted DAG. Negate all weight. Find hortet path. Negate weight in reult. equivalent: revere ene of equality in relax() Parallel job cheduling. Given a et of job with duration and precedence contraint, chedule the job (by finding a tart time for each) o a to achieve the minimum completion time, while repecting the contraint. longet path input ->. ->7.7 ->7.28 ->.2 ->.8 ->2.2 ->7. ->.2 7->2. ->2. ->.2 ->.8 ->. hortet path input -> -. -> > > -.2 -> -.8 -> >7 -. -> >2 -. ->2 -. -> -.2 -> -.8 -> -. job duration mut complete before Parallel job cheduling olution Key point. Topological ort algorithm work even with negative weight. 7 8

13 Critical path method Critical path method CPM. To olve a parallel job-cheduling problem, create edge-weighted DAG: Source and ink vertice. job duration mut complete before Two vertice (begin and end) for each job. Three edge for each job. begin to end (weighted by duration) ource to begin ( weight) end to ink ( weight) One edge for each precedence contraint ( weight) CPM. Ue longet path from the ource to chedule each job. 7 Parallel job cheduling olution job tart duration zero-weight edge to each job tart job finih precedence contraint (zero weight) 2 2 zero-weight edge from each job finih duration critical path Shortet path with negative weight: failed attempt Dijktra. Doen t work with negative edge weight.. SHORTEST PATHS 2-8 Dijktra elect vertex immediately after. But hortet path from to i 2. Algorithm ROBERT SEDGEWICK KEVIN WAYNE API hortet-path propertie Dijktra' algorithm edge-weighted DAG negative weight Re-weighting. Add a contant to every edge weight doen t work. 2 2 Adding 8 to each edge weight change the hortet path from 2 to. 2 Concluion. Need a different algorithm. 2

14 Negative cycle Bellman-Ford algorithm Def. A negative cycle i a directed cycle whoe um of edge weight i negative. Bellman-Ford algorithm digraph ->. -> -. ->7.7 -> >.28 ->.2 ->.8 ->2.2 7->. ->.2 2->7. ->2. ->.2 ->.8 ->. negative cycle ( ) ->->7-> hortet path from to ->->7->->->7->...->->-> Initialize ditto[] = and ditto[v] = for all other vertice. Repeat V time: - Relax each edge. for (int i = ; i < G.V(); i++) for (int v = ; v < G.V(); v++) for (DirectedEdge e : G.adj(v)) relax(e); pa i (relax each edge) Propoition. A SPT exit iff no negative cycle. auming all vertice reachable from Bellman-Ford algorithm demo Bellman-Ford algorithm demo Repeat V time: relax all E edge. Repeat V time: relax all E edge v ditto[] edgeto[] an edge-weighted digraph hortet-path tree from vertex

15 Bellman-Ford algorithm: viualization Bellman-Ford algorithm: analyi pae 7 Bellman-Ford algorithm Initialize ditto[] = and ditto[v] = for all other vertice. Repeat V time: - Relax each edge. SPT Propoition. Dynamic programming algorithm compute SPT in any edgeweighted digraph with no negative cycle in time proportional to E V. Pf idea. After pa i, found path that i at leat a hort a any hortet path containing i (or fewer) edge. 7 8 Bellman-Ford algorithm: practical improvement Single ource hortet-path implementation: cot ummary Obervation. If ditto[v] doe not change during pa i, no need to relax any edge pointing from v in pa i+. algorithm retriction typical cae wort cae extra pace FIFO implementation. Maintain queue of vertice whoe ditto[] changed. Overall effect. be careful to keep at mot one copy of each vertex on queue (why?) The running time i till proportional to E V in wort cae. But much fater than that in practice. topological ort Dijktra (binary heap) Bellman-Ford Bellman-Ford (queue-baed) no directed cycle no negative weight no negative cycle E + V E + V V E log V E log V V E V E V V E + V E V V Remark. Directed cycle make the problem harder. Remark 2. Negative weight make the problem harder. Remark. Negative cycle make the problem intractable.

16 Finding a negative cycle Finding a negative cycle Negative cycle. Add two method to the API for SP. boolean hanegativecycle() i there a negative cycle? Obervation. If there i a negative cycle, Bellman-Ford get tuck in loop, updating ditto[] and edgeto[] entrie of vertice in the cycle. Iterable <DirectedEdge> negativecycle() negative cycle reachable from 2 digraph ->. -> -. ->7.7 -> >.28 ->.2 ->.8 ->2.2 7->. ->.2 2->7. ->2. ->.2 ->.8 ->. negative cycle ( ) ->->7-> edgeto[v] v Propoition. If any vertex v i updated in pa V, there exit a negative cycle (and can trace back edgeto[v] entrie to find it). In practice. Check for negative cycle more frequently. 2 Negative cycle application: arbitrage detection Negative cycle application: arbitrage detection Problem. Given table of exchange rate, i there an arbitrage opportunity? USD EUR GBP CHF CAD USD Currency exchange graph. Vertex = currency. Edge = tranaction, with weight equal to exchange rate. Find a directed cycle whoe product of edge weight i >. EUR GBP *. *. = EUR..888 CHF USD GBP CAD Ex. $, 7 Euro,2.2 Canadian dollar $, CAD. CHF.7.. = 7.7 Challenge. Expre a a negative cycle detection problem.

17 Negative cycle application: arbitrage detection Shortet path ummary Model a a negative cycle detection problem by taking log. Let weight of edge v w be -ln (exchange rate from currency v to w). Multiplication turn to addition; > turn to <. Find a directed cycle whoe um of edge weight i < (negative cycle). -ln(.7) -ln(.) -ln(.) = -.7 USD Remark. Fatet algorithm i extraordinarily valuable!.2 CAD -. EUR -.8 replace each weight w with ln(w) CHF GBP Nonnegative weight. Arie in many application. Dijktra' algorithm i nearly linear-time. Acyclic edge-weighted digraph. Arie in ome application. Topological ort algorithm i linear time. Edge weight can be negative. Negative weight and negative cycle. Arie in ome application. If no negative cycle, can find hortet path via Bellman-Ford. If negative cycle, can find one via Bellman-Ford. Shortet-path i a broadly ueful problem-olving model.

Algorithms. Algorithms 4.4 SHORTEST PATHS. APIs properties Bellman Ford algorithm Dijkstra s algorithm ROBERT SEDGEWICK KEVIN WAYNE

Algorithms. Algorithms 4.4 SHORTEST PATHS. APIs properties Bellman Ford algorithm Dijkstra s algorithm ROBERT SEDGEWICK KEVIN WAYNE Algorithms ROBERT SEDGEWICK KEVIN WAYNE 4.4 SHORTEST PATHS Algorithms F O U R T H E D I T I O N APIs properties Bellman Ford algorithm Dijkstra s algorithm ROBERT SEDGEWICK KEVIN WAYNE https://algs4.cs.princeton.edu

More information

4.4 Shortest Paths. Dijkstra's algorithm implementation acyclic networks negative weights. Reference: Algorithms in Java, 4 th edition, Section 4.

4.4 Shortest Paths. Dijkstra's algorithm implementation acyclic networks negative weights. Reference: Algorithms in Java, 4 th edition, Section 4. 4.4 Shortest Paths Dijkstra's algorithm implementation acyclic networks negative weights Reference: Algorithms in Java, 4 th edition, Section 4.4 Algorithms in Java, 4 th Edition Robert Sedgewick and Kevin

More information

Shortest Paths. Dijkstra's algorithm implementation negative weights. Google maps. Shortest paths in a weighted digraph. Shortest path versions

Shortest Paths. Dijkstra's algorithm implementation negative weights. Google maps. Shortest paths in a weighted digraph. Shortest path versions Google map Shortet Path Dijktra' algorithm implementation negatie eight Reference: Algorithm in Jaa, Chapter http://.c.princeton.edu/alg/p Algorithm in Jaa, th Edition Robert Sedgeick and Kein Wayne Copyright

More information

4.4 Shortest Paths. Dijkstra's algorithm implementation acyclic networks negative weights. Google maps. Shortest path versions

4.4 Shortest Paths. Dijkstra's algorithm implementation acyclic networks negative weights. Google maps. Shortest path versions . Shortet Path Google map Dijktra' algorithm implementation acyclic netork negatie eight Reference: Algorithm in Jaa, th edition, Section. Algorithm in Jaa, th Edition Robert Sedgeick and Kein Wayne Copyright

More information

CMSC 132: Object-Oriented Programming II. Shortest Paths

CMSC 132: Object-Oriented Programming II. Shortest Paths CMSC 13: Object-Oriented Programming II Shortest Paths 1 Quiz 1 One advantage of adjacency list representation over adjacency matrix representation of a graph is that in adjacency list representation,

More information

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

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

More information

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

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

More information

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

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

More information

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

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

More information

Lecture 14: Minimum Spanning Tree I

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

More information

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

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

More information

1 The secretary problem

1 The secretary problem Thi i new material: if you ee error, pleae email jtyu at tanford dot edu 1 The ecretary problem We will tart by analyzing the expected runtime of an algorithm, a you will be expected to do on your homework.

More information

Lecture 18 Graph-Based Algorithms. CSE373: Design and Analysis of Algorithms

Lecture 18 Graph-Based Algorithms. CSE373: Design and Analysis of Algorithms Lecture 18 Graph-Baed Algorithm CSE: Deign and Anali of Algorithm Shortet Path Problem Modeling problem a graph problem: Road map i a weighted graph: vertice = citie edge = road egment between citie edge

More information

Lecture 17: Shortest Paths

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

More information

Algorithms. Algorithms. Algorithms 4.3 MINIMUM SPANNING TREES

Algorithms. Algorithms. Algorithms 4.3 MINIMUM SPANNING TREES Announcements Algorithms ROBERT SEDGEWICK KEVIN WAYNE Exam Regrades Due by Wednesday s lecture. Teaching Experiment: Dynamic Deadlines (WordNet) Right now, WordNet is due at PM on April 8th. Starting Tuesday

More information

Algorithmic Discrete Mathematics 4. Exercise Sheet

Algorithmic Discrete Mathematics 4. Exercise Sheet Algorithmic Dicrete Mathematic. Exercie Sheet Department of Mathematic SS 0 PD Dr. Ulf Lorenz 0. and. May 0 Dipl.-Math. David Meffert Verion of May, 0 Groupwork Exercie G (Shortet path I) (a) Calculate

More information

Topics. Lecture 37: Global Optimization. Issues. A Simple Example: Copy Propagation X := 3 B > 0 Y := 0 X := 4 Y := Z + W A := 2 * 3X

Topics. Lecture 37: Global Optimization. Issues. A Simple Example: Copy Propagation X := 3 B > 0 Y := 0 X := 4 Y := Z + W A := 2 * 3X Lecture 37: Global Optimization [Adapted from note by R. Bodik and G. Necula] Topic Global optimization refer to program optimization that encompa multiple baic block in a function. (I have ued the term

More information

Lecture Outline. Global flow analysis. Global Optimization. Global constant propagation. Liveness analysis. Local Optimization. Global Optimization

Lecture Outline. Global flow analysis. Global Optimization. Global constant propagation. Liveness analysis. Local Optimization. Global Optimization Lecture Outline Global flow analyi Global Optimization Global contant propagation Livene analyi Adapted from Lecture by Prof. Alex Aiken and George Necula (UCB) CS781(Praad) L27OP 1 CS781(Praad) L27OP

More information

See chapter 8 in the textbook. Dr Muhammad Al Salamah, Industrial Engineering, KFUPM

See chapter 8 in the textbook. Dr Muhammad Al Salamah, Industrial Engineering, KFUPM Goal programming Objective of the topic: Indentify indutrial baed ituation where two or more objective function are required. Write a multi objective function model dla a goal LP Ue weighting um and preemptive

More information

Algorithms. Algorithms 4.3 MINIMUM SPANNING TREES. introduction greedy algorithm edge-weighted graph API Kruskal's algorithm Prim's algorithm context

Algorithms. Algorithms 4.3 MINIMUM SPANNING TREES. introduction greedy algorithm edge-weighted graph API Kruskal's algorithm Prim's algorithm context Algorithms ROBERT SEDGEWICK KEVIN WAYNE 4.3 MINIMUM SPANNING TREES Algorithms F O U R T H E D I T I O N ROBERT SEDGEWICK KEVIN WAYNE http://algs4.cs.princeton.edu introduction greedy algorithm edge-weighted

More information

Routing Definition 4.1

Routing Definition 4.1 4 Routing So far, we have only looked at network without dealing with the iue of how to end information in them from one node to another The problem of ending information in a network i known a routing

More information

Stochastic Search and Graph Techniques for MCM Path Planning Christine D. Piatko, Christopher P. Diehl, Paul McNamee, Cheryl Resch and I-Jeng Wang

Stochastic Search and Graph Techniques for MCM Path Planning Christine D. Piatko, Christopher P. Diehl, Paul McNamee, Cheryl Resch and I-Jeng Wang Stochatic Search and Graph Technique for MCM Path Planning Chritine D. Piatko, Chritopher P. Diehl, Paul McNamee, Cheryl Rech and I-Jeng Wang The John Hopkin Univerity Applied Phyic Laboratory, Laurel,

More information

Delaunay Triangulation: Incremental Construction

Delaunay Triangulation: Incremental Construction Chapter 6 Delaunay Triangulation: Incremental Contruction In the lat lecture, we have learned about the Lawon ip algorithm that compute a Delaunay triangulation of a given n-point et P R 2 with O(n 2 )

More information

Algorithms. Algorithms 4.3 MINIMUM SPANNING TREES. introduction cut property edge-weighted graph API Kruskal s algorithm Prim s algorithm

Algorithms. Algorithms 4.3 MINIMUM SPANNING TREES. introduction cut property edge-weighted graph API Kruskal s algorithm Prim s algorithm Algorithms ROBERT SEDGEWICK KEVIN WAYNE 4.3 MINIMUM SPANNING TREES Algorithms F O U R T H E D I T I O N ROBERT SEDGEWICK KEVIN WAYNE introduction cut property edge-weighted graph API Kruskal s algorithm

More information

Algorithms 4.3 MINIMUM SPANNING TREES. edge-weighted graph API greedy algorithm Kruskal's algorithm Prim's algorithm advanced topics

Algorithms 4.3 MINIMUM SPANNING TREES. edge-weighted graph API greedy algorithm Kruskal's algorithm Prim's algorithm advanced topics 4.3 MINIMUM SPANNING TREES Algorithms F O U R T H E D I T I O N edge-weighted graph API greedy algorithm Kruskal's algorithm Prim's algorithm advanced topics R O B E R T S E D G E W I C K K E V I N W A

More information

graph G not connected

graph G not connected Algorithms ROBERT SEDGEWICK KEVIN WAYNE. MINIMUM SPANNING TREES. MINIMUM SPANNING TREES introduction introduction Algorithms F O U R T H E D I T I O N greedy algorithm edge-weighted graph API Kruskal's

More information

Algorithms. Algorithms 4.3 MINIMUM SPANNING TREES. introduction greedy algorithm edge-weighted graph API Kruskal's algorithm Prim's algorithm context

Algorithms. Algorithms 4.3 MINIMUM SPANNING TREES. introduction greedy algorithm edge-weighted graph API Kruskal's algorithm Prim's algorithm context Algorithms ROBERT SEDGEWICK KEVIN WAYNE 4.3 MINIMUM SPANNING TREES Algorithms F O U R T H E D I T I O N ROBERT SEDGEWICK KEVIN WAYNE http://algs4.cs.princeton.edu introduction greedy algorithm edge-weighted

More information

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

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

More information

Algorithms. Algorithms 4.3 MINIMUM SPANNING TREES. introduction greedy algorithm edge-weighted graph API Kruskal's algorithm Prim's algorithm context

Algorithms. Algorithms 4.3 MINIMUM SPANNING TREES. introduction greedy algorithm edge-weighted graph API Kruskal's algorithm Prim's algorithm context Algorithms ROBERT SEDGEWICK KEVIN WAYNE 4.3 MINIMUM SPANNING TREES Algorithms F O U R T H E D I T I O N ROBERT SEDGEWICK KEVIN WAYNE http://algs4.cs.princeton.edu introduction greedy algorithm edge-weighted

More information

6.4 Maximum Flow. overview Ford-Fulkerson implementations applications

6.4 Maximum Flow. overview Ford-Fulkerson implementations applications 6.4 Maximum Flow overview Ford-Fulkerson implementations applications Algorithms, 4 th Edition Robert Sedgewick and Kevin Wayne Copyright 2002 2010 April 18, 2011 11:02:27 AM Mincut problem Given. A weighted

More information

Algorithms. Algorithms 4.3 MINIMUM SPANNING TREES. introduction cut property edge-weighted graph API Kruskal s algorithm Prim s algorithm context

Algorithms. Algorithms 4.3 MINIMUM SPANNING TREES. introduction cut property edge-weighted graph API Kruskal s algorithm Prim s algorithm context Algorithms ROBERT SEDGEWICK KEVIN WAYNE 4.3 MINIMUM SPANNING TREES Algorithms F O U R T H E D I T I O N ROBERT SEDGEWICK KEVIN WAYNE http://algs4.cs.princeton.edu introduction cut property edge-weighted

More information

Shortest Path Problems

Shortest Path Problems Shortet Path Problem How can we find the hortet route between two point on a road map? Model the problem a a graph problem: Road map i a weighted graph: vertice = citie edge = road egment between citie

More information

arxiv: v1 [cs.ds] 27 Feb 2018

arxiv: v1 [cs.ds] 27 Feb 2018 Incremental Strong Connectivity and 2-Connectivity in Directed Graph Louka Georgiadi 1, Giueppe F. Italiano 2, and Niko Parotidi 2 arxiv:1802.10189v1 [c.ds] 27 Feb 2018 1 Univerity of Ioannina, Greece.

More information

Algorithms. Algorithms. Algorithms 4.3 MINIMUM SPANNING TREES

Algorithms. Algorithms. Algorithms 4.3 MINIMUM SPANNING TREES Algorithms ROBERT SEDGEWICK KEVIN WAYNE. MINIMUM SPANNING TREES. MINIMUM SPANNING TREES Algorithms F O U R T H E D I T I O N ROBERT SEDGEWICK KEVIN WAYNE http://algs.cs.princeton.edu introduction greedy

More information

Minimum congestion spanning trees in bipartite and random graphs

Minimum congestion spanning trees in bipartite and random graphs Minimum congetion panning tree in bipartite and random graph M.I. Otrovkii Department of Mathematic and Computer Science St. John Univerity 8000 Utopia Parkway Queen, NY 11439, USA e-mail: otrovm@tjohn.edu

More information

Localized Minimum Spanning Tree Based Multicast Routing with Energy-Efficient Guaranteed Delivery in Ad Hoc and Sensor Networks

Localized Minimum Spanning Tree Based Multicast Routing with Energy-Efficient Guaranteed Delivery in Ad Hoc and Sensor Networks Localized Minimum Spanning Tree Baed Multicat Routing with Energy-Efficient Guaranteed Delivery in Ad Hoc and Senor Network Hanne Frey Univerity of Paderborn D-3398 Paderborn hanne.frey@uni-paderborn.de

More information

Laboratory Exercise 6

Laboratory Exercise 6 Laboratory Exercie 6 Adder, Subtractor, and Multiplier The purpoe of thi exercie i to examine arithmetic circuit that add, ubtract, and multiply number. Each type of circuit will be implemented in two

More information

8.1 Shortest Path Trees

8.1 Shortest Path Trees I tudy my Bible a I gather apple. Firt I hake the whole tree, that the ripet might fall. Then I climb the tree and hake each limb, and then each branch and then each twig, and then I look under each leaf.

More information

7. NETWORK FLOW I. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley Copyright 2013 Kevin Wayne. Last updated on Sep 8, :40 AM

7. NETWORK FLOW I. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley Copyright 2013 Kevin Wayne. Last updated on Sep 8, :40 AM 7. NETWORK FLOW I max-flow and min-cut problem Ford-Fulkeron algorithm max-flow min-cut theorem capacity-caling algorithm hortet augmenting path blocking-flow algorithm unit-capacity imple network Lecture

More information

CS201: Data Structures and Algorithms. Assignment 2. Version 1d

CS201: Data Structures and Algorithms. Assignment 2. Version 1d CS201: Data Structure and Algorithm Aignment 2 Introduction Verion 1d You will compare the performance of green binary earch tree veru red-black tree by reading in a corpu of text, toring the word and

More information

Robert Bryan and Marshall Dodge, Bert and I and Other Stories from Down East (1961) Michelle Shocked, Arkansas Traveler (1992)

Robert Bryan and Marshall Dodge, Bert and I and Other Stories from Down East (1961) Michelle Shocked, Arkansas Traveler (1992) Well, ya turn left by the fire tation in the village and take the old pot road by the reervoir and...no, that won t do. Bet to continue traight on by the tar road until you reach the choolhoue and then

More information

Karen L. Collins. Wesleyan University. Middletown, CT and. Mark Hovey MIT. Cambridge, MA Abstract

Karen L. Collins. Wesleyan University. Middletown, CT and. Mark Hovey MIT. Cambridge, MA Abstract Mot Graph are Edge-Cordial Karen L. Collin Dept. of Mathematic Weleyan Univerity Middletown, CT 6457 and Mark Hovey Dept. of Mathematic MIT Cambridge, MA 239 Abtract We extend the definition of edge-cordial

More information

CMSC 132: Object-Oriented Programming II

CMSC 132: Object-Oriented Programming II CMSC 132: Object-Oriented Programming II DIRECTED GRAPHS Graphs slides are modified from COS 126 slides of Dr. Robert Sedgewick. 1 Directed graphs Digraph Set of vertices connected pairwise by directed

More information

Shortest Path Routing in Arbitrary Networks

Shortest Path Routing in Arbitrary Networks Journal of Algorithm, Vol 31(1), 1999 Shortet Path Routing in Arbitrary Network Friedhelm Meyer auf der Heide and Berthold Vöcking Department of Mathematic and Computer Science and Heinz Nixdorf Intitute,

More information

Shortest Paths in Directed Graphs

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

More information

Computer Arithmetic Homework Solutions. 1 An adder for graphics. 2 Partitioned adder. 3 HDL implementation of a partitioned adder

Computer Arithmetic Homework Solutions. 1 An adder for graphics. 2 Partitioned adder. 3 HDL implementation of a partitioned adder Computer Arithmetic Homework 3 2016 2017 Solution 1 An adder for graphic In a normal ripple carry addition of two poitive number, the carry i the ignal for a reult exceeding the maximum. We ue thi ignal

More information

Cutting Stock by Iterated Matching. Andreas Fritsch, Oliver Vornberger. University of Osnabruck. D Osnabruck.

Cutting Stock by Iterated Matching. Andreas Fritsch, Oliver Vornberger. University of Osnabruck. D Osnabruck. Cutting Stock by Iterated Matching Andrea Fritch, Oliver Vornberger Univerity of Onabruck Dept of Math/Computer Science D-4909 Onabruck andy@informatikuni-onabrueckde Abtract The combinatorial optimization

More information

Universität Augsburg. Institut für Informatik. Approximating Optimal Visual Sensor Placement. E. Hörster, R. Lienhart.

Universität Augsburg. Institut für Informatik. Approximating Optimal Visual Sensor Placement. E. Hörster, R. Lienhart. Univerität Augburg à ÊÇÅÍÆ ËÀǼ Approximating Optimal Viual Senor Placement E. Hörter, R. Lienhart Report 2006-01 Januar 2006 Intitut für Informatik D-86135 Augburg Copyright c E. Hörter, R. Lienhart Intitut

More information

CERIAS Tech Report EFFICIENT PARALLEL ALGORITHMS FOR PLANAR st-graphs. by Mikhail J. Atallah, Danny Z. Chen, and Ovidiu Daescu

CERIAS Tech Report EFFICIENT PARALLEL ALGORITHMS FOR PLANAR st-graphs. by Mikhail J. Atallah, Danny Z. Chen, and Ovidiu Daescu CERIAS Tech Report 2003-15 EFFICIENT PARALLEL ALGORITHMS FOR PLANAR t-graphs by Mikhail J. Atallah, Danny Z. Chen, and Ovidiu Daecu Center for Education and Reearch in Information Aurance and Security,

More information

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

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

More information

Markov Random Fields in Image Segmentation

Markov Random Fields in Image Segmentation Preented at SSIP 2011, Szeged, Hungary Markov Random Field in Image Segmentation Zoltan Kato Image Proceing & Computer Graphic Dept. Univerity of Szeged Hungary Zoltan Kato: Markov Random Field in Image

More information

MAT 155: Describing, Exploring, and Comparing Data Page 1 of NotesCh2-3.doc

MAT 155: Describing, Exploring, and Comparing Data Page 1 of NotesCh2-3.doc MAT 155: Decribing, Exploring, and Comparing Data Page 1 of 8 001-oteCh-3.doc ote for Chapter Summarizing and Graphing Data Chapter 3 Decribing, Exploring, and Comparing Data Frequency Ditribution, Graphic

More information

Operational Semantics Class notes for a lecture given by Mooly Sagiv Tel Aviv University 24/5/2007 By Roy Ganor and Uri Juhasz

Operational Semantics Class notes for a lecture given by Mooly Sagiv Tel Aviv University 24/5/2007 By Roy Ganor and Uri Juhasz Operational emantic Page Operational emantic Cla note for a lecture given by Mooly agiv Tel Aviv Univerity 4/5/7 By Roy Ganor and Uri Juhaz Reference emantic with Application, H. Nielon and F. Nielon,

More information

Analysis of slope stability

Analysis of slope stability Engineering manual No. 8 Updated: 02/2016 Analyi of lope tability Program: Slope tability File: Demo_manual_08.gt In thi engineering manual, we are going to how you how to verify the lope tability for

More information

The Data Locality of Work Stealing

The Data Locality of Work Stealing The Data Locality of Work Stealing Umut A. Acar School of Computer Science Carnegie Mellon Univerity umut@c.cmu.edu Guy E. Blelloch School of Computer Science Carnegie Mellon Univerity guyb@c.cmu.edu Robert

More information

3D SMAP Algorithm. April 11, 2012

3D SMAP Algorithm. April 11, 2012 3D SMAP Algorithm April 11, 2012 Baed on the original SMAP paper [1]. Thi report extend the tructure of MSRF into 3D. The prior ditribution i modified to atify the MRF property. In addition, an iterative

More information

Touring a Sequence of Polygons

Touring a Sequence of Polygons Touring a Sequence of Polygon Mohe Dror (1) Alon Efrat (1) Anna Lubiw (2) Joe Mitchell (3) (1) Univerity of Arizona (2) Univerity of Waterloo (3) Stony Brook Univerity Problem: Given a equence of k polygon

More information

Drawing Lines in 2 Dimensions

Drawing Lines in 2 Dimensions Drawing Line in 2 Dimenion Drawing a traight line (or an arc) between two end point when one i limited to dicrete pixel require a bit of thought. Conider the following line uperimpoed on a 2 dimenional

More information

Midterm 2 March 10, 2014 Name: NetID: # Total Score

Midterm 2 March 10, 2014 Name: NetID: # Total Score CS 3 : Algorithm and Model of Computation, Spring 0 Midterm March 0, 0 Name: NetID: # 3 Total Score Max 0 0 0 0 Grader Don t panic! Pleae print your name and your NetID in the boxe above. Thi i a cloed-book,

More information

Shortest Paths with Single-Point Visibility Constraint

Shortest Paths with Single-Point Visibility Constraint Shortet Path with Single-Point Viibility Contraint Ramtin Khoravi Mohammad Ghodi Department of Computer Engineering Sharif Univerity of Technology Abtract Thi paper tudie the problem of finding a hortet

More information

A Linear Interpolation-Based Algorithm for Path Planning and Replanning on Girds *

A Linear Interpolation-Based Algorithm for Path Planning and Replanning on Girds * Advance in Linear Algebra & Matrix Theory, 2012, 2, 20-24 http://dx.doi.org/10.4236/alamt.2012.22003 Publihed Online June 2012 (http://www.scirp.org/journal/alamt) A Linear Interpolation-Baed Algorithm

More information

Brief Announcement: Distributed 3/2-Approximation of the Diameter

Brief Announcement: Distributed 3/2-Approximation of the Diameter Brief Announcement: Ditributed /2-Approximation of the Diameter Preliminary verion of a brief announcement to appear at DISC 14 Stephan Holzer MIT holzer@mit.edu David Peleg Weizmann Intitute david.peleg@weizmann.ac.il

More information

Hassan Ghaziri AUB, OSB Beirut, Lebanon Key words Competitive self-organizing maps, Meta-heuristics, Vehicle routing problem,

Hassan Ghaziri AUB, OSB Beirut, Lebanon Key words Competitive self-organizing maps, Meta-heuristics, Vehicle routing problem, COMPETITIVE PROBABIISTIC SEF-ORGANIZING MAPS FOR ROUTING PROBEMS Haan Ghaziri AUB, OSB Beirut, ebanon ghaziri@aub.edu.lb Abtract In thi paper, we have applied the concept of the elf-organizing map (SOM)

More information

Graphs: Finding shortest paths

Graphs: Finding shortest paths /0/01 Graph: Finding hortet path Tecniche di Programmazione Summary Definition Floyd-Warhall algorithm Bellman-Ford-Moore algorithm Dijktra algorithm 1 /0/01 Definition Graph: Finding hortet path Definition:

More information

Touring a Sequence of Polygons

Touring a Sequence of Polygons Touring a Sequence of Polygon Mohe Dror (1) Alon Efrat (1) Anna Lubiw (2) Joe Mitchell (3) (1) Univerity of Arizona (2) Univerity of Waterloo (3) Stony Brook Univerity Problem: Given a equence of k polygon

More information

Temporal Abstract Interpretation. To have a continuum of program analysis techniques ranging from model-checking to static analysis.

Temporal Abstract Interpretation. To have a continuum of program analysis techniques ranging from model-checking to static analysis. Temporal Abtract Interpretation Patrick COUSOT DI, École normale upérieure 45 rue d Ulm 75230 Pari cedex 05, France mailto:patrick.couot@en.fr http://www.di.en.fr/ couot and Radhia COUSOT LIX École polytechnique

More information

Shortest-Path Routing in Arbitrary Networks

Shortest-Path Routing in Arbitrary Networks Ž. Journal of Algorithm 31, 105131 1999 Article ID jagm.1998.0980, available online at http:www.idealibrary.com on Shortet-Path Routing in Arbitrary Network Friedhelm Meyer auf der Heide and Berthold Vocking

More information

A SIMPLE IMPERATIVE LANGUAGE THE STORE FUNCTION NON-TERMINATING COMMANDS

A SIMPLE IMPERATIVE LANGUAGE THE STORE FUNCTION NON-TERMINATING COMMANDS A SIMPLE IMPERATIVE LANGUAGE Eventually we will preent the emantic of a full-blown language, with declaration, type and looping. However, there are many complication, o we will build up lowly. Our firt

More information

COS 226 Algorithms and Data Structures Spring Second Written Exam

COS 226 Algorithms and Data Structures Spring Second Written Exam COS 226 Algorithms and Data Structures Spring 2018 Second Written Exam This exam has 7 questions (including question 0) worth a total of 80 points. You have 80 minutes. This exam is preprocessed by a computer,

More information

Advanced Encryption Standard and Modes of Operation

Advanced Encryption Standard and Modes of Operation Advanced Encryption Standard and Mode of Operation G. Bertoni L. Breveglieri Foundation of Cryptography - AES pp. 1 / 50 AES Advanced Encryption Standard (AES) i a ymmetric cryptographic algorithm AES

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 7 Greedy Graph Algorithms Topological sort Shortest paths Adam Smith The (Algorithm) Design Process 1. Work out the answer for some examples. Look for a general principle

More information

An Intro to LP and the Simplex Algorithm. Primal Simplex

An Intro to LP and the Simplex Algorithm. Primal Simplex An Intro to LP and the Simplex Algorithm Primal Simplex Linear programming i contrained minimization of a linear objective over a olution pace defined by linear contraint: min cx Ax b l x u A i an m n

More information

AN ALGORITHM FOR RESTRICTED NORMAL FORM TO SOLVE DUAL TYPE NON-CANONICAL LINEAR FRACTIONAL PROGRAMMING PROBLEM

AN ALGORITHM FOR RESTRICTED NORMAL FORM TO SOLVE DUAL TYPE NON-CANONICAL LINEAR FRACTIONAL PROGRAMMING PROBLEM RAC Univerity Journal, Vol IV, No, 7, pp 87-9 AN ALGORITHM FOR RESTRICTED NORMAL FORM TO SOLVE DUAL TYPE NON-CANONICAL LINEAR FRACTIONAL PROGRAMMING PROLEM Mozzem Hoain Department of Mathematic Ghior Govt

More information

Chapter S:II (continued)

Chapter S:II (continued) Chapter S:II (continued) II. Baic Search Algorithm Sytematic Search Graph Theory Baic State Space Search Depth-Firt Search Backtracking Breadth-Firt Search Uniform-Cot Search AND-OR Graph Baic Depth-Firt

More information

A note on degenerate and spectrally degenerate graphs

A note on degenerate and spectrally degenerate graphs A note on degenerate and pectrally degenerate graph Noga Alon Abtract A graph G i called pectrally d-degenerate if the larget eigenvalue of each ubgraph of it with maximum degree D i at mot dd. We prove

More information

Increasing Throughput and Reducing Delay in Wireless Sensor Networks Using Interference Alignment

Increasing Throughput and Reducing Delay in Wireless Sensor Networks Using Interference Alignment Int. J. Communication, Network and Sytem Science, 0, 5, 90-97 http://dx.doi.org/0.436/ijcn.0.50 Publihed Online February 0 (http://www.scirp.org/journal/ijcn) Increaing Throughput and Reducing Delay in

More information

else end while End References

else end while End References 621-630. [RM89] [SK76] Roenfeld, A. and Melter, R. A., Digital geometry, The Mathematical Intelligencer, vol. 11, No. 3, 1989, pp. 69-72. Sklanky, J. and Kibler, D. F., A theory of nonuniformly digitized

More information

CORRECTNESS ISSUES AND LOOP INVARIANTS

CORRECTNESS ISSUES AND LOOP INVARIANTS The next everal lecture 2 Study algorithm for earching and orting array. Invetigate their complexity how much time and pace they take Formalize the notion of average-cae and wort-cae complexity CORRECTNESS

More information

Research Article Longest Path Reroute to Optimize the Optical Multicast Routing in Sparse Splitting WDM Networks

Research Article Longest Path Reroute to Optimize the Optical Multicast Routing in Sparse Splitting WDM Networks International Optic Volume 0, Article ID 9, page http://dxdoiorg/0/0/9 Reearch Article Longet Path Reroute to Optimize the Optical Multicat Routing in Spare Splitting WDM Network Huanlin Liu, Hongyue Dai,

More information

Multicast with Network Coding in Application-Layer Overlay Networks

Multicast with Network Coding in Application-Layer Overlay Networks IEEE JOURNAL ON SELECTED AREAS IN COMMUNICATIONS, VOL. 22, NO. 1, JANUARY 2004 1 Multicat with Network Coding in Application-Layer Overlay Network Ying Zhu, Baochun Li, Member, IEEE, and Jiang Guo Abtract

More information

xy-monotone path existence queries in a rectilinear environment

xy-monotone path existence queries in a rectilinear environment CCCG 2012, Charlottetown, P.E.I., Augut 8 10, 2012 xy-monotone path exitence querie in a rectilinear environment Gregory Bint Anil Mahehwari Michiel Smid Abtract Given a planar environment coniting of

More information

A Practical Model for Minimizing Waiting Time in a Transit Network

A Practical Model for Minimizing Waiting Time in a Transit Network A Practical Model for Minimizing Waiting Time in a Tranit Network Leila Dianat, MASc, Department of Civil Engineering, Sharif Univerity of Technology, Tehran, Iran Youef Shafahi, Ph.D. Aociate Profeor,

More information

Distributed Fractional Packing and Maximum Weighted b-matching via Tail-Recursive Duality

Distributed Fractional Packing and Maximum Weighted b-matching via Tail-Recursive Duality Ditributed Fractional Packing and Maximum Weighted b-matching via Tail-Recurive Duality Chrito Koufogiannaki, Neal E. Young Department of Computer Science, Univerity of California, Riveride {ckou, neal}@c.ucr.edu

More information

AVL Tree. The height of the BST be as small as possible

AVL Tree. The height of the BST be as small as possible 1 AVL Tree re and Algorithm The height of the BST be a mall a poible The firt balanced BST. Alo called height-balanced tree. Introduced by Adel on-vel kii and Landi in 1962. BST with the following condition:

More information

ISSN: (Online) Volume 3, Issue 4, April 2015 International Journal of Advance Research in Computer Science and Management Studies

ISSN: (Online) Volume 3, Issue 4, April 2015 International Journal of Advance Research in Computer Science and Management Studies ISSN: 2321-7782 (Online) Volume 3, Iue 4, April 2015 International Journal Advance Reearch in Computer Science and Management Studie Reearch Article / Survey Paper / Cae Study Available online at: www.ijarcm.com

More information

Key Terms - MinMin, MaxMin, Sufferage, Task Scheduling, Standard Deviation, Load Balancing.

Key Terms - MinMin, MaxMin, Sufferage, Task Scheduling, Standard Deviation, Load Balancing. Volume 3, Iue 11, November 2013 ISSN: 2277 128X International Journal of Advanced Reearch in Computer Science and Software Engineering Reearch Paper Available online at: www.ijarce.com Tak Aignment in

More information

Lecture 11: Analysis of Algorithms (CS ) 1

Lecture 11: Analysis of Algorithms (CS ) 1 Lecture 11: Analysis of Algorithms (CS583-002) 1 Amarda Shehu November 12, 2014 1 Some material adapted from Kevin Wayne s Algorithm Class @ Princeton 1 2 Dynamic Programming Approach Floyd-Warshall Shortest

More information

Shortest Path Problem

Shortest Path Problem Shortest Path Problem CLRS Chapters 24.1 3, 24.5, 25.2 Shortest path problem Shortest path problem (and variants) Properties of shortest paths Algorithmic framework Bellman-Ford algorithm Shortest paths

More information

Exercise 4: Markov Processes, Cellular Automata and Fuzzy Logic

Exercise 4: Markov Processes, Cellular Automata and Fuzzy Logic Exercie 4: Marko rocee, Cellular Automata and Fuzzy Logic Formal Method II, Fall Semeter 203 Solution Sheet Marko rocee Theoretical Exercie. (a) ( point) 0.2 0.7 0.3 tanding 0.25 lying 0.5 0.4 0.2 0.05

More information

Directed Graphs. digraph API digraph search transitive closure topological sort strong components. Directed graphs

Directed Graphs. digraph API digraph search transitive closure topological sort strong components. Directed graphs Directed graphs Digraph. Set of vertices connected pairwise by oriented edges. Directed Graphs digraph API digraph search transitive closure topological sort strong components References: Algorithms in

More information

DAROS: Distributed User-Server Assignment And Replication For Online Social Networking Applications

DAROS: Distributed User-Server Assignment And Replication For Online Social Networking Applications DAROS: Ditributed Uer-Server Aignment And Replication For Online Social Networking Application Thuan Duong-Ba School of EECS Oregon State Univerity Corvalli, OR 97330, USA Email: duongba@eec.oregontate.edu

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 4 Graphs Definitions Traversals Adam Smith 9/8/10 Exercise How can you simulate an array with two unbounded stacks and a small amount of memory? (Hint: think of a

More information

Announcements. CSE332: Data Abstractions Lecture 19: Parallel Prefix and Sorting. The prefix-sum problem. Outline. Parallel prefix-sum

Announcements. CSE332: Data Abstractions Lecture 19: Parallel Prefix and Sorting. The prefix-sum problem. Outline. Parallel prefix-sum Announcement Homework 6 due Friday Feb 25 th at the BEGINNING o lecture CSE332: Data Abtraction Lecture 19: Parallel Preix and Sorting Project 3 the lat programming project! Verion 1 & 2 - Tue March 1,

More information

Lecture 8: More Pipelining

Lecture 8: More Pipelining Overview Lecture 8: More Pipelining David Black-Schaffer davidbb@tanford.edu EE8 Spring 00 Getting Started with Lab Jut get a ingle pixel calculating at one time Then look into filling your pipeline Multiplier

More information

Shortest path problems

Shortest path problems Next... Shortest path problems Single-source shortest paths in weighted graphs Shortest-Path Problems Properties of Shortest Paths, Relaxation Dijkstra s Algorithm Bellman-Ford Algorithm Shortest-Paths

More information

VLSI Design 9. Datapath Design

VLSI Design 9. Datapath Design VLSI Deign 9. Datapath Deign 9. Datapath Deign Lat module: Adder circuit Simple adder Fat addition Thi module omparator Shifter Multi-input Adder Multiplier omparator detector: A = 1 detector: A = 11 111

More information

Planning of scooping position and approach path for loading operation by wheel loader

Planning of scooping position and approach path for loading operation by wheel loader 22 nd International Sympoium on Automation and Robotic in Contruction ISARC 25 - September 11-14, 25, Ferrara (Italy) 1 Planning of cooping poition and approach path for loading operation by wheel loader

More information

Gray-level histogram. Intensity (grey-level) transformation, or mapping. Use of intensity transformations:

Gray-level histogram. Intensity (grey-level) transformation, or mapping. Use of intensity transformations: Faculty of Informatic Eötvö Loránd Univerity Budapet, Hungary Lecture : Intenity Tranformation Image enhancement by point proceing Spatial domain and frequency domain method Baic Algorithm for Digital

More information

Robust Routing in Interdependent Networks

Robust Routing in Interdependent Networks Robut Routing in Interdependent Network Jianan Zhang and Eytan Modiano Laboratory for Information and Deciion Sytem, Maachuett Intitute of Technology Abtract We conider a model of two interdependent network,

More information

A Multi-objective Genetic Algorithm for Reliability Optimization Problem

A Multi-objective Genetic Algorithm for Reliability Optimization Problem International Journal of Performability Engineering, Vol. 5, No. 3, April 2009, pp. 227-234. RAMS Conultant Printed in India A Multi-objective Genetic Algorithm for Reliability Optimization Problem AMAR

More information