The same data can also already be stored in a Neo4j graph, in cases where some relationships between observations already exist. However, we are interested in user interactions and, unless your website has a social component that would allow users to follow each other, for instance, we will have to create links between users in a different way.
Let's assume your graph contains information about users and products. The simplified graph schema could look like this:
(u:User)-[:BOUGHT]->(p:Product)
Creating a relationship between users having bought the same product(s) is then as simple as a single Cypher query:
MATCH (u1:User)-[:BOUGHT]->(p:Product)<-[:BOUGHT]-(u2:User)
WITH u1, u2, count(p) as weight
CREATE (u1)-[:LINKED_TO {weight: weight}]->(u2)
Your graph now contains an additional relationship type, LINKED_TO, which contains some kind of virtual interaction between users and can help you to extract more relevant information...