Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I would like to obtain a "slick" implementation of A*-search algorithm on Graph objects, using the built-in BreadthFirstScan (if that is possible at all). I noticed that BreadthFirstScan is static in the sense that once a graph g is given to,

BreadthFirstScan[g, StartNode, {"DiscoverVertex -> func}]

'func' cannot alter g as need be and hence cannot run the course of the A*-search algorithm.

I know of one solution to A* algorithm on Mathematica.se, but it seems too verbose. Is it possible to use BreadthFirstScan? My rough guess is that it is not, but I want to confirm. To summarize my question is this: "Is there a way to make BreadthFirstScan alter its path?" I know that Throw can be used inside the execution of BreadthFirstScan, but it only jumps out of an "event" (e.g., "DiscoverVertex"), not alter the path of traversal for the graph.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.