Apologies, typo in the query, should be: MATCH (n2)--(n1)--(n0)--(n3)--(n4) *return n0,n1,n2,n3,n4*.
On Thursday, January 31, 2019 at 2:44:32 PM UTC-5, Steve wrote: > > Hi, > > I am wondering if there is a more optimal way to ensure a one-to-one > relationship between the nodes in the query graph and the nodes in the > matches that are obtained. > > For example, suppose I want to find paths of length 4 consisting of unique > nodes. > > I could have a query like: MATCH (n2)--(n1)--(n0)--(n3)--(n4) return > a,b,c,d,e. However, this does not ensure the matched nodes are distinct. > For instance, n2 and n4 are allowed to match (which would give me a cycle). > I can add a where clause "where not(n2=n4)", but other nodes can match too. > It seems like I will need to add this for all pairs of nodes that I want to > be unique. > > Is there a better way to ensure a one-to-one relationship? > > Thanks, > Steve > -- 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.