Practice free →
HomeGATE CSEcomputerscienceAlgorithms › If Bellman-Ford performs a V-th iteration and ST…

If Bellman-Ford performs a V-th iteration and STILL relaxes some edge, the algorithm concludes that

Aa negative-weight cycle is reachable from the source
Bthe graph is sparse and needs Dijkstra instead
Cthe source vertex is disconnected
Dthe priority queue is exhausted
Answer & Solution
Correct answer: A. a negative-weight cycle is reachable from the source
After V − 1 iterations Bellman-Ford has correctly computed all shortest paths (which use at most V − 1 edges). If a V-th pass still finds an improvable edge, no finite shortest path exists from s to that subgraph — a negative cycle must be reachable. Bellman-Ford uniquely detects this; Dijkstra cannot.
Solve this in the app — GATE CSE practice & 24k+ MCQs →
Related questions