I have got nodes connected like in the picture from the link
I do query START a=node(27), b=node(0) MATCH p=b<-[*]-a RETURN p
I expect that I will get 3 paths but got 6. First 3 are correct but the last 3 have got duplicate 'node 0'
For example:
correct path: 0 -> 41 -> 2 -> ... -> 27
duplicate node path: 0 -> 0 -> 41 -> 2 -> 27
The lengths of incorrect paths are exactly incremented by one.
How to write a query to get (in this example) exactly 3 path without duplicate nodes?
Your query is correct and there probably is a problem in the database. I replicated your graph structure: console.neo4j. Run START n=node(*) RETURN n
to get the ids of node 27 and 0 and then run your query. It returns exactly 3 results.
To check whether you have loops on node 0 execute:
START n=node(0) MATCH n-[r]-n RETURN r