Slight correction to the accepted answer
Best-first search does not estimate how close to goal the current state is, it estimates how close to goal each of the next states will be (from the current state) to influence the path selected.
Uniform-cost search expands the least cost node (regardless of heuristic), and best-first search expands the least (cost + heuristic) node.
- f(n) is the cost function used to evaluate the potential nodes to
expand
- g(n) is the cost of moving to a node n
- h(n) is the estimated
cost that it will take to get to the final goal state from if we were
to go to n
The f(n) used in uniform-cost search
f(n) = g(n)
The f(n) used in best-first search (A* is an example of best-first search)
f(n) = h(n)
The f(n) used in A* search.
Note: The h(n) from best-first search above is expanded in A* so that it always includes g(n). It is still basically just a heuristic, but it is a heuristic that includes g(n).
f(n) = g(n) + h(n).
Each of these functions is evaluating the potential expansion nodes, not the current node when traversing the tree looking for an n that is a goal state