Count distinct pairs i.e. Count rows "after" RETURN distinct a, b

Hi Tony.

Thank you for your great insight and quick reply!!
The "total" gave me the value that I needed, BUT what I sent was part of my code which includes a UNWIND in the beginning. So, is there any alternative without a deja vu?

Maybe you can better help with knowing my full code:

# My topusers list is actually bigger
WITH [522,192] as topusers
UNWIND topusers as topuser 
MATCH (u1 {id: topuser})-[r1:InteractsWith]-(u2)
WITH topuser, collect(distinct u2.id) as neighbours, count(distinct u2.id) as neighboursCount
MATCH (u1 {id: topuser})-[r1:InteractsWith]-(u2)-[r2:InteractsWith]-(u3)
WHERE u3.id in neighbours
WITH topuser, neighboursCount, count(distinct u2.id, u3.id)/2+neighboursCount as links
# The part "count(distinct u2.id, u3.id)" doesn't work, and should be the "total" we are talking about
WITH topuser, tofloat(links)/(neighboursCount*(neighboursCount-1)) as coefficient
RETURN topuser, round(100*coefficient)/100 as coefficient order by coefficient desc

Thanks again!
:grinning:

.