Re: [Neo4j] Suggestions on how to order relationships?
On the other hand, it avoids a sort when you are working with the list of movies a particular user likes. (You are pre-building the linked list.) Like I said, probably not better, just different. I guess it partly depends on how you are using the data and whether a sort is faster than a traversal. It is an approach that would not really help with recommendations or finding similar folks. -- In the split-the-difference approach, you would still occasionally have to re-write the properties on all of the "like" relationships, but only when you hit the limit for your ability to find a between value. It is a good approach -Original Message- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of Aseem Kishore Sent: Thursday, January 19, 2012 2:42 PM To: Neo4j user discussions Subject: Re: [Neo4j] Suggestions on how to order relationships? Can't say I'm a fan of this approach. You lose the ability to quickly determine if the user likes a particular movie, and storing the user (presumably their ID) as a property on the relationship feels like it defeats the point of a graph db, know what I mean? On Thu, Jan 19, 2012 at 1:29 PM, Rick Otten wrote: > 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 > ___ 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
Re: [Neo4j] Suggestions on how to order relationships?
Can't say I'm a fan of this approach. You lose the ability to quickly determine if the user likes a particular movie, and storing the user (presumably their ID) as a property on the relationship feels like it defeats the point of a graph db, know what I mean? On Thu, Jan 19, 2012 at 1:29 PM, Rick Otten wrote: > 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 > ___ 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
Re: [Neo4j] Suggestions on how to order relationships?
Not a bad idea. So something like: if a user drags/drops item X in between item Y and Z, set X's weight to halfway between Y's and Z's? Clever. =) On Thu, Jan 19, 2012 at 1:28 PM, Linan Wang wrote: > how about "weight"? > > On Thu, Jan 19, 2012 at 6:23 PM, Aseem Kishore > wrote: > > 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 > > > > -- > Best wishes, > > Linan Wang > Architect, Programmer, PhD > ___ > 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
Re: [Neo4j] Suggestions on how to order relationships?
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
Re: [Neo4j] Suggestions on how to order relationships?
how about "weight"? On Thu, Jan 19, 2012 at 6:23 PM, Aseem Kishore wrote: > 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 -- Best wishes, Linan Wang Architect, Programmer, PhD ___ 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
[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