Skip to main content

One doc tagged with "breadth-first-search"

View all tags

Breadth-first search (BFS)

Breadth-first search (BFS) is a widely used algorithm for traversing or searching tree and graph data structures. It starts at a selected node (often referred to as the 'root' in the context of trees), and explores all of the neighbor nodes at the present depth prior to moving on to nodes at the next depth level. This characteristic allows BFS to provide the shortest path to a target node in an unweighted graph, which is one of its most significant advantages.