+3 votes
in Databases by (355k points)
I want to check how many relationship types are in the database. Also, how many relationships by each type are there in the database?

1 Answer

+1 vote
by (40.5k points)
selected by
 
Best answer

You can try the following Cypher query to get the number of relationships by relationship type.

MATCH ()-[r]-() 

RETURN TYPE(r) AS relationshipType, COUNT(r) AS relationshipCount;

by (355k points)
The above Cypher will return 2x count for each relationship type because of the bi-directional match. To get unique counts, you need to use "MATCH ()-[r]->()".

Also, you can use the apoc.meta.status() procedure to get the unique count of each relationship type. Here is an example:

CALL apoc.meta.stats() YIELD relTypesCount
RETURN relTypesCount

Related questions


...