所以我试图找到每个节点至少与另一个节点有一个公共节点。这是我用来执行此操作的请求:
MATCH (source:Article)--(neighbor)--(target:Article)
WHERE NOT (source.unique_url) = (target.unique_url)
WITH DISTINCT [source.unique_url, target.unique_url] AS combo,
source, target, neighbor
RETURN combo,
source.unique_url AS source_unique_url,
source.title AS source_title,
source.url AS source_url,
target.unique_url AS target_unique_url, target._id AS target_id,
target.title AS target_title,
count(neighbor) AS common_neighbors
ORDER BY common_neighbors DESCENDING
但遗憾[source.unique_url, target.unique_url]
的是总是重复的,比如一个节点与另一个节点有一个共同的邻居,我总是得到这样的结果:
[url1, url2]
[url2, url1]
[url1, url2]
[url2, url1]
我检查了数据库中的数据没有重复,所以请求正在复制它们,有人知道可能是什么原因造成的吗?非常感谢 !