Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MATCH (me:User {firstname: "Name"}), (me)-[:FRIEND]->(friend:User)<-[:FRIEND]-(potential:User), (me)-[:MEMBER]->(i:Interest)
- WHERE NOT (potential)-[:FRIEND]->(me)
- WITH COLLECT(DISTINCT potential) AS potentialFriends, COLLECT(DISTINCT friend) AS friends,
- COLLECT(i) as interests
- UNWIND potentialFriends AS potential
- /*
- @HANDLING_FINDINGS
- Here I count common friends, interests and try to find relationships between
- potential friends too -- hence the collect/unwind
- */
- RETURN potential, commonFriends, commonInterests, (commonFriends+commonInterests) as
- totalPotential ORDER BY totalPotential DESC LIMIT 10
- ...
- UNWIND potentialFriends AS potential
- CASE
- WHEN (count(potential) < 10 )
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement