java.lang.Object
org.jgrapht.alg.shortestpath.ListSingleSourcePathsImpl<V,E>
- Type Parameters:
V- the graph vertex typeE- the graph edge type
- All Implemented Interfaces:
Serializable,ShortestPathAlgorithm.SingleSourcePaths<V,E>
public class ListSingleSourcePathsImpl<V,E>
extends Object
implements ShortestPathAlgorithm.SingleSourcePaths<V,E>, Serializable
An implementation of
ShortestPathAlgorithm.SingleSourcePaths which stores one path per vertex.
This is an explicit representation which stores all paths. For a more compact representation see
TreeSingleSourcePathsImpl.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetGraph()Returns the graph over which this set of paths is defined.Return the path from the source vertex to the sink vertex.Returns the single source vertex.doubleReturn the weight of the path from the source vertex to the sink vertex.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
graph
The graph -
source
The source vertex of all paths -
paths
One path per vertex
-
-
Constructor Details
-
ListSingleSourcePathsImpl
Construct a new instance.- Parameters:
graph- the graphsource- the source vertexpaths- one path per target vertex
-
-
Method Details
-
getGraph
Returns the graph over which this set of paths is defined.- Specified by:
getGraphin interfaceShortestPathAlgorithm.SingleSourcePaths<V,E> - Returns:
- the graph
-
getSourceVertex
Returns the single source vertex.- Specified by:
getSourceVertexin interfaceShortestPathAlgorithm.SingleSourcePaths<V,E> - Returns:
- the single source vertex
-
getWeight
Return 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:
targetVertex- the sink vertex- Returns:
- the weight of the path between source and sink vertices or
Double.POSITIVE_INFINITYin case no such path exists
-
getPath
Return the path from the source vertex to the sink vertex.- Specified by:
getPathin interfaceShortestPathAlgorithm.SingleSourcePaths<V,E> - Parameters:
targetVertex- the sink vertex- Returns:
- the path from the source vertex to the sink vertex or null if no such path exists
-