Help with Cypher

Hello! I need help with forming a Cypher query

For a graph with 2 types of nodes :User and :Event and 2 types of relationships :OWNS and :PARTICIPATES_IN,

I want to get a list of all events that a user participates in along with the owner of that event and no more that 4 other participants of the same event.

Your help is much appreciated.
Thanks
Sachin

Hello! Welcome to the community.
You could try something like this with Neo4j 4.1 by using a subquery:

MATCH (u:User)-[:PARTICIPATES_IN]->(e:Event)
CALL {
   WITH u, e
   MATCH (u)-[:OWNS]->(e)<-[:PARTICIPATES_IN]-(o:User)
   RETURN o, u LIMIT 4
}
RETURN u, e, o

Not sure if that's exactly how your graph is structured but something along those lines should get it done. Here's an example of something similar in the new docs Limiting MATCH results per row - Knowledge Base

Thank you very much!