1
votes

I am running the following Neo4j Cypher query:

MATCH (n:ARTICLE { article_id: '1234' })-[k:CONNECTS]->(r:ARTICLE) 
RETURN n,k,r;

Now I'd like to filter for all those r nodes that within the matched results have in-degree (ie. degree of (n)-[k]->(r)) greater than 1. How would I do that?

(I thought this questions is distinct from How to get degree of a node while filtering using MATCH in neo4j , which is why I decided to ask it here.)

1

1 Answers

1
votes

You could check the size of the number of inbound relationships between the nodes in a WHERE clause.

MATCH (n:ARTICLE { article_id: '1234' })-[k:CONNECTS]->(r:ARTICLE)
WHERE size((n)-[:CONNECTS]->(r)) > 1
RETURN n,k,r