ne a priority queue for the nodes of G; ile (! PQ.is empty( )) select u PQ with d(u) minimal and remove it; I Informatik 1 Kurt Mehlhorn

Size: px
Start display at page:

Download "ne a priority queue for the nodes of G; ile (! PQ.is empty( )) select u PQ with d(u) minimal and remove it; I Informatik 1 Kurt Mehlhorn"

Transcription

1 n-negative Edge Costs: optimal choice: u U with d(u) minimal. e use a priority queue (de nition on next slide) PQ to maintain the set of pairs, d(u)) ; u U } and obtain Dijkstra s Algorithm: ne a priority queue for the nodes of G; init s) = 0; d(v) = for v s;.insert(s, 0); ile (! PQ.is empty( )) select u PQ with d(u) minimal and remove it; delete min forall edges e = (u,v) { if ( D = d(u) + c(e) <d(v) ) { if ( d(v) == ) { PQ.insert(v, D); } else { PQ.decrease p(v, D); } } } d(v) = D; me = O(n + m) + init + n (is empty + delete min + insert) + m decrease p I Informatik 1 Kurt Mehlhorn

2 Priority Queues, The LEDA De nition of the ADT instance Q of the parameterized data type p queue<p, I > is a collection of priority eue nodes. An (abstract) pointer to a priority queue node is called an priority queue m. (type pq item). Every node contains a priority from a linearly ordered type P nction compare(const P&, const P&)) and an information from an arbitrary type I. e use p, i to denote a pq item with priority p and information i. pq item P I node priority queue = I Informatik 2 Kurt Mehlhorn

3 pq item P I node priority queue = ueue<p, I > Q; creates an instance Q of type p queue<p, I > and initializes it with the empty priority queue. Q.prio(pq item it) Q.inf(pq item it) returns the priority of item it. Precondition: it is an item in Q. returns the information of item it. Precondition: it is an item in Q. item Q.insert(P x, Ii) adds a new item <x, i> to Q and returns it. I Informatik 2 Kurt Mehlhorn

4 pq item P I node priority queue = item Q. nd min( ) returns an item with minimal priority (nil if Q is empty). Q.del min( ) removes the item it = Q. nd min() from Q and returns the priority of it. Precondition: Q is not empty. id Q.decrease p(pq item it, Px) makes x the new priority of item it. Precondition: it is an item in Q and x is not larger then prio(it). ol Q.empty( ) returns true, if Q is empty, false otherwise. I Informatik 2 Kurt Mehlhorn

5 The Use of Priority Queues in Dijkstra s Algorithm p_queue<int,node>& PQ; node_array<pq_item> I(G); node v; edge e; forall_nodes(v,g) pred[v] = nil; dist[s] = 0; I[s] = PQ.insert(0,s); while (! PQ.empty()) { pq_item it = PQ.find_min(); node u = PQ.inf(it); int du = dist[u]; } forall_out_edges(e,u) { v = G.target(e); int c = du + cost[e]; if ( v!= s && ( pred[v] == nil c < dist[v] )) { if (pred[v] == nil) I[v] = PQ.insert(c,v); else PQ.decrease_p(I[v],c); dist[v] = c; pred[v] = e; } } PQ.del_item(it); I Informatik 5 Kurt Mehlhorn

6 Priority Queues: The List Implementation ore the pairs in the queue in a linear list (list< pair<p, I >>), a pq item is a pointer to a t element. e operations on priority queues are realized as follows: t: create an empty list, time O(1). empty: check whether the list is empty, time O(1). ert(p, i): add a list element (p, i) and return a pointer to it, time O(1). dmin( ): search through the list and return a pointer to the element with the smallest iority, time O(size). crease p(it, p): decrease the priority in the list element pointed to by it, time O(1). l item(it): delete the list element pointed to by it, time O(1). eorem 1 With the list implementation of priority queues, Dijkstra s algorithm runs in e O(m + n 2 ). (good for almost complete graphs, m n 2 ) I Informatik 6 Kurt Mehlhorn

7 Priority Queues: The Heap Implementation eorem 2 With the heap implementation of priority queues, Dijkstra s algorithm runs time O(m log n + n log n). Priority Queues: Radix Heaps eorem 3 With the Radix heap implementation of priority queues, Dijkstra s algorithm ns in time O(m + n log C). This assumes that edge costs are integers in the range.. C]. Priority Queues: Fibonacci Heaps eorem 4 With the Fibonacci heap implementation of priority queues, Dijkstra s orithm runs in time O(m + n log n). Further Priority Queue Implementations Amortized Time Bounds: General Results I Informatik 7 Kurt Mehlhorn

8 Shortest Paths, Arbitrary Edge Costs eorem 5 (Bellman-Ford algorithm) The Bellman-Ford algorithm solves the shortest th problem in time O(nm). e use the generic algorithm and relax the edges in round robin fashion. s) = 0; d(v) = for v s; ( n times ) { forall edges e = (u,v) E in some arbitrary order { if ( d(u) + c(e) <d(v) ) d(v) = d(u) + c(e); } stop, if no distance label changed; } t d(x) to for all x that can be reached from the target node of a red edge. If µ(v) > and there is a shortest path from s to v consisting of k edges then d(v) = µ(v) after the k-th iteration of the outer loop. Observe k < n. Running time is O(nm). If there is no negative cycle, it is O((1 + k max )m), if there is a negative cycle, it is (nm). correctness in the presence of negative cycles: see next slide I Informatik 8 Kurt Mehlhorn

9 Correctness of Bellman-Ford µ(v) > and there is a shortest path from s to v consisting of k edges then v) = µ(v) after the k-th iteration of the outer loop. Observe k < n. us d(v) = µ(v) after termination of the do-loop if µ(v) IR {+ }. assume µ(v) =. Then there is a path from s to v containing a negative cycle. At st one edge of this path is red at all times and hence d(v) is set to. nversely, if d(v) is set to, there is an edge (x, y) which is red after termination of do-loop and such that v is reachable from y. e red edge allows to decrease d(y) further and hence d(y) µ(y) when the do-loop minates. us µ(y) = by the rst paragraph. nce v is reachable from y, we also have µ(v) =. I Informatik 9 Kurt Mehlhorn

10 Shortest Paths, Arbitrary Edge Costs ternative Implementation of Bellman-Ford: We use the revised generic algorithm d avoid to relax edges that are known to be black. s) = 0; d(v) = for v s; U ={s}; U next = ; ( n times ) { forall u U and all edges e = (u,v) E { if (d(u) + c(e) <d(v)) { d(v) = d(u) + c(e); add v to U next ; }} if ( U next == ) { break; } else { U = U next ; U next = ; } } t d(x) to for all x that can be reached from the target node of a red edge. rst case performance is the same, but practical performance is much better, e.g., = 10000, m = 40000, random graph, random positive edge weights orithm above: 0.07 seconds eceding algorithm: 0.25 seconds rform your own experiments with shortest_path_time.c. I Informatik 10 Kurt Mehlhorn

11 Early Detection of Negative Cycles and Re ned U assume µ(v) < + for simplicity (see book for general case). maintain a rooted tree T with root s (initially T ={s}) for every node v T : tree path from s to v has cost d(v) for every node v T : µ(v) < d(v). U is organized as a queue; only leaves of T are in U. when an edge e = (u,v)is relaxed and d(v) is decreased to d(u) + c(e). v T : make v a child of u in T and add v to U. v T and v is not an ancestor of u: make v a child of u and add v to U. Remove all descendants of v from T and U. v T and v is an ancestor of u: we have discovered a negative cycle and all nodes reachable from v have distance. u correctness: it suf ces to keep those nodes u in U which have an outgoing red edge and satisfy d(u) = µ(u). I Informatik 11 Kurt Mehlhorn

12 Random Graphs with Non-Negative Edge Weights nerate m random edges (here m = 8n) and assign a random integer weight in [0.. C] r some C (here C = 1000). BASIC = basic version of Bellman-Ford llman Ford = early detection of neg cycles and re ned treatment of U. n BF Basic Bellman Ford Dijkstra Checking nning time seems to grow only slightly superlinearly. ax is small for random graphs with random edge weights. allenge: Prove it or do a serious experimental study. For complete graphs it is known t k max = O(log n). (Cooper/Frieze/M/Priebe: Random Structures and Algorithms, 00, 33 46). In this PhD-thesis, Priebe extends the result to random graphs with (n log n) edges I Informatik 12 Kurt Mehlhorn

13 Graphs with Negative Edges but no Negative Cycles generate a (random) graph assign a (random) non-negative (!!!) weight to every edge. assign a (random) potential to every node. set cost of e = (u,v) according to: c(e) = pot(u) + w(e) pot(v). mma 1 This rule does not generate negative cycles. oof: The cost of a cycle with respect to c is the same as with respect to w. n BF Basic Bellman Ford Dijkstra Checking Running times are as on preceding slide. Dijkstra is not applicable. I Informatik 13 Kurt Mehlhorn

14 Random Graphs with Random Edge Weights = 8n, random edge weights in [ ]. ch graphs are likely to have negative cycles n BF Basic Bellman Ford Dijkstra Checking Basic has running time (nm), i.e., ubling n approximately quadruples the running time (since m = 8n). re ned version discovers negative cycles early and is much faster. I Informatik 14 Kurt Mehlhorn

15 A Worst Case Input for Bellman-Ford want that many nodes are dequeued (n) times. Bellman-Ford does essentially breadth- rst search, i.e., discovers paths in the order of their cardinality. if paths of larger cardinality are shorter, nodes will be queued and dequeued many times (give edges length 1). s v our graph consists of two parts. left part is acyclic, has L = 2 l nodes, < 2L edges, all edges have cost 1, and there is a path of cardinality r from s to v for every r, 1 r < L. right part is a complete graph on K nodes, all K 2 edges have cost zero. v is queued L 1 times. Whenever v is dequeued, all nodes in the right part will be queued and in the next round dequeued. running time is (LK 2 ). choose K m and L n. Then O(n) nodes and O(n + m) edges. I Informatik 15 Kurt Mehlhorn

16 Worst Case Example: Recursive Construction of Left Part G1 = G(l+1) = G(l) has L = 2 l nodes and m l = m l 1 + L/ l+1 edges. aim: For any r, 1 r < L, there is exactly one path from rst to last node consisting r edges. oof: r = 1: Jump from s to last node of G l 1 + r, where 1 r < L/2: Jump from s to rst node of G l 1 and use induction. L/2 + r, where 1 r < L/2: Walk slowly from s to the rst node of G l 1 and use uction. I Informatik 16 Kurt Mehlhorn

17 Worst Case Example: Experiments have made edges in rst-part non-negative: (i, j) has cost j i 1. th of cardinality k from node 0 to node L 1 has cost L 1 k and hence longer ths are favored. 8n n BF Basic Bellman Ford Dijkstra Checking Basic has running time (nm), i.e., ubling n approximately quadruples the running time (since m = 8n). re ned version has running (LK) = (n m), since the nodes in the complete aph are removed from the queue without scanning their outgoing edges, running time is ltiplied by about , when n is doubled. jkstra is much, much faster. I Informatik 17 Kurt Mehlhorn

