Skip to main content

One doc tagged with "bfs"

View All Tags

Breadth-First Search (BFS)

Breadth-first search (BFS) visits the nodes of a graph in increasing order of their distance from the starting node. Thus, we can calculate the distance from the starting node to all other nodes using breadth-first search. However, breadth-first search is more difficult to implement than depth-first search.