Trace Bellman-Ford on 5-vertex graph with negative edge
Analyze the trace bellman-ford on 5-vertex graph with negative edge.
Examples
Input:"test_input_1"
Output:"output_1"
Input:"test_input_2"
Output:"output_2"
Hints
Recall that Bellman-Ford relaxes all edges in each iteration and terminates early if no relaxation occurs in a full pass.
For a 5-vertex graph with a negative edge, determine the maximum number of iterations required before termination and explain why.
Construct a concrete 5-vertex graph with a negative edge, run Bellman-Ford step-by-step, and analyze how the negative edge affects the shortest-path estimates in each iteration.
Trace Bellman-Ford on 5-vertex graph with negative edge
Analyze the trace bellman-ford on 5-vertex graph with negative edge.