public class AllPairShortestPathAnalysis extends Analysis
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)
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
analyzer, changeAnalyzer, graph, valid
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.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()
public boolean validAnalyzerInterface(Analyzer analyzer)
validAnalyzerInterface
in class Analysis
analyzer
- The given analyzer.