18 All Pairs Shortest Path, Potential Functions naive approach: solve n single source problems, time O(n 2 m) re ned approach: one general single source problem plus n non-negative single source problems, time O(nm + n(m + n log n) = O(nm + n 2 log n). node potential assigns a number pot(v) to each vertex v. For an edge e = (v, w) de ne reduced cost as: c(e) = pot(v) + c(e) pot(w) nsider a path p = [e 0,...,e k 1 ] and let e i = (v i,v i+1 ). Then c(p) = c(e i ) = (pot(v i ) + c(e i ) pot(v i+1 )) 0 i<k = pot(v 0 ) + 0 i<k 0 i<k c(e i ) pot(v k ) = pot(v 0 ) + c(p) pot(v k ), nsequence: If p and q are two paths from v to w. Then c( p) c(q) iff c( p) c(q). ortest paths with respect to c are the same as with respect to c. I Informatik 18 Kurt Mehlhorn

19 All Pair Shortest Paths: Algorithm sumptions: G has no negative cycles. (MPSS have recently generalized) particularly nice potential function: Let pot(v) = µ(s,v)and assume that all nodes n be reached from s. Then µ(s,v)is nite for all v and hence reduced edge costs are well de ned. Reduced costs are non-negative: For e = (v, w), we have µ(v) + c(e) µ(w) and hence c(e) = µ(s,v)+ c(e) µ(s,w) 0. gorithm: Add a new node s and edges (s,v)of length zero for all v (no new cycles!!). Compute µ(s,v)for all v with Bellman-Ford: Set pot(v) = µ(s,v)and compute reduced costs: time O(nm). time O(m). for every node x solve single source problem with source x and reduced edge costs (Dijkstra): time O(n(m + n log n)). translate distance back to original cost function: µ(v, w) = µ(v, w) + pot(w) pot(v) time O(m) I Informatik 19 Kurt Mehlhorn

Breadth First Search, Dijkstra s Algorithm for Shortest Paths

Breadth First Search, Dijkstra s Algorithm for Shortest Paths CS 374: Algorithms & Models of Computation, Spring 2017 Breadth First Search, Dijkstra s Algorithm for Shortest Paths Lecture 17 March 1, 2017 Chandra Chekuri (UIUC) CS374 1 Spring 2017 1 / 42 Part I Breadth

More information

Design and Analysis of Algorithms

Design and Analysis of Algorithms Design and Analysis of Algorithms CSE 5311 Lecture 21 Single-Source Shortest Paths Junzhou Huang, Ph.D. Department of Computer Science and Engineering CSE5311 Design and Analysis of Algorithms 1 Single-Source

More information

Single Source Shortest Paths

Single Source Shortest Paths CMPS 00 Fall 017 Single Source Shortest Paths Carola Wenk Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk Paths in graphs Consider a digraph G = (V, E) with an edge-weight

More information

CMPS 6610 Fall 2018 Shortest Paths Carola Wenk

CMPS 6610 Fall 2018 Shortest Paths Carola Wenk CMPS 6610 Fall 018 Shortest Paths Carola Wenk Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk Paths in graphs Consider a digraph G = (V, E) with an edge-weight function w

More information

Shortest Path Algorithms

Shortest Path Algorithms Shortest Path Algorithms Andreas Klappenecker [based on slides by Prof. Welch] 1 Single Source Shortest Path 2 Single Source Shortest Path Given: a directed or undirected graph G = (V,E) a source node

More information

CS 4407 Algorithms Lecture: Shortest Path Algorithms

CS 4407 Algorithms Lecture: Shortest Path Algorithms CS 440 Algorithms Lecture: Shortest Path Algorithms Prof. Gregory Provan Department of Computer Science University College Cork 1 Outline Shortest Path Problem General Lemmas and Theorems. Algorithms Bellman-Ford

More information

Dynamic Programming: Shortest Paths and DFA to Reg Exps

Dynamic Programming: Shortest Paths and DFA to Reg Exps CS 374: Algorithms & Models of Computation, Spring 207 Dynamic Programming: Shortest Paths and DFA to Reg Exps Lecture 8 March 28, 207 Chandra Chekuri (UIUC) CS374 Spring 207 / 56 Part I Shortest Paths

More information

Dynamic Programming: Shortest Paths and DFA to Reg Exps

Dynamic Programming: Shortest Paths and DFA to Reg Exps CS 374: Algorithms & Models of Computation, Fall 205 Dynamic Programming: Shortest Paths and DFA to Reg Exps Lecture 7 October 22, 205 Chandra & Manoj (UIUC) CS374 Fall 205 / 54 Part I Shortest Paths with

More information

Discrete Wiskunde II. Lecture 5: Shortest Paths & Spanning Trees

Discrete Wiskunde II. Lecture 5: Shortest Paths & Spanning Trees , 2009 Lecture 5: Shortest Paths & Spanning Trees University of Twente m.uetz@utwente.nl wwwhome.math.utwente.nl/~uetzm/dw/ Shortest Path Problem "#$%&'%()*%"()$#+,&- Given directed "#$%&'()*+,%+('-*.#/'01234564'.*,'7+"-%/8',&'5"4'84%#3

More information

Single Source Shortest Paths

Single Source Shortest Paths CMPS 00 Fall 015 Single Source Shortest Paths Carola Wenk Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk 1 Paths in graphs Consider a digraph G = (V, E) with an edge-weight

More information

Discrete Optimization 2010 Lecture 2 Matroids & Shortest Paths

Discrete Optimization 2010 Lecture 2 Matroids & Shortest Paths Matroids Shortest Paths Discrete Optimization 2010 Lecture 2 Matroids & Shortest Paths Marc Uetz University of Twente m.uetz@utwente.nl Lecture 2: sheet 1 / 25 Marc Uetz Discrete Optimization Matroids

More information

Slides credited from Hsueh-I Lu & Hsu-Chun Hsiao

Slides credited from Hsueh-I Lu & Hsu-Chun Hsiao Slides credited from Hsueh-I Lu & Hsu-Chun Hsiao Homework 3 released Due on 12/13 (Thur) 14:20 (one week only) Mini-HW 9 released Due on 12/13 (Thur) 14:20 Homework 4 released Due on 1/3 (Thur) 14:20 (four

More information

Analysis of Algorithms. Outline. Single Source Shortest Path. Andres Mendez-Vazquez. November 9, Notes. Notes

Analysis of Algorithms. Outline. Single Source Shortest Path. Andres Mendez-Vazquez. November 9, Notes. Notes Analysis of Algorithms Single Source Shortest Path Andres Mendez-Vazquez November 9, 01 1 / 108 Outline 1 Introduction Introduction and Similar Problems General Results Optimal Substructure Properties

More information

Dijkstra s Single Source Shortest Path Algorithm. Andreas Klappenecker

Dijkstra s Single Source Shortest Path Algorithm. Andreas Klappenecker Dijkstra s Single Source Shortest Path Algorithm Andreas Klappenecker Single Source Shortest Path Given: a directed or undirected graph G = (V,E) a source node s in V a weight function w: E -> R. Goal:

More information

Breadth-First Search of Graphs

Breadth-First Search of Graphs Breadth-First Search of Graphs Analysis of Algorithms Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Applications of Breadth-First Search of Graphs a) Single Source

More information

Algorithms: Lecture 12. Chalmers University of Technology

Algorithms: Lecture 12. Chalmers University of Technology Algorithms: Lecture 1 Chalmers University of Technology Today s Topics Shortest Paths Network Flow Algorithms Shortest Path in a Graph Shortest Path Problem Shortest path network. Directed graph G = (V,

More information

A faster algorithm for the single source shortest path problem with few distinct positive lengths

A faster algorithm for the single source shortest path problem with few distinct positive lengths A faster algorithm for the single source shortest path problem with few distinct positive lengths J. B. Orlin, K. Madduri, K. Subramani, and M. Williamson Journal of Discrete Algorithms 8 (2010) 189 198.

More information

8 Priority Queues. 8 Priority Queues. Prim s Minimum Spanning Tree Algorithm. Dijkstra s Shortest Path Algorithm

8 Priority Queues. 8 Priority Queues. Prim s Minimum Spanning Tree Algorithm. Dijkstra s Shortest Path Algorithm 8 Priority Queues 8 Priority Queues A Priority Queue S is a dynamic set data structure that supports the following operations: S. build(x 1,..., x n ): Creates a data-structure that contains just the elements

More information

CMPS 2200 Fall Carola Wenk Slides courtesy of Charles Leiserson with small changes by Carola Wenk. 10/8/12 CMPS 2200 Intro.

CMPS 2200 Fall Carola Wenk Slides courtesy of Charles Leiserson with small changes by Carola Wenk. 10/8/12 CMPS 2200 Intro. CMPS 00 Fall 01 Single Source Shortest Paths Carola Wenk Slides courtesy of Charles Leiserson with small changes by Carola Wenk 1 Paths in graphs Consider a digraph G = (V, E) with edge-weight function

More information

The Maximum Flow Problem

The Maximum Flow Problem The Maximum Flow Problem put: a directed graph G =(V,E), source node s V, sink node t V edge capacities cap : E IR 0 s 1/0 1/1 1/1 t 2/2 2/1 oal: compute a flow of maximal value, i.e., a function f : E

More information

CSCE 750 Final Exam Answer Key Wednesday December 7, 2005

CSCE 750 Final Exam Answer Key Wednesday December 7, 2005 CSCE 750 Final Exam Answer Key Wednesday December 7, 2005 Do all problems. Put your answers on blank paper or in a test booklet. There are 00 points total in the exam. You have 80 minutes. Please note

More information

CS 6301 PROGRAMMING AND DATA STRUCTURE II Dept of CSE/IT UNIT V GRAPHS

CS 6301 PROGRAMMING AND DATA STRUCTURE II Dept of CSE/IT UNIT V GRAPHS UNIT V GRAPHS Representation of Graphs Breadth-first search Depth-first search Topological sort Minimum Spanning Trees Kruskal and Prim algorithm Shortest path algorithm Dijkstra s algorithm Bellman-Ford

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 7 Greedy Graph Algorithms Shortest paths Minimum Spanning Tree Sofya Raskhodnikova 9/14/016 S. Raskhodnikova; based on slides by E. Demaine, C. Leiserson, A. Smith,

More information

Chapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Chapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. Chapter 4 Greedy Algorithms Slides by Kevin Wayne. Copyright Pearson-Addison Wesley. All rights reserved. 4 4.1 Interval Scheduling Interval Scheduling Interval scheduling. Job j starts at s j and finishes

More information

Shortest Paths. CS 320, Fall Dr. Geri Georg, Instructor 320 ShortestPaths 3

Shortest Paths. CS 320, Fall Dr. Geri Georg, Instructor 320 ShortestPaths 3 Shortest Paths CS 320, Fall 2017 Dr. Geri Georg, Instructor georg@colostate.edu 320 ShortestPaths 3 Preliminaries Weighted, directed graphs Weight function: maps edges to real numbers Shortest path weight:

More information

Analysis of Algorithms. Outline 1 Introduction Basic Definitions Ordered Trees. Fibonacci Heaps. Andres Mendez-Vazquez. October 29, Notes.

Analysis of Algorithms. Outline 1 Introduction Basic Definitions Ordered Trees. Fibonacci Heaps. Andres Mendez-Vazquez. October 29, Notes. Analysis of Algorithms Fibonacci Heaps Andres Mendez-Vazquez October 29, 2015 1 / 119 Outline 1 Introduction Basic Definitions Ordered Trees 2 Binomial Trees Example 3 Fibonacci Heap Operations Fibonacci

More information

Fibonacci Heaps These lecture slides are adapted from CLRS, Chapter 20.

Fibonacci Heaps These lecture slides are adapted from CLRS, Chapter 20. Fibonacci Heaps These lecture slides are adapted from CLRS, Chapter 20. Princeton University COS 4 Theory of Algorithms Spring 2002 Kevin Wayne Priority Queues Operation mae-heap insert find- delete- union

More information

Introduction to Algorithms

Introduction to Algorithms Introduction to Algorithms, Lecture 5 // Introduction to Algorithms 6.46J/.4J LECTURE Shortest Paths I Properties o shortest paths Dijkstra s Correctness Analysis Breadth-irst Pro. Manolis Kellis March,

More information

Chapter 5 Data Structures Algorithm Theory WS 2017/18 Fabian Kuhn

Chapter 5 Data Structures Algorithm Theory WS 2017/18 Fabian Kuhn Chapter 5 Data Structures Algorithm Theory WS 2017/18 Fabian Kuhn Priority Queue / Heap Stores (key,data) pairs (like dictionary) But, different set of operations: Initialize-Heap: creates new empty heap

More information

Discrete Optimization 2010 Lecture 3 Maximum Flows

Discrete Optimization 2010 Lecture 3 Maximum Flows Remainder: Shortest Paths Maximum Flows Discrete Optimization 2010 Lecture 3 Maximum Flows Marc Uetz University of Twente m.uetz@utwente.nl Lecture 3: sheet 1 / 29 Marc Uetz Discrete Optimization Outline

More information

CS781 Lecture 3 January 27, 2011

CS781 Lecture 3 January 27, 2011 CS781 Lecture 3 January 7, 011 Greedy Algorithms Topics: Interval Scheduling and Partitioning Dijkstra s Shortest Path Algorithm Minimum Spanning Trees Single-Link k-clustering Interval Scheduling Interval

More information

Design and Analysis of Algorithms

Design and Analysis of Algorithms Design and Analysis of Algorithms CSE 5311 Lecture 22 All-Pairs Shortest Paths Junzhou Huang, Ph.D. Department of Computer Science and Engineering CSE5311 Design and Analysis of Algorithms 1 All Pairs

More information

CSE 431/531: Analysis of Algorithms. Dynamic Programming. Lecturer: Shi Li. Department of Computer Science and Engineering University at Buffalo

CSE 431/531: Analysis of Algorithms. Dynamic Programming. Lecturer: Shi Li. Department of Computer Science and Engineering University at Buffalo CSE 431/531: Analysis of Algorithms Dynamic Programming Lecturer: Shi Li Department of Computer Science and Engineering University at Buffalo Paradigms for Designing Algorithms Greedy algorithm Make a

More information

6.889 Lecture 4: Single-Source Shortest Paths

6.889 Lecture 4: Single-Source Shortest Paths 6.889 Lecture 4: Single-Source Shortest Paths Christian Sommer csom@mit.edu September 19 and 26, 2011 Single-Source Shortest Path SSSP) Problem: given a graph G = V, E) and a source vertex s V, compute

More information

Fundamental Algorithms 11

Fundamental Algorithms 11 Technische Universität München WS 2013/14 Institut für Informatik Worksheet Scientific Computing in Computer Science 20.01.2014 Fundamental Algorithms 11 Exercise 1 Hypergraphs A hypergraph extends the

More information

Part V. Matchings. Matching. 19 Augmenting Paths for Matchings. 18 Bipartite Matching via Flows

Part V. Matchings. Matching. 19 Augmenting Paths for Matchings. 18 Bipartite Matching via Flows Matching Input: undirected graph G = (V, E). M E is a matching if each node appears in at most one Part V edge in M. Maximum Matching: find a matching of maximum cardinality Matchings Ernst Mayr, Harald

More information

Undirected Graphs. V = { 1, 2, 3, 4, 5, 6, 7, 8 } E = { 1-2, 1-3, 2-3, 2-4, 2-5, 3-5, 3-7, 3-8, 4-5, 5-6 } n = 8 m = 11

Undirected Graphs. V = { 1, 2, 3, 4, 5, 6, 7, 8 } E = { 1-2, 1-3, 2-3, 2-4, 2-5, 3-5, 3-7, 3-8, 4-5, 5-6 } n = 8 m = 11 Undirected Graphs Undirected graph. G = (V, E) V = nodes. E = edges between pairs of nodes. Captures pairwise relationship between objects. Graph size parameters: n = V, m = E. V = {, 2, 3,,,, 7, 8 } E

