Package dsa
Class Kruskal
java.lang.Object
dsa.Kruskal
An immutable data type to determine the minimum spanning tree (MST) of an edge-weighted graph.
-
Constructor Summary
ConstructorDescriptionDetermines the MST of the edge-weighted graphG
. -
Method Summary
-
Constructor Details
-
Kruskal
Determines the MST of the edge-weighted graphG
.- Parameters:
G
- the edge-weighted graph.
-
-
Method Details
-
edges
Returns the edges in the MST.- Returns:
- the edges in the MST.
-
weight
public double weight()Returns the sum of the edge weights in the MST.- Returns:
- the sum of the edge weights in the MST.
-
main
Unit tests the data type.- Parameters:
args
- the command-line arguments.
-