Package org.jgrapht.alg.shortestpath
Class ListSingleSourcePathsImpl<V,E>
- 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 ofShortestPathAlgorithm.SingleSourcePathswhich 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
-
-
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 targetVertex)Return the path from the source vertex to the sink vertex.VgetSourceVertex()Returns the single source vertex.doublegetWeight(V targetVertex)Return the weight of the path from the source vertex to the sink vertex.
-
-
-
Method Detail
-
getGraph
public Graph<V,E> getGraph()
Returns the graph over which this set of paths is defined.- Specified by:
getGraphin interfaceShortestPathAlgorithm.SingleSourcePaths<V,E>- Returns:
- the graph
-
getSourceVertex
public V getSourceVertex()
Returns the single source vertex.- Specified by:
getSourceVertexin interfaceShortestPathAlgorithm.SingleSourcePaths<V,E>- Returns:
- the single source vertex
-
getWeight
public double getWeight(V targetVertex)
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
public GraphPath<V,E> getPath(V targetVertex)
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
-
-