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

Size: px
Start display at page:

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

Transcription

1 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 pecial vertice, a ource and a target t We want to find the hortet directed path from to t In other word, we want to find the path p tarting at and ending at t minimizing the function w(p) = e p w(e) Today Outline Negative Weight 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. - Tao Te Ching Single Source Shortet Path Dijktra Algorithm Bellman-Ford Algorithm We ll actually allow negative weight on edge The preence of a negative cycle might mean that there i no hortet path A hortet path from to t exit if and only if there i at leat one path from to t but no path from to t that touche a negative cycle In the following example, there i no hortet path from to t 5 t

2 Single Source Shortet Path SSSP Algorithm Single Source Shortet Path (SSSP) i a more general problem SSSP i the following problem: find the hortet path from the ource vertex to every other vertex in the graph The problem i olved by finding a hortet path tree rooted at the vertex that contain all the deired hortet path A hortet path tree i not a MST Each vertex v in the graph will tore two value which decribe a tentative hortet path from to v dit(v) i the length of the tentative hortet path between and v pred(v) i the predeceor of v in thi tentative hortet path The predeceor pointer automatically define a tentative hortet path tree 6 SSSP Algorithm Defn We ll now go over ome algorithm for SSSP on directed graph. Thee algorithm will work for undirected graph with light modification In particular, we mut pecifically prohibit alternating back and forth acro the ame undirected negative-weight edge Like for graph traveral, all the SSSP algorithm will be pecial cae of a ingle generic algorithm Initially we et: dit() =, pred() = NULL For every vertex v, dit(v) = and pred(v) = NULL 5

