public final class SpanningTrees extends Object
Modifier and Type | Method and Description |
---|---|
static double |
cost(EdgeList treeEdges,
IDataProvider edgeCost)
Returns the overall cost of a previously calculated minimum spanning tree.
|
static EdgeList |
kruskal(Graph graph,
IDataProvider cost)
Calculates a minimum spanning tree for the given graph.
|
static EdgeList |
minimum(Graph graph,
IDataProvider cost)
Calculates a minimum spanning tree for the given graph.
|
static EdgeList |
prim(Graph graph,
IDataProvider cost)
Calculates a minimum spanning tree for the given graph.
|
static EdgeList |
uniform(Graph graph)
Calculates a spanning tree for the given graph in which each edge has a uniform cost of
1.0 . |
public static final double cost(EdgeList treeEdges, IDataProvider edgeCost)
treeEdges
- the given list
of edges that form a minimum spanning treeedgeCost
- the IDataProvider
that returns a double value (cost) for each tree edgepublic static final EdgeList kruskal(Graph graph, IDataProvider cost)
The implementation is based on an algorithm originally published in:
connected
.cost.length == graph.E()
graph.E() + graph.N() * log(graph.N())
graph
- the input graphcost
- the IDataProvider
that returns a double value (cost) for each edgelist
containing the edges that form the minimum spanning treepublic static final EdgeList minimum(Graph graph, IDataProvider cost)
Currently, the result is obtained by calling prim(Graph, IDataProvider)
.
connected
.cost.length == graph.E()
graph.E() * log(graph.N())
graph
- the input graphcost
- the IDataProvider
that returns a double value (cost) for each edgelist
containing the edges that form the minimum spanning treepublic static final EdgeList prim(Graph graph, IDataProvider cost)
The implementation is based on an algorithm originally published in:
connected
.cost.length == graph.E()
graph.E() * log(graph.N())
graph
- the input graphcost
- the IDataProvider
that returns a double value (cost) for each edgelist
containing the edges that form the minimum spanning tree