diff --git a/md/Breadth-First-Search.md b/md/Breadth-First-Search.md index 684d655..3f8419b 100644 --- a/md/Breadth-First-Search.md +++ b/md/Breadth-First-Search.md @@ -2,24 +2,24 @@ ## AIMA4e -__function__ BREADTH-FIRST-SEARCH(_problem_) __returns__ a solution, or failure - __if__ problem's initial state is a goal __then return__ empty path to initial state - _frontier_ ← a FIFO queue initially containing one path, for the _problem_'s initial state - _reached_ ← a set of states; initially empty - _solution_ ← failure +__function__ BREADTH-FIRST-SEARCH(_problem_) __returns__ a solution node, or failure + __if__ the initial state is a goal __then__ +   __return__ a node for the initial state + _frontier_ ← a FIFO queue, with a node for the initial state + _reached_ ← a set of states, initially empty  __while__ _frontier_ is not empty __do__ -   _parent_ ← the first node in _frontier_ -   __for__ _child_ __in__ successors(_parent_) __do__ -     _s_ ← _child_.state -     __if__ _s_ is a goal __then__ -       __return__ _child_ -     __if__ _s_ is not in _reached_ __then__ -       add _s_ to _reached_ -       add _child_ to the end of _frontier_ - __return__ _solution_ +   node ← POP(_frontier_) +   __if__ _node_ is a goal __then__ __return__ _node_ +   __for__ _child_ __in__ EXPAND(_problem_, _node_) __do__ +    _s_ ← _child_.STATE +    __if__ _s_ is a goal __then__ __return__ _child_ +    __if__ _s_ is not in _reached_ __then__ +     add _s_ to _reached_ +     add _child_ to _frontier_ + __return__ _failure_ --- -__Figure 3.9__ Breadth-first search algorithm. +__Figure 3.2__ Breadth-first search algorithm. ## AIMA3e