Reputation: 177
I have to found all paths between two nodes. The length of each path has to be beetween 1 and 5 ( 2 and 3 for this exemple ).
So i'm using this query :
profile match p = (a:Station {name : 'X'} ) - [r*2..3] -> (b:Station {name : 'Y'} ) return distinct p
I have an index on :Station(name)
but when I profile this query I have this result :
So the problem is neo4j takes every relationship possible for this node B and then filters using the name. Is it a way for just taking the relation which involved this two specific nodes ?
Upvotes: 0
Views: 296
Reputation: 20185
Maybe you might want to use allShortestPaths
for that, eg :
PROFILE MATCH p=allShortestPaths((n:Person {name:'Ian Robinson'})-[r*1..5]–(b:Person {name:'Michal Bachman'}))
RETURN p
Upvotes: 1