Neo4j - Counting Nodes with Labels

neo4j

Solution

Try something like this

MATCH (n) 
RETURN count(labels(n)), labels(n);

This will return the sum of the labels in the first column and the label name in the second.

Problem

I'd like a query that counts how many nodes have each label in the dataset. For instance: LabelA 100 LabelB 200 I can do this for each individual label with something like ``` MATCH (n:LabelA) return count(n); ``` But, I'd like to do it for every label in one command.

Original source