Package com.jgalgo.alg.shortestpath
Class ShortestPathSingleSourceBellmanFord
- java.lang.Object
-
- com.jgalgo.alg.shortestpath.ShortestPathSingleSourceAbstract
-
- com.jgalgo.alg.shortestpath.ShortestPathSingleSourceBellmanFord
-
- All Implemented Interfaces:
ShortestPathSingleSource
public class ShortestPathSingleSourceBellmanFord extends ShortestPathSingleSourceAbstract
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, useShortestPathSingleSourceGoldberg
.- Author:
- Barak Ugav
- See Also:
- Wikipedia
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.jgalgo.alg.shortestpath.ShortestPathSingleSource
ShortestPathSingleSource.Builder, ShortestPathSingleSource.IResult, ShortestPathSingleSource.Result<V,E>
-
-
Constructor Summary
Constructors Constructor Description ShortestPathSingleSourceBellmanFord()
Create a Sssp bellman-ford algorithm.
-
-
-
Constructor Detail
-
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.
-
-