I took an Olympiad Exam three days ago. I ran into a nice question as follows.
We know the bellman-ford algorithm checks all edges in each step, and for each edge if,
d(v)>d(u)+w(u,v)
then d(v) being updated such that w(u,v) is the weight of edge (u, v) and d(u) is the length of best finding path for vertex u. if in one step we have no update for vertexes, the algorithms terminates. Supposing this algorithm for finding all shortest path from vertex s in graph G with n vertex after k < n iterations is finished, which of the following is correct?
- number of edges in all shortest paths from
sis at mostk-1
- weight of all shortest paths from
sis at mostk-1
- Graph has no negative cycle.
Who can discuss on these options ?