Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Neo4j relationship direction

I have a collection of users. I am connecting them to the root node of the graph via a relationship.

Should I make the relationship point from the root node to the user or should I make it point from the user to the root node.

What are the benefits and drawbacks?

like image 397
Aran Mulholland Avatar asked Nov 19 '25 06:11

Aran Mulholland


1 Answers

For Neo4j, there is not differences about features or performances depending on the relationship direction. So the best practice is to make your choice based on the how it sounds the best.

Here for exemple, I would create a relationship from the root node to the user, as the root node is a kind of "owner", and I want to traverse from the root to the users if I want them all.

like image 168
cporte Avatar answered Nov 20 '25 22:11

cporte



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!