Question 2
The Bellman–Ford algorithm can be used to detect the presence of a negative-weight cycle reachable from the source vertex in a weighted directed graph. Which of the following correctly explains how Bellman–Ford detects a negative-weight cycle?
A negative-weight cycle exists if the shortest distance to any vertex becomes negative at any point during the algorithm.
If, after performing exactly relaxation iterations, an additional relaxation of any edge further reduces a distance value, then a negative-weight cycle is present.
If the algorithm encounters an edge with a negative weight during relaxation, it immediately concludes that a negative-weight cycle exists.
If multiple shortest paths exist between two vertices, the graph must contain a negative-weight cycle.