Input: , edges , , , . Iteration : prev = [0, Infinity, Infinity]. Relax edges: dist[1] = 100, dist[2] = 500. Iteration : prev = [0, 100, 500]. Relax edges: dist[2] can improve via using prev[1] + 100 = 200.
Final dist[2] = 200. This path uses stop (city ), which satisfies . The direct flight costs , but the one-stop route costs .