Skip to content

Instantly share code, notes, and snippets.

@yanatan16
Last active December 25, 2015 08:19
Show Gist options
  • Save yanatan16/6945507 to your computer and use it in GitHub Desktop.
Save yanatan16/6945507 to your computer and use it in GitHub Desktop.
Simple neo4j recommendation engine
CREATE (u:User { user })-[:BUYS]->(p:Product { product }) RETURN u, p;
START u=node({ user_node_id })
MATCH (u:User)-[r1:BUYS]->(u2:User)<-[r2:BUYS]-(p2:Product)->[r3:BUYS]->(p:Product)
WHERE r1 <> r2 AND r2 <> r3
RETURN p, COUNT(p) as score
ORDER BY score DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment