scenario 01 · simulated
Fewest links or lowest total weight?
BFS treats every link as equal. Dijkstra accounts for its weight. Play both traces, compare their routes, then edit a connection or take one offline and predict what changes.
Algorithm
Choose what “shortest” means
Breadth-first search uses a FIFO queue and minimizes the number of links. It deliberately ignores every weight printed on the graph.
invariant: visit hop layer k before layer k + 1
Live graph
Source S to target T
weights 1–9 · one optional outage
- Double ring = current node
- Dashed ring = frontier
- Crossed weight = failed link
- Filled route = final answer
Step 1 / 28
bfs · initialize
Enqueue the source
BFS begins with the source in a first-in, first-out queue at hop distance 0.
Routing timeline playback
Algorithm state
Queue, distances, predecessors
FIFO frontier
- 1. S0 hops
Visit order
No node visited yet
Tentative distances and predecessors
| Node | Hops | Predecessor | State |
|---|---|---|---|
| S | 0 | — | frontier |
| A | ∞ | — | unseen |
| B | ∞ | — | unseen |
| C | ∞ | — | unseen |
| D | ∞ | — | unseen |
| E | ∞ | — | unseen |
| T | ∞ | — | unseen |
Text trace
Every decision, in order
Select any row to inspect the exact graph and table snapshot for that decision.