Reputation: 603
How to build a Neo4J query that:
1) Will return all nodes in a sub-graph of arbitrary depth with nodes connected by a given set of relations?
For example in Cypher-like syntax:
MATCH (*)-[r1:FRIEND_OF AND r2:COLLEAGUE_WITH]->(*) RETURN *
Upvotes: 0
Views: 912
Reputation: 66999
This query will return just the nodes, as you stated in your question:
MATCH (n)-[:FRIEND_OF|COLLEAGUE_WITH*]->(m)
RETURN n, m;
If you also want the relationships:
MATCH (n)-[r:FRIEND_OF|COLLEAGUE_WITH*]->(m)
RETURN n, r, m;
Upvotes: 1