#### Step 3: Find patterns in Movie Graph

###### Question 1: Find all the movies Tom Hanks acted in

MATCH (tom:Person {name: “Tom Hanks”})-[:ACTED_IN]->(tomHanksMovies:Movie)

###### Question 2: Who directed the film Cast Away?

MATCH (directors:Person)-[:DIRECTED]->(castAway:Movie {title: “Cast Away”})
RETURN directors, castAway

###### Question 3: Find Tom Hank’s co-actors

This is an extension of Question 1. For all the movies Tom Hank is in, we want to find other actors in those movies, therefore, we need to extend the query we used in Q1.
MATCH (tom:Person {name: “Tom Hanks”})-[:ACTED_IN]->(tomHanksMovies:Movie)<-[:ACTED_IN]-(coActors:Person)

###### Question 4: Can we have any connections between Kevin Bacon and Meg Ryan?

Here, we can use a built-in function provided by Neo4j on finding the shortest path, if exist, between two entities. In our case, we are trying to find the path connections between Kevin Bacon and Meg Ryan. Below is the query:
MATCH p=shortestPath((baconPath:Person {name: “Kevin Bacon”})-[*]-(meg:Person {name: “Meg Ryan”}))
RETURN p

#### How to remove all the data?

Grab all nodes and relationships using MATCH and using DETACH DELETE:
MATCH(n)
DETACH DELETE n

Data Scientist