Back

BFSBreadth-First Search

Edit the tree or graph, pick a start node, then press Play. BFS visits every node one level at a time, using a queue to remember who is next.

Not found yet In queue Visiting now Visited Color shows the level, the number of steps from the start.
Step 0 of 0

Traversal order

Each node appears here as BFS visits it. The levels below show which nodes sit the same number of steps from the start.

Adjacency table

Every node and the nodes it connects to. It updates as you edit the graph. Click a row to select that node.

NodeConnected toLevelStatus

The algorithm

The highlighted lines are the ones running in the current step.