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

Reply via email to