Skip to content

Instantly share code, notes, and snippets.

@trentonstrong
Created April 17, 2013 18:44
Show Gist options
  • Save trentonstrong/5406696 to your computer and use it in GitHub Desktop.
Save trentonstrong/5406696 to your computer and use it in GitHub Desktop.
"START n=node:`entity-type-index`('entity-type:USER')
MATCH n<-[:`type-of`]-opaluser,
opaluser-[:`is-opal-user`]-user,
user-[:`fb-friend`]->friend<-[:`fb-friend`]-person
WHERE NOT id(person)=id(user)
WITH user, person, length(collect(DISTINCT friend)) as number
CREATE UNIQUE user-[r:`fb-mutual-friends`]->person
SET r.`mutual-friends` = number
RETURN DISTINCT user.`fb-name`, user, collect(DISTINCT [person.`fb-name`, r.`mutual-friends`]) as people"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment