Comp 215 Programming Project: Implementations of Dijkstra's Algorithm


Introduction

Your goal for this project is to implement Dijkstra's algorithm using two different techniques, as given in Sections 9.2 and 10.4 of your text. The first technique is a straightforward implementation; the second technique uses a heap. We will use the algorithms to solve the single-source shortest path problem in different directed graphs. (These are Programming Problems 9.8 and 10.8 in your text.)

Program Details

You are welcome to use either Java or Python for this project. If you insist on using a language other than one of these two, you must have instructor approval before starting the project.

You may work with a partner on this project. That means a team of 2, not 3 or more. If you work with a partner, you may submit one copy of the project, with both names included on it.

Regardless of the programming language you use, you are expected to turn in well structured, well documented code. For guidance, you can refer to the CS Program Style Guide and CS Program Documentation Standards. The specifics will obviously vary from one language to the next, but these standards should give you a starting point.

Your program should use the adjacency list representation of a graph. You may use the Java Priority Queue class or the Python Heapq library for your heap in the second implementation. If you copy or modify code from any online source you must include a link to your source in your program documentation, along with descriptions of the modifications that you made.

You may decide if your program will get the graph information as input from the user or if it will read the graph information from a file. The Algorithms Illuminated site has sample data and test cases you may use and/or modify.

Program Analysis

In addition to implementing the Dijkstra algorithms, you will need to analyze their performance as the input size increases (both in terms of number of vertices and edges). Run your two algorithms on sparse as well as dense graphs. Once you are confident your implementations are working correctly, you may find larger graphs online (cite your sources) or you may think further about how to generate random graphs.

Another issue that will require some thought is specifying the basic operation for the different algorithms (i.e., what are you counting?). If you use different basic operations for different algorithms, you will need to take this into account when you compare performance. You should include appropriate counters in your code to be used in comparison with the expected running times.

Your analysis should take the form of a 2-3 page paper (including figures if appropriate). Your paper should 1) Describe the algorithms that you implemented, particularly any modifications that you had to make to the algorithms as they are presented in the textbook. 2) Discuss the predicted time complexity, and 3) compare the empirical performance of the algorithms with each other, as well as with their predicted performance. Your paper will be graded on content as well as style. Grammar, spelling and readability count. You should cite any outside sources of information that you use. All figures should have captions and clearly labeled axes. Equations should be typeset with a proper equation editor.

Handing In

By the due date you should submit a compressed archive (zip file) through Kit containing your code along with any necessary companion files.

Your archive should contain at least two files in addition to your code. The first will be the write-up described above. The second will be a plain-text README file that includes all of the information necessary for me (or anyone else) to run and understand your code. The README should include your name, the name of your partner (if any), and brief descriptions of all of the files included in the archive. More importantly, it should include clear instructions for running your code. The README is also the place to fill me in on any quirks in your implementation that I should know about. For instance, if your implementation only works on odd sized inputs, you should let me know. Undocumented bugs will tend to have a greater impact on your grade than documented bugs.

Grading Criteria

Grades on this project will be broken down as follows:

Comments and Documentation: 4
Implementations (2): 8
Write-up: 4
Total: 16


This page is maintained by Pamela Cutter pcutter{at}kzoo{dot}edu.
Official Disclaimer