Aseem,
you could index all the activity nodes of a user with a timeline index,
https://github.com/peterneubauer/graph-collections/blob/master/src/test/java/org/neo4j/collections/timeline/TestTimeline.javato
be able to run backwards the last activities of each user. Thus, for
each
of the friends, fetch the last 20 activities and merge them into the
combined result of say the last 50 activities. If the merging reveals that
one users 20 last activities are exhausted during the merge, go back and
fetch more, since he has a lot of fresh events, or increase the number of
events fetched from each user so you have more activities to work with.

Would that be an interesting heuristic?

Cheers,

/peter neubauer

GTalk:      neubauer.peter
Skype       peter.neubauer
Phone       +46 704 106975
LinkedIn   http://www.linkedin.com/in/neubauer
Twitter      http://twitter.com/peterneubauer

http://www.neo4j.org               - Your high performance graph database.
http://startupbootcamp.org/    - Ă–resund - Innovation happens HERE.
http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.


On Wed, Aug 24, 2011 at 11:23 PM, Aseem Kishore <[email protected]>wrote:

> Hi guys,
>
> Here's another scenario I'd love to get a sanity check on.
>
> In our social network, users "do" various things. E.g. maybe they "like"
> something, maybe they comment on something, maybe they follow someone, etc.
> For each such action, we generate an "event" node in our graph, and connect
> it to that user.
>
> If you want to see a particular user's feed then, that's easy: we just
> fetch
> (via a simple breadth-first traverse of max depth 1) the event nodes for
> that user.
>
> We also want to show you a personalized "home" feed that shows the activity
> across all of the users you "follow". Think Twitter's timeline here.
>
> We achieved this by logic like this:
>
> 1. Fetch the list of people I follow.
> 2. For each person in that list, in parallel...
> 3. ...Fetch that person's events.
> 4. Merge sort all of the resulting events together.
>
> This again results in O(n) traverses. We've realized we can achieve this
> with a single traverse, so we'll try that soon.
>
> But the bigger problem this has is that the list of events for each user is
> ever-growing, but we don't know for each user how many events we need,
> since
> that depends on the times of other user's events. If we switch to a single
> traverse, we could potentially address this if we could control the order
> of
> the traverse, yeah? (i.e. Beyond just "breadth first" -- e.g. breadth first
> but based on the timestamps of the event nodes.)
>
> Is there another way of doing this that we're missing? E.g. a simple
> Gremlin
> or Cypher query?
>
> Thanks much!
>
> Aseem
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to