Hi Fajar,
this is a depth 2 traversal from the person in question. While
exhaustively traversing his friends, you increase the group count as
for each FOAF you get on the second step.

However, we have seen edge cases with supernodes where in a social
network, persons can have 50K friends. There, you might use heuristics
or indexing approaches to make this very fast.

If you have some more details, I could write down the query in Gremlin
or Cypher (http://docs.neo4j.org/chunked/snapshot/cypher-query-lang.html),
but in principle, it would be like
https://github.com/tinkerpop/gremlin/wiki (actually using 3 steps, I
think we could get it down to 2) for Gremlin.

In neo4j, if things are not cached, only the parts the data that are
needed for this traversal wil be loaded from disk, so you don't need
to hold all the graph in cache for this, since it is a data-local
operation.

HTH

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 Fri, Jun 17, 2011 at 1:33 PM, Fajar Maulana Firdaus
<[email protected]> wrote:
> Hi all,
>
> I am new to neo4j and excited to know more about graph database.
>
> First of all, could anyone please help me to figure out the documentation
> about the query or rest client?
>
> Then, back to my question, I want to find 2nd degree friends but ordered by
> number of mutual friend. I understand that if I have all data in memory, I
> could've traverse the graph to 2nd level, and keep counter for each nodes in
> 2nd level. So in away its like finding all paths from start node to all
> second degree friend, but if we do that, it would be inefficient.
>
> Does anyone have any idea how to do this with neo4j?
>
> Thank you,
> Fajarmf
> _______________________________________________
> 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