This is an approach for scaling the retrieval of activity streams in a friend graph put forward by Rene Pickard as Graphity. In short, a linked list is created for every persons friends in the order that the last activities of these friends have occured. When new activities occur for a friend, all the ordered friend lists that this friend is part of are reordered, transferring computing load to the time of new event updates instead of activity stream reads.
![]() | Tip |
---|---|
This approach of course makes excessive use of relationship types. This needs to be taken into consideration when designing a production system with this approach. See Section 10.5, “Capacity” for the maximum number of relationship types. |
To find the activity stream for a person, just follow the linked list of the friend list, and retrieve the needed amount of activities form the respective activity list of the friends.
Query.
MATCH p=me-[:jane_knows*]->friend, friend-[:has]->status WHERE me.name = 'Jane' RETURN me.name, friend.name, status.name, length(p) ORDER BY length(p)
The returns the activity stream for Jane.
Result
me.name | friend.name | status.name | length(p) |
---|---|---|---|
3 rows | |||
0 ms | |||
|
|
|
|
|
|
|
|
|
|
|
|
Copyright © 2013 Neo Technology