0
votes

I want to get all path between two nodes with the relation "->" between them. I ask my DB using query (Cypher) like that:

START a=node(27), b=node(0) MATCH p=b<-[*]-a RETURN p 

In Neo4j visualization I get this:

Cypher query visualization

I want to get list of 3 path:

  • 27 -> 81 -> .... -> 0
  • 27 -> 67 -> .... -> 0
  • 27 -> 24 -> .... -> 0

but in the result I have got 6 paths (instead of 3). I want to figure out why.

2
Can you create a graphgist of this? Easier to play aroundBadmiral
Can you provide the 6 paths in the result ?RaduK
The result was to long to put in in comment so here is link to it: hubic.com/home/pub/…trojek

2 Answers

1
votes

This happens because the query includes the 0 length paths starting from 'a'. If you look at the file you provided, the last three results are the same as the first three ones, except for the duplication of Node[0] at the beginning of the path.

1
votes

Your (OwlThing) has a [:subClassOf] relationship to itself. It doesn't show in the visualisation, but that's what

Node[0]{name:"owl:Thing"},:subClassOf[35]{},Node[0]{name:"owl:Thing"}

in your results means. For every path from that ends with (41)-[43]->(0) there is also a (41)-[43]->(0)-[35]->(0) which means your results are doubled.