Reputation: 53
I would like to find path between two nodes like
[:relation] [:relation] [:relation]
A-------------B--------------C------------D
(name=A) (name=B) (name=C) (name=D)
So, I have only A B D and want to find A B C D
I tried
MATCH
(q1:check4 {name:'A'})-[r1:relation]->
(q2:check4 {name:'B'})-[r2:relation]->(q3:check4 {name:'D'})
RETURN DISTINCT q3.name as name
But it's not working.
Upvotes: 1
Views: 52
Reputation: 5047
If you are trying to find the name
attribute of the node between B
and D
, this query should do it:
MATCH
(:check4 {name:'A'})-[:relation]->
(:check4 {name:'B'})-[:relation]->
(q3:check4)-[:relation]->
(:check4 {name:'D'})
RETURN DISTINCT q3.name as name
A tip: you do not have to name every node and relationship, e.g. q1
, r1
can be omitted.
Upvotes: 2