neo4j how to return all node labels with Cypher?

Sovos picture Sovos · Aug 23, 2013 · Viewed 38.4k times · Source

I can't find how to return a node labels with Cypher.

Anybody knows the syntax for this operation?

Answer

petra picture petra · Jun 5, 2014

To get all distinct node labels:

MATCH (n) RETURN distinct labels(n)

To get the node count for each label:

MATCH (n) RETURN distinct labels(n), count(*)