Implement a Java method that computes a minimum spanning tree
of a
connected
undirected weighted graph. In particular, you should implement a
version of Kruskal's MST algorithm that differs from the one
described on pages
568-570 of your textbook as follows: instead of sorting the whole list
of edges at
the beginning, it initially arranges all edges in a priority heap,
where edges of smaller weight have higher priorities. Whenever the
algorithm needs to get an edge with the smallest weight among the
remaining edges, it just performs an extractTop()
operation on the heap.
To implement the methods described in parts A, B, and C you will have to use classes that you previously implemented in the programming part of the first four assignments (Assignment 1&2, Assignment 3, Assignment 4). You can use your own implementations, or, if you are not sure that your code works correctly, you can use the binary files of these classes found here.
For more details, including the exact specification of the
methods that
you should implement, see the starter code. All of your work must be
done inside the Mst,
GraphTraversal
,
and DeltaTSP
classes, where indicated by comments that start with: "//
TODO:
".
You may also add appropriate instance variables or helper methods.
Submission
Instructions:
Submit your code using
the
"submit" mechanism on fissure (by
5:30pm on Thursday, April 5).
Use the following command from the directory containing your solution:
submit -N PGM5 cscb63s Mst.java GraphTraversal.java DeltaTSP.java
The command "man submit"
contains general instructions for submitting your code electronically.
Submit only
three
.Java file: Mst.java
, GraphTraversal
.java
and
DeltaTSP.java
(after you have implemented
the missing
parts) to the directory called PGM5.
All the code that you implement should be inside those three
files.
Do not submit any other files, and in particular, do not submit any class files. If you do, we will delete them before we compile your code.
Do not rename the files, or any of the methods and variables found in our starter code.
Fill in your
name, student
number
and login name in the comment at
the
top of the Mst.java
file. If you have a partner, you
should also
fill in the corresponding information about your partner.
We will test your code using our own tester code. The tester that we provide is very basic, running it successfully does not guarantee that your code is correct or will pass our marking tester routine. You are encouraged to derive your own test cases.