April 2018
Beginner to intermediate
426 pages
10h 19m
English
The BFS algorithm starts traversing the graph from the first specified vertex and visits all its neighbors (adjacent vertices) first, one layer of the graph at a time. In other words, it visits the vertices first widely and then deeply, as demonstrated by the following diagram:

These are the steps followed by the BFS algorithm, starting at vertex v:
The BFS algorithm is declared ...