Comp 121 Introduction to Data Structures.
Spring 2000Programming Assignment 5 -- Due May 4, 2000
Objective: To obtain experience in representing and manipulating graphs.
Goal. To implement an adjacency-matrix representation of graphs. To implement the Warshall-Floyd shortest-paths algorithm on the graph.
Graphs may be stored internally in either adjacency-matrix or adjacency-list form. For this assignment, you are to implement (and test) an implementation of a graph object that is stored internally in adjacency-matrix form. You may assume that the vertices of your graph are identified by the integers 0,1,....n-1, and that all edge-weights are floating-point numbers. Your graph object should support the following operations
:The specifications of the graph are to be read from an input file by your client program. This file has the following format
:n
u1 v1 w1
u2 v2 w2
...
um vm wm
-1
Here, n denotes the number of vertices in the graph. Each following 3-tuple denotes an edge, which is specified by its source-vertex, its destination-vertex, and its weight. The input file is terminated by a 1.
Rules for submitting this program:
All of the above should be placed in an envelope with your name and student-ID on the outside, and submitted at the beginning of class on the due date. Submissions will not be accepted after 10 minutes have elapsed from the start of class no late submissions will be accepted without documented reasons.