Count relationship on each nodes

(Mithil Dave) #1

I have nodes with one of the properties called "Model".
If I have node names as a,b,c,d,e etc,
d.Model="1" etc

I want to ask a query : "For a particular Model, return the count of relationships for each individual nodes "

If i ask for Model=1 , it should give me the count of relationships for each distinct node under Model 1.
need results like below
for Model="1"
a---> count of relationships for a
d---> count of relationships for d

How many times each node collaborated with other nodes
(Benoit Simard) #2


You can try this query :

MATCH (n:MyNodeLabel)
WHERE n.Model = "1"
RETURN n, size((n)-->()) AS count

NB : In this example, you should replace MyNodeLabel by the label of your nodes.