Package dsa
Class Kruskal
- java.lang.Object
-
- dsa.Kruskal
-
public class Kruskal extends Object
An immutable data type to determine the minimum spanning tree (MST) of an edge-weighted graph.
-
-
Constructor Summary
Constructors Constructor Description Kruskal(EdgeWeightedGraph G)
Determines the MST of the edge-weighted graphG
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterable<Edge>
edges()
Returns the edges in the MST.static void
main(String[] args)
Unit tests the data type.double
weight()
Returns the sum of the edge weights in the MST.
-
-
-
Constructor Detail
-
Kruskal
public Kruskal(EdgeWeightedGraph G)
Determines the MST of the edge-weighted graphG
.- Parameters:
G
- the edge-weighted graph.
-
-
Method Detail
-
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
public static void main(String[] args)
Unit tests the data type.- Parameters:
args
- the command-line arguments.
-
-