I have two types of nodes stored in Neo4j db: Person and Group. I defined a relationship "IN" between Person and Group: (p:Person)-[:IN]->(g:Group)
.
The question is given 2 Person nodes, how can I find the relationships between them?
I know I can use Cypher queries such as
MATCH (p1:Person{pid: '11231'})-[:IN]->(g:Group)<-[:IN]-(p2:Person{pid: '1231231'})
RETURN p1,p2,g;
But how can I describe a multi-hop relationship so that Neo4j can find links between two not directly linked Person nodes? I don't know how many hops are required to link these two Person nodes.