A tentative path cost is an upper bound supplied by a discovered route. Dijkstra's algorithm can turn the smallest tentative label into a final answer because nonnegative remaining edges cannot make an undiscovered continuation cheaper in the wrong direction. A negative edge removes that protection. The issue is not whether a priority queue can store negative numbers; it is whether removing a vertex certifies its label permanently.
Consider an abstract robot-related cost graph, where a signed edge represents a declared additive objective rather than physical travel distance. The graph below is invented and directed. It is not a claim that a real robot has negative travel time or that a library was executed. Its purpose is to expose exactly which proof condition fails.
Specify every directed edge
There are four vertices: source S, intermediate vertices A and B, and goal G. The complete edge list is S to A with cost 2, S to B with cost 5, B to A with cost -4, A to G with cost 2, and B to G with cost 10. There are no other edges.
The graph has no cycle. Its complete source-to-goal routes are S-A-G with cost 4, S-B-G with cost 15, and S-B-A-G with cost 3. Enumeration therefore certifies that the minimum goal cost is 3. The negative edge creates no ambiguity about whether this finite minimum exists.
MIT's Dijkstra notes explicitly assume nonnegative edge weights and use monotonic shortest-path distances in their correctness argument. NetworkX's official Bellman-Ford reference documents negative-edge support and the different obstruction caused by negative cycles. The graph and step-by-step traces here are independent constructions.
Trace permanent settlement
Initialize S at zero and other labels at infinity. Process S first. Its outgoing edges give tentative labels A = 2 and B = 5. A is the next minimum, so the standard permanent-settlement version marks it final at 2 and relaxes A to G, producing G = 4.
The unsettled frontier now contains G at 4 and B at 5. Removing G next would normally certify its cost and allow an early goal termination. That result is 4, but the enumerated optimum is 3. The shorter route has not yet been exposed because its first leg to B appears more expensive than the goal's present label.
Continuing after G does not repair a version that refuses to revisit settled vertices. When B is processed at 5, its edge to A proposes 5 - 4 = 1. This is lower than A's settled value 2. Ignoring the proposal preserves an incorrect label. Merely changing A's stored number without propagating its improved outgoing consequences also leaves G at the wrong value.
Reopening vertices and repeatedly propagating improvements changes the algorithm's invariant and work pattern. Such a modified procedure should be analyzed on its own terms. It cannot inherit the standard permanent-settlement proof simply because it still uses a priority queue.
Locate the missing inequality
With nonnegative edges, extending a path cannot lower its accumulated cost. If an undiscovered path would improve the current minimum vertex, a frontier point along that path should already have a cost no greater than the final improved cost. That is the ordering idea which makes settlement safe.
Here the optimum route reaches B at cost 5 and then drops to A at cost 1. A point farther along that route is cheaper than an earlier point. The frontier's current minimum does not bound what B's negative continuation can later achieve. Nonnegative weights are therefore a structural premise of the proof, not an optional preference about numerical input formatting.
One negative edge does not guarantee that every Dijkstra run will return the wrong answer. Some graph orders happen to reveal all improvements before settlement. The counterexample establishes that the general guarantee is lost. Testing one favorable negative-edge graph would not restore it.
Repeated relaxation can recover this graph
Define relaxation as replacing d(v) by d(u) + w(u,v) whenever that proposed value is smaller. For an explicit in-place repeated-relaxation trace, scan edges in this order: S-A, A-G, S-B, B-A, B-G. Keep S at zero and begin the other labels at infinity.
During the first pass, A becomes 2, G becomes 4, B becomes 5, and then A improves to 1. The final edge proposes G = 15, so G remains 4. During the second pass, A-G uses the improved A label and changes G to 3. A third pass changes nothing. The final labels are A = 1, B = 5, and G = 3.
The trace is deliberately order-specific. In-place updates can transmit several improvements within one pass; another edge order can converge earlier. The general Bellman-Ford argument allows up to |V|-1 full passes for finite shortest paths without reachable negative cycles because a simple shortest path needs at most that many edges. It does not require a vertex's first removal from a queue to certify its final label.
A negative cycle is a separate boundary
Now modify the graph by adding A to B with cost 3. Together with B to A at -4, it forms a cycle of total cost -1. It is reachable from S, and G is reachable after it. Repeating the cycle any number of times reduces the route cost without bound before continuing to G.
There is then no finite minimum walk cost to G. Returning a different finite number would not solve the problem; the mathematical objective itself is unbounded below. A negative cycle in an unreachable component has a different scope, as NetworkX notes for its source-based search. The original acyclic example has no such cycle: its failure isolates Dijkstra's settlement assumption rather than hiding behind unboundedness.
Sources checked October 24, 2026:
MIT 6.006: Lecture 13, Dijkstra’s Algorithm: https://ocw.mit.edu/courses/6-006-introduction-to-algorithms-spring-2020/d819e7f4568aced8d5b59e03db6c7b67_MIT6_006S20_lec13.pdf
NetworkX: bellman_ford_predecessor_and_distance: https://networkx.org/documentation/stable/reference/algorithms/generated/networkx.algorithms.shortest_paths.weighted.bellman_ford_predecessor_and_distance.html
Concept illustration: Generic robot workstation imagery provides robotics context. It does not depict these invented inputs, an executed algorithm, or a measured system result.