The data model is as shown in the above diagram.
The queries are generated based on multiple selections of nodes and relationships. A sample query is as follows:
MATCH (Ve_0:Node4)-[Su_2:Rel1]->(Ma_1:Node3) WHERE Ma_1.property1 IN ['A','B','C']
OPTIONAL MATCH (Ma_1)-[St_5:Rel2]->(Pl_4:Node2)
OPTIONAL MATCH (Pl_4)-[Sh_8:Rel3]->(Cu_7:Node1)
OPTIONAL MATCH (Ma_1)-[De_11:Rel4]->(Cu_7)
OPTIONAL MATCH (Ve_0)-[Su_14:Rel5]->(Pl_4)
RETURN Ve_0,Ma_1,Su_2,Pl_4,St_5,Cu_7,Sh_8,De_11,Su_14
LIMIT 100
Considering the above query, the limit is applied to the combination used in the return statement. 100 records of Ve_0,Ma_1,Su_2,Pl_4,St_5,Cu_7,Sh_8,De_11,Su_14 are returned.
How to apply the limit on each entity/relation in the graph? (Ve_0 10, Ma_1 20, Su_2 30 and so on)
Also, when limit 100 is used A is only returned along with other nodes and relationships, for limit 300 A and B both are returned, ideally A, B, C must be returned for any limit.
Request you to suggest some changes in the queries to achieve the same.