2
$\begingroup$

I read somewhere that DFS is a special case of Best first search algorithm if f(n)=-depth(n). please justify this i am not getting it.:/

$\endgroup$
0

1 Answer 1

1
$\begingroup$

Consider a node $u$ such that $depth(u)=l$.

In Best first Search when you evaluate $u$ with the evaluation function you defined, you have $f(u)=−l$.

queue

╔═══╤═══╤═════╤═══╗
║ r │ a │ ... │ u ║
╚═══╧═══╧═════╧═══╝

When you expand $u$ and you evaluate the first child of $u$ (suppose it is Node $v$) you have $f(v)=−(l+1)<−l=f(u)$ so now you expand $v$ (that means that you put $v$ in the front of the queue) and you continue.

queue

╔═══╤═══╤═════╤═══╤═══╗
║ r │ a │ ... │ u │ v ║
╚═══╧═══╧═════╧═══╧═══╝

This corresponds to what you do when you use Depth First Search.

$\endgroup$
1
  • $\begingroup$ is minus sign here showing the very first position of the queue? i.e the node with the least cost? $\endgroup$
    – mehru
    Commented Apr 2, 2017 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.