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.

Should or Should NOT create the same relationship multi-times between 2 Nodes?

In recommendation, we need to calculate the score of each relationship and return the result to our app.
So the question is: should we create multi relationships with the same label between 2 nodes with each relationship contains 1 score for example.
OR we should create only 1 relationship and update it's score each we listen an event to it from the app?

Which is the best practice for this in neo4j ?

2 REPLIES 2

The one issue i see with multi-relationships between two nodes using the same name is you have to rely on something to help distringuish them if you need to select a specific one; which, then means you need to rely on properties of these relationships to distinguish or directionality of the relationships since the labels cant be used to distinguish. This multi-relationship with the same label approach and no distinguishing characteristics on direction or properties is only acceptable if your algorithm uses an aggregation of the relationships off a node either with a count or summation of property value, etc. My personal perference, which may or may not be the best practice, would be then to use properties under a single relationship to hold those calculations, or to rely on different directionality of the multi-relationships (one points one way, the other points the other way). I may have not answered what you were thinking, but i would be interested to hear where i may be mis-thinking or overlooking other parts of Neo4j, since i am only a few month veteran of the technology

Thanks to share your thoughts, I did use properties for them (relationships). What I concern here is about performance, alos the visualization of the graph in case it can react to millions relationships when we track user's behavior in app.