More information

Contents Lecture 4. Greedy graph algorithms Dijkstra s algorithm Prim s algorithm Kruskal s algorithm Union-find data structure with path compression

Contents Lecture 4. Greedy graph algorithms Dijkstra s algorithm Prim s algorithm Kruskal s algorithm Union-find data structure with path compression Contents Lecture 4 Greedy graph algorithms Dijkstra s algorithm Prim s algorithm Kruskal s algorithm Union-find data structure with path compression Jonas Skeppstedt (jonasskeppstedt.net) Lecture 4 2018

More information

Introduction to Algorithms

Introduction to Algorithms Introduction to Algorithms 6.046J/8.40J/SMA550 Lecture 7 Prof. Erik Demaine Paths in graphs Consider a digraph G = (V, E) with edge-weight function w : E R. The weight of path p = v v L v k is defined

More information

22 Max-Flow Algorithms

22 Max-Flow Algorithms A process cannot be understood by stopping it. Understanding must move with the flow of the process, must join it and flow with it. The First Law of Mentat, in Frank Herbert s Dune (965) There s a difference

More information

Introduction to Algorithms

Introduction to Algorithms Introduction to Algorithms 6.046J/18.401J LECTURE 14 Shortest Paths I Properties of shortest paths Dijkstra s algorithm Correctness Analysis Breadth-first search Prof. Charles E. Leiserson Paths in graphs

More information

Fibonacci (Min-)Heap. (I draw dashed lines in place of of circular lists.) 1 / 17

Fibonacci (Min-)Heap. (I draw dashed lines in place of of circular lists.) 1 / 17 Fibonacci (Min-)Heap A forest of heap-order trees (parent priority child priority). Roots in circular doubly-linked list. Pointer to minimum-priority root. Siblings in circular doubly-linked list; parent

More information

Optimal Tree-decomposition Balancing and Reachability on Low Treewidth Graphs

Optimal Tree-decomposition Balancing and Reachability on Low Treewidth Graphs Optimal Tree-decomposition Balancing and Reachability on Low Treewidth Graphs Krishnendu Chatterjee Rasmus Ibsen-Jensen Andreas Pavlogiannis IST Austria Abstract. We consider graphs with n nodes together

More information

1 Matchings in Non-Bipartite Graphs

1 Matchings in Non-Bipartite Graphs CS 598CSC: Combinatorial Optimization Lecture date: Feb 9, 010 Instructor: Chandra Chekuri Scribe: Matthew Yancey 1 Matchings in Non-Bipartite Graphs We discuss matching in general undirected graphs. Given

More information

Algorithms Booklet. 1 Graph Searching. 1.1 Breadth First Search

Algorithms Booklet. 1 Graph Searching. 1.1 Breadth First Search Algorithms Booklet 2010 Note: in all algorithms, unless stated otherwise, the input graph G is represented by adjacency lists. 1 Graph Searching 1.1 Breadth First Search Algorithm 1: BFS(G, s) Input: G

More information

1 Introduction A priority queue is a data structure that maintains a set of elements and supports operations insert, decrease-key, and extract-min. Pr

1 Introduction A priority queue is a data structure that maintains a set of elements and supports operations insert, decrease-key, and extract-min. Pr Buckets, Heaps, Lists, and Monotone Priority Queues Boris V. Cherkassky Central Econ. and Math. Inst. Krasikova St. 32 117418, Moscow, Russia cher@cemi.msk.su Craig Silverstein y Computer Science Department

More information

Assignment 5: Solutions

Assignment 5: Solutions Comp 21: Algorithms and Data Structures Assignment : Solutions 1. Heaps. (a) First we remove the minimum key 1 (which we know is located at the root of the heap). We then replace it by the key in the position

More information

Chapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Chapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. Chapter 4 Greedy Algorithms Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 1 4.1 Interval Scheduling Interval Scheduling Interval scheduling. Job j starts at s j and

More information

25. Minimum Spanning Trees

