BellmanFord
Bellman-Ford is a graph search algorithm that computes the shortest paths from a single source vertex to all other vertices in a weighted directed graph. It can handle graphs with negative edge weights and can also detect the presence of negative-weight cycles reachable from the source. The algorithm is named after Richard Bellman and Lester Ford, Jr., who developed and published it in the 1950s.
The method initializes the distance to the source as zero and to all other vertices as infinity.
Bellman-Ford runs in O(VE) time and O(V) space, where V is the number of vertices and E