Traversing Relationships

Now for a challenge.

We are interested in the movie, Cloud Atlas.

How many people directed the movie Cloud Atlas?

Use the Neo4j Browser window to the right of the screen to modify the query to find the number of (:Person) nodes who have a [:DIRECTED] relationship to the Cloud Atlas (:Movie) node.

Enter the number of directors for Cloud Atlas in the box below, then click the Check Answer button below to continue.

  • ✓ 3

Hint

You are looking for the number of [:DIRECTED] relationships between person nodes and the Cloud Atlas movie node. You can find the result by returning the number of nodes and counting the rows, or use the count() aggregate function to find the answer.

Solution

You can use the following query to find the number of people who directed Cloud Atlas:

cypher
MATCH (m:Movie {title: 'Cloud Atlas'})<-[:DIRECTED]-(p)
RETURN count(p) AS answer

Click the Run in Sandbox button to reveal the answer in the Sandbox window.

Summary

In this challenge, you demonstrated your skills in traversing the graph. Next you will demonstrate more skills in traversing the graph.

Chatbot

Hi, I am an Educational Learning Assistant for Intelligent Network Exploration. You can call me E.L.A.I.N.E.

How can I help you today?