V - the vertex typeE - the edge typepublic class PrimMinimumSpanningTree<V,E> extends Object implements com.google.common.base.Function<Graph<V,E>,Graph<V,E>>
| Modifier and Type | Field and Description |
|---|---|
protected com.google.common.base.Supplier<? extends Graph<V,E>> |
treeFactory |
protected com.google.common.base.Function<? super E,Double> |
weights |
| Constructor and 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,Double> weights)
Creates an instance which generates a minimum spanning tree using the input edge weights.
|
| Modifier and Type | Method and 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,
Collection<E> unfinishedEdges) |
public PrimMinimumSpanningTree(com.google.common.base.Supplier<? extends Graph<V,E>> supplier)
supplier - used to create the tree instancespublic PrimMinimumSpanningTree(com.google.common.base.Supplier<? extends Graph<V,E>> supplier, com.google.common.base.Function<? super E,Double> weights)
supplier - used to create the tree instancesweights - the edge weights to use for defining the MSTCopyright © 2016. All rights reserved.