Le mercredi 13 avril 2016 09:39:53 UTC+2, Michael Hunger a écrit : > > Try this: > > MATCH (a:Person{name:1})-->(b)-->(c)-->(d) > with collect(DISTINCT b) as nodesDist1, collect(DISTINCT c) as > nodesDist2,collect(DISTINCT > d) as nodesDist3 > RETURN nodesDist1, > filter(n in nodesDist2 WHERE NOT n in nodesDist1) as > nodesDist2, > filter(n in nodesDist3 WHERE NOT n in nodesDist1 OR n in > nodesDist2) as nodesDist3 >
Indeed,it's working well, I just had to replace the "OR" by "AND NOT" However, isn"t there a way to optimise this query ? Because, I have the impression that we are, for instance, collecting all the D nodes from all the C nodes and then doing a filtering on them. Wouldn"t it be better if we first filtered the C nodes to the relevant ones and then, starting from this reduced subset, looked for the D nodes ? -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.