Best First Search

Best-first search is a search algorithm which
explores a graph by
expanding the most promising node chosen
according to a specified rule.




This specific type of search is called greedy bestfirst search or pure heuristic search.
Efficient selection of the current best candidate
for extension is typically implemented using a
priority queue.
The A* search algorithm is an example of bestfirst search, as is B*.
Somtimes best-first search doesn’t find the
“best” (shortest/longest/cheapest) path to the
target!
open = initial state
while open != null
do
 1. Pick the best node on open.
 2. Create open's successors
 3. For each successor do:
 a. If it has not been generated before: evaluate
it, add it to OPEN, and record its parent
 b. Otherwise: change the parent if this new path
is better than previous one.
 done


Depth-first search (DFS) is an algorithm
for traversing or searching tree or graph
data structures.
One starts at the root (selecting some
arbitrary node as the root in the case of a
graph)
and explores as far as possible along each
branch before backtracking
.