Class PrimMinimumSpanningTree<V,W>
java.lang.Object
org.episteme.core.mathematics.discrete.PrimMinimumSpanningTree<V,W>
- All Implemented Interfaces:
MinimumSpanningTree<V,W>
Implementation of Prim's algorithm for finding the Minimum Spanning Tree.
*
Reference:
Prim, R. C. (1957). Shortest connection networks and some generalizations. Bell System Technical Journal, 36(6), 1389-1401.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Constructor Summary
ConstructorsConstructorDescriptionPrimMinimumSpanningTree(GraphWeightAdapter<W> weightAdapter) Creates a new Prim's MST algorithm instance. -
Method Summary
Modifier and TypeMethodDescriptionSet<WeightedEdge<V, W>> findMST(WeightedGraph<V, W> graph) Finds the Minimum Spanning Tree of the given graph.static <V> PrimMinimumSpanningTree<V, Double> ofDouble()Creates an instance for Double weights.static <V> PrimMinimumSpanningTree<V, Real> ofReal()Creates an instance for Real weights.
-
Constructor Details
-
PrimMinimumSpanningTree
Creates a new Prim's MST algorithm instance.- Parameters:
weightAdapter- adapter for handling weights
-
-
Method Details
-
ofDouble
Creates an instance for Double weights. -
ofReal
Creates an instance for Real weights. -
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
-