Class PrimMinimumSpanningTree<V,E>
- java.lang.Object
-
- edu.uci.ics.jung.algorithms.shortestpath.PrimMinimumSpanningTree<V,E>
-
- Type Parameters:
V
- the vertex typeE
- the edge type
- All Implemented Interfaces:
com.google.common.base.Function<Graph<V,E>,Graph<V,E>>
,java.util.function.Function<Graph<V,E>,Graph<V,E>>
public class PrimMinimumSpanningTree<V,E> extends java.lang.Object implements com.google.common.base.Function<Graph<V,E>,Graph<V,E>>
For the input Graph, creates a MinimumSpanningTree using a variation of Prim's algorithm.
-
-
Constructor Summary
Constructors Constructor Description PrimMinimumSpanningTree(com.google.common.base.Supplier<? extends Graph<V,E>> supplier)
Creates an instance which generates a minimum spanning tree assuming constant edge weights.PrimMinimumSpanningTree(com.google.common.base.Supplier<? extends Graph<V,E>> supplier, com.google.common.base.Function<? super E,java.lang.Double> weights)
Creates an instance which generates a minimum spanning tree using the input edge weights.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Graph<V,E>
apply(Graph<V,E> graph)
protected V
findRoot(Graph<V,E> graph)
protected void
updateTree(Graph<V,E> tree, Graph<V,E> graph, java.util.Collection<E> unfinishedEdges)
-
-
-
Constructor Detail
-
PrimMinimumSpanningTree
public PrimMinimumSpanningTree(com.google.common.base.Supplier<? extends Graph<V,E>> supplier)
Creates an instance which generates a minimum spanning tree assuming constant edge weights.- Parameters:
supplier
- used to create the tree instances
-
PrimMinimumSpanningTree
public PrimMinimumSpanningTree(com.google.common.base.Supplier<? extends Graph<V,E>> supplier, com.google.common.base.Function<? super E,java.lang.Double> weights)
Creates an instance which generates a minimum spanning tree using the input edge weights.- Parameters:
supplier
- used to create the tree instancesweights
- the edge weights to use for defining the MST
-
-