Actors 2 Hops Away

Variable length traversal

Actors 2 hops away from Robert Blake.

Write and execute the query to return the names of actors that are 2 hops away from Robert Blake using the ACTED_IN relationship.

How many actors are returned in the result?

  • ✓ 12

Hint

Use the :ACTED_IN*2 specification for the relationship.

How many 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*2]-(others:Person)
RETURN  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 wrote a query that uses varying length paths.

In the next challenge, you will write another query.