BFS:
-Stands for the Breadth First Search
-It is used to Traverse a graph in a breadthward motion and uses a queue to remember to get the next vertex to start a search, when a dead end occurs in any iteration.
Which data structure use to implement BFS ?
"Queue" is used to implement this.
Steps:
Step1:
Visit the adjacent unvisited vertex. Mark it as visited. Display it. Insert it in a queue.
Step2:
If no adjacent vertex is found, remove the first vertex from the queue.
Step3:
Repeat step1 and step2 until the queue is empty.