Finding co-actors
Co-actors of Robert Blake
Given this query and what you have learned about graph traversal:
MATCH (p:Person {name: 'Robert Blake'})-[:ACTED_IN]->(m:Movie),
(coActors:Person)-[:ACTED_IN]->(m)
RETURN m.title, collect(coActors.name)
How many relationships are traversed to return the result?
-
✓ 16
Hint
The query finds each movie that Robert Blake acted in. How many ACTED_IN traversals is that?
For each movie, it then finds all actors to acted in that movie. It does not traverse the ACTED_IN relationship from Robert Blake twice.
How many ACTED_IN relationships are traversed?
Once you have entered the answer, click the Try Again button below to continue.
Solution
This query traverses a total of 16
ACTED_IN relationships.
Once you have entered the answer, click the Try Again button below to continue.
Summary
In this challenge, you determined the number of relationships that are traversed during query.
In the next challenge, you will answer another question about query traversal.