Variable length traversal
Actors up to 4 hops away from Robert Blake.
Write and execute the query to return the unique names of actors that up to 4 hops away from Robert Blake using the ACTED_IN relationship.
How many unique actors are returned in the result?
-
✓ 263
Hint
Use the :ACTED_IN*1..4
specification for the relationship.
How many unique actors are returned?
Once you have entered the answer, click the Try Again button below to continue.
Solution
You can run the following query to find the answer:
cypher
MATCH (p:Person {name: 'Robert Blake'})-[:ACTED_IN*1..4]-(others:Person)
RETURN DISTINCT others.name
How many unique actors are returned?
Once you have entered the answer, click the Try Again button below to continue.
Summary
In this challenge, you answered a question about a query with a varying length paths.
In the next module, you will learn about pipelining queries.