Mesh Manuel
Mesh Manuel

Reputation: 104

Get a count of relationships connected to each node - neo4j

please I want to get the count of relationships (no_of_relationships) connected to each node in a path.

MATCH (parent:Members {id:"1", position:"R"})-[:PARENT_OF]->(child)
WHERE no_of_relationship < 1

So, I want to get all the nodes in this path where no_of_relationship is < 1

My question is how do I get no_of_relationship

Thanks guys.

Upvotes: 0

Views: 610

Answers (1)

Mesh Manuel
Mesh Manuel

Reputation: 104

I found a solution to my problem

MATCH (parent:Members {id:"1"})-[:PARENT_OF*1..]->(c) 
WITH c as result
WHERE size((result)-->()) < 2
RETURN result.id, size((result)-->()) as no_of_relationship LIMIT 50

Thanks guys.

Upvotes: 1

Related Questions