Skip to content
Related Articles

Related Articles

GATE | GATE 2017 MOCK II | Question 16

View Discussion
Improve Article
Save Article
  • Last Updated : 28 Jul, 2022
View Discussion
Improve Article
Save Article

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 correct answer if the Graph is having negative edge weight cycle.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!