1 votes 1 votes closed as a duplicate of: Shortest path - bellman ford and floyd warshall Consider the following statements with respect to a directed graph G in which edges can have positive or negative edge length but that has no negative cycles: S1 : The Bellman-Ford algorithm correctly computes shortest path lengths from a given origin ‘s’ to every other vertex ‘v ’. S2 : The Floyd-Warshall algorithm correctly computes shortest path lengths between every pair of vertices. Which of the following is correct? Algorithms graph-algorithm shortest-path made-easy-test-series + – garg div asked Dec 31, 2017 closed Jan 10 by Hira Thakur garg div 355 views comment Share Follow See all 3 Comments See all 3 3 Comments reply Ajay Jadhav commented Dec 31, 2017 reply Follow Share both are correct 1 votes 1 votes garg div commented Jan 1, 2018 reply Follow Share But ans is given only S2 0 votes 0 votes akash.dinkar12 commented Jan 1, 2018 reply Follow Share Given answer might be wrong!!! Both of statements are correct... 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes I think S2 is correct only because if the graph is disconnected you can't apply bellman ford into it but you can apply Floyd Warshall algorithm into it. Please correct me if I am wrong rajatmyname answered May 14, 2018 rajatmyname comment Share Follow See all 0 reply Please log in or register to add a comment.