Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Breadth First Search, and Iterative deepening

I understand BFS, and DFS, but for the life of me cannot figure out the difference between iterative deepening and BFS. Apparently Iterative deepening has the same memory usage as DFS, but I am unable to see how this is possible, as it just keeps expanding like BFS. If anyone can clarify that would be awesome.

tree to work on if required:

    A    / \   B   C  /   / \ D   E   F 
like image 387
theraven Avatar asked Jun 08 '10 00:06

theraven


People also ask

What are the main differences between iterative deepening search and breadth-first search?

Iterative Deepening Search (IDS) is an iterative graph searching strategy that takes advantage of the completeness of the Breadth-First Search (BFS) strategy but uses much less memory in each iteration (similar to Depth-First Search).

What is the difference between iterative deepening DFS and breadth-first search take one running example and explain?

DFS may explore the entire graph before finding the target node; iterative deepening only does this if the distance between the start and end node is the maximum in the graph. BFS and iterative deepening both run in time O(bd), but iterative deepening likely has a higher constant factor.

Is iterative deepening breadth-first search?

Iterative deepening depth-first search is a hybrid algorithm emerging out of BFS and DFS. IDDFS might not be used directly in many applications of Computer Science, yet the strategy is used in searching data of infinite space by incrementing the depth limit by progressing iteratively.

Which search strategy is faster among breadth-first search and iterative deepening search?

Bidirectional search can use search techniques such as BFS, DFS, DLS, etc. Advantages: Bidirectional search is fast. Bidirectional search requires less memory.


2 Answers

From What I understand iterative deepening does DFS down to depth 1 then does DFS down to depth of 2 ... down to depth n , and so on till it finds no more levels

for example I think that tree would be read

read                   visited               depth  A                      A                     1  ABC                    ABAC                  2  ABDCEF                 ABDBACECF             3 

I believe its pretty much doing a separate DFS with depth limit for each level and throwing away the memory.

like image 185
Roman A. Taycher Avatar answered Sep 28 '22 22:09

Roman A. Taycher


From my understanding of the algorithm, IDDFS (iterative-deepening depth-first search) is simply a depth-first search performed multiple times, deepening the level of nodes searched at each iteration. Therefore, the memory requirements are the same as depth-first search because the maximum depth iteration is just the full depth-first search.

Therefore, for the example of the tree you gave, the first iteration would visit node A, the second iteration would visit nodes A, B, and C, and the third iteration would visit all of the nodes of the tree.

The reason it is implemented like this is so that, if the search has a time constraint, then the algorithm will at least have some idea of what a "good scoring" node is if it reaches the time-limit before doing a full traversal of the tree.

This is different than a breadth-first search because at each iteration, the nodes are visited just like they would be in a depth-first search, not like in a breadth-first search. Typically, IDDFS algorithms would probably store the "best scoring" node found from each iteration.

like image 38
Steven Oxley Avatar answered Sep 29 '22 00:09

Steven Oxley