|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.graph.analysis.strategy.Strategy
ptolemy.graph.analysis.strategy.CachedStrategy
ptolemy.graph.analysis.strategy.AllEdgeSingleSourceLongestPathStrategy
public class AllEdgeSingleSourceLongestPathStrategy
An analyzer used to find the longest path from a single source.
This algorithm runs in O(E), in which E is the number of edges.
SingleSourceLongestPathAnalysis
Red (ssb) |
Red (shahrooz) |
Field Summary | |
---|---|
private ToDoubleMapping |
_edgeLengths
|
private int[] |
_predecessor
|
private Node |
_startNode
|
Constructor Summary | |
---|---|
AllEdgeSingleSourceLongestPathStrategy(Graph graph,
Node startNode,
ToDoubleMapping edgeLengths)
Construct an instance of this analyzer. |
Method Summary | |
---|---|
protected java.lang.Object |
_compute()
The computation associated with this analyzer. |
double[] |
distance()
Return the distance from the start node to all the other nodes in the graph. |
Node |
getStartNode()
Return the single source-node (start node) of this analyzer. |
java.util.List |
path(Node endNode)
Return the longest path from node startNode to node endNode in the form of an ordered list. |
double |
pathLength(Node endNode)
Return the length of the longest path from node startNode to node endNode. |
private int[] |
predecessors()
Return the predecessor array of this analyzer. |
void |
setStartNode(Node startNode)
Set the single source node (starting node) of this analyzer to the given node. |
java.lang.String |
toString()
Return a description of the analyzer. |
boolean |
valid()
Check for compatibility between the analysis and the given graph. |
Methods inherited from class ptolemy.graph.analysis.strategy.CachedStrategy |
---|
_convertResult, _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 ptolemy.graph.analysis.analyzer.GraphAnalyzer |
---|
graph |
Field Detail |
---|
private ToDoubleMapping _edgeLengths
private Node _startNode
private int[] _predecessor
Constructor Detail |
---|
public AllEdgeSingleSourceLongestPathStrategy(Graph graph, Node startNode, ToDoubleMapping edgeLengths)
graph
- The given graph.startNode
- The node from which the longest path is going to be
calculated.edgeLengths
- The lengths of the edges of the given graph, which
are going to be used to calculated the longest path.Method Detail |
---|
public double[] distance()
distance
in interface SingleSourceLongestPathAnalyzer
Graph.nodeLabel(ptolemy.graph.Node)
public Node getStartNode()
getStartNode
in interface SingleSourceLongestPathAnalyzer
setStartNode(Node)
public java.util.List path(Node endNode)
setStartNode(ptolemy.graph.Node)
.
The result includes the starting and the ending nodes.
path
in interface SingleSourceLongestPathAnalyzer
endNode
- The ending node of the path.
public double pathLength(Node endNode)
setStartNode(ptolemy.graph.Node)
.
pathLength
in interface SingleSourceLongestPathAnalyzer
endNode
- The ending node of the path.
public void setStartNode(Node startNode)
setStartNode
in interface SingleSourceLongestPathAnalyzer
startNode
- The given node.getStartNode()
public java.lang.String toString()
toString
in interface Analyzer
toString
in class CachedStrategy
public boolean valid()
valid
in interface Analyzer
protected java.lang.Object _compute()
_compute
in class CachedStrategy
private int[] predecessors()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |