Database Reference
In-Depth Information
name to the column presenting the results, and
type
is a special
keyword that gives the type of relationship between two nodes.
• How do we get the path and number of hops between two nodes?
◦
Answer
:
MATCH p = (:Movie{Title:"The Karate
Kid"})-[:DIRECTED*0..4]-(:Movie{Title:"Rocky V"})
return p;
◦
Explanation
: Paths are the distance between two nodes. In the preceding
statement, we are trying to find out all paths between two nodes, which
are between 0 (minimum) and 4 (maximum) hops away from each other
and are only connected through the relationship
DIRECTED.
You can
also find the path, originating only from a particular node and re-write
your query as
MATCH p = (:Movie{Title:"The Karate
Kid"})-[:DIRECTED*0..4]-() return p;
.