Imagine an example graph like
Graph
To find out the friends of Joes friends that are not already his friends, Cypher looks like:
Query
START joe=node:node_auto_index(name = "Joe") MATCH joe-[:knows]->friend-[:knows]->friend_of_friend, joe-[r?:knows]->friend_of_friend WHERE r IS NULL RETURN friend_of_friend.name, COUNT(*) ORDER BY COUNT(*) DESC, friend_of_friend.name
The list of Friends-of-friends order by the number of connections to them, secondly by their name.
Copyright © 2012 Neo Technology