Class KruskalMinimumSpanningTree<V,W>
java.lang.Object
org.episteme.core.mathematics.discrete.KruskalMinimumSpanningTree<V,W>
- All Implemented Interfaces:
MinimumSpanningTree<V,W>
Kruskal's algorithm for finding Minimum Spanning Tree.
Alternative to Prim's algorithm. Sorts edges by weight and greedily adds them if they don't create a cycle. Uses Union-Find data structure. O(E log E) time.
*
Reference:
Kruskal, J. B. (1956). On the shortest spanning subtree of a graph and the traveling salesman problem. Proceedings of the American Mathematical Society, 7(1), 48-50.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSet<WeightedEdge<V, W>> findMST(WeightedGraph<V, W> graph) Finds the Minimum Spanning Tree of the given graph.static <V> KruskalMinimumSpanningTree<V, Double> ofDouble()static <V> KruskalMinimumSpanningTree<V, Real> ofReal()
-
Constructor Details
-
KruskalMinimumSpanningTree
-
-
Method Details
-
ofDouble
-
ofReal
-
findMST
Description copied from interface:MinimumSpanningTreeFinds the Minimum Spanning Tree of the given graph.- Specified by:
findMSTin interfaceMinimumSpanningTree<V,W> - Parameters:
graph- the graph to find the MST for- Returns:
- a set of edges representing the MST
-