java.lang.Object
org.jgrapht.alg.shortestpath.ListSingleSourcePathsImpl<V,E>
- Type Parameters:
V
- the graph vertex typeE
- the graph edge type
- All Implemented Interfaces:
java.io.Serializable
,ShortestPathAlgorithm.SingleSourcePaths<V,E>
public class ListSingleSourcePathsImpl<V,E> extends java.lang.Object implements ShortestPathAlgorithm.SingleSourcePaths<V,E>, java.io.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
.
- Author:
- Dimitrios Michail
- See Also:
- Serialized Form
-
Field Summary
-
Constructor Summary
-
Method Summary
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 targetVertex)
Return the path from the source vertex to the sink vertex.V
getSourceVertex()
Returns the single source vertex.double
getWeight(V targetVertex)
Return the weight of the path from the source vertex to the sink vertex.
-
Field Details
-
Constructor Details
-
Method Details
-
getGraph
Returns the graph over which this set of paths is defined.- Specified by:
getGraph
in interfaceShortestPathAlgorithm.SingleSourcePaths<V,E>
- Returns:
- the graph
-
getSourceVertex
Returns the single source vertex.- Specified by:
getSourceVertex
in 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_INFINITY
is returned. The weight of the path between a vertex and itself is always zero.- Specified by:
getWeight
in interfaceShortestPathAlgorithm.SingleSourcePaths<V,E>
- Parameters:
targetVertex
- the sink vertex- Returns:
- the weight of the path between source and sink vertices or
Double.POSITIVE_INFINITY
in case no such path exists
-
getPath
Return the path from the source vertex to the sink vertex.- Specified by:
getPath
in 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
-