Skip to content

Instantly share code, notes, and snippets.

@guillaumegarcia13
Created December 29, 2016 16:51
Show Gist options
  • Save guillaumegarcia13/fa0db0d5a31e97207cb263b41890bd20 to your computer and use it in GitHub Desktop.
Save guillaumegarcia13/fa0db0d5a31e97207cb263b41890bd20 to your computer and use it in GitHub Desktop.
Neo4j: Count all relations per node types
MATCH (n)-[r]->(m)
WITH HEAD(LABELS(n)) AS label_n, type(r) as type_r, HEAD(LABELS(m)) AS label_m
RETURN type_r, label_n, label_m, COUNT(*)
ORDER BY type_r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment