Neo4j tricks

Basic graph statistics

Count number of edges:

MATCH ()-[]->()
RETURN count(*)

Count number of distinct edge types:

MATCH ()-[e]->()
RETURN count(DISTINCT type(e))

Count number of nodes:

MATCH ()
RETURN count(*)

Get distinct edge types in a graph:

MATCH ()-[e]->()
RETURN DISTINCT type(e);

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.