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

Get Neo4j Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.