Skip to content

Instantly share code, notes, and snippets.

@Iknewthisguy
Created November 15, 2012 21:34
Show Gist options
  • Save Iknewthisguy/4081444 to your computer and use it in GitHub Desktop.
Save Iknewthisguy/4081444 to your computer and use it in GitHub Desktop.
Outer_circle
START n=node(127)
MATCH
(n)-[:friends]->(y)-[:friends]->(z)
WHERE
(z<>n)
AND(z-[:friends]->y-[:friends]->n)
AND NOT(n-[:friends]->z-[:friends]->n)
AND NOT(n-[:blocked_friends]->y-[:blocked_friends|friends]->z)
AND NOT(n-[:blocked_friends|friends]->y-[:blocked_friends]->z)
AND NOT(n-[:blocked_friends]->z)
AND NOT(has(z.deleted_at))
WITH n, count(distinct(z)) as foaf_count, collect(distinct(z)) as foaf
MATCH
(n)-[:outer_only_friends|friends]->(i)-[:outer_only_friends|friends]->(n)
WHERE
(i<>n)
AND NOT(n-[:friends]->i-[:friends]->n)
AND NOT(n-[:blocked_friends]->i)
AND NOT(has(i.deleted_at))
WITH n, count(distinct(i)) as outeronly_count, collect(distinct(i)) as outeronly,foaf,foaf_count
RETURN collect(foaf + outeronly) as total, (foaf_count + outeronly_count) as total_count
@freeeve
Copy link

freeeve commented Nov 16, 2012

Does this work?

RETURN foaf + outeronly as total, foaf_count + outeronly_count as total_count

@freeeve
Copy link

freeeve commented Nov 16, 2012

Oh, no, that will give you more results than you want. I think I get it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment