Package com.jgalgo.alg.shortestpath
Class ShortestPathSingleSourceBellmanFord
java.lang.Object
com.jgalgo.alg.shortestpath.ShortestPathSingleSourceAbstract
com.jgalgo.alg.shortestpath.ShortestPathSingleSourceBellmanFord
- All Implemented Interfaces:
ShortestPathSingleSource
Bellman–Ford algorithm for Single Source Shortest Path (SSSP) with negative weights in directed graphs.
Compute the shortest paths from a single source to all other vertices with weight function of arbitrary values. The algorithm runs in \(O(n m)\) time and uses linear space.
In case there are only positive weights, use ShortestPathSingleSourceDijkstra
. In case the weights are
integers, use ShortestPathSingleSourceGoldberg
.
- Author:
- Barak Ugav
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.jgalgo.alg.shortestpath.ShortestPathSingleSource
ShortestPathSingleSource.Builder, ShortestPathSingleSource.IResult, ShortestPathSingleSource.Result<V,
E> -
Constructor Summary
-
Method Summary
Methods inherited from class com.jgalgo.alg.shortestpath.ShortestPathSingleSourceAbstract
computeShortestPaths
-
Constructor Details
-
ShortestPathSingleSourceBellmanFord
public ShortestPathSingleSourceBellmanFord()Create a Sssp bellman-ford algorithm.Please prefer using
ShortestPathSingleSource.newInstance()
to get a default implementation for theShortestPathSingleSource
interface, orShortestPathSingleSource.builder()
for more customization options.
-