3 Relaxation Correctne We call an edge (u, v) tene if dit(u) + w(u, v) < dit(v) If (u, v) i tene, then the tentative hortet path from to v i incorrect ince the path to u and then (u, v) i horter Our generic algorithm repeatedly find a tene edge in the graph and relaxe it If there are no tene edge, our algorithm i finihed and we have our deired hortet path tree The correctne of the relaxation algorithm follow directly from three imple claim The run time of the algorithm will depend on the way that we make choice about which edge to relax Relax Claim Relax(u,v){ dit(v) = dit(u) + w(u,v); pred(v) = u; If dit(v), then dit(v) i the total weight of the predeceor chain ending at v: pred(pred(v)) pred(v) v. Thi i eay to prove by induction on the number of edge in the path from to v. (left a an exercie) 9

4 Claim Generic SSSP If the algorithm halt, then dit(v) w( v) for any path v. Thi i eay to prove by induction on the number of edge in the path v. (which you will do in the hw) We haven t yet aid how to detect which edge can be relaxed or what order to relax them in The following Generic SSSP algorithm anwer thee quetion We will maintain a bag of vertice initially containing jut the ource vertex Whenever we take a vertex u out of the bag, we can all of it outgoing edge, looking for omething to relax Whenever we uccefully relax an edge (u, v), we put v in the bag Claim InitSSSP The algorithm halt if and only if there i no negative cycle reachable from. The only if direction i eay if there i a reachable negative cycle, then after the firt edge in the cycle i relaxed, the cycle alway ha at leat one tene edge. The if direction follow from the fact that every relaxation tep reduce either the number of vertice with dit(v) = by or reduce the um of the finite hortet path length by ome poitive amount. InitSSSP(){ dit() = ; pred() = NULL; for all vertice v!= { dit(v) = infinity; pred(v) = NULL; 5

5 GenericSSSP Diktra Algorithm GenericSSSP(){ InitSSSP(); put in the bag; while the bag i not empty{ take u from the bag; for all edge (u,v){ if (u,v) i tene{ Relax(u,v); put v in the bag; If we implement the bag a a heap, where the key of a vertex v i dit(v), we obtain Dijktra algorithm Dijktra algorithm doe particularly well if the graph ha no negative-weight edge In thi cae, it not hard to how (by induction, of coure) that the vertice are canned in increaing order of their hortet-path ditance from It follow that each vertex i canned at mot once, and thu that each edge i relaxed at mot once 6 Generic SSSP Dijktra Algorithm Jut a with graph traveral, uing different data tructure for the bag give u different algorithm Some obviou choice are: a tack, a queue and a heap Unfortunately if we ue a tack, we need to perform Θ( E ) relaxation tep in the wort cae (an exercie for the diligent tudent) The other poibilitie are more efficient Since the key of each vertex in the heap i it tentative ditance from, the algorithm perform a DecreaeKey operation every time an edge i relaxed Thu the algorithm perform at mot E DecreaeKey Similarly, there are at mot V Inert and ExtractMin operation Thu if we tore the vertice in a Fibonacci heap, the total running time of Dijktra algorithm i O( E + V log V ) 9

6 Negative Edge Bellman-Ford Thi analyi aume that no edge ha negative weight The algorithm given here i till correct if there are negative weight edge but the wort-cae run time could be exponential The algorithm in our text book give incorrect reult for graph with negative edge (which they make clear) If we replace the bag in the GenericSSSP with a queue, we get the Bellman-Ford algorithm Bellman-Ford i efficient even if there are negative edge and it can be ued to quickly detect the preence of negative cycle If there are no negative edge, however, Dijktra algorithm i fater than Bellman-Ford Example Analyi 9 Four phae of Dijktra algorithm run on a graph with no negative edge. At each phae, the haded vertice are in the heap, and the bold vertex ha jut been canned. The bold edge decribe the evolving hortet path tree. 9 The eaiet way to analyze thi algorithm i to break the execution into phae Before we begin the alg, we inert a token into the queue Whenever we take the token out of the queue, we begin a new phae by jut reinerting the token into the queue The -th phae conit entirely of canning the ource vertex The algorithm end when the queue contain only the token

7 Invariant Analyi A imple inductive argument (left a an exercie) how the following invariant: At the end of the i-th phae, for each vertex v, dit(v) i le than or equal to the length of the hortet path v coniting of i or fewer edge Since a hortet path can only pa through each vertex once, either the algorithm halt before the V -th phae or the graph contain a negative cycle In each phae, we can each vertex at mot once and o we relax each edge at mot once Hence the run time of a ingle phae i O( E ) Thu, the overall run time of Bellman-Ford i O( V E ) 6 Example Book Bellman-Ford d a b e d a f c b e 9 d 6 a f c b e d f a f 6 c a b e 9 d c b e Four phae of Bellman-Ford algorithm run on a directed graph with negative edge. Node are taken from the queue in the order a b c d f b a e d d a, where i the token. Shaded vertice are in the queue at the end of each phae. The bold edge decribe the evolving hortet path tree. f c 5 Now that we undertand how the phae of Bellman-Ford work, we can implify the algorithm Intead of uing a queue to perform a partial BFS in each phae, we will jut can through the adjacency lit directly and try to relax every edge in the graph Thi will be much cloer to how the textbook preent Bellman- Ford The run time will till be O( V E ) To how correctne, we ll have to how that are earlier invariant hold which can be proved by induction on i

8 Book Bellman-Ford All-Pair Shortet Path Book-BF(){ InitSSSP(); repeat V time{ for every edge (u,v) in E{ if (u,v) i tene{ Relax(u,v); for every edge (u,v) in E{ if (u,v) i tene, return Negative Cycle For the ingle-ource hortet path problem, we wanted to find the hortet path from a ource vertex to all the other vertice in the graph We will now generalize thi problem further to that of finding the hortet path from every poible ource to every poible detination In particular, for every pair of vertice u and v, we need to compute the following information: dit(u, v) i the length of the hortet path (if any) from u to v pred(u, v) i the econd-to-lat vertex (if any) on the hortet path (if any) from u to v Take Away Example Dijktra algorithm and Bellman-Ford are both variant of the GenericSSSP algorithm for olving SSSP Dijktra algorithm ue a Fibonacci heap for the bag while Bellman-Ford ue a queue Dijktra algorithm run in time O( E + V log V ) if there are no negative edge Bellman-Ford run in time O( V E ) and can handle negative edge (and detect negative cycle) For any vertex v, we have dit(v, v) = and pred(v, v) = NULL If the hortet path from u to v i only one edge long, then dit(u, v) = w(u v) and pred(u, v) = u If there no hortet path from u to v, then dit(u, v) = and pred(u, v) = NULL 9

9 APSP ObviouAPSP The output of our hortet path algorithm will be a pair of V V array encoding all V ditance and predeceor. Many map contain uch a ditance matric - to find the ditance from (ay) Albuquerque to (ay) Ruidoo, you look in the row labeled Albuquerque and the column labeled Ruidoo We ll focu only on computing the ditance array The predeceor array, from which you would compute the actual hortet path, can be computed with only minor addition to the algorithm preented here ObviouAPSP(V,E,w){ for every vertex { dit(,*) = SSSP(V,E,w,); Lot of Single Source Analyi Mot obviou olution to APSP i to jut run SSSP algorithm V timne, once for every poible ource vertex Specifically, to fill in the ubarray dit(, ), we invoke either Dijktra or Bellman-Ford tarting at the ource vertex We ll call thi algorithm ObviouAPSP The running time of thi algorithm depend on which SSSP algorithm we ue If we ue Bellman-Ford, the overall running time i O( V E ) = O( V ) If all the edge weight are poitive, we can ue Dijktra intead, which decreae the run time to Θ( V E + V log V ) = O( V ) 5

10 Problem We d like to have an algorithm which take O( V ) but which can alo handle negative edge weight We ll ee that a dynamic programming algorithm, the Floyd Warhall algorithm, will achieve thi Note: the book dicue another algorithm, Johnon algorithm, which i aymptotically better than Floyd Warhall on pare graph. However we will not be dicuing thi algorithm in cla. 6

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

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

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

CS 561, Lecture 10. Jared Saia University of New Mexico

CS 561, Lecture 10. Jared Saia University of New Mexico CS 561, Lecture 10 Jared Saia University of New Mexico Today s Outline The path that can be trodden is not the enduring and unchanging Path. The name that can be named is not the enduring and unchanging

More information

CS 561, Lecture 10. Jared Saia University of New Mexico

CS 561, Lecture 10. Jared Saia University of New Mexico CS 561, Lecture 10 Jared Saia University of New Mexico Today s Outline The path that can be trodden is not the enduring and unchanging Path. The name that can be named is not the enduring and unchanging

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

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

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

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

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

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

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

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

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

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

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

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

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

CS 4349 Lecture October 23rd, 2017

CS 4349 Lecture October 23rd, 2017 CS 4349 Lecture October 23rd, 2017 Main topics for #lecture include #minimum_spanning_trees and #SSSP. Prelude Homework 7 due Wednesday, October 25th. Don t forget about the extra credit. Minimum Spanning

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

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

Algorithms. Algorithms 4.4 S HORTEST P ATHS. APIs shortest-paths properties. Dijkstra's algorithm edge-weighted DAGs negative weights 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 ->7.28 7->.28 ->.2

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Graphs. Part II: SP and MST. Laura Toma Algorithms (csci2200), Bowdoin College

Graphs. Part II: SP and MST. Laura Toma Algorithms (csci2200), Bowdoin College Laura Toma Algorithms (csci2200), Bowdoin College Topics Weighted graphs each edge (u, v) has a weight denoted w(u, v) or w uv stored in the adjacency list or adjacency matrix The weight of a path p =

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

Programmazione di sistemi multicore

Programmazione di sistemi multicore Programmazione di itemi multicore A.A. 2015-2016 LECTURE 9 IRENE FINOCCHI http://wwwuer.di.uniroma1.it/~inocchi/ More complex parallel pattern PARALLEL PREFIX PARALLEL SORTING PARALLEL MERGESORT PARALLEL

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

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

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

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

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

Theory of Computing. Lecture 7 MAS 714 Hartmut Klauck

Theory of Computing. Lecture 7 MAS 714 Hartmut Klauck Theory of Computing Lecture 7 MAS 714 Hartmut Klauck Shortest paths in weighted graphs We are given a graph G (adjacency list with weights W(u,v)) No edge means W(u,v)=1 We look for shortest paths from

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

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

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

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

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

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

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

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

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

Trading Off Space for Passes in Graph Streaming Problems

Trading Off Space for Passes in Graph Streaming Problems Trading Off Space for Pae in Graph Streaming Problem CAMIL DEMETRESCU, IRENE FINOCCHI and ANDREA RIBICHINI Univerità di Roma La Sapienza, Roma, Italy Data tream proceing ha recently received increaing

More information

The Set Constraint/CFL Reachability Connection in Practice

The Set Constraint/CFL Reachability Connection in Practice The Set Contraint/CFL Reachability Connection in Practice John Kodumal EECS Department Univerity of California, Berkeley jkodumal@c.berkeley.edu Alex Aiken Computer Science Department Stanford Univerity

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

Course Updates. Reminders: 1) Assignment #13 due Monday. 2) Mirrors & Lenses. 3) Review for Final: Wednesday, May 5th

Course Updates. Reminders: 1) Assignment #13 due Monday. 2) Mirrors & Lenses. 3) Review for Final: Wednesday, May 5th Coure Update http://www.phy.hawaii.edu/~varner/phys272-spr0/phyic272.html Reminder: ) Aignment #3 due Monday 2) Mirror & Lene 3) Review for Final: Wedneday, May 5th h R- R θ θ -R h Spherical Mirror Infinite

More information

Edits in Xylia Validity Preserving Editing of XML Documents

Edits in Xylia Validity Preserving Editing of XML Documents dit in Xylia Validity Preerving diting of XML Document Pouria Shaker, Theodore S. Norvell, and Denni K. Peter Faculty of ngineering and Applied Science, Memorial Univerity of Newfoundland, St. John, NFLD,

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

Size Balanced Tree. Chen Qifeng (Farmer John) Zhongshan Memorial Middle School, Guangdong, China. December 29, 2006.

Size Balanced Tree. Chen Qifeng (Farmer John) Zhongshan Memorial Middle School, Guangdong, China. December 29, 2006. Size Balanced Tree Chen Qifeng (Farmer John) Zhonghan Memorial Middle School, Guangdong, China Email:44687@QQ.com December 9, 006 Abtract Thi paper preent a unique trategy for maintaining balance in dynamically

More information

Floating Point CORDIC Based Power Operation

Floating Point CORDIC Based Power Operation Floating Point CORDIC Baed Power Operation Kazumi Malhan, Padmaja AVL Electrical and Computer Engineering Department School of Engineering and Computer Science Oakland Univerity, Rocheter, MI e-mail: kmalhan@oakland.edu,

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

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

The norm Package. November 15, Title Analysis of multivariate normal datasets with missing values

The norm Package. November 15, Title Analysis of multivariate normal datasets with missing values The norm Package November 15, 2003 Verion 1.0-9 Date 2002/05/06 Title Analyi of multivariate normal dataet with miing value Author Ported to R by Alvaro A. Novo . Original by Joeph

More information

Now consider the following situation after deleting three elements from the queue...

Now consider the following situation after deleting three elements from the queue... Scheme of valuvation -1I Subject & Code : Data Structure and Application (15CS33) NOTE: ANSWER All FIVE QUESTIONS 1 Explain the diadvantage of linear queue and how it i olved in circular queue. Explain

More information

Bottom Up parsing. Bottom-up parsing. Steps in a shift-reduce parse. 1. s. 2. np. john. john. john. walks. walks.

Bottom Up parsing. Bottom-up parsing. Steps in a shift-reduce parse. 1. s. 2. np. john. john. john. walks. walks. Paring Technologie Outline Paring Technologie Outline Bottom Up paring Paring Technologie Paring Technologie Bottom-up paring Step in a hift-reduce pare top-down: try to grow a tree down from a category

More information

Using Partial Evaluation in Distributed Query Evaluation

Using Partial Evaluation in Distributed Query Evaluation A X x Z z R r y Y B Uing Partial Evaluation in Ditributed Query Evaluation Peter Buneman Gao Cong Univerity of Edinburgh Wenfei Fan Univerity of Edinburgh & Bell Laboratorie Anataio Kementietidi Univerity

More information

CENTER-POINT MODEL OF DEFORMABLE SURFACE

CENTER-POINT MODEL OF DEFORMABLE SURFACE CENTER-POINT MODEL OF DEFORMABLE SURFACE Piotr M. Szczypinki Iintitute of Electronic, Technical Univerity of Lodz, Poland Abtract: Key word: Center-point model of deformable urface for egmentation of 3D

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

Refining SIRAP with a Dedicated Resource Ceiling for Self-Blocking

Refining SIRAP with a Dedicated Resource Ceiling for Self-Blocking Refining SIRAP with a Dedicated Reource Ceiling for Self-Blocking Mori Behnam, Thoma Nolte Mälardalen Real-Time Reearch Centre P.O. Box 883, SE-721 23 Väterå, Sweden {mori.behnam,thoma.nolte}@mdh.e ABSTRACT

More information

Maneuverable Relays to Improve Energy Efficiency in Sensor Networks

Maneuverable Relays to Improve Energy Efficiency in Sensor Networks Maneuverable Relay to Improve Energy Efficiency in Senor Network Stephan Eidenbenz, Luka Kroc, Jame P. Smith CCS-5, MS M997; Lo Alamo National Laboratory; Lo Alamo, NM 87545. Email: {eidenben, kroc, jpmith}@lanl.gov

More information

Policy-based Injection of Private Traffic into a Public SDN Testbed

Policy-based Injection of Private Traffic into a Public SDN Testbed Intitut für Techniche Informatik und Kommunikationnetze Adrian Friedli Policy-baed Injection of Private Traffic into a Public SDN Tetbed Mater Thei MA-2013-12 Advior: Dr. Bernhard Ager, Vaileio Kotroni

More information

(12) Patent Application Publication (10) Pub. No.: US 2011/ A1

(12) Patent Application Publication (10) Pub. No.: US 2011/ A1 (19) United State US 2011 0316690A1 (12) Patent Application Publication (10) Pub. No.: US 2011/0316690 A1 Siegman (43) Pub. Date: Dec. 29, 2011 (54) SYSTEMAND METHOD FOR IDENTIFYING ELECTRICAL EQUIPMENT

More information

ALIASING AND ALPHA Introduction to Graphics, Lecture 3. Anthony Steed , Jan Kautz

ALIASING AND ALPHA Introduction to Graphics, Lecture 3. Anthony Steed , Jan Kautz ALIASING AND ALPHA 2011 Introduction to Graphic, Lecture 3 Anthony Steed 2000-2006, Jan Kautz 2007 2012 Overview Plotting Pixel Aliaing Anti-aliaing Alpha Value Image Compoition Rule Porter-Duff Super-Sampling

More information

Quadrilaterals. Learning Objectives. Pre-Activity

Quadrilaterals. Learning Objectives. Pre-Activity Section 3.4 Pre-Activity Preparation Quadrilateral Intereting geometric hape and pattern are all around u when we tart looking for them. Examine a row of fencing or the tiling deign at the wimming pool.

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

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

Minimum Energy Reliable Paths Using Unreliable Wireless Links

Minimum Energy Reliable Paths Using Unreliable Wireless Links Minimum Energy Reliable Path Uing Unreliable Wirele Link Qunfeng Dong Department of Computer Science Univerity of Wiconin-Madion Madion, Wiconin 53706 qunfeng@c.wic.edu Micah Adler Department of Computer

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

CS 561, Lecture 9. Jared Saia University of New Mexico

CS 561, Lecture 9. Jared Saia University of New Mexico CS 561, Lecture 9 Jared Saia University of New Mexico Today s Outline Minimum Spanning Trees Safe Edge Theorem Kruskal and Prim s algorithms Graph Representation 1 Graph Definition A graph is a pair of

More information

Single Source Shortest Path (SSSP) Problem

Single Source Shortest Path (SSSP) Problem Single Source Shortest Path (SSSP) Problem Single Source Shortest Path Problem Input: A directed graph G = (V, E); an edge weight function w : E R, and a start vertex s V. Find: for each vertex u V, δ(s,

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

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

So we find a sample mean but what can we say about the General Education Statistics

So we find a sample mean but what can we say about the General Education Statistics So we fid a ample mea but what ca we ay about the Geeral Educatio Statitic populatio? Cla Note Cofidece Iterval for Populatio Mea (Sectio 9.) We will be doig early the ame tuff a we did i the firt ectio

More information

Fast Approximation Algorithms for the Diameter and Radius of Sparse Graphs

Fast Approximation Algorithms for the Diameter and Radius of Sparse Graphs Fat Approximation Algorithm for the Diameter and Radiu of Spare Graph Liam Roditty Bar Ilan Univerity liam.roditty@biu.ac.il Virginia Vailevka William UC Berkeley and Stanford Univerity virgi@eec.berkeley.edu

More information

Optimal Gossip with Direct Addressing

Optimal Gossip with Direct Addressing Optimal Goip with Direct Addreing Bernhard Haeupler Microoft Reearch 1065 La Avenida, Mountain View Mountain View, CA 94043 haeupler@c.cmu.edu Dahlia Malkhi Microoft Reearch 1065 La Avenida, Mountain View

More information

Modeling of underwater vehicle s dynamics

Modeling of underwater vehicle s dynamics Proceeding of the 11th WEA International Conference on YTEM, Agio Nikolao, Crete Iland, Greece, July 23-25, 2007 44 Modeling of underwater vehicle dynamic ANDRZEJ ZAK Department of Radiolocation and Hydrolocation

More information

Representations and Transformations. Objectives

Representations and Transformations. Objectives Repreentation and Tranformation Objective Derive homogeneou coordinate tranformation matrice Introduce tandard tranformation - Rotation - Tranlation - Scaling - Shear Scalar, Point, Vector Three baic element

More information

Analyzing Hydra Historical Statistics Part 2

Analyzing Hydra Historical Statistics Part 2 Analyzing Hydra Hitorical Statitic Part Fabio Maimo Ottaviani EPV Technologie White paper 5 hnode HSM Hitorical Record The hnode i the hierarchical data torage management node and ha to perform all the

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

Distance Optimal Formation Control on Graphs with a Tight Convergence Time Guarantee

Distance Optimal Formation Control on Graphs with a Tight Convergence Time Guarantee Ditance Optimal Formation Control on Graph with a Tight Convergence Time Guarantee Jingjin Yu Steven M. LaValle Abtract For the tak of moving a et of inditinguihable agent on a connected graph with unit

More information

Solutions by Artem Gritsenko, Ahmedul Kabir, Yun Lu, and Prof. Ruiz Problem I. By Artem Gritsenko, Yun Lu, and Prof. Ruiz

Solutions by Artem Gritsenko, Ahmedul Kabir, Yun Lu, and Prof. Ruiz Problem I. By Artem Gritsenko, Yun Lu, and Prof. Ruiz CS3 Algorithm. B Term 3. Homework 5 Soltion Soltion b Artem Gritenko, Ahmedl Kabir, Yn L, and Prof. Riz Problem I. B Artem Gritenko, Yn L, and Prof. Riz a. Algorithm. KNAPSACK (,,,,,,, ) # i the knapack

More information

Performance Evaluation of an Advanced Local Search Evolutionary Algorithm

Performance Evaluation of an Advanced Local Search Evolutionary Algorithm Anne Auger and Nikolau Hanen Performance Evaluation of an Advanced Local Search Evolutionary Algorithm Proceeding of the IEEE Congre on Evolutionary Computation, CEC 2005 c IEEE Performance Evaluation

More information

from notes written mostly by Dr. Carla Savage: All Rights Reserved

from notes written mostly by Dr. Carla Savage: All Rights Reserved CSC 505, Fall 2000: Week 9 Objectives: learn about various issues related to finding shortest paths in graphs learn algorithms for the single-source shortest-path problem observe the relationship among

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

Control Flow Analysis

Control Flow Analysis Control Flow Analyi Efficiency Control Flow Analyi Type an Effect ytem Data Flow Analyi Abtract Interpretation Correctne Control Flow Analyi p.1/35 Control Flow Analyi Flow information i eential for the

More information

Growing Networks Through Random Walks Without Restarts

Growing Networks Through Random Walks Without Restarts Growing Network Through Random Walk Without Retart Bernardo Amorim, Daniel Figueiredo, Giulio Iacobelli, Giovanni Neglia To cite thi verion: Bernardo Amorim, Daniel Figueiredo, Giulio Iacobelli, Giovanni

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