Finding user similarity with Neo4j
It is often necessary to find the similarities between things on any social network so as to effectively propose new things and other suggestions.
In this recipe, you will learn how to implement algorithms for finding similarities between users based on some criteria.
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, Place
visited and times
, to similar friends. Instead of the Cypher query used in the first recipe of this chapter, add the following nodes and relationships to a similar Cypher query:
//Places (pl1:Place { type: 'Disco'}), (pl2:Place { type : 'Coffee bar'}), (pl3:Place { type : 'Church'}), (pl4:Place { type : 'College'}), (pl5:Place { type : 'pizza Corner'}), (pl6:Place { type : 'Stadium'}), //VISITED (Bradley)-[:VISITED {times:5} ]-> (pl1), (Bradley)-[:VISITED {times:1} ]-> (pl3)
How to do it...
The following Cypher queries will get you started...