Each relaxation operation is actually an access to adjacent nodes. The nth relaxation operation ensures that all paths with depth n are the shortest. Since the shortest path of the graph will not pass through more than | V | -1 edges, it can be seen that the Bellman-Ford algorithm obtains the shortest path