0
$\begingroup$

How do we determine the cost of the parent path to its child in A* ("A star") search?

$\endgroup$
  • $\begingroup$ Please, edit your post to clarify what you're actually asking. I gave an answer below, but I am not sure if that's what you're asking. $\endgroup$ – nbro Nov 25 '18 at 19:51
  • $\begingroup$ @nbro retagged and edited the body text. (Feel free to flesh it out as this is a brand new contributor.) $\endgroup$ – DukeZhou Nov 26 '18 at 2:10
2
$\begingroup$

The evaluation function in A* is $f(n) = g(n) + h(n)$, where $g(n)$ is the cost of the path from the starting node to $n$ and $h(n)$ is an estimate of the distance from $n$ to the goal node. To compute $g(n)$, you simply do $g(n) = g(p) + c(p, n)$, where $p$ is the parent node, and $c(p, n)$ is the $c$ost of the edge between $p$ and $n$. So, yes, to compute $g(n)$ you use $g(p)$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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