GATE | GATE 2017 MOCK II | Question 16

Consider the following statements about Bellman ford algorithm for finding shortest path in a directed connected graph G having integral edge weights.

Statement I: It will always find out negative edge weight cycle in G reachable from source.


Statement II: It will always give correct answer for the graph G.

Choose from the options given below.

(A) Both statements are true
(B) Both statements are false

(C) Statement I is true and Statement II is false
(D) Statement II is true and Statement I is false


Answer: (C)

Explanation: Statement 1 is true as in the nth iteration of Bellman Ford, if the length of the path of any node reachable from the source is decreased, that means we are having negative edge weight cycle in the graph.



Statement 2 is false as no algorithm can give give correct answer if the Graph is having negative edge weight cycle.


Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.