Another approach, probably not better, would be to only have a relationship 
from the user to the first movie in the list.

Between the movies have relationships  with the user as a property, so you 
could traverse from first to last (which would have no outgoing relationships 
for that user).

You'd have to drop and add relationships to change the ordering (instead of 
changing properties on a set of relationships).



-----Original Message-----
From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On 
Behalf Of Aseem Kishore
Sent: Thursday, January 19, 2012 1:24 PM
To: Neo4j user discussions
Subject: [Neo4j] Suggestions on how to order relationships?

Hi there,

Take a Facebook-like example, where users can "like" different 
movies/music/celebs/etc. Suppose we want to let users drag-and-drop these 
movies/etc. on their profile pages, to let them e.g. show their favorite movies 
first.

How would you guys recommend achieving that in Neo4j? If possible, I'd like to 
avoid creating a node for every relationship (redundancy/overhead as we do this 
more and more).

I can't think of anything better than putting properties on the relationship. 
Maybe index numbers (e.g. rel D might have "index: 0", rel B might have "index: 
1", etc.), but that's essentially reordering an array, which sucks. The other 
option that thus came to mind was to mimic a linked
list: have an "after" property that contains the ID of the relationship this 
one comes after (and/or maybe a "before" property instead or in addition).

Just wondering if there are better ideas! Thanks. =)

Aseem
_______________________________________________
NOTICE: THIS MAILING LIST IS BEING SWITCHED TO GOOGLE GROUPS, please register 
and consider posting at https://groups.google.com/forum/#!forum/neo4j

Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user
_______________________________________________
NOTICE: THIS MAILING LIST IS BEING SWITCHED TO GOOGLE GROUPS, please register 
and consider posting at https://groups.google.com/forum/#!forum/neo4j

Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to