Finding mutual friends with Neo4j
Sally and John are Facebook friends. Now, find out the people who are friends with both Sally and John. This is also known as the mutual friend problem.
In this recipe, you will learn how to find mutual friends between two people.
Getting ready
Perform the following steps to get ready for this recipe:
- Install Neo4j on your machine using the recipes from Chapter 1, Getting Started with Neo4j.
- Use the following Cypher script to create the dataset for this recipe:
CREATE (bradley:User {name:'Bradley', surname:'Green', age:24, city:'Los Angeles'}), (matthew:User {name:'Matthew', surname:'Cooper', age:36, city:'Los Angeles'}), (lisa:User {name:'Lisa', surname:'Adams', age:15, city:'New York'}), (annie:User {name:'Annie', surname:'Behr', age:25, city:'Chicago'}), (ripley:User {name:'Ripley', surname:'Aniston&apos...