Retrieving incoming edges in Neo4j query

Viewed 50

I have a Neo4j graph as below. I can get the chains of nodes of type B with the following command. How can I obtain the nodes of type A, along with the B ones?

MATCH (from: B)-[relation:SAW*1..]->(to: B) RETURN from,to,relation

Neo4j sample graph

1 Answers
MATCH (from)-[relation:SAW*1..]->(to) 
WHERE (from:A OR from:B)
AND (to:A OR to:B)
RETURN from,to,relation
Related