Variable length traversal
Actors 4 hops away from Robert Blake.
Write and execute the query to return the distinct names of actors that are 4 hops away from Robert Blake using the ACTED_IN relationship.
How many actor names are returned in the result?
-
✓ 253
Hint
Use the :ACTED_IN*4
specification for the relationship.
Make sure you specify DISTINCT so there will be no duplicate names.
How many actor names 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*4]-(others:Person)
RETURN DISTINCT others.name
How many 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 challenge, you will write another query.