Cypher查询朋友的朋友过滤掉已经是朋友的朋友

时间:2014-02-07 21:25:18

标签: java neo4j cypher

我有这个Cypher查询...

match (p:Person{userid:8432})-[r:friends_with]->(p1:Person)-[r2:friends_with]->(p2:Person) return p, count(p1), p2 order by count(p1) desc limit 25

这将返回包含已经是p的朋友的人的结果(p2)。如何过滤掉那些已经是节点p的朋友的p2节点?我在这个网站上尝试了一个类似问题的片段

... where not (p)<-[r:friends_with]->(p2) ...

但这不起作用。希望对此有所帮助。

感谢。

1 个答案:

答案 0 :(得分:1)

事实证明,使用以下where子句可以解决问题。

where not (p)-->(p2)
相关问题