Spring 1996
As input, your program will read a graph's adjacency matrix from an input file using redirected standard input.
Here is an example input file based on the example in Standish 10.6. The first line of the file gives the number of vertices in the graph. Subsequent lines describe the graph's adjacency matrix with integer weights. Vertices with edges between them have positive weights. Vertices with no edge between them are denoted with a special negative weight: -1.
As output, your program should print the length of the shortest path between the first vertex and each other vertex in the graph. If there is no path, your program should print "Infinity" as the shortest path length. In addition to shortest path length, your program should print out the list of intermediate vertices passed through for the shortest path between the two vertices.
Here is what your program output should look like for the example input file:
Shortest path between: (1,1) = 0, via none (1,2) = 3, via none (1,3) = 10, via 2 (1,4) = 7, via 6 (1,5) = 11, via 2,3 (1,6) = 5, via none
Your source file is to be electronically submitted by using the submit program on csa. The code you submit should conform with the program assignment guidelines.
Programming assignments are due before class on the assignment due date.
Late assignments will be levied a late penalty of 10% per day. Late assignments will only be accepted up to 4 days late.
Do not allow your work to be used by others:
Warning: If someone cheats by using your work, you will also be penalized
Page Created: March 11, 1996 Maintained by: Stan Sclaroff