public class AllEdgeSingleSourceLongestPathStrategy extends CachedStrategy implements SingleSourceLongestPathAnalyzer
This algorithm runs in O(E), in which E is the number of edges.
SingleSourceLongestPathAnalysis
Constructor and Description |
---|
AllEdgeSingleSourceLongestPathStrategy(Graph graph,
Node startNode,
ToDoubleMapping edgeLengths)
Construct an instance of this analyzer.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
_convertResult, _result, cachingStatus, disableCaching, enableCaching, getCachedResult, graph, obsolete, reset, setCachedResult
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
graph
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.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()
protected java.lang.Object _compute()
_compute
in class CachedStrategy