Finding an A* heuristic for a directed graph
Posted
by
Janis Peisenieks
on Programmers
See other posts from Programmers
or by Janis Peisenieks
Published on 2011-12-26T12:21:31Z
Indexed on
2012/06/04
4:47 UTC
Read the original article
Hit count: 353
In a previous question, I asked about finding a route (or path if you will) in a city. That is all dandy. The solution I chose was with the A* algorithm, which really seems to suit my needs. What I find puzzling is heuristic. How do I find one in an environment without constant distance between 2 nodes? Meaning, not every 2 nodes have the same distance between them.
What I have is nodes (junctures), streets with weight (which may also be one-way), a start/finish node (since the start and end is always in the same place) and a goal node. In an ordinary case, I would just use the same way I got to goal to go back, but since one of the streets could have been a one-way, that may not be possible.
The main question
How do I find a heuristic in a directed graph?
© Programmers or respective owner