Shortest Pair

graphs


Preliminaries

The purpose of this assignment is to gain experience with Greedy and Dynamic Programming Algorithms.


If the vector library is used in this assignment, you will not receive any credit.

Lab To Do

  1. Write a class called shortest that implements a directed, weighted graph using an adjacency matrix.

    To keep things simple, we will use the value 1000000 to represent infinity. You should declare it as a constant. Infinity is also represented in the math library. You can use it.

    You are going to implement Floyd2 from Chapter 3. The path algorithm on page 105 must be a private function.

    You are going to modify Dijkstra's shortest path algorithm from Chapter 4 to take a starting vertex V and calculate the shortest path from V to every other vertex.

    Your class must be in shortest.cpp and shortest.h.

    Your private section must contain the dynamically allocated 2-dimentional matrices for W, D, and P.

    You must provide the following member functions:

Lab Turn In

On the command line, type turnin, select cs328, assign2.


The program is due before the start of class on the date specified on the lab page.





This page is maintained by Barbara Bracken

Last Modified 2:27 PM 6/17/2022