Dijkstra's algorithm with Direction in Neo4j -


i have added of nodes , relationships. issue when using dijikstra, don't in single direction:

(0)--[progressed_to,3812]-->(1)<--[progressed_to,3965]--(26)--[progressed_to,4932]-->(63) weight:0.07873392808600001 

as see have a -> b <- c -> d

why path not going forward?

my algo created by:

pathfinder dijkstra = dijkstra(traversal.expanderforalltypes(), commonevaluators.doublecostevaluator("length")); 

whereby iterate through paths: iterator<weightedpath> paths = dijkstra.findallpaths(node_a, node_b ).iterator();

you have tell expander go in 1 particular direction:

traversal.expanderforalltypes(direction.outgoing); 

as aside, if using neo4j 2.0 or greater, should aim @ using traversal components in org.neo4j.graphdb.traversal, rather ones org.neo4j.kernel. kernel ones internal code , may change. this:

pathexpanders.fordirection(direction.outgoing); 

Comments

Popular posts from this blog

visual studio - vb.net filter binding source by time -

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -