Hi guys,

We're building a social network which has an asymmetrical follower model
like Twitter's: users "follow" each other.

We have various views where we show a list of people. This could be e.g. all
people in the network, or it might be some user's followers, or it might be
a list of people that share interests, etc.

In these views, it's easy to show how many followers each person has. But we
also want to show a message like "Followed by 4 people you follow" next to
each person. This helps show the trustworthiness/relevance of each person.

We implemented that by logic like this:

1. Fetch the list of people that *I* follow.
2. Given the list of people we want to show, for each person in parallel...
3. ...Fetch the list of people that follow *that* person...
4. ...And compare this list with the list of people that I follow.

Each "fetch" is a traverse (breadth first, max depth 1). This requires O(n)
traverses, where "n" is the number of people we're showing in this view.

(Assume that, generally, the number of people we're showing is smaller than
the number of people I potentially follow, but the logic could be reversed
if this is not the case: for each person I follow, fetch the list of people
that *they* follow.)

I wanted to do a sanity check: is this the best way of answering this
question? Or is there a better way, e.g. via a single traverse somehow, or
via a Cypher or Gremlin query?

Thanks much!

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

Reply via email to