CS 3158 -- Design and Analysis of Algorithms

Fall 1998


Animation Assignment 3: Minimum Spanning Tree


Due December 2

In this assignment, you will build an animation of either Kruskal's or Prim's minimum spanning tree algorithm. Students whose last numeric digit of their gt account ends in an even number (e.g., gt1234a) should animate Kruskal's algorithm. Students with odd-numbered finishing gt accounts should animation Prim's algorithm. As before, use the samba tool. You should try to make the animation as informative and interesting as possible. You will be graded on the correctness of the animation (does it accurately reflect the operation of the algorithm), its informative content (does it really help explain what the algorithm is doing), and its general originality and visual aesthetics.

The input files for your programs will consist of 3 sequential sections. The first section is simply one integer number which denotes how many vertices are in the graph. The next section, one line per vertex, provides the x, y position of each vertex (0.0 - 1.0). The final section provides the adjacency matrix for the graph. For Prim's algorithm, use the first vertex as the starter. An example of this format appears below. Sample input files, and the eventual turn-in data file will be posted in the newsgroup.

Again, all you need to do to submit your assignment is to use the 3158in program to electronically submit the ascii trace file of the animator commands for that special input set.

7
0.2 0.55
0.3 0.3
0.4 0.8
0.6 0.7
0.5 0.5
0.7 0.2
0.8 0.9
0  4  9  0  6  0  0
4  0  0  0  7 12  0
9  0  0 12 10  0 19
0  0 12  0  5 14 13
6  7 10  5  0 11  0
0 12  0 14 11  0 18
0  0 19 13  0 18  0