Breadth-first search
Also known as BFS
search miniplanheuristic-search
Breadth-first search (BFS) explores a state space level by level from the start: first all states one step away, then all states two steps away, and so on. It keeps the frontier in a first-in, first-out queue and visits each state at most once. So the first goal it reaches has the fewest steps of all paths to a goal. BFS is complete on finite spaces and optimal in the number of steps, but it ignores action costs; when steps have different costs, use Dijkstra's algorithm or A*.
See it run
The start state is the only open state.
Pseudocode
algorithm BFS(s₀, goal)input: start state s₀, goal test goaloutput: a path to a goal with the fewest steps, or failureQ ← ⟨s₀⟩ ▷ first in, first outSEEN ← {s₀}while Q ≠ ∅ dos ← pop-front(Q)if goal(s) then ▷ heuristic-search tests when a state is generatedreturn path-to(s)for each (o, s′) in successors(s) do ▷ every operator applicable in sif s′ ∉ SEEN thenSEEN ← SEEN ∪ {s′}parent[s′] ← (s, o)push-back(Q, s′)return failureIn the crates
miniplanBlind breadth-first search over the grounded task (optimal).
heuristic-searchBreadth-first search over a user-described graph.
Lineage
Comes from
Nothing on this site.
Led to
Beam search builds on it
Bidirectional BFS builds on it
IW builds on it
Symbolic BFS builds on it