The BFS method performs a breadth-first search [clr98] of a graph.
A breadth-first search visits vertices that are closer to the
source before visiting vertices that are further away. In this
context `distance' is defined as the number of edges in the
shortest path from the source vertex.

The time complexity is

[

clr98].