cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Order of expanding graph with traversal framework

Hello,

I am developing a stored procedure that is used to traverse a graph.

The procedure is returning nodes and a complete path to these nodes from the root node. The path to traverse is defined by properties on relationships (endNode -> follow this relation and expand the end node).

I would like to ask if Neo4j can guarantee an order in which a graph is traversed so the path will be always the same ?

Example that can cause problems:

(root)-[:rel1 {traverse:"endNode"}]->(n1)-[:rel2 {traverse:"endNode"}]->(n2)-[:rel3 {traverse:"endNode"}]->(n1)-[:rel4 {traverse:"endNodeAndStartNode"}]->(n0)

Is it possible that the traversal will once reach the n0 node via path (root)-[rel1]->(n1)-[rel4]->(n0)
and another time via (root)-[rel1]->(n1)-[rel2]->(n2)-[rel3]->(n1)-[rel4]->(n0) ???

If yes, Is there any way to fix the order of traversal to I have always the same path ?

Thank you

1 REPLY 1

Jiropole
Graph Voyager

You might look into the TraversalDescription object. Links:

It offers things like uniqueness control. I'm no expert, but it feels like you might find what you're looking for with this built-in traversal framework.