Module org.jgrapht.core
Package org.jgrapht.alg.shortestpath
Class FloydWarshallShortestPaths.FloydWarshallSingleSourcePaths
- java.lang.Object
-
- org.jgrapht.alg.shortestpath.FloydWarshallShortestPaths.FloydWarshallSingleSourcePaths
-
- All Implemented Interfaces:
ShortestPathAlgorithm.SingleSourcePaths<V,E>
- Enclosing class:
- FloydWarshallShortestPaths<V,E>
class FloydWarshallShortestPaths.FloydWarshallSingleSourcePaths extends java.lang.Object implements ShortestPathAlgorithm.SingleSourcePaths<V,E>
-
-
Constructor Summary
Constructors Constructor Description FloydWarshallSingleSourcePaths(V source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Graph<V,E>getGraph()Returns the graph over which this set of paths is defined.GraphPath<V,E>getPath(V sink)Return the path from the source vertex to the sink vertex.VgetSourceVertex()Returns the single source vertex.doublegetWeight(V sink)Return the weight of the path from the source vertex to the sink vertex.
-
-
-
Field Detail
-
source
private final V source
-
-
Constructor Detail
-
FloydWarshallSingleSourcePaths
public FloydWarshallSingleSourcePaths(V source)
-
-
Method Detail
-
getGraph
public Graph<V,E> getGraph()
Description copied from interface:ShortestPathAlgorithm.SingleSourcePathsReturns the graph over which this set of paths is defined.- Specified by:
getGraphin interfaceShortestPathAlgorithm.SingleSourcePaths<V,E>- Returns:
- the graph
-
getSourceVertex
public V getSourceVertex()
Description copied from interface:ShortestPathAlgorithm.SingleSourcePathsReturns the single source vertex.- Specified by:
getSourceVertexin interfaceShortestPathAlgorithm.SingleSourcePaths<V,E>- Returns:
- the single source vertex
-
getWeight
public double getWeight(V sink)
Description copied from interface:ShortestPathAlgorithm.SingleSourcePathsReturn the weight of the path from the source vertex to the sink vertex. If no such path exists,Double.POSITIVE_INFINITYis returned. The weight of the path between a vertex and itself is always zero.- Specified by:
getWeightin interfaceShortestPathAlgorithm.SingleSourcePaths<V,E>- Parameters:
sink- the sink vertex- Returns:
- the weight of the path between source and sink vertices or
Double.POSITIVE_INFINITYin case no such path exists
-
getPath
public GraphPath<V,E> getPath(V sink)
Description copied from interface:ShortestPathAlgorithm.SingleSourcePathsReturn the path from the source vertex to the sink vertex.- Specified by:
getPathin interfaceShortestPathAlgorithm.SingleSourcePaths<V,E>- Parameters:
sink- the sink vertex- Returns:
- the path from the source vertex to the sink vertex or null if no such path exists
-
-