I want to calculate the number of incoming relationships and the number of outgoing relationships for each node (this gives some insight).
I can get the number of incoming (or outgoing) requests, for example:
MATCH outg=(a)-->(b)
RETURN a.name, labels(a) AS Stereotype,count(rels(outg)) AS out
ORDER BY out DESC
It works.
If, however, I try to add an incoming relationship:
MATCH outg=(a)-->(b), incom=(c)-->(a)
RETURN a.name, labels(a) AS Stereotype,count(rels(outg)) AS out, count(rels(incom)) AS in
ORDER BY out DESC
then it does not give what I expect. In this case, both the incoming and outgoing values coincide and are much higher than on their own (therefore, some kind of multiplication occurs).
How to do this and what is wrong with the logic used in the second case?
source
share