Package com.jgalgo.alg.shortestpath
Class ShortestPathStAbstract
- java.lang.Object
-
- com.jgalgo.alg.shortestpath.ShortestPathStAbstract
-
- All Implemented Interfaces:
ShortestPathSt
- Direct Known Subclasses:
ShortestPathStBidirectionalBfs
,ShortestPathStBidirectionalDijkstra
public abstract class ShortestPathStAbstract extends Object implements ShortestPathSt
Abstract class for computing a single shortest path between a source and a target.The class implements the interface by solving the problem on the index graph and then maps the results back to the original graph. The implementation for index graphs is abstract and left to the subclasses.
- Author:
- Barak Ugav
-
-
Constructor Summary
Constructors Constructor Description ShortestPathStAbstract()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <V,E>
ObjectDoublePair<Path<V,E>>computeShortestPathAndWeight(Graph<V,E> g, WeightFunction<E> w, V source, V target)
Compute the shortest path from a source vertex to a target vertex, and its weight.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.jgalgo.alg.shortestpath.ShortestPathSt
computeShortestPath
-
-
-
-
Method Detail
-
computeShortestPathAndWeight
public <V,E> ObjectDoublePair<Path<V,E>> computeShortestPathAndWeight(Graph<V,E> g, WeightFunction<E> w, V source, V target)
Description copied from interface:ShortestPathSt
Compute the shortest path from a source vertex to a target vertex, and its weight.If
g
is anIntGraph
, aIPath
object will be returned. In that case, its better to pass aIWeightFunction
asw
to avoid boxing/unboxing.- Specified by:
computeShortestPathAndWeight
in interfaceShortestPathSt
- Type Parameters:
V
- the vertices typeE
- the edges type- Parameters:
g
- the graphw
- an edge weight functionsource
- the source vertextarget
- the target vertex- Returns:
- a pair of the shortest path from the source to the target, and its weight, or
null
if there is no path
-
-