Goals This guide explains how to leverage connections in your data to gather insights and start recommending currently unrelated but relevant facts to your nodes in focus. Prerequisites You should have a basic understanding of the property graph model. Having… Read more →
This guide explains how to leverage connections in your data to gather insights and start recommending currently unrelated but relevant facts to your nodes in focus.
You should have a basic understanding of the property graph model. Having downloaded and installed the Neo4j server helps you code along with the examples.
This demo explains how to use a basic dataset of Actors acting in Movies to create recommendations with a graph database.
By following the relationships between the people and movies in a meaningful manner you can determine co-occurences, frequencies, and relevant nodes in the graph. This is the basis for many recommendation engines.
Recommendation for Collaboration of Actors
You can follow along by installing and starting Neo4j server, opening it on
http://localhost:7474 then inserting the movie dataset via the
:play movie graph command.
Go to the second slide, click the query, and run it.
In this guide we will load the dataset using
You should be able to run a query like this to find a single actor like Tom Hanks.
Similarly, you should be able to retrieve all his movies with a single query. Your results should already look like a graph.
Of course Tom has colleagues who acted with him in his movies. This “co-actor” statement looks like this:
We can now turn this “co-actor” query into a recommendation query by following those relationships another step out to find the “co-co-actors”, i.e. the second-degree actors in Tom’s network with whom he has not acted.
For a collaborative filtering, you often take frequencies of occurrences into account to find the people or things that appear most frequently in your network. Also you’d probably want to state that Tom Hanks never worked with the recommended people, not just not in movies that his co-actors worked in.
One of those “co-co-actors” is Tom Cruise. Now let’s see which movies and actors are between the two Toms.
This returns multiple Bacon-Paths, even with Kevin Bacon himself.
So with two simple Cypher statements we created already two recommendation algorithms: Who you should know and How you get to know them.
You can also watch the video of Andreas running these queries live on our main example movie dataset.
Imagine a graph like this: a few friends with their favorite restaurants, their cuisines and locations.
A practical question to answer here, formulated in Graph Search slang:
How could we translate that into the appropriate Cypher statement?
Other factors that can be easily integrated in this query are favorites, allergies, ratings and closeness to my current position.