Bellman-Ford
mediumAfter k passes, every shortest path using at most k edges is correct. A simple path uses at most V−1 edges - so if anything still improves on pass V, there is a negative cycle.
Best
O(E) with early exitWorst O(V·E)Space O(V)Loading the bellman-ford engine…