A heuristic function must use only information readily obtained about a node.
There is a trade-off between the amount of work it takes to compute a heuristic value and the accuracy of the heuristic value.
One common way to derive a heuristic function is to solve a simpler problem and use the cost to the goal in the simplified problem as the heuristic function for the original problem.
The given example shows an admissible heuristic function for different nodes.