Class MinimumSpanningForest2<V,E>
- java.lang.Object
-
- edu.uci.ics.jung.algorithms.shortestpath.MinimumSpanningForest2<V,E>
-
- Type Parameters:
V
- the vertex typeE
- the edge type
public class MinimumSpanningForest2<V,E> extends java.lang.Object
For the input Graph, creates a MinimumSpanningTree using a variation of Prim's algorithm.
-
-
Constructor Summary
Constructors Constructor Description MinimumSpanningForest2(Graph<V,E> graph, com.google.common.base.Supplier<Forest<V,E>> supplier, com.google.common.base.Supplier<? extends Graph<V,E>> treeFactory, com.google.common.base.Function<? super E,java.lang.Double> weights)
Create a Forest from the supplied Graph and supplied Supplier, which is used to create a new, empty Forest.MinimumSpanningForest2(Graph<V,E> graph, Forest<V,E> forest, com.google.common.base.Supplier<? extends Graph<V,E>> treeFactory, com.google.common.base.Function<? super E,java.lang.Double> weights)
Create a forest from the supplied graph, populating the supplied Forest, which must be empty.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Forest<V,E>
getForest()
-
-
-
Constructor Detail
-
MinimumSpanningForest2
public MinimumSpanningForest2(Graph<V,E> graph, com.google.common.base.Supplier<Forest<V,E>> supplier, com.google.common.base.Supplier<? extends Graph<V,E>> treeFactory, com.google.common.base.Function<? super E,java.lang.Double> weights)
Create a Forest from the supplied Graph and supplied Supplier, which is used to create a new, empty Forest. If non-null, the supplied root will be used as the root of the tree/forest. If the supplied root is null, or not present in the Graph, then an arbitary Graph vertex will be selected as the root. If the Minimum Spanning Tree does not include all vertices of the Graph, then a leftover vertex is selected as a root, and another tree is created- Parameters:
graph
- the graph for which the minimum spanning forest will be generatedsupplier
- a factory for the type of forest to buildtreeFactory
- a factory for the type of tree to buildweights
- edge weights; may be null
-
MinimumSpanningForest2
public MinimumSpanningForest2(Graph<V,E> graph, Forest<V,E> forest, com.google.common.base.Supplier<? extends Graph<V,E>> treeFactory, com.google.common.base.Function<? super E,java.lang.Double> weights)
Create a forest from the supplied graph, populating the supplied Forest, which must be empty. If the supplied root is null, or not present in the Graph, then an arbitary Graph vertex will be selected as the root. If the Minimum Spanning Tree does not include all vertices of the Graph, then a leftover vertex is selected as a root, and another tree is created- Parameters:
graph
- the Graph to find MST inforest
- the Forest to populate. Must be emptytreeFactory
- a factory for the type of tree to buildweights
- edge weights, may be null
-
-