Home BFS(Breadth-First Search)
Post
Cancel

BFS(Breadth-First Search)

graph traversal algorithm

Explore all neighbors of a given node and move to each of them

How it works

  1. Visit the root node and enqueue it to a queue
  2. 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 path between two nodes in unweighted graph







reference: https://chat.openai.com/

This post is licensed under CC BY 4.0 by the author.