0

If we have the following graph:

enter image description here

And the following query:

MATCH (me)-[:KNOWS*1..2]-(remote_friend)
WHERE me.name = 'Filipa'
RETURN remote_friend.name

Is "Dilshad" guaranteed to be returned before "Anders", in other words, is :KNOWS*1..2 guaranteed to be traversed in BFS manner?

adnanmuttaleb
  • 3,388
  • 1
  • 29
  • 46

1 Answers1

1

Actually it is DFS.

If you want to control this and more things about the traversal there is a path expander in the APOC library

https://neo4j.com/labs/apoc/4.1/graph-querying/path-expander/

Michael Hunger
  • 41,339
  • 3
  • 57
  • 80
  • Thank you for your answer, but is there any place in the docs that says that variable length relations are traversed in DFS fashion. – adnanmuttaleb Sep 02 '20 at 12:56