I would like to count how many
(User) nodes exists for a which there is a direct relationship with a
If I do
Match (u:User)-->(k:Keyword) Return Count(u)
then the same user may be counted multiple times since it can have connections to different keywords. How do I account for this?
Assuming the Keyword node has a property 'name' with values: name: 'cat', name: 'dog'
Return distinct k.name, Count(u)
I'm not asking for a count over each keyword. I'm asking for the number of nodes that have a keyword relationship, regardless of
Though if you know the relationship type (if only a single type connects from a :User to a :Keyword node), then you can use that in your WHERE pattern instead of the :Keyword label, and it will turn to a more efficient degree check, since a node knows what relationship types are connected to it, so you won't have to pay the cost of expanding and filtering on the label of the node on the other side.