Anyone have any thoughts on this?
Newbie here. I am trying to implement a stateful AStar traversal in Neo4J using the Java embedded API. That is, I'd like to pass an object which holds some contextual information gathered down a branch to use in selecting/pruning onward relationships once I've arrived at a certain node in the graph. This works well with the Dijkstra traversal, as the GraphAlgoFactory has a dijkstra-producing factory method which supports setting an initial state:
dijkstra(PathExpander expander, InitialStateFactory stateFactory, String relationshipPropertyRepresentingCost)
Great. However, I cannot find a corresponding factory method to set the initial state in an AStar traversal, and my findSinglePath() invocaton meets an untimely end with:
java.lang.UnsupportedOperationException: Branch state disabled, pass in an initial state to enable it
at org.neo4j.kernel.Traversal$1.getState(Traversal.java:100)[neo4j-kernel-1.8.jar:1.8]
So how does one "pass in an initial state" sans a InitialStateFactory parameter on the factory method? Looking at post 1.8 API docs seems to reveal no answer, either.
Thanks in advance, and apologies in advance as well if the answer to this is obvious to everyone except me.
--
Thanks for the reply. Its a relief that I wasn't missing something obvious. I'd be delighted to exercise the code. In the meantime, I implemented a "poor man's AStar" by simply reordering edges in the Pathexpander.expand() within the Dijkstra search based on distance to the goal node. That at least gave me access to the state object, but it's a poor substitute for a proper AStar. Thanks again, and I look forward to being able to give the new AStar a try.
--