| 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmocgraph.analysis.strategy.CachedStrategy
mapss.dif.graph.MinimumSpanningTreeStrategy
public class MinimumSpanningTreeStrategy
Computation of a minimum spanning tree in a graph. The collection returned cannot be modified.
This implementation is adapted from Prim's algorithm, as taken from Introduction to Algorithms by Cormen, Leiserson, and Rivest (second edition).
MinimumSpanningTreeAnalysis| Constructor Summary | |
|---|---|
MinimumSpanningTreeStrategy(mocgraph.Graph graph,
                            mocgraph.mapping.ToDoubleMapping edgeWeights)
Construct a minimum spanning tree strategy for a given graph and a given set of edge weights.  | 
|
| Method Summary | |
|---|---|
protected  java.lang.Object | 
_compute()
Compute a minimal spanning tree of the graph in the form of a List. | 
protected  java.lang.Object | 
_convertResult(java.lang.Object result)
Return the result of this analysis in a form that cannot be modified.  | 
 java.util.List | 
edges()
Compute a minimum spanning tree in the form of a a list.  | 
 java.lang.String | 
toString()
Return a description of the minimal spanning tree.  | 
 boolean | 
valid()
Check compatibility of the class of graph.  | 
 double | 
weight()
Return the weight of the minimum spanning tree (i.e., the sum of the weights of the edges in the tree.  | 
| Methods inherited from class mocgraph.analysis.strategy.CachedStrategy | 
|---|
_result, cachingStatus, disableCaching, enableCaching, getCachedResult, graph, obsolete, reset, setCachedResult | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Methods inherited from interface mocgraph.analysis.analyzer.GraphAnalyzer | 
|---|
graph | 
| Constructor Detail | 
|---|
public MinimumSpanningTreeStrategy(mocgraph.Graph graph,
                                   mocgraph.mapping.ToDoubleMapping edgeWeights)
graph - The given graph.edgeWeights - The edge weights.| Method Detail | 
|---|
public java.util.List edges()
Edge.
edges in interface MinimumSpanningTreeAnalyzerpublic java.lang.String toString()
toString in interface mocgraph.analysis.analyzer.AnalyzertoString in class mocgraph.analysis.strategy.CachedStrategypublic boolean valid()
valid in interface mocgraph.analysis.analyzer.Analyzergraph - The given graph.
public double weight()
weight in interface MinimumSpanningTreeAnalyzerprotected java.lang.Object _compute()
List. Each element of the list is an Edge.
  If the graph contains no edges, an empty list is returned.
  The graph is assumed to be connected.
_compute in class mocgraph.analysis.strategy.CachedStrategyprotected java.lang.Object _convertResult(java.lang.Object result)
_convertResult in class mocgraph.analysis.strategy.CachedStrategyresult - The original result.
  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||