4 3 4. The Bellman-Ford algorithm also solves the single-source shortest path problem, but unlike Dijkstra’s algorithm (see problem 2), it can work with negative-weight arcs as long as there is no negative-weight cycle (see problem 3). Because a shortest path has maximum n -1 arcs, the algorithm computes in turn all shortest paths with number of arcs from 1 ton -1. (Because arcs can have negative weights, adding more arcs to a path could reduce the overall
OR
OR