How to count distinct couples

Hello, I have this query

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

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 c1.name)

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

Other attempts gave me error.

Could you help?

Tnx!

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

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

Regards,
Cobra