0
votes

I need to find most connected friend's friend node with help of a Cypher query.

In the example below, given B, I need a query to return the "Salad" node but not the "Bacon" node. For this particular case, I have picked up node C (as opposed to node A), as the most connected friend. This is because B&C share most friends. Then I have picked up the friend of C that are not B's friend's list so that friend node (salad) can be recommended.

enter image description here

Given B, I need a Cypher query to return "Salad" node in Neo4j. Per Stefan's suggestion I have added Neo4j Console data here. Thanks.

1
What is the question?user47589
Hi Amy, please see edited question above. Let me know if this is not clear.Anshul

1 Answers

2
votes

I assume you know the id of node B and C beforehand.

start b=node(<id_of_b>), c=node(<id_of_c>)
match c-[:LIKES]->stuff
where not(b-[:LIKES]->stuff)
return stuff

This should give you a list of items that C likes not B not, aka the "salad" node.

For future questions please consider setting up your data set on http://console.neo4j.org, this makes your question much clearer.