Create a new object for generating a minimum spanning tree using Kruskal's
algorithm. If a separate spanning tree will not be needed (i.e., the
relevant edges only need to be marked in the original graph), null may be
passed as vertex factory. If null is passed, a NullPointerException will
result if generateTree() is called.
graph - graph for which a minimum spanning tree is to be determined
vertexFactory - factory method for creating new vertices for the spanning
tree graph that can be generated by calling generateTree()
public void markEdges()
Set edges in minimum spanning tree to BLACK, all other edges are
set to WHITE
Creates and returns a minimum spanning tree. Running this method does not modify
the original graph. Corresponding vertices can be determined by running getVertexMap().
The 2 graphs will have the same weight epsilon for
determining the accuracy used for weight equality, and the weights of edges between
corresponding vertices will be the same. With the exception of edge weights and weight epsilon,
however, all vertex and edge data in the spanning tree will be set to the default value,
regardless of the corresponding value in the original graph.
Returns a map showing which vertex in the spanning tree corresponds to a given
vertex in the original graph. Edges between corresponding vertices in the 2 graphs
will have the same weight. The keys of this map are the vertices in the original
graph, and the values are vertices in the spanning tree generated when generateTree()
map from vertices in the original graph to vertices in the spanning tree
java.lang.IllegalStateException - if this method is called before generateTree(). In this case, the map
has not been created yet.