aysylu / loom

Graph library for Clojure. Mailing list https://groups.google.com/forum/#!forum/loom-clj
http://aysy.lu/loom/
887 stars 108 forks source link

A* implementation is incorrect. #82

Closed austinhaas closed 7 years ago

austinhaas commented 8 years ago

The A* implementation in alg/astar_path applies the heuristic function to the current node and its successors. It should apply the heuristic to the current node and the target node.

The consequence is that this implementation is not optimal, it visits many more nodes than it should, and it really isn't A* at all.

https://github.com/aysylu/loom/blob/master/src/loom/alg.cljc#L638

I created a pull request that adds a test to demonstrate this deficiency: #81