Another useful way to see A* is as the synthesis of two different search algorithms. To compute which untraversed node to choose next, A* uses the function<p><pre><code> f(n) = g(n) + h(n)
</code></pre>
where g(n) is the actual traversed distance from the start to n, and h(n) is an (optimistic) approximation of the distance from n to the goal. Now, without making any other modifications to the algorithm, if we substitute<p><pre><code> g(n) = 0
</code></pre>
what we get is the greedy "best-first" search [1]. If, on the other hand, we select<p><pre><code> h(n) = 0
</code></pre>
we get a single-goal variant of Dijkstra's algorithm [2].<p>[1] <a href="http://en.wikipedia.org/wiki/Best-first_search" rel="nofollow">http://en.wikipedia.org/wiki/Best-first_search</a><p>[2] <a href="http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm" rel="nofollow">http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm</a>