A shorter path can cost more.
A hop is one edge. Route cost sums the weights on that route. BFS minimises hops; only equal edge weights make that the same problem as finding the cheapest route.
From Dijkstra to contraction hierarchies
Five algorithms. The same graph. Follow the frontier, reveal the route, and see how much work each search does.
The explorer
These are fixed presets replayed from real library runs on small synthetic graphs. The page does not compute new routes, edit graphs, or measure runtime.
Recorded search
The comparison
Compare the complete searches for your selected pair, even while the replay is paused. Lower work counts describe this query; they do not establish a universal speedup.
On a narrow screen, scroll the table horizontally to see every metric.
| Method | Route cost | Hops | Nodes settled | Edges relaxed | Oracle check |
|---|
Focus any playback button to use these shortcuts. Tab moves between controls; Enter or Space activates the focused button. Selects and sliders retain their native arrow keys.
Changing a preset or algorithm pauses and resets the replay. A scene change selects that scene’s default endpoints. Speed persists for this visit. Reduced-motion mode makes Play jump to the final state.
Make sense of the result
A hop is one edge. Route cost sums the weights on that route. BFS minimises hops; only equal edge weights make that the same problem as finding the cheapest route.
Weighted searches require finite, non-negative real weights. This closed-set A* needs a consistent heuristic. A missing route and a source equal to its goal are valid preset cases.
Settled nodes and relaxed edges count query work, not milliseconds. Two-ended searches add both directions. Hierarchy preprocessing adds shortcut edges and uses extra memory before any query.
This is an educational replay, not a production road router or a live benchmark. All graphs are synthetic. The contraction hierarchy is a simplified, undirected teaching implementation. There is no arbitrary graph editing or computation for arbitrary endpoints.
Recorded from 150 real library runs on 3 seeded scenes (30 source/goal pairs). When this page was built, the cost and route of every run were checked against an independent Floyd-Warshall oracle, and the cost shown at each step against the recorded events that produced it. Payload sha256: 14ba9857737d3f2a710b98e432c45f56b67aad158482cd5c318e0bc05455ee9b. The data also lists the sha256 of each library source file the traces and the oracle values came from.
The oracle checks BFS hop count separately from weighted route cost. The comparison’s oracle column explains when BFS’s weighted route is more expensive. Rebuild instructions are in the repository README.