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, use ShortestPathSingleSourceGoldberg.

Author:
Barak Ugav
See Also: