You don't need to consult every single player after updating the  
scores — only the ones that are already on the leader board. So the  
time to make an update should be relatively constant. The maximum  
number of updates will be relative to the deepest chain of  
introductions in the pyramid. I don't see why you need any fancy  
indexing beyond maintaining the leader board.

Cheers,
Lach


On 16/03/2010, at 7:49 PM, Craig Taverner wrote:

> If the total number of players scores changed was a relatively small  
> part of
> the list, then re-linking those on each change might still be  
> efficient, but
> you indicate that the number might be high, then Rick's b-tree  
> approach
> works better. In my opinion you have two options:
>
>   - Lucene - you can have your scores as numeric strings such that
>   alphanumeric sorting will give the right order
>   - Tree index - a b-tree, or multi-branch tree, or even the  
> TimeLineIndex
>   built into neo4j
>
> If you want to try the tree index approach, but want a 'magic'  
> solution, why
> not try the TimeLineIndex? All that you need is for your score to be
> expressible as a long, and be a positive number.
>
> On Tue, Mar 16, 2010 at 9:16 AM, Mattias Ask  
> <mattias....@jayway.com> wrote:
>
>> Thanks for answering! Linked list... My spontaneous feeling is that  
>> then
>> I'll have to sort every time the scores change, right? And that  
>> operations
>> would probably take more and more time depending on the number of
>> players..?
>> But the fetching of the leaderboard would be dead fast every time!
>>
>> The logic is kind of that of a pyramid game (no, I'm not doing  
>> anything
>> bad... quite the opposite, actually... ask Emil if you don't  
>> believe me ;).
>> If I score, the person that has introduced me will get points, and  
>> the
>> person that introduced that person would get points and so on. This  
>> means
>> that one changed score can ripple out over a number of different  
>> scores. In
>> my mind, If I use a linked list approach, I would have to sort the  
>> list for
>> every update of the scores. Or I would have to bash-sort at a later  
>> stage.
>> Or I would have to sort when getting the top scores. What I really  
>> was
>> hoping for some magic Lucene-sorted-index-type-of-thingy ;) Any  
>> ideas on
>> that?
>>
>> /Mattias
>>
>> On Mon, Mar 15, 2010 at 11:19 PM, Lachlan Cotter <l...@lachlanc.id.au
>>> wrote:
>>
>>> Probably depends on the logic of your scoring system, I would think.
>>>
>>>
>>> On 16/03/2010, at 8:43 AM, Rick Bullotta wrote:
>>>
>>>> Perhaps a linked list using relationships?
>>>>
>>>> Or even a btree should be doable?
>>>>
>>>> ------Original Message------
>>>> From: Mattias Ask
>>>> Sender: user-boun...@lists.neo4j.org
>>>> To: Neo user discussions
>>>> ReplyTo: Neo user discussions
>>>> Subject: [Neo] Leaderboard?
>>>> Sent: Mar 15, 2010 11:03 AM
>>>>
>>>> I've been thinking of a problem that I have, and would like to hear
>>>> how you
>>>> all would solve it.
>>>>
>>>> I have a use case where the top scoring users should be presented  
>>>> in a
>>>> leaderboard. One players action may effect many players scores. How
>>>> would
>>>> you solve this problem when using Neo? I know that I could make all
>>>> actions
>>>> trigger an update to a PlayersScore-table in a relational db, and
>>>> then do a
>>>> "SELECT player_id, score FROM PlayersScores ORDER BY score DESC",
>>>> but I
>>>> would like to know how this can be done in Neo without killing
>>>> performance.
>>>> Any ideas?
>>>>
>>>> Best regards,
>>>> Mattias Ask
>>>> _______________________________________________
>>>> Neo mailing list
>>>> User@lists.neo4j.org
>>>> https://lists.neo4j.org/mailman/listinfo/user
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Neo mailing list
>>>> User@lists.neo4j.org
>>>> https://lists.neo4j.org/mailman/listinfo/user
>>>
>>> _______________________________________________
>>> Neo mailing list
>>> User@lists.neo4j.org
>>> https://lists.neo4j.org/mailman/listinfo/user
>>>
>> _______________________________________________
>> Neo mailing list
>> User@lists.neo4j.org
>> https://lists.neo4j.org/mailman/listinfo/user
>>
> _______________________________________________
> Neo mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user

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

Reply via email to