|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--y.algo.SpanningTrees
Provides (minimum) spanning tree algorithms for graphs. A spanning tree of an undirected connected graph is a subset of its edges that from a tree connecting all edges of the graph. If the edges of a graph have a cost or a weight associated with them then it is possible to calculate a minimum spanning tree of that graph, i.e. a spanning tree whose edges have minimum overall cost of all spanning trees of that graph.
Constructor Summary | |
SpanningTrees()
|
Method Summary | |
static double |
cost(EdgeList treeEdges,
DataProvider edgeCost)
Returns the overall cost of a previously calculated minimum spanning tree. |
static EdgeList |
kruskal(Graph graph,
DataProvider cost)
Calculates a minimum spanning tree for the given graph. |
static EdgeList |
minimum(Graph graph,
DataProvider cost)
Calculates a minimum spanning tree for the given graph using our favourite algorithm for that problem. |
static EdgeList |
prim(Graph graph,
DataProvider cost)
Calculates a minimum spanning tree for the given graph. |
static EdgeList |
uniform(Graph graph)
Calculates a spanning tree for the given graph. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SpanningTrees()
Method Detail |
public static EdgeList minimum(Graph graph, DataProvider cost)
graph
- the input graphcost
- a data provider that must return a double value for each
edge in the graph.
public static EdgeList kruskal(Graph graph, DataProvider cost)
J.B. Kruskal. On the shortest spanning subtree of a graph and the travelling salesman problem. Proceedings of the American Mathematical Society, pages 48-50, 1956.
graph
- the input graphcost
- a data provider that must return a double value for each
edge in the graph.
public static EdgeList prim(Graph graph, DataProvider cost)
R.C. Prim. Shortest connection networks ans some generalizations. Bell System Technical Journal, 36:1389-1401, 1957.
graph
- the input graphcost
- a data provider that must return a double value for each
edge in the graph.
public static EdgeList uniform(Graph graph)
graph
- the input graph
public static double cost(EdgeList treeEdges, DataProvider edgeCost)
treeEdges
- edges that make up a minimum spanning tree.edgeCost
- a data provider that returns the double valued
cost of each of the tree edges.
|
© Copyright 2000-2003, yWorks GmbH. All rights reserved. 2003 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |