cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Limiting the amount of edges specifically

werner
Node Clone

Good day,

I would like to know if there is a easy way to limit the total number of out going nodes from another node (hope that makes sense)

MATCH (a:Instance) WITH a LIMIT 10 MATCH (a)-[r]-(b) WHERE b.count <> 0 AND b.count IS NOT NULL WITH a,r,b ORDER BY b.count DESC LIMIT 15 RETURN a,b,r;

At the moment I am limiting the total number of b to 15 , but I want to limit it to 5 per a. If that makes sense.

In other words :
I can limit the total number of b ,but I can not limit them specifically per a.
LIMIT b top 20 but not LIMIT b 5 per a.

MATCH (a:Instance)
WITH a LIMIT 10
MATCH (a)-[r]-(b)
WHERE b.count <> 0 AND b.count IS NOT NULL
WITH a,r,b ORDER BY b.count DESC LIMIT 15
RETURN a,b,r;

0 REPLIES 0