Breadth-First Search
A
B
C
D
E
F
G
H
queue · FIFO
A
take from the front
Breadth-first search fans out in rings from A, using a queue. A queue is first-in-first-out, so nearer nodes always come off before farther ones — that's why BFS explores level by level.
step 01/21
- just discovered
- visited
- visiting now