O'Reilly logo

Neo4j Cookbook by Ankur Goel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Finding friends of friends with Neo4j

If you have used Facebook or LinkedIn, you must have seen something such as "People you may know". This feature can be implemented using various different algorithms; most common are mutual friends, common interests, common location, and so on.

In this recipe, you will learn how to implement these algorithms and implement this feature with Neo4j.

Getting ready

The steps required for this recipe are similar to the steps described in the first recipe of this chapter. We are adding one more field, Interest, to find friends based on mutual interests. Apart from the Cypher query used in the first recipe of this chapter, we add the following nodes and relationships in a similar Cypher query, as shown here:

CREATE

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required