Prove Bellman-Ford detects negative cycles from source
Analyze the prove bellman-ford detects negative cycles from source.
Examples
Input:"proof_case_1"
Output:true
Input:"proof_case_2"
Output:true
Hints
Recall that Bellman-Ford relaxes all edges |V|-1 times to guarantee shortest paths in graphs without negative cycles.
After |V|-1 relaxations, if any edge can still be relaxed, what does that imply about the graph's structure?
Prove that such a relaxation in the |V|th iteration must create a negative cycle reachable from the source, and explain why this cycle must be part of a path from the source.
Prove Bellman-Ford detects negative cycles from source
Analyze the prove bellman-ford detects negative cycles from source.