Algorithm visualizer
Pick an algorithm, enter your own numbers or use a preset, then step through the run. The pseudocode and the explanation follow each step.
Explore outward in rings: visit every neighbour of the start, then their neighbours, and so on. A queue drives the order.
Start from node 0 in the connected preset. Which nodes are at distance 2, and in what order does BFS find them?
Step 1 of 37
Queue (front on the left)0
Start at 0. Mark it seen and put it in the queue.