neo4j - Calculating User Counts with Common Entities -


i want determine groups of users have common interests.

data model , characteristics

  • user , interest node labels , represent unique nodes
  • likes relationship among them, (user)-[:likes]->(interest)
  • all properties of nodes indexed
  • relation nature can characterized many many between nodes
  • there 300+ interests , 120,000+ users

i used following query determine user count 1 common interest , others;

match (u:user)-[:likes]-(i:interest) i.name = "baking" u match (u)-[:likes]-(i:interest) i.name <> "baking" return i.name, count(u) usercount order usercount desc 

i tried making query can have 3 common interests made slower. think not good, scallable design, can help?

though maybe not plausible end goal calculate nxn combinations of interests.

maybe should limit interests , take top 5 or something? don't know data model interest unique node. speed query. relation [has interest]->( baking) points same node , can start baking users. maybe flip query , start interest (cypher strange) or can force query use indexes


Comments