Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct BREADTH_FIRST_SEARCH.md #90

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions md/Breadth-First-Search.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down