Breadth-first search
Explore in rings of distance with a queue: the first time you reach a node is by a shortest route.
EdgesA-B, A-C, B-D, C-D, C-E, D-F, E-Ffrom A
Start at A (distance 0). The queue holds the nodes waiting to be explored.
- compare
- swap or write
- settled
Space play · ← → step · Home End jump · drag the strip to scrub