Breadth-First Search (BFS)
The short answer · 18 words
In short
Graph and tree search algorithm, which searches nodes layer by layer for their distance from the starting node.
Flow-alerta.cab (2026): Breadth-First Search (BFS). https://flow-alerta.cab/en/glossar/breadth-first-search-bfs. Editorially reviewed on: 09 October 2026.
How much detail would you like?
Practical
Basic algorithm for graphing, routing, dependencies and state spaces. It is also an important basis for search and planning procedures.
Example scenario: In an unweighted network, the shortest path is sought in terms of the number of connections between two nodes.
Use for unweighted relationship graphs, state spaces or dependency analyses when a layer-by-layer search or shortest number of edges is required.
At a glance
- Core
- The breadth-first search first visits the starting node, then all directly adjacent nodes, then their still unvisited neighbors and so on. Typically, a queue is used for this. In unweighted graphs, BFS finds a path with minimal number of edges.
- Use
- Basic algorithm for graphing, routing, dependencies and state spaces. It is also an important basis for search and planning procedures.
- Example
- Example scenario: In an unweighted network, the shortest path is sought in terms of the number of connections between two nodes.
- Limits
- Confuse BFS with depth search; use weighted edges without adjustment; do not mark visited nodes; underestimate memory requirements on very wide graphs.
Questions about this term
Does BFS always find the shortest way?
In unweighted graphs with respect to the edge number, yes.
What data structure is typically used?
A cue.
Is BFS the same as DFS?
No.
All details and background
The breadth-first search first visits the starting node, then all directly adjacent nodes, then their still unvisited neighbors and so on. Typically, a queue is used for this. In unweighted graphs, BFS finds a path with minimal number of edges.
ELI5 – Explained simply
Instead of following a path deeply, the algorithm first looks at everything in close proximity and works its way outwards level by level.
Why it matters in practice
Basic algorithm for graphing, routing, dependencies and state spaces. It is also an important basis for search and planning procedures.
Example
Example scenario: In an unweighted network, the shortest path is sought in terms of the number of connections between two nodes.
Pitfalls and limits
- Confuse BFS with depth search; use weighted edges without adjustment; do not mark visited nodes; underestimate memory requirements on very wide graphs.
Origin & history
Broadband search is one of the classic graph search methods and has been used in computer science and artificial intelligence for decades.
Use in mid-sized companies
- Use for unweighted relationship graphs, state spaces or dependency analyses when a layer-by-layer search or shortest number of edges is required.
Related terms
- Depth search
- Queue
- Search algorithm
Matching Flow-alerta service
Websites & web applicationsWebsites & web applications: technical implementation and testing of a suitable web application.Matching tool / use case
View use casesUse Case: Shortest connection in an unweighted dependency or relationship graph.Sources
- xlinux.nist.govNIST Dictionary of Algorithms and Data Structures, breadth-first search
Quellenprüfung: 09.10.2026. Definition und dokumentierte Einordnung abgeglichen; Beispiele beschreiben mögliche Anwendungen.
Editorially reviewed on: