State Space Search : Breadth First Search - SciComp

Post Top Ad

Responsive Ads Here

State Space Search : Breadth First Search

Share This
 Breadth First Search begins with the source node and it explores its neighboring nodes first. After that it moves for search to the next level neigbours. It generates one tree at a time.
Breadth first search, is very conservative. It inspects the nodes generated on a First Come First Serve basis that is the nodes form a Queue to be inspected . The data structure queue implements the First In first Out order .
The BFS algorithm is only a small modification of the DFS algorithm. Only the order in the append statement where OPEN is updated needs to be changed. The small difference in order of adding nodes to OPEN produces radically different behaviour from the two search methods between DFS and BFS.  DFS dives down expanding the search tree. Traditionally, we do it going down left most side first and BFS on the other hand pushes into the tree, examining it layer by layer .





Algorithm for Breadth First Search :
BreadthFirstSearch ()
   open - ( (start, NIL) )
   closed - ( )
   while not Null (open)
      do nodePair - Head (open)
       node - Head(nodePair)
       if GoalTest (node) = TRUE
             then return ReconstructPath (nodePair, closed)
             else closed - Cons (nodePair, closed)
                 children - MoveGen(node)
                     noLoops - RemoveSeen(children, open, closed)
                     new - MakePairs(noLoops, node )
                     open - Append(new, Tail(open), new )
  return "No solution found"


No comments:

Post a Comment

Post Bottom Ad

Responsive Ads Here

Pages