Search code examples
memgraphdb

How to find all distinct relationships and count of relations?


I know that I can get total number of relationships using MATCH () -[r]-> () RETURN count(r) AS quantity. How I can get count per relationship type?


Solution

  • Use the following query to get count per relationship type:

    MATCH ()-[e]->() RETURN type(e), count(e) as quantity