Feel free to use the source code files from the web site
(http://www.cise.ufl.edu/~sahni/dsac) of the author of our
textbook. Make adaptations, and further assumptions as necessary, but
must be documented. Do not use source code obtained from other
sources unless you have received prior consent from me. I will answer
questions relating to P3 in our newsgroup. Keep an eye on the
newsgroup wright.cs.400.
We wish to compare the run-time performance of Prim, Kruskal and Sollin's
algorithms (Section 13.3.6 of Sahni's book) by
actually running the algorithms on a series of weighted undirected
graphs that are randomly generated. The number of trees to be
generated is given as an argument to your program. Name this program
compareMST. The program is then required to output for each
graph G considered
(1) a string representation of G,
(2)
a measure of time consumed (as in the prvious project) by each of the
algorithms, and
(3) a string representation of the min spanning tree found by each of the two
algorithms.
class Graph {
public:
Graph (int n);
~Graph();
String toString();
int isConnected();
int isTree();
int totalWeight();
Graph Kruskal();
Graph Prim();
}
vertices = 3; edges = 3; total = 104; 1-2:5, 2-3:4, 1-3:95.
Submit your solution electronically using turnin P3
<files>. It should include a Makefile, the source
code files, and test input files of your choice, and their output
files, a ReadMe.txt file, and a successfully run
typescript file of test results of at least 10 graphs, We may
make and test your program.
http://www.cs.wright.edu/people/faculty/pmateti/