For a match like MATCH (node0 {id: 1})-[:REL*]->(nodeN)
,
are there any guarantees on:
Experimenting on this, for the same data set (created from integration tests with entities created in the same order each time), two Neo4j instances (one in docker ran through github action, another on docker desktop) seems to have:
Is there any Cypher parameters to influence 1) DFS vs. BFS behaviour 2) order of traversal from one node i.e. based on a relation property
I know there are traversal (i.e. tree-spanning) algorithms that do a similar thing but I don't want to explore them yet for the reason they are more restrictive in regard to property filtering (being able to filter only by labels)
I don't think there are any parameters right to do any of these things.
DFS vs BFS -> Path matching is DFS only. For the query MATCH (node0 {id: 1})-[:REL*]->(nodeN)
, first cypher will obtain a nodeN
, at one hop distance. Then it will traverse from that node and go forward. A good way to notice this is by looking at the output of the following query:
MATCH (n{id: 1})-[r:REL*]->(nodeN) return n, nodeN, r
We can't influence the traversal order using some property. There is no such keyword, the WHERE
clause will filter out the results, and ORDER BY
will order the final results, but nothing right now can influence the traversals internally.