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

Size: px
Start display at page:

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

Transcription

1 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 Copyright Networking Laboratory

2 Single-Source Shortest Path Problem: Given a weighted directed graph G, find the minimum-weight path from a given source vertex s to another vertex v Shortest-path minimum weight Weight of path is sum of edges e.g., a road map what is the shortest path from Chapel Hill to Charlottesville? Networking Laboratory /9

3 Shortest Path Properties Again, we have optimal substructure the shortest path consists of shortest subpaths: Proof: suppose some subpath is not a shortest path There must then exist a shorter subpath It could substitute the shorter subpath for a shorter path But then overall path is not shortest path Contradiction Networking Laboratory /9

4 Shortest Path Properties Define δ(u,v) to be the weight of the shortest path from u to v Shortest paths satisfy the triangle inequality δ(u,v) δ(u,x) + δ(x,v) Proof: x u v This path is no longer than any other path Networking Laboratory /9

5 Relaxation A key technique in shortest path algorithms is relaxation Idea: for all v, maintain upper bound d[v] on δ(s,v) Relax(u,v,w) { if (d[v] > d[u]+w) then d[v]=d[u]+w; } 9 Relax Relax Networking Laboratory /9

6 Bellman-Ford Algorithm BellmanFord() for each v V d[v] = ; d[s] = 0; for i= to V - for each edge (u,v) E Relax(u,v, w(u,v)); for each edge (u,v) E if (d[v] > d[u] + w(u,v)) return no solution ; Initialize d[], which will converge to shortest-path value δ Relaxation: Make V - passes, relaxing each edge Test for solution Under what condition do we get a solution? Relax(u,v,w): if (d[v] > d[u]+w) then d[v]=d[u]+w Networking Laboratory /9

7 Bellman-Ford Algorithm e.g. s s t y t x z y x z s s t y t x z y x z s 0 8 t y x z Networking Laboratory /9

8 Practice Problems Given a directed graph as bellow. Suppose that in Bellman-Ford algorithm all the edges will be relaxed in the following order: BC AC BA SA SB. Fill in the table with the distance estimates for each vertex after each iteration. Vertex S A B C Initial 0 Iteration Iteration Iteration Iteration Networking Laboratory 8/9

9 Dijkstra s Algorithm Input A digraph G(V,E) where edges are associated with non-negative weight (cost) and a source src Output Lengths of shortest paths from src to each node in G Idea : without loss of general V = {,,, n } where is a source node We have two sets S : set of nodes already chosen ( S = { } ) C : set of remaining node ( C = {,,, n } ) D[,,, n] : containing costs of shortest path Networking Laboratory 9/9

10 Dijkstra s Algorithm Repeatedly add a node v in C to S whose distance to (source) is minimal until S = {,,, n} Dijkstra ( L[,,n,,,n] ) /* L is cost array, L[i,j] : cost if (i,j) in E or : infinity if (i,j) is not in E */ C <- {,,, n } for i <- to n do D[i] <- L[,i] repeat (n-) times v <- a node in C s.t. D[v] = Min{ D[w] } for each w in C C <- C {v} for each w in C do D[w] <- Min{ D[w], D[v]+L[v,w] } return D Networking Laboratory 0/9

11 Dijkstra s Algorithm e.g V = E = Step v C D 0 -- {,,, } {,, } {, } { } Networking Laboratory /9

12 Dijkstra s Algorithm e.g. 0 u v 0 u v 8 0 u v 8 9 s 0 9 x y s 0 9 x y 0 9 x y 0 u v 0 0 u v 8 0 u v 8 9 s 0 9 s x y 0 9 x y 0 9 x y Networking Laboratory /9

13 Dijkstra s Algorithm e.g. Networking Laboratory /9

14 Minimum Steiner Tree The Steiner problem in graphs (NP-complete) Given graph G(V,E) A subset S of V Find a subgraph the minimum cost among all connected subgraphs subgraphs contain S It is evident that the subgraph is a solution of this problem must be a tree We briefly call it an optimal tree V =n, S =k (k>) Shortest path problem when k= Minimum-cost Spanning Tree problem when k=n Networking Laboratory /9

15 Minimum Steiner Tree Multicasting It refers to the transmission of data from one node to a selected group of nodes TM Algorithm Hiromitsu Takahashi and Akira Matsuyama AN APPROXIMATE SOLUTION FOR THE STEINER PROBLEM IN GRAPHS Math. Japonica, vol., no., pp. -, 980. Pseudo Code Networking Laboratory /9

16 Minimum Steiner Tree TM e.g. Source Member Member Networking Laboratory /9

17 Minimum Steiner Tree Self-study: KMB Algorithm L. Kou, G. Markowsky, and L. Berman A Fast Algorithm for Steiner Trees Acta Informatica, vol., pp. -, 98. Source Source Source Member Member Member Member Member Member Networking Laboratory /9

18 Shortest Path Problems Input: Directed graph G = (V, E) Weight function w : E R Weight of path p = v 0, v,..., v k w( p) = k i= w( v i, v i ) Shortest-path weight from u to v s 0 9 p δ(u, v) = min w(p) : u v if there exists a path from u to v t y x z otherwise Shortest path from u to v is any path p such that w(p) = δ(u, v) Networking Laboratory 8/9

19 Shortest Path Representation d[v] = δ(s, v): a shortest path estimate Initially, d[v]= Reduces as algorithms progress π[v] = predecessor of v on a shortest path from s If no predecessor, π[v] = NIL π induces a tree : shortest path tree Shortest paths & shortest path trees are not unique s 0 t 9 y x z Networking Laboratory 9/9

20 Relaxation Relaxing an edge (u, v) Testing whether we can improve the shortest path to v found so far by going through u If d[v] > d[u] + w(u, v) we can improve the shortest path to v update d[v] and π[v] s u v 9 s u v RELAX(u, v, w) RELAX(u, v, w) u v u v Networking Laboratory 0/9

21 Bellman-Ford Algorithm t Computes d[v] and π[v] for all v V s y 9 TRUE if no negative-weight cycles are reachable from the source s Single-source shortest paths problem It allows negative edge weights Returns: FALSE otherwise no solution exists Idea: Traverse all the edges V times, every time performing a relaxation step of each edge - x z Networking Laboratory /9

22 Dijkstra s Algorithm Single-source shortest path problem: No negative-weight edges: w(u, v) > 0 (u, v) E Maintains two sets of vertices: 0 u v 8 9 S = vertices whose final shortest-path weights have already been determined C = vertices in V S x Repeatedly select a vertex u V S, with the minimum shortest-path estimate d[v] 0 9 y Networking Laboratory /9

23 Practice Problems Is the following algorithm a valid method for finding the shortest path from node S to node T in a directed graph with some negative edges? add a large constant to each edge weight so that all the weights become positive then run Dijkstra s algorithm starting at node S, and return the shortest path found to node T. Networking Laboratory /9

24 All-Pairs Shortest Paths - Solutions If we run Bellman-Ford once from each vertex: O(V E), which is O(V ) if the graph is dense (E = Θ(V )) If no negative-weight edges, we could run Dijkstra s algorithm once from each vertex: O(VElgV) with binary heap, O(V lgv) if the graph is dense O(EV + V lgv) with Fibonacci heap, O(V ) if the graph is dense We ll see how to do in O(V ) in all cases, with no fancy data structure Networking Laboratory /9

25 All-Pairs Shortest Paths (APSP) Given: Directed graph G = (V, E) Weight function w : E R Compute: The shortest paths between all pairs of vertices in a graph Representation of the result: an n n matrix of shortest-path distances δ(u, v) Networking Laboratory /9

26 All-Pairs Shortest Paths Assume the graph G is given as adjacency matrix of weights W = (w ij ), n x n matrix, V = n Vertices numbered to n w ij = 0 weight of (i, j) if i = j if i j, (i, j) E if i j, (i, j) E Output the result in an n x n matrix D = (d ij ), where d ij = δ(i, j) Solve the problem using dynamic programming Networking Laboratory /9

27 Optimal Substructure of a Shortest Path All subpaths of a shortest path at most m edges are shortest paths Let p: a shortest path p from i k j vertex i to j that contains at most m edges at most m - edges If i = j w(p) = 0 and p has no edges If i j: p = i p k j p has at most m- edges p is a shortest path δ(i, j) = δ(i, k) + w kj Networking Laboratory /9

28 Recursive Solution l (m) ij : weight of shortest path i that contains at most m edges j at most m edges m = 0: l ij (0) = 0 if i = j if i j i k j m : l ij (m) = min {, min { l (m-) ik + w kj } } l ij (m-) k n = min { l ik (m-) + w kj } k n Shortest path from i to j with at most m edges Shortest path from i to j containing at most m edges, considering all possible predecessors (k) of j Networking Laboratory 8/9

29 Computing the Shortest Paths m = : l ij () = The path between i and j is restricted to edge L () = W w ij Given W = (w ij ), compute: L (), L (),, L (n-), where L (m) = (l (m) ij ) L (n-) contains the actual shortest-path weights Given L (m-) and W compute L (m) Extend the shortest paths computed so far by one more edge If the graph has no negative cycles: all simple shortest paths contain at most n - edges δ(i, j) = l (n-) ij and l (n) ij, l (n+) ij... l (n-) ij Networking Laboratory 9/9

30 Extending the Shortest Paths k l ij (m) = min { l ik (m-) + w kj } k n j j i k = i L (m-) n x n W L (m) Replace: min + + Computing L (m) looks like matrix multiplication Networking Laboratory 0/9

31 EXTEND(L, W, n) l (m) ij = min { l (m-) ik + w kj } k n. create L, an n n matrix. for i to n. do for j to n. do l ij. for k to n. do l ij min ( l ij, l ik + w kj ). return L Running time: Θ(n ) Networking Laboratory /9

32 SLOW-APSP(W,n) SLOW-ALL-PAIRS-SHORTEST PATHS(W, n). L () W. for m to n-. do L (m) EXTEND ( L (m - ), W, n ). return L (n - ) Running time: Θ(n ) Networking Laboratory /9

33 Example W L (m-) = L () L (m) = L () l ij (m) = min { l ik (m-) + w kj } k n and so on until L () Networking Laboratory /9

34 Improving Running Time No need to compute all L (m) matrices If no negative-weight cycles exist: L (m) = L (n - ) for all m n We can compute L (n-) by computing the sequence: L () = W L () = W = W W L () = W = W W L (8) = W 8 = W W x = n ( ) lg( n ) L n = W Networking Laboratory /9

35 FASTER-APSP(W, n). L () W. m. while m < n -. do L (m) EXTEND(L (m), L (m), n). m m. return L (m) OK to overshoot: products don t change after L (n - ) Running Time: Θ(n lg n) Networking Laboratory /9

36 The Floyd-Warshall Algorithm Given: Directed, weighted graph G = (V, E) Negative-weight edges may be present No negative-weight cycles could be present in the graph Compute: The shortest paths between all pairs of vertices in a graph Networking Laboratory /9

37 The Structure of a Shortest Path Vertices in G are given by V = {,,, n} Consider a path p = v, v,, v l An intermediate vertex of p is any vertex in the set {v, v,, v l - } e.g.: p =,,, : {, } 0. p =,, : {} Networking Laboratory /9

38 The Structure of a Shortest Path For any pair of vertices i, j V, consider all paths from i to j whose intermediate vertices are all drawn from a subset {,,, k} Find p, a minimum-weight path from these paths p i p u j p t No vertex on these paths has index > k Networking Laboratory 8/9

39 Example d (k) ij = the weight of a shortest path from vertex i to vertex j with all intermediary vertices drawn from {,,, k} d (0) = d () = d () = 0. d () = d () =. Networking Laboratory 9/9

40 The Structure of a Shortest Path k is not an intermediate vertex of path p Shortest path from i to j with intermediate vertices from {,,, k} is a shortest path from i to j with i k j intermediate vertices from {,,, k - } p k is an intermediate vertex of path p k is not intermediary vertex of p, p p is a shortest path from i to k with vertices from {,,, k - } i p k p p j p is a shortest path from k to j with vertices from {,,, k - } Networking Laboratory 0/9

41 A Recursive Solution d ij (k) = the weight of a shortest path from vertex i to vertex j with all intermediary vertices drawn from {,,, k} k = 0 d ij (k) = w ij k Case : k is not an intermediate vertex of path p d ij (k) = d ij (k-) i k j Case : k is an intermediate vertex of path p d ij (k) =d ik (k-) + d kj (k-) i k j Networking Laboratory /9

42 Computing The Shortest Path Weights d ij (k) = w ij if k = 0 min { d ij (k-), d ik (k-) + d kj (k-) } if k The final solution: D (n) = (d ij (n) ): d ij (n) = δ(i, j) i, j V j j + (k, j) i D (k-) (i, k) i D (k) Networking Laboratory /9

43 FLOYD-WARSHALL(W). n rows[w]. D (0) W. for k to n. do for i to n. do for j to n. do d (k) ij min (d (k-) ij, d (k-) ik + d (k-) kj ). return D (n) Running time: Θ(n ) Networking Laboratory /9

44 Constructing a Shortest Path = = = Π ij ij ij w j i i w j i Nil and or (0) Π + Π = Π otherwise ) ( ) ( ) ( ) ( ) ( ) ( k kj k kj k ik k ij k ij k ij d d d Networking Laboratory /9

45 d ij (k) = min {d ij (k-), d ik (k-) + d kj (k-) } Example D (0) = W D () (0) () N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N Networking Laboratory /9

46 d ij (k) = min {d ij (k-), d ik (k-) + d kj (k-) } Example D () () N N N N N D () () N N N N N N N N N N N N N N N N N N N N Networking Laboratory /9

47 d ij (k) = min {d ij (k-), d ik (k-) + d kj (k-) } Example D () () N N N N 0 N N D () () N N N N N N N N N N N N N N N Networking Laboratory /9

48 Example D () D () d ij (k) = min {d ij (k-), d ik (k-) + d kj (k-) } () N N N N N N N N N N () N N N N N Networking Laboratory 8/9

49 Example D () d ij (k) = min {d ij (k-), d ik (k-) + d kj (k-) } N N 0 N N 8 0 N D () N N 0 N N 8 0 N () () Networking Laboratory 9/9

Lecture Notes for Chapter 25: All-Pairs Shortest Paths

Lecture Notes for Chapter 25: All-Pairs Shortest Paths Lecture Notes for Chapter 25: All-Pairs Shortest Paths Chapter 25 overview Given a directed graph G (V, E), weight function w : E R, V n. Goal: create an n n matrix of shortest-path distances δ(u,v). Could

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

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

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

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

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

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

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

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

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

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

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

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

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

Analysis of Algorithms I: All-Pairs Shortest Paths

Analysis of Algorithms I: All-Pairs Shortest Paths Analysis of Algorithms I: All-Pairs Shortest Paths Xi Chen Columbia University The All-Pairs Shortest Paths Problem. Input: A directed weighted graph G = (V, E) with an edge-weight function w : E R. Output:

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

Data Structures and and Algorithm Xiaoqing Zheng

Data Structures and and Algorithm Xiaoqing Zheng Data Structures and Algorithm Xiaoqing Zheng zhengxq@fudan.edu.cn Representations of undirected graph 1 2 1 2 5 / 5 4 3 2 3 4 5 1 3 4 / 2 4 / 2 5 3 / 4 1 / Adjacency-list representation of graph G = (V,

More information

Myriad of applications

Myriad of applications Shortet Path Myriad of application Finding hortet ditance between location (Google map, etc.) Internet router protocol: OSPF (Open Shortet Path Firt) i ued to find the hortet path to interchange package

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

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

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

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

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 241 Analysis of Algorithms

CS 241 Analysis of Algorithms CS 241 Analysis of Algorithms Professor Eric Aaron Lecture T Th 9:00am Lecture Meeting Location: OLB 205 Business Grading updates: HW5 back today HW7 due Dec. 10 Reading: Ch. 22.1-22.3, Ch. 25.1-2, Ch.

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

Chapter 8 Dynamic Programming

Chapter 8 Dynamic Programming Chapter 8 Dynamic Programming Copyright 2007 Pearson Addison-Wesley. All rights reserved. Dynamic Programming Dynamic Programming is a general algorithm design technique for solving problems defined by

More information

Introduction to Algorithms

Introduction to Algorithms Introduction to Algorithms 6.046J/18.401J/SMA5503 Lecture 18 Prof. Erik Demaine Negative-weight cycles Recall: If a graph G = (V, E) contains a negativeweight cycle, then some shortest paths may not exist.

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

Chapter 8 Dynamic Programming

Chapter 8 Dynamic Programming Chapter 8 Dynamic Programming Copyright 007 Pearson Addison-Wesley. All rights reserved. Dynamic Programming Dynamic Programming is a general algorithm design technique for solving problems defined by

More information

Lecture 9. Greedy Algorithm

Lecture 9. Greedy Algorithm Lecture 9. Greedy Algorithm T. H. Cormen, C. E. Leiserson and R. L. Rivest Introduction to Algorithms, 3rd Edition, MIT Press, 2009 Sungkyunkwan University Hyunseung Choo choo@skku.edu Copyright 2000-2018

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

Partha Sarathi Mandal

Partha Sarathi Mandal MA 252: Data Structures and Algorithms Lecture 32 http://www.iitg.ernet.in/psm/indexing_ma252/y12/index.html Partha Sarathi Mandal Dept. of Mathematics, IIT Guwahati The All-Pairs Shortest Paths Problem

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

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

IS 2610: Data Structures

IS 2610: Data Structures IS 2610: Data Structures Graph April 12, 2004 Graph Weighted graph call it networks Shortest path between nodes s and t in a network Directed simple path from s to t with the property that no other such

More information

Shortest paths with negative lengths

Shortest paths with negative lengths Chapter 8 Shortest paths with negative lengths In this chapter we give a linear-space, nearly linear-time algorithm that, given a directed planar graph G with real positive and negative lengths, but no

More information

CSC 1700 Analysis of Algorithms: Warshall s and Floyd s algorithms

CSC 1700 Analysis of Algorithms: Warshall s and Floyd s algorithms CSC 1700 Analysis of Algorithms: Warshall s and Floyd s algorithms Professor Henry Carter Fall 2016 Recap Space-time tradeoffs allow for faster algorithms at the cost of space complexity overhead Dynamic

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

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

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

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

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

6. DYNAMIC PROGRAMMING II

6. DYNAMIC PROGRAMMING II 6. DYNAMIC PROGRAMMING II sequence alignment Hirschberg's algorithm Bellman-Ford algorithm distance vector protocols negative cycles in a digraph Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison

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

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

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

Lecture 4. Quicksort

Lecture 4. Quicksort Lecture 4. Quicksort T. H. Cormen, C. E. Leiserson and R. L. Rivest Introduction to Algorithms, 3rd Edition, MIT Press, 2009 Sungkyunkwan University Hyunseung Choo choo@skku.edu Copyright 2000-2018 Networking

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

6. DYNAMIC PROGRAMMING II. sequence alignment Hirschberg's algorithm Bellman-Ford distance vector protocols negative cycles in a digraph

6. DYNAMIC PROGRAMMING II. sequence alignment Hirschberg's algorithm Bellman-Ford distance vector protocols negative cycles in a digraph 6. DYNAMIC PROGRAMMING II sequence alignment Hirschberg's algorithm Bellman-Ford distance vector protocols negative cycles in a digraph Shortest paths Shortest path problem. Given a digraph G = (V, E),

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

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

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

Scribes: Po-Hsuan Wei, William Kuzmaul Editor: Kevin Wu Date: October 18, 2016

Scribes: Po-Hsuan Wei, William Kuzmaul Editor: Kevin Wu Date: October 18, 2016 CS 267 Lecture 7 Graph Spanners Scribes: Po-Hsuan Wei, William Kuzmaul Editor: Kevin Wu Date: October 18, 2016 1 Graph Spanners Our goal is to compress information about distances in a graph by looking

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

Design and Analysis of Algorithms April 16, 2015 Massachusetts Institute of Technology Profs. Erik Demaine, Srini Devadas, and Nancy Lynch Quiz 2

Design and Analysis of Algorithms April 16, 2015 Massachusetts Institute of Technology Profs. Erik Demaine, Srini Devadas, and Nancy Lynch Quiz 2 Design and Analysis of Algorithms April 16, 2015 Massachusetts Institute of Technology 6.046J/18.410J Profs. Erik Demaine, Srini Devadas, and Nancy Lynch Quiz 2 Quiz 2 Do not open this quiz booklet until

More information

Inderjit Dhillon The University of Texas at Austin

Inderjit Dhillon The University of Texas at Austin Inderjit Dhillon The University of Texas at Austin ( Universidad Carlos III de Madrid; 15 th June, 2012) (Based on joint work with J. Brickell, S. Sra, J. Tropp) Introduction 2 / 29 Notion of distance

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

iretilp : An efficient incremental algorithm for min-period retiming under general delay model

iretilp : An efficient incremental algorithm for min-period retiming under general delay model iretilp : An efficient incremental algorithm for min-period retiming under general delay model Debasish Das, Jia Wang and Hai Zhou EECS, Northwestern University, Evanston, IL 60201 Place and Route Group,

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

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

Dynamic Programming. p. 1/43

Dynamic Programming. p. 1/43 Dynamic Programming Formalized by Richard Bellman Programming relates to planning/use of tables, rather than computer programming. Solve smaller problems first, record solutions in a table; use solutions

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

Complexity Theory of Polynomial-Time Problems

Complexity Theory of Polynomial-Time Problems Complexity Theory of Polynomial-Time Problems Lecture 5: Subcubic Equivalences Karl Bringmann Reminder: Relations = Reductions transfer hardness of one problem to another one by reductions problem P instance

More information

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

2 hours THE UNIVERSITY OF MANCHESTER. 6 June :45 11:45

2 hours THE UNIVERSITY OF MANCHESTER. 6 June :45 11:45 2 hours THE UNIVERSITY OF MANCHESTER DISCRETE MATHEMATICS 6 June 2016 9:45 11:45 Answer ALL THREE questions in Section A (30 marks in total) and TWO of the THREE questions in Section B (50 marks in total).

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

CS684 Graph Algorithms

CS684 Graph Algorithms CS684 Graph Algorithms Administration and Mathematical Background Instructor: Fei Li lifei@cs.gmu.edu with subject: CS684 Office hours: Engineering Building, Room 5326, Monday 5:00pm - 7:00pm or by appointments

More information

A Note on the Connection between the Primal-Dual and the A* Algorithm

A Note on the Connection between the Primal-Dual and the A* Algorithm A Note on the Connection between the Primal-Dual and the A* Algorithm Xugang Ye, Johns Hopkins University, USA Shih-Ping Han, Johns Hopkins University, USA Anhua Lin, Middle Tennessee State University,

More information

Proof methods and greedy algorithms

Proof methods and greedy algorithms Proof methods and greedy algorithms Magnus Lie Hetland Lecture notes, May 5th 2008 1 Introduction This lecture in some ways covers two separate topics: (1) how to prove algorithms correct, in general,

More information

Question Paper Code :

Question Paper Code : www.vidyarthiplus.com Reg. No. : B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2011. Time : Three hours Fourth Semester Computer Science and Engineering CS 2251 DESIGN AND ANALYSIS OF ALGORITHMS (Regulation

More information

On Hamiltonian cycles and Hamiltonian paths

On Hamiltonian cycles and Hamiltonian paths Information Processing Letters 94 (2005) 37 41 www.elsevier.com/locate/ipl On Hamiltonian cycles and Hamiltonian paths M. Sohel Rahman a,, M. Kaykobad a,b a Department of Computer Science and Engineering,

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

University of Toronto Department of Electrical and Computer Engineering. Final Examination. ECE 345 Algorithms and Data Structures Fall 2016

University of Toronto Department of Electrical and Computer Engineering. Final Examination. ECE 345 Algorithms and Data Structures Fall 2016 University of Toronto Department of Electrical and Computer Engineering Final Examination ECE 345 Algorithms and Data Structures Fall 2016 Print your first name, last name, UTORid, and student number neatly

More information

NP-completeness. Chapter 34. Sergey Bereg

NP-completeness. Chapter 34. Sergey Bereg NP-completeness Chapter 34 Sergey Bereg Oct 2017 Examples Some problems admit polynomial time algorithms, i.e. O(n k ) running time where n is the input size. We will study a class of NP-complete problems

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

Analytic Theory of Power Law Graphs

Analytic Theory of Power Law Graphs Analytic Theory of Power Law Graphs Jeremy Kepner This work is sponsored by the Department of Defense under Air Force Contract FA8721-05-C-0002. Opinions, interpretations, conclusions, and recommendations

More information

Introduction to Algorithms

Introduction to Algorithms Introducton to Algorthms 6.046J/8.40J LECTURE 6 Shortest Paths III All-pars shortest paths Matrx-multplcaton algorthm Floyd-Warshall algorthm Johnson s algorthm Prof. Charles E. Leserson Shortest paths

More information

GRAPH ALGORITHMS Week 3 (16-21 October 2017)

GRAPH ALGORITHMS Week 3 (16-21 October 2017) GRAPH ALGORITHMS Week 3 (16-21 October 2017) C. Croitoru croitoru@info.uaic.ro FII October 15, 2017 1 / 63 OUTLINE Graph Theory Vocabulary 1 Definition of a Graph 2 Variations in the Definition of a Graph

More information

CS/COE

CS/COE CS/COE 1501 www.cs.pitt.edu/~nlf4/cs1501/ P vs NP But first, something completely different... Some computational problems are unsolvable No algorithm can be written that will always produce the correct

More information

cs/ee/ids 143 Communication Networks

cs/ee/ids 143 Communication Networks cs/ee/ids 143 Communication Networks Chapter 5 Routing Text: Walrand & Parakh, 2010 Steven Low CMS, EE, Caltech Warning These notes are not self-contained, probably not understandable, unless you also

More information

Shortest Paths in Directed Planar Graphs with Negative Lengths: a Linear-Space O(n log 2 n)-time Algorithm

Shortest Paths in Directed Planar Graphs with Negative Lengths: a Linear-Space O(n log 2 n)-time Algorithm Shortest Paths in Directed Planar Graphs with Negative Lengths: a Linear-Space O(n log 2 n)-time Algorithm Philip Klein 1, Shay Mozes 1 and Oren Weimann 2 1 Department of Computer Science, Brown University,

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

CS 301: Complexity of Algorithms (Term I 2008) Alex Tiskin Harald Räcke. Hamiltonian Cycle. 8.5 Sequencing Problems. Directed Hamiltonian Cycle

CS 301: Complexity of Algorithms (Term I 2008) Alex Tiskin Harald Räcke. Hamiltonian Cycle. 8.5 Sequencing Problems. Directed Hamiltonian Cycle 8.5 Sequencing Problems Basic genres. Packing problems: SET-PACKING, INDEPENDENT SET. Covering problems: SET-COVER, VERTEX-COVER. Constraint satisfaction problems: SAT, 3-SAT. Sequencing problems: HAMILTONIAN-CYCLE,

More information

UNIVERSITY OF YORK. MSc Examinations 2004 MATHEMATICS Networks. Time Allowed: 3 hours.

UNIVERSITY OF YORK. MSc Examinations 2004 MATHEMATICS Networks. Time Allowed: 3 hours. UNIVERSITY OF YORK MSc Examinations 2004 MATHEMATICS Networks Time Allowed: 3 hours. Answer 4 questions. Standard calculators will be provided but should be unnecessary. 1 Turn over 2 continued on next

More information

The Multiple Traveling Salesman Problem with Time Windows: Bounds for the Minimum Number of Vehicles

The Multiple Traveling Salesman Problem with Time Windows: Bounds for the Minimum Number of Vehicles The Multiple Traveling Salesman Problem with Time Windows: Bounds for the Minimum Number of Vehicles Snežana Mitrović-Minić Ramesh Krishnamurti School of Computing Science, Simon Fraser University, Burnaby,

More information

Introduction to Algorithms

Introduction to Algorithms Introducton to Algorthms 6.046J/8.40J/SMA5503 Lecture 9 Prof. Erk Demane Shortest paths Sngle-source shortest paths Nonnegate edge weghts Djkstra s algorthm: OE + V lg V General Bellman-Ford: OVE DAG One

More information

Quickest Path Distances on Context-Free Labeled Graphs

Quickest Path Distances on Context-Free Labeled Graphs 6th WSEAS International Conference on Information Security and Privacy, Tenerife, Spain, December 14-16, 2007 22 Quickest Path Distances on Context-Free Labeled Graphs PHILLIP G. BRADFORD The University

More information

CSE101: Design and Analysis of Algorithms. Ragesh Jaiswal, CSE, UCSD

CSE101: Design and Analysis of Algorithms. Ragesh Jaiswal, CSE, UCSD Greedy s Greedy s Shortest path Claim 2: Let S be a subset of vertices containing s such that we know the shortest path length l(s, u) from s to any vertex in u S. Let e = (u, v) be an edge such that 1

More information

Combinatorial Optimization

Combinatorial Optimization Combinatorial Optimization Problem set 8: solutions 1. Fix constants a R and b > 1. For n N, let f(n) = n a and g(n) = b n. Prove that f(n) = o ( g(n) ). Solution. First we observe that g(n) 0 for all

More information

Algorithms and Complexity Theory. Chapter 8: Introduction to Complexity. Computer Science - Durban - September 2005

Algorithms and Complexity Theory. Chapter 8: Introduction to Complexity. Computer Science - Durban - September 2005 Algorithms and Complexity Theory Chapter 8: Introduction to Complexity Jules-R Tapamo Computer Science - Durban - September 2005 Contents 1 Introduction 2 1.1 Dynamic programming...................................

More information

Midterm Exam 2 Solutions

Midterm Exam 2 Solutions Algorithm Design and Analysis November 12, 2010 Pennsylvania State University CSE 565, Fall 2010 Professor Adam Smith Exam 2 Solutions Problem 1 (Miscellaneous). Midterm Exam 2 Solutions (a) Your friend

More information

CMPSCI 611 Advanced Algorithms Midterm Exam Fall 2015

CMPSCI 611 Advanced Algorithms Midterm Exam Fall 2015 NAME: CMPSCI 611 Advanced Algorithms Midterm Exam Fall 015 A. McGregor 1 October 015 DIRECTIONS: Do not turn over the page until you are told to do so. This is a closed book exam. No communicating with

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

Centrality measures in graphs or social networks

Centrality measures in graphs or social networks Centrality measures in graphs or social networks V.S. Subrahmanian University of Maryland vs@cs.umd.edu Copyright (C) 2012, V.S. Subrahmanian 1 PageRank Examples of vertices: Web pages Twitter ids nodes

More information

Lecture 8: Complete Problems for Other Complexity Classes

Lecture 8: Complete Problems for Other Complexity Classes IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Basic Course on Computational Complexity Lecture 8: Complete Problems for Other Complexity Classes David Mix Barrington and Alexis Maciel

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

Traveling Salesman. Given G = (V,V V), find simple cycle C = (v 1,v 2,...,v n,v 1 ) such that n = V and (u,v) C d(u,v) is minimized.

Traveling Salesman. Given G = (V,V V), find simple cycle C = (v 1,v 2,...,v n,v 1 ) such that n = V and (u,v) C d(u,v) is minimized. Sanders/van Stee: Approximations- und Online-Algorithmen 1 Traveling Salesman Given G = (V,V V), find simple cycle C = (v 1,v 2,...,v n,v 1 ) such that n = V and (u,v) C d(u,v) is minimized. Sanders/van

More information

NATIONAL UNIVERSITY OF SINGAPORE CS3230 DESIGN AND ANALYSIS OF ALGORITHMS SEMESTER II: Time Allowed 2 Hours

NATIONAL UNIVERSITY OF SINGAPORE CS3230 DESIGN AND ANALYSIS OF ALGORITHMS SEMESTER II: Time Allowed 2 Hours NATIONAL UNIVERSITY OF SINGAPORE CS3230 DESIGN AND ANALYSIS OF ALGORITHMS SEMESTER II: 2017 2018 Time Allowed 2 Hours INSTRUCTIONS TO STUDENTS 1. This assessment consists of Eight (8) questions and comprises

More information