PLAIN/TEXT — ISSUE 217/456 COMPUTER SCIENCE · FOUNDATION / NEGATIVE COSTS · ~4 MIN READING DATE: 2027-05-06 ARCHIVE: https://plaintext.click/newsletter/ SUBJECT: What if taking another step reduces a route’s cost? What if taking another step reduces a route’s cost? =================================================== / START HERE A delivery route may include both charges and rebates. Bellman–Ford is a procedure that finds minimum total costs through a network even when some connections have negative costs. It repeatedly checks whether reaching one place offers a cheaper route to a neighbour, instead of declaring an early-looking answer final. / WHY NOW A direct route that looks cheapest now can lose after a later rebate. This is not the same question as finding the fewest connections. The important input is the sum of signed costs, and the procedure must leave room for a later improvement. / THE IDEA Represent each place as a node and each permitted one-way step as an edge with a cost. Start with zero cost at the starting node and an unknown, effectively infinite cost elsewhere. For every edge, compare the recorded cost of its endpoint with the route through its start. Replacing a larger estimate with that smaller candidate is called relaxation. Repeating passes propagates improvements through longer paths. With V nodes, V − 1 full passes are sufficient when a finite shortest route exists, because a best route need not repeat a node unless a useful cycle changes the problem. / THE FORMAL IDEA d(v) ← min(d(v), d(u) + w(u,v)) - d(v) = currently recorded cost to node v; d(u) = recorded cost to node u. - w(u,v) = cost of the edge from u to v; min selects the smaller value. The arrow means update the stored estimate, not mathematical equality for all time. / RUN THE TINY EXAMPLE Change one thing. Predict what happens. Edges: S→A costs 2; S→B costs 5; B→A costs −4. Direct estimates give A = 2 and B = 5. Relax B→A: candidate = 5 − 4 = 1, improving A from 2 to 1. Change the rebate to −1: candidate = 4, so A stays at 2. The extra step helped only when its negative contribution outweighed the detour. A positive-cost intuition such as never reconsidering the apparently cheapest finished place would miss this kind of improvement. / SO WHAT? A further pass also provides a warning. If a reachable route can still improve after the necessary passes, a reachable negative-cost cycle exists. Repeating that cycle lowers cost without bound for affected onward destinations, so a finite cheapest walk is not an answer the model can supply. / ONE CAVEAT Negative travel time is not physically meaningful; rebates or signed accounting costs are the intended model. This procedure is generally more expensive than methods exploiting nonnegative costs. Real rebate rules may forbid repetition, requiring additional state rather than this simple network. / KEEP THIS When a later connection can reduce total cost, keep revising route estimates and check whether repeatable reductions destroy the notion of a minimum. / SOURCE TRAIL [1] MIT — Bellman–Ford https://ocw.mit.edu/courses/6-006-introduction-to-algorithms-spring-2020/resources/mit6_006s20_lec12/ NEXT: Why one viewing angle makes a reflection special --- HARD IDEAS. PLAIN TEXT. You are receiving this because you asked for one clear computer-science or physics idea each day. Unsubscribe: https://plaintext.click/unsubscribe View in browser: https://plaintext.click/newsletter/2027/05/2027-05-06-bellman-ford-negative-costs.html From: Plain/Text / Brickston Consulting · 30 N Gould St Ste N, Sheridan, WY 82801 US · knowledge@plaintext.click