Next: Human Search Up: Search to the Previous: An Outline Prolog

Breadth-First Search: An Alternative

If we take a tree of 12 states which have been searched in a depth-first way then we number all the nodes in a depth-first left-to-right manner. If the goal searched for is labelled L then the search path taken would be A B C D E F G H I J K L.

Now we search breadth-first. This entails searching all nodes at one ``level'' of the tree before going down a level. Thus we follow the search by looking first at node 1 then at nodes 2, 3 and 4 then nodes 5, 6, 7 and 8. At this point we have found the goal state (labelled L). The breadth-first search has found a shorter solution path.


paulb@comp.lancs.ac.uk
Tue Jan 9 10:51:07 GMT 1996