accomplish Bellman-Ford algorithm.