2
votes

I need to find common node between two nodes. For example find B from A -> B -> C

A = node 1
B = node 2
C = node 3

A, B and C have common property (user_id, fullname) and relation property is KNOWS. node index is user_id.

Node related to: A [:KNOWS] B and B [:KNOWS] C

I have A and C node id. I want find B node id. How can I do this using Cypher or neo4jphp?

1

1 Answers

1
votes

Would really prefer to see something that you had written yourself, but I suppose sometimes that's just too much effort...

START a=node(1)
MATCH (a)-[:KNOWS]->(b)-[:KNOWS]->(c)
WHERE a.user_id = ... (Explanation on what exactly should be done here was lacking)
RETURN b