neo4j - Find all shortest paths using TraversalDescription -


i need find all shortest paths between 2 nodes using traversaldescription.

(i cannot use cypher procedure allshortestpaths() because need add specific evaluator later: neo4j: shortest paths specific relation types sequence constrain )

node startnode = ...; node endnode = ...; traversaldescription td = graphdb.traversaldescription()     .breadthfirst()     .evaluator(evaluators.endnodeis(evaluation.include_and_prune,                                     evaluation.exclude_and_continue,                                     endnode));  (path path : td.traverse(startnode)) {     // 1 path found } 

i 1 path.

but if run cypher query:

match (startnode{...}) match (endnode{...}) match path = allshortestpaths((startnode)-[*]-(endnode)) return path; 

there more 1 paths found same startnode , endnode.

how set traversaldescription find (shortest) paths?

some suggestions:

  1. take @ how shortestpath , allshortestpths actually implemented. may able modify copy of code want. traversadescription not used @ all.

  2. there "experimental" bidirectionaltraversaldescription seems closer design of shortestpath , allshortestpths implementations. might able use instead.


Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -