BFS uses a priority queue to store the entries to be explored during the search. The entries in priority queue are sorted by their from . For each popped entry , all its child are pushed into the queue if is a node. If is a leaf, all the objects it contains are considered and the candidate set and is updated, accordingly. The algorithm stops as soon as the next popped entry has greater than
Consider the same example of Fig. . BFS inserts nodes and in queue. The node is popped first and its child entries and are inserted in the priority queue which becomes { , , }. Since has the smallest , it is popped next and its child entries and are inserted in the queue ( { , , , }). The next entry is , the object is inserted in candidate set and the is updated to . Algorithm stops because the next entry in queue has greater than . Table shows the nodes in the order they were processed by DFS algorithm.
Muhammad Aamir Cheema 2007-10-11