[Neo] Traversal

Anders Nawroth anders at neotechnology.com
Fri Feb 26 09:59:21 CET 2010


Hi Sumanth!

> Even if we traverse using BREADTH_FIRST, node3 and node7 are covered at
> level 1, so they won't be considered in the second level. Effectively I just
> get node8(node5 has a different name), where I wanted to have node3 and
> node7 as well.

That's correct: when using a traverser, only one path to every node will 
be  followed. Using BREADTH_FIRST, it will be the shortest path.

> Please suggest me if there is another, probably easy and better solution to
> achieve this.

You can achieve this by traversing the graph using the 
Node.getRelationships() methods:
http://api.neo4j.org/current/org/neo4j/graphdb/Node.html#getRelationships%28%29
managing the depth in your own code.

/anders



More information about the User mailing list