when to go for Breadth first search over depth first search

hi,under which scenarios breadth first search could be used and under which scenarios depth first search could be used?what is the difference between these two searches?Regards,Ajay.
[217 byte] By [ajay_it01@yahoo.coma] at [2007-10-2 18:25:54]
# 1

No real clear-cut rule for when to use one over the other. It depends on the nature of your search and where you would prefer to find results.

The difference is that in breadth-first you first search all immidiate neighbours before searching their neighbours (sort of like preorder traversal). Whereas in depth-first you search some random (or otherwise selected) neighbour and then a neighbour of that node until you can't go deeper (i.e., you've searched a neighbour that has no other neighbours). This probably isn't a very clear explanation, perhaps you'll find this more helpful: http://www.ics.uci.edu/~eppstein/161/960215.html

If you would prefer to find results closer to the origin node, breadth first would be better. If you would prefer to find results further away use depth first.

dwga at 2007-7-13 19:46:57 > top of Java-index,Other Topics,Algorithms...