1

I want to retrieve all the relationships and nodes present between two nodes from the graph I created using neo4j. I am using py2neo and I want to know how can we write a cypher query which can retrieve intermediate relationships between two nodes and also the intermediate nodes between those two nodes.

For ex:

(A)-[relation1]->(B)-[relation2]->(C)-[relation3]->(D)

If I give A as starting node and D as ending node, I want the output to be as set of relations relation1,relation2,relation3 and set of intermediate nodes as B and C.

rickhg12hs
  • 10,638
  • 6
  • 24
  • 42
  • Do you mean something like [`nodes()`](https://neo4j.com/docs/cypher-manual/current/functions/list/#functions-nodes) and `relationships()`? – rickhg12hs Feb 15 '19 at 04:53

1 Answers1

0

match mypath=(A)-[:*0..]->(D) return nodes(mypath), relationships(mypath)