Input | Correct Output | Description |
---|---|---|
Complete | Answer | A large complete graph. This test was the basis for the performance score. The fastest scores were in the 25-30ms range. Anything less than 50ms is excellent, and anything less than 100ms still earns "full credit" for performance. |
Grid | Answer | A medium-sized grid graph, as from the provided tests. |
Small | Answer | A very small, hand-made graph with 8 vertices and 13 edges. Tests performance on graphs with multiple edges with the same weight, and graphs with a wide range of weights. This is the only graph in the set with a non-unique solution. |
Regular | Answer | A medium-sized |V|/2-regular graph, as from the provided tests. |
do_MCST()
. This function should compute the
minimum-cost spanning tree for the graph it is given. Exact
details of the parameters are given in the file.
Note: The benchmark files are quite large. In order to prevent unnecessary copying, I have placed public copies in
~dfasulo/cse326/mcstbenchfor use on sanjuan and orcas.
Input File | MCST | Description | Time | Holder | Algorithm |
---|---|---|---|---|---|
grid-small | answer | A 30x30 grid (on a torus) | 2 ms. | T. Huynh | Kruskal's |
grid-medium | answer | A 50x50 grid (on a torus) | 9 ms. | D. Fasulo | Kruskal's |
grid-large | answer | A 60x60 grid (on a torus) | 15 ms. | T. Huynh | Kruskal's |
v2reg-small | answer | A 100-regular graph with 200 vertices | 4 ms. | D. Fasulo | Kruskal's |
v2reg-medium | answer | A 150-regular graph with 300 vertices | 8 ms. | T. Huynh | Kruskal's |
v2reg-large | answer | A 250-regular graph with 500 vertices | 26 ms. | D. Fasulo | Kruskal's |
complete-small | answer | A 125-vertex complete graph | 3 ms. | T. Huynh | Kruskal's |
complete-medium | answer | A 250-vertex complete graph | 12 ms. | D. Fasulo | Kruskal's |
complete-large | answer | A 375-vertex complete graph | 27 ms. | D. Fasulo | Kruskal's |
makefile
and mcst.cpp
above.
do_MCST()
. You can add any additional files to the
project you want; for example, you will probably want to
separately create a graph class to make writing the algorithm easier.
cin
) in the form
V E i1 j1 w1 i2 j2 w2 ...For each edge, there is exactly one entry; hence, if there is an edge from vertex 1 to vertex 3 with weight 7 and there is an entry of the form
1 3 7then there is no entry
3 1 7After calling your algorithm, the program then prints out a list of edges in the MCST to standard out (
cout
) and also a
message about the running time of the algorithm to the
standard error device (cerr
). This is
convenient because you can run your program in the following
way:
mcst < mygraph > mygraph-resultThis will place the edges of the MCST into
mygraph-result
but print the running
time of the algorithm to the console.
The program will be judged partially on effort, so more sophisticated, faster algorithms will receive more credit than very naive implementations.
Tip: Be more concerned with algorithmic
improvements than hand-optimizing your C++ code (i.e., trying
to eliminate assignment statements, etc.). Once you have a
working program, you can compile
with the g++
optimization flag -O2
to perform many source-level optimizations for you.