Bellman Ford Algorithm, Data Structure Algorithm, Algorithms, Weighted Graph, Graph Data Structure.
with a negative cycle As you would have noticed, the paths were getting relaxed even after 3 times (as there were 4 vertices in the graph, so V-1 times). It’s because of the negative weighed edge cycle: 4 → 2 → 3. So, that’s the shortcoming of the Bellman-Ford algorithm, it can’t find an optimal