|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.graph.analysis.Analysis
ptolemy.graph.analysis.AllPairShortestPathAnalysis
public class AllPairShortestPathAnalysis
An analysis to compute of the all pair shortest path of a directed graph. The result is in the form of two dimensional array (matrix). The first dimension is indexed by the source node label while the second one is indexed by the sink node label. In graphs that have multiple edges between two nodes obviously the edge with the minimum weight is being considered for the shortest path.
The distance between a node and itself is being considered Double.MAX_VALUE, unless there is a self-edge.
The result of shortestPathMatrix()
[i][i] would be the
length of the shortest cycle that includes the node with label "i".
The default analyzer runs in O(N^3) in which N is the number of nodes.
Graph.nodeLabel(ptolemy.graph.Node)
Red (ssb) |
Red (shahrooz) |
Constructor Summary | |
---|---|
AllPairShortestPathAnalysis(AllPairShortestPathAnalyzer analyzer)
Construct an instance of this class with a given analyzer. |
|
AllPairShortestPathAnalysis(Graph graph,
ToDoubleMapping edgeLength)
Construct an instance of this class with a default analyzer. |
Method Summary | |
---|---|
java.util.List |
shortestPath(Node startNode,
Node endNode)
Return the nodes on the shortest path from the node "startNode" to the node "endNode" in the form of an ordered list. |
double |
shortestPathLength(Node startNode,
Node endNode)
Return the length of the shortest path from the node startNode to the node endNode. |
double[][] |
shortestPathMatrix()
Return a matrix representing the result of the all pair shortest path algorithm. |
java.lang.String |
toString()
Return a description of the analysis and the associated analyzer. |
boolean |
validAnalyzerInterface(Analyzer analyzer)
Check if a given analyzer is compatible with this analysis. |
Methods inherited from class ptolemy.graph.analysis.Analysis |
---|
analyzer, changeAnalyzer, graph, valid |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AllPairShortestPathAnalysis(Graph graph, ToDoubleMapping edgeLength)
graph
- The given graph.edgeLength
- A mapping between the graph edges and double values,
which play the role of edge costs.public AllPairShortestPathAnalysis(AllPairShortestPathAnalyzer analyzer)
analyzer
- The given analyzer.Method Detail |
---|
public java.util.List shortestPath(Node startNode, Node endNode)
startNode
- The starting node of the path.endNode
- The ending node of the path.
public double shortestPathLength(Node startNode, Node endNode)
startNode
- The starting node of the path.endNode
- The end node of the path.
public double[][] shortestPathMatrix()
shortestPathMatrix()
[i][i] would be
the length of the shortest cycle that includes the node with label "i"
and the result of shortestPathMatrix()
[i][j] would be
the length of the shortest from the node with label "i" to the node
with label "j".
public java.lang.String toString()
toString
in class Analysis
public boolean validAnalyzerInterface(Analyzer analyzer)
validAnalyzerInterface
in class Analysis
analyzer
- The given analyzer.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |