Does A* algorithm work with negative edge weights?
I was trying to figure out why the heuristic used in A* tree search needs to be admissible if A* has to be optimal. By tr开发者_高级运维ee search I mean that there is no explored set maintained by the algorithm.
While doing this, I ran into the question: Does A* work for negative edge weights?
The A* algorithm is basically Dijkstra’s algorithm with heuristics. And Dijkstra’s algorithm does not work with negative edge weights. So A* won’t work with negative edge weights neither.
If you’re looking for an algorithm that works with negative edge weights, take a look at the Bellman-Ford algorithm (but it doesn’t use heuristics).
This excellent article regarding Dijkstra's may prove helpful and provides a nice example about negative edges...
http://www.ics.uci.edu/~eppstein/161/960208.html
精彩评论