Exploration · 001-find-the-shortest-path-between-two · Quarantined

find the shortest path between two nodes in a small weighted graph

A build-to-learn record. Loose by design — graduate or delete; nothing here ships un-graduated.

Status Quarantined Explore ID001-find-the-shortest-path-between-two Intent find the shortest path between two nodes in a small weighted graph Created Exits graduate (→ spec/design/tasks) · delete

1 · Intent

find the shortest path between two nodes in a small weighted graph

The one thing I want to know at the end: does “shortest” here mean the fewest hops or the least total weight? They're the same on an unweighted graph and can diverge sharply on a weighted one — and which one it is decides the algorithm. I'll build to find out, not argue about it.

2 · What I built / tried / worked / didn't

Keep it rough. This is the discovery log — the value is the learning, not the prose.

Built

Tried

Worked

Didn't

3 · What actually ran

The commands you ran and what they proved. Captured in the verify.html Run/Demo shape so a later graduation can promote these facts to grounding="verified" with no re-capture.

node probe.ts none node probe.ts — exits non-zero unless Dijkstra's path is strictly cheaper than BFS's (one inline assertion; not a suite yet) On the weighted sample, shortest A → E: BFS returns A → C → E (2 hops, cost 25) while Dijkstra returns A → B → C → D → E (cost 6). They disagree by 19 — proving “shortest” means least weight, not fewest hops. Verdict: keep Dijkstra, graduate as a tracer-bullet.