Ruben Catchme Obregon
Ruben Catchme Obregon

Reputation: 569

Neo4j - social network - relationship properties - two way or one way with properties

Say I have two people who are friends, in an effort to keep the number of relationships used low, should I use an outbound relationship from one to the other with a property of "friend_type: mutual" in order to indicate a two way friendship? (one way friendship would have "friend_type: following")

Will this affect performance since properties are not first class objects? Or should I make inbound and outbound friendship relationships so that performance won't suffer.

For example, to find a friend of mine that has friended me, using an outgoing relationship such as:

Ruben [f:Friend]->You where f.friend_type="mutual"

or instead, rely on incoming and outgoing relationships (not properties)

Ruben <-[:Friend]-> You

Which option offers the best performance?

32 billion relationship limit might seem like enough, but hey, I have big plans and if it works out I'll need all relationships I can get....

Upvotes: 1

Views: 197

Answers (1)

Max De Marzi
Max De Marzi

Reputation: 1108

Your graph will be faster if you just have to traverse relationships without having to look at the properties on those relationships. The 32 Billion Relationship constraint will soon be removed, I wouldn't worry about it.

Upvotes: 3

Related Questions