Files
marqdo/tests/applications/routes/consumer.py
cflmyandCursor 8f1010f967 Ship oracle journal values, bytecode/frontend hardening, and replay-policy Lean.
Host exposes oracle journals as language values with refuse/copy gates; bytecode and foreign session paths get modularized; applications and verification replay-policy sources land with Lake builds ignored.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-06 15:04:27 +08:00

18 lines
654 B
Python

import heapq
adjacency = {node: [] for node in bridge['nodes']}
for edge in bridge['edges']:
adjacency[edge['from']].append((edge['to'], edge['weight']))
distance = {bridge['source']: 0}
pending = [(0, bridge['source'])]
while pending:
cost, node = heapq.heappop(pending)
if distance[node] != cost:
continue
for target, weight in adjacency[node]:
candidate = cost + weight
if target not in distance or candidate < distance[target]:
distance[target] = candidate
heapq.heappush(pending, (candidate, target))
answer = [{'node': n, 'distance': distance.get(n)} for n in bridge['nodes']]
answer