Breadth-First Search
graph traversal algorithm
Explore all neighbors of a given node and move to each of them
How it works
- Visit the root node and enqueue it to a queue
- Repeat until the queue is not empty
2-1. Dequeue and process the first node in the queue
2-2. Enqueue children of processed nodes
This method is useful for finding
the shortest pathbetween two nodes inunweighted graph
reference: https://chat.openai.com/