How to count distinct couples

Hello, I have this query

match (c1:CI)-[:USES]->(c2:CI)
return distinct,

Now I would like to count the rows, but I don't seem to be able to figure this out!

I tried

return count(*)

but this does count duplicates.

I tried

return count (distinct

but this is wrong, as it counts only the "users", not the distinct relationships.

Other attempts gave me error.

Could you help?


Hello @dario.piantanida and welcome to the Neo4j community :slight_smile:

MATCH (c1:CI)-[:USES]->(c2:CI)
WITH DISTINCT AS c1_name, AS c2_name
RETURN count(c1_name) AS couples