25. Minimum Spanning Trees 695 25. Minimum Spanning Trees Motivation, Greedy, Algorithm Kruskal, General Rules, ADT Union-Find, Algorithm Jarnik, Prim, Dijkstra, Fibonacci Heaps [Ottman/Widmayer, Kap. 9.6, 6.2, 6.1, Cormen et al,

More information

25. Minimum Spanning Trees

25. Minimum Spanning Trees Problem Given: Undirected, weighted, connected graph G = (V, E, c). 5. Minimum Spanning Trees Motivation, Greedy, Algorithm Kruskal, General Rules, ADT Union-Find, Algorithm Jarnik, Prim, Dijkstra, Fibonacci

More information

Introduction to Algorithms

Introduction to Algorithms Introduction to Algorithms 6.046J/18.401J LECTURE 17 Shortest Paths I Properties of shortest paths Dijkstra s algorithm Correctness Analysis Breadth-first search Prof. Erik Demaine November 14, 005 Copyright

More information

IS 709/809: Computational Methods in IS Research Fall Exam Review

IS 709/809: Computational Methods in IS Research Fall Exam Review IS 709/809: Computational Methods in IS Research Fall 2017 Exam Review Nirmalya Roy Department of Information Systems University of Maryland Baltimore County www.umbc.edu Exam When: Tuesday (11/28) 7:10pm

More information

Trees. A tree is a graph which is. (a) Connected and. (b) has no cycles (acyclic).

Trees. A tree is a graph which is. (a) Connected and. (b) has no cycles (acyclic). Trees A tree is a graph which is (a) Connected and (b) has no cycles (acyclic). 1 Lemma 1 Let the components of G be C 1, C 2,..., C r, Suppose e = (u, v) / E, u C i, v C j. (a) i = j ω(g + e) = ω(g).

More information

CS60020: Foundations of Algorithm Design and Machine Learning. Sourangshu Bhattacharya

CS60020: Foundations of Algorithm Design and Machine Learning. Sourangshu Bhattacharya CS6000: Foundations of Algorithm Design and Machine Learning Sourangshu Bhattacharya Paths in graphs Consider a digraph G = (V, E) with edge-weight function w : E R. The weight of path p = v 1 v L v k

More information

MA015: Graph Algorithms

MA015: Graph Algorithms MA015 3. Minimum cuts 1 MA015: Graph Algorithms 3. Minimum cuts (in undirected graphs) Jan Obdržálek obdrzalek@fi.muni.cz Faculty of Informatics, Masaryk University, Brno All pairs flows/cuts MA015 3.

More information

A walk over the shortest path: Dijkstra s Algorithm viewed as fixed-point computation

A walk over the shortest path: Dijkstra s Algorithm viewed as fixed-point computation A walk over the shortest path: Dijkstra s Algorithm viewed as fixed-point computation Jayadev Misra 1 Department of Computer Sciences, University of Texas at Austin, Austin, Texas 78712-1188, USA Abstract

More information

Divide-and-Conquer Algorithms Part Two

Divide-and-Conquer Algorithms Part Two Divide-and-Conquer Algorithms Part Two Recap from Last Time Divide-and-Conquer Algorithms A divide-and-conquer algorithm is one that works as follows: (Divide) Split the input apart into multiple smaller

More information

Directed Graphs (Digraphs) and Graphs

Directed Graphs (Digraphs) and Graphs Directed Graphs (Digraphs) and Graphs Definitions Graph ADT Traversal algorithms DFS Lecturer: Georgy Gimel farb COMPSCI 220 Algorithms and Data Structures 1 / 74 1 Basic definitions 2 Digraph Representation

More information

Preliminaries. Graphs. E : set of edges (arcs) (Undirected) Graph : (i, j) = (j, i) (edges) V = {1, 2, 3, 4, 5}, E = {(1, 3), (3, 2), (2, 4)}

Preliminaries. Graphs. E : set of edges (arcs) (Undirected) Graph : (i, j) = (j, i) (edges) V = {1, 2, 3, 4, 5}, E = {(1, 3), (3, 2), (2, 4)} Preliminaries Graphs G = (V, E), V : set of vertices E : set of edges (arcs) (Undirected) Graph : (i, j) = (j, i) (edges) 1 2 3 5 4 V = {1, 2, 3, 4, 5}, E = {(1, 3), (3, 2), (2, 4)} 1 Directed Graph (Digraph)

More information

4.8 Huffman Codes. These lecture slides are supplied by Mathijs de Weerd

4.8 Huffman Codes. These lecture slides are supplied by Mathijs de Weerd 4.8 Huffman Codes These lecture slides are supplied by Mathijs de Weerd Data Compression Q. Given a text that uses 32 symbols (26 different letters, space, and some punctuation characters), how can we

More information

CS675: Convex and Combinatorial Optimization Fall 2014 Combinatorial Problems as Linear Programs. Instructor: Shaddin Dughmi

CS675: Convex and Combinatorial Optimization Fall 2014 Combinatorial Problems as Linear Programs. Instructor: Shaddin Dughmi CS675: Convex and Combinatorial Optimization Fall 2014 Combinatorial Problems as Linear Programs Instructor: Shaddin Dughmi Outline 1 Introduction 2 Shortest Path 3 Algorithms for Single-Source Shortest

More information

CS361 Homework #3 Solutions

CS361 Homework #3 Solutions CS6 Homework # Solutions. Suppose I have a hash table with 5 locations. I would like to know how many items I can store in it before it becomes fairly likely that I have a collision, i.e., that two items

More information

Algorithms and Data Structures 2016 Week 5 solutions (Tues 9th - Fri 12th February)

Algorithms and Data Structures 2016 Week 5 solutions (Tues 9th - Fri 12th February) Algorithms and Data Structures 016 Week 5 solutions (Tues 9th - Fri 1th February) 1. Draw the decision tree (under the assumption of all-distinct inputs) Quicksort for n = 3. answer: (of course you should

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 8 Greedy Algorithms V Huffman Codes Adam Smith Review Questions Let G be a connected undirected graph with distinct edge weights. Answer true or false: Let e be the

More information

Maximum flow problem (part I)

Maximum flow problem (part I) Maximum flow problem (part I) Combinatorial Optimization Giovanni Righini Università degli Studi di Milano Definitions A flow network is a digraph D = (N,A) with two particular nodes s and t acting as

More information

Priority queues implemented via heaps

Priority queues implemented via heaps Priority queues implemented via heaps Comp Sci 1575 Data s Outline 1 2 3 Outline 1 2 3 Priority queue: most important first Recall: queue is FIFO A normal queue data structure will not implement a priority

More information

CS 410/584, Algorithm Design & Analysis, Lecture Notes 4

CS 410/584, Algorithm Design & Analysis, Lecture Notes 4 CS 0/58,, Biconnectivity Let G = (N,E) be a connected A node a N is an articulation point if there are v and w different from a such that every path from 0 9 8 3 5 7 6 David Maier Biconnected Component

More information

Lecture 11. Single-Source Shortest Paths All-Pairs Shortest Paths

Lecture 11. Single-Source Shortest Paths All-Pairs Shortest Paths Lecture. Single-Source Shortest Paths All-Pairs Shortest Paths T. H. Cormen, C. E. Leiserson and R. L. Rivest Introduction to, rd Edition, MIT Press, 009 Sungkyunkwan University Hyunseung Choo choo@skku.edu

More information

Generic ǫ-removal and Input ǫ-normalization Algorithms for Weighted Transducers

Generic ǫ-removal and Input ǫ-normalization Algorithms for Weighted Transducers International Journal of Foundations of Computer Science c World Scientific Publishing Company Generic ǫ-removal and Input ǫ-normalization Algorithms for Weighted Transducers Mehryar Mohri mohri@research.att.com

More information

FIBONACCI HEAPS. preliminaries insert extract the minimum decrease key bounding the rank meld and delete. Copyright 2013 Kevin Wayne

FIBONACCI HEAPS. preliminaries insert extract the minimum decrease key bounding the rank meld and delete. Copyright 2013 Kevin Wayne FIBONACCI HEAPS preliminaries insert extract the minimum decrease key bounding the rank meld and delete Copyright 2013 Kevin Wayne http://www.cs.princeton.edu/~wayne/kleinberg-tardos Last updated on Sep

More information

Running Time. Assumption. All capacities are integers between 1 and C.

Running Time. Assumption. All capacities are integers between 1 and C. Running Time Assumption. All capacities are integers between and. Invariant. Every flow value f(e) and every residual capacities c f (e) remains an integer throughout the algorithm. Theorem. The algorithm

More information

CSE548, AMS542: Analysis of Algorithms, Fall 2017 Date: Oct 26. Homework #2. ( Due: Nov 8 )

CSE548, AMS542: Analysis of Algorithms, Fall 2017 Date: Oct 26. Homework #2. ( Due: Nov 8 ) CSE548, AMS542: Analysis of Algorithms, Fall 2017 Date: Oct 26 Homework #2 ( Due: Nov 8 ) Task 1. [ 80 Points ] Average Case Analysis of Median-of-3 Quicksort Consider the median-of-3 quicksort algorithm

More information

Matching Residents to Hospitals

Matching Residents to Hospitals Midterm Review Matching Residents to Hospitals Goal. Given a set of preferences among hospitals and medical school students, design a self-reinforcing admissions process. Unstable pair: applicant x and

More information

Covering Linear Orders with Posets

Covering Linear Orders with Posets Covering Linear Orders with Posets Proceso L. Fernandez, Lenwood S. Heath, Naren Ramakrishnan, and John Paul C. Vergara Department of Information Systems and Computer Science, Ateneo de Manila University,

More information

Lecture 7: Shortest Paths in Graphs with Negative Arc Lengths. Reading: AM&O Chapter 5

Lecture 7: Shortest Paths in Graphs with Negative Arc Lengths. Reading: AM&O Chapter 5 Lecture 7: Shortest Paths in Graphs with Negative Arc Lengths Reading: AM&O Chapter Label Correcting Methods Assume the network G is allowed to have negative arc lengths but no directed negativelyweighted

More information

Equivalence Relations. Equivalence Classes. A new question. Building Equivalence Classes. CSE 326: Data Structures Disjoint Union/Find

Equivalence Relations. Equivalence Classes. A new question. Building Equivalence Classes. CSE 326: Data Structures Disjoint Union/Find Equivalence Relations CE : Data tructures Disjoint Union/Find Relation R : For every pair of elements (a, b) in a set, a R b is either true or false If a R b is true, then a is related to b An equivalence

More information

ICS 252 Introduction to Computer Design

ICS 252 Introduction to Computer Design ICS 252 fall 2006 Eli Bozorgzadeh Computer Science Department-UCI References and Copyright Textbooks referred [Mic94] G. De Micheli Synthesis and Optimization of Digital Circuits McGraw-Hill, 1994. [CLR90]

More information

A Simple Implementation Technique for Priority Search Queues

A Simple Implementation Technique for Priority Search Queues A Simple Implementation Technique for Priority Search Queues RALF HINZE Institute of Information and Computing Sciences Utrecht University Email: ralf@cs.uu.nl Homepage: http://www.cs.uu.nl/~ralf/ April,

More information

Part IA Algorithms Notes

Part IA Algorithms Notes Part IA Algorithms Notes 1 Sorting 1.1 Insertion Sort 1 d e f i n s e r t i o n S o r t ( a ) : 2 f o r i from 1 i n c l u d e d to l e n ( a ) excluded : 3 4 j = i 1 5 w h i l e j >= 0 and a [ i ] > a

More information

CSE 202 Homework 4 Matthias Springer, A

CSE 202 Homework 4 Matthias Springer, A CSE 202 Homework 4 Matthias Springer, A99500782 1 Problem 2 Basic Idea PERFECT ASSEMBLY N P: a permutation P of s i S is a certificate that can be checked in polynomial time by ensuring that P = S, and

More information

On the Exponent of the All Pairs Shortest Path Problem

On the Exponent of the All Pairs Shortest Path Problem On the Exponent of the All Pairs Shortest Path Problem Noga Alon Department of Mathematics Sackler Faculty of Exact Sciences Tel Aviv University Zvi Galil Department of Computer Science Sackler Faculty

More information

CMU Lecture 4: Informed Search. Teacher: Gianni A. Di Caro

CMU Lecture 4: Informed Search. Teacher: Gianni A. Di Caro CMU 15-781 Lecture 4: Informed Search Teacher: Gianni A. Di Caro UNINFORMED VS. INFORMED Uninformed Can only generate successors and distinguish goals from non-goals Informed Strategies that can distinguish

More information

Query Processing in Spatial Network Databases

Query Processing in Spatial Network Databases Temporal and Spatial Data Management Fall 0 Query Processing in Spatial Network Databases SL06 Spatial network databases Shortest Path Incremental Euclidean Restriction Incremental Network Expansion Spatial

More information

Dynamic Programming. Data Structures and Algorithms Andrei Bulatov

Dynamic Programming. Data Structures and Algorithms Andrei Bulatov Dynamic Programming Data Structures and Algorithms Andrei Bulatov Algorithms Dynamic Programming 18-2 Weighted Interval Scheduling Weighted interval scheduling problem. Instance A set of n jobs. Job j

More information

(v,w) disconnected? bridge? articulatiion point? Update MST during insertion and deletion

(v,w) disconnected? bridge? articulatiion point? Update MST during insertion and deletion Dynamic graph algorithms with applications Mikkel Thorup AT&T Labs{Research Dynamic data structures in static problems Standard example: priority queue in greedy algorithm such as Dijkstra's single source

More information

Graph-theoretic Problems

Graph-theoretic Problems Graph-theoretic Problems Parallel algorithms for fundamental graph-theoretic problems: We already used a parallelization of dynamic programming to solve the all-pairs-shortest-path problem. Here we are

More information

CS 253: Algorithms. Chapter 24. Shortest Paths. Credit: Dr. George Bebis

CS 253: Algorithms. Chapter 24. Shortest Paths. Credit: Dr. George Bebis CS : Algorithms Chapter 4 Shortest Paths Credit: Dr. George Bebis Shortest Path Problems How can we find the shortest route between two points on a road map? Model the problem as a graph problem: Road

More information

FINAL EXAM PRACTICE PROBLEMS CMSC 451 (Spring 2016)

FINAL EXAM PRACTICE PROBLEMS CMSC 451 (Spring 2016) FINAL EXAM PRACTICE PROBLEMS CMSC 451 (Spring 2016) The final exam will be on Thursday, May 12, from 8:00 10:00 am, at our regular class location (CSI 2117). It will be closed-book and closed-notes, except

More information

Slides for CIS 675. Huffman Encoding, 1. Huffman Encoding, 2. Huffman Encoding, 3. Encoding 1. DPV Chapter 5, Part 2. Encoding 2

Slides for CIS 675. Huffman Encoding, 1. Huffman Encoding, 2. Huffman Encoding, 3. Encoding 1. DPV Chapter 5, Part 2. Encoding 2 Huffman Encoding, 1 EECS Slides for CIS 675 DPV Chapter 5, Part 2 Jim Royer October 13, 2009 A toy example: Suppose our alphabet is { A, B, C, D }. Suppose T is a text of 130 million characters. What is

More information

Graph Theorizing Peg Solitaire. D. Paul Hoilman East Tennessee State University

Graph Theorizing Peg Solitaire. D. Paul Hoilman East Tennessee State University Graph Theorizing Peg Solitaire D. Paul Hoilman East Tennessee State University December 7, 00 Contents INTRODUCTION SIMPLE SOLVING CONCEPTS 5 IMPROVED SOLVING 7 4 RELATED GAMES 5 5 PROGENATION OF SOLVABLE

More information

MAKING A BINARY HEAP

MAKING A BINARY HEAP CSE 101 Algorithm Design and Analysis Miles Jones mej016@eng.uc sd.edu Office 4208 CSE Building Lecture 19: Divide and Conquer Design examples/dynamic Programming MAKING A BINARY HEAP Base case. Break

More information

Constraint Programming and Graph Algorithms

Constraint Programming and Graph Algorithms Constraint Programming and Graph Algorithms Kurt Mehlhorn Max-Planck-Institute for Computer Science (with significant help from Sven Thiel) I am not an expert on the subject (four publications), but I

More information

An Õ m 2 n Randomized Algorithm to compute a Minimum Cycle Basis of a Directed Graph

An Õ m 2 n Randomized Algorithm to compute a Minimum Cycle Basis of a Directed Graph An Õ m 2 n Randomized Algorithm to compute a Minimum Cycle Basis of a Directed Graph T Kavitha Indian Institute of Science Bangalore, India kavitha@csaiiscernetin Abstract We consider the problem of computing

More information

An Analysis of the Highest-Level Selection Rule in the Preflow-Push Max-Flow Algorithm

An Analysis of the Highest-Level Selection Rule in the Preflow-Push Max-Flow Algorithm An Analysis of the Highest-Level Selection Rule in the Preflow-Push Max-Flow Algorithm Joseph Cheriyan Kurt Mehlhorn August 20, 1998 Abstract Consider the problem of finding a maximum flow in a network.

More information

BFS Dijkstra. Oct abhi shelat

BFS Dijkstra. Oct abhi shelat 4102 BFS Dijkstra Oct 22 2009 abhi shelat breadth first search bfs(g, a) 1 2 a b 1 2 d c e f g 2 h bfs theorem Theorem 1 (CLRS, p. 599) Let G =(V, E) be a graph and suppose that BFS is run on G from vertex

More information

COMP251: Bipartite graphs

COMP251: Bipartite graphs COMP251: Bipartite graphs Jérôme Waldispühl School of Computer Science McGill University Based on slides fom M. Langer (McGill) & P. Beame (UofW) Recap: Dijkstra s algorithm DIJKSTRA(V, E,w,s) INIT-SINGLE-SOURCE(V,s)

More information

All-Pairs Shortest Paths

All-Pairs Shortest Paths All-Pairs Shortest Paths Version of October 28, 2016 Version of October 28, 2016 All-Pairs Shortest Paths 1 / 26 Outline Another example of dynamic programming Will see two different dynamic programming

More information

Discrete Optimization Lecture 5. M. Pawan Kumar

Discrete Optimization Lecture 5. M. Pawan Kumar Discrete Optimization Lecture 5 M. Pawan Kumar pawan.kumar@ecp.fr Exam Question Type 1 v 1 s v 0 4 2 1 v 4 Q. Find the distance of the shortest path from s=v 0 to all vertices in the graph using Dijkstra

More information

CSE548, AMS542: Analysis of Algorithms, Fall 2016 Date: Nov 30. Final In-Class Exam. ( 7:05 PM 8:20 PM : 75 Minutes )

CSE548, AMS542: Analysis of Algorithms, Fall 2016 Date: Nov 30. Final In-Class Exam. ( 7:05 PM 8:20 PM : 75 Minutes ) CSE548, AMS542: Analysis of Algorithms, Fall 2016 Date: Nov 30 Final In-Class Exam ( 7:05 PM 8:20 PM : 75 Minutes ) This exam will account for either 15% or 30% of your overall grade depending on your

More information

Shortest paths: label setting

Shortest paths: label setting : label setting CE 377K February 19, 2015 REVIEW HW 2 posted, due in 2 weeks Review Basic search algorithm Prim s algorithm Review Algorithm (Assumes that the network is connected.) 1 Arbitrarily choose

More information