Breadth First Search (BFS)

Graph traversal is the process of traversing each vertex and edge exactly once in a predefined order. You must verify that each vertex of the graph is visited exactly once when utilizing certain graph algorithms. The sequence in which the vertices are visited is significant and may be determined by the method or question being solved.


BFS is a traversal method that requires you to begin traversing from a certain node (the source or starting node) and travel the graph layer by layer, thereby examining the neighbor nodes (nodes that are directly connected to the source node). Then you must go to the next-level neighbor nodes.