Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-24-2021 12:50 AM
match (a:User {name: "HakumanaTata"}) ,(a)<-[f:Follows]-(:User) ,(a)-[F:Follows]->(:User) return count(f) as Followers, count(F) as Following
This returns nothing.
Also, which is faster, counting relationships or counting nodes?
Solved! Go to Solution.
01-24-2021 04:50 AM
does
match (a:User {name: "HakumanaTata"}) return a;
report any data? if not then no such :User node exists.
if you run
match (a:User {name: "HakumanaTata"})
return size ( (a)-[:Follows]->() ) as Followers,
size ( (a)<-[:Follows]-() ) as Following
should be fast and do what I suspect what you might be after however this is dependent on the fact that the :Follows relationship only connects to :User nodes.
See Fast counts using the count store - Knowledge Base for more details
01-24-2021 04:50 AM
does
match (a:User {name: "HakumanaTata"}) return a;
report any data? if not then no such :User node exists.
if you run
match (a:User {name: "HakumanaTata"})
return size ( (a)-[:Follows]->() ) as Followers,
size ( (a)<-[:Follows]-() ) as Following
should be fast and do what I suspect what you might be after however this is dependent on the fact that the :Follows relationship only connects to :User nodes.
See Fast counts using the count store - Knowledge Base for more details
01-24-2021 06:28 AM
Thank you very much.. I don't know why the previous query did not execute correctly... the user I searched for definitely exists., fortunately for me your solution worked.
All the sessions of the conference are now available online