Course Home | Assignments | Peer Assessment Procedures | Schedule & Lecture Notes

Saint Louis University

Computer Science 314
Algorithms

Michael Goldwasser

Fall 2014

Dept. of Math & Computer Science

Homework Assignment 05

MST, Shortest Paths


Overview

Topics: MST, Shortest Paths
Related Reading: Chapters 24, 25 of CLRS
Due: 10:00am, Monday, 17 November, 2014

Please make sure to strictly adhere to the stated course procedures regarding the format of your submitted homework. In particular, your name should not appear on anything other than the cover page, and your solution for each problem must be in a separate packet, labeled appropriately with your assigned codename.

You must also adhere to the policies on academic integrity, paying particular attention to the limits on collaboration.


Problems to be Submitted

  1. Work entirely on your own

    Assume that we are interested in the single-source shortest path of a weighted graph for a given source s, and that someone provides us with what they claim are the shortest path costs, δ(s,v), for all vertices v, but we do not necessarily trust them. Explain how we can verify, in O(V+E) time, whether the given values are truly the shortest path costs for all v. (you may assume that the graph does not have any negative cycles.)

  2. You may discuss ideas with other students (but your writeup must be independent)

    Prim's algorithm for computing an MST runs in worst-case time O(E + V lg V) when using a Fibonacci Heap. Show that if all edge weights of a graph are integers in the range from 1 to W, for some fixed W, then a custom implementation of a priority queue data structure can be used to allow Prim's algorithm to run in time O(E + VW), which is an improvement when W = o(lg V).

    Note: You are NOT to change Prim's algorithm per se. You are only to design a new concrete implementation for the priority queue abstraction, which allows the existing algorithm to achieve the stated time bound.

  3. You may discuss ideas with other students (but your writeup must be independent)

    Dijkstra's algorithm for computing single-source shortest paths in a graph with nonnegative edge weights runs in worst-case time O(E + V lg V) when using a Fibonacci Heap. Show that if all edge weights of a graph are integers in the range from 1 to W, for some fixed W, then a custom implementation of a priority queue data structure can be used to allow Dijkstra's algorithm to run in time O(E + VW), which is an improvement when W = o(lg V).

    Note: although this problem is clearly very similar to the previous problem, your solution will be evaluated by a different person, so please make sure your write-ups of the two are self-contained. Also, it is worth noting that although they are similar, the same solution is not likely to be correct for both problems. There is a key difference in how priorities are defined for vertices in the two different contexts.

  4. Work entirely on your own

    For the minimum-spanning tree problem, we saw that if a graph has unique edge weights, then there is a unique minimum spanning tree. The same is not true for the shortest path problem.

    Note: For the sake of this problem, you may assume that all edge weights are positive.

  5. Work entirely on your own

    Exercise 25.3-5 on page 705 of CLRS.


Extra Credit

  1. Work entirely on your own

    Revisiting the use of Dijkstra's algorithm on a graph with integer edge weights in the range 1 to W, show that a custome priority queue implementation can be used to achieve a running time of O((V+E) lg W). Hint: how many distinct shortest-path estimates (i.e., priorities) can there be at any point in time?


Michael Goldwasser ©2014
CSCI 314, Fall 2014
Last modified: Thursday, 04 December 2014
Course Home | Assignments | Peer Assessment Procedures | Schedule & Lecture Notes