Skip to content

Instantly share code, notes, and snippets.

@mananai
Last active June 21, 2022 12:34
Show Gist options
  • Select an option

  • Save mananai/77f09c08ea2a6893af6556660413df15 to your computer and use it in GitHub Desktop.

Select an option

Save mananai/77f09c08ea2a6893af6556660413df15 to your computer and use it in GitHub Desktop.
User Recommendations
MATCH (u:User)
WHERE u.labelId = 4854
WITH collect(id(u)) AS ids
CALL gds.pageRank.stream('follows',{sourceNodes:ids })
YIELD nodeId, score
WITH gds.util.asNode(nodeId) AS topUser, score
WHERE topUser.followers_count > 100000
MATCH (u2:User)
WHERE id(u2)=2138
AND NOT ( (u2)-[:FOLLOWS]->(topUser) )
RETURN topUser.screen_name, topUser.name, topUser.followers_count, score
ORDER BY score DESC LIMIT 5;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment