Write BFS algorithm

  1. Initialize the first node’s dist number and place in queue
  2. Repeat until all nodes have been examined
  3. Remove current node to be examined from queue
  4. Find all unlabeled nodes adjacent to current node
  5. If this is an unvisited node label it and add it to the queue
  6. Finished.

Leave a Reply