gpt4 book ai didi

neo4j - ArticleRank 似乎忽略了关系权重

转载 作者:行者123 更新时间:2023-12-04 13:36:10 27 4
gpt4 key购买 nike

我正在创建我的第一个 Neo4j (4.0.4) 应用程序,我正在尝试根据加权 ArticleRank 算法对结果进行排序。到目前为止,一切都很直观,但我不明白为什么关系权重不影响 ArticleRank 分数。

鉴于架构:

MERGE (paper0:Paper {name:'Paper 0'})
MERGE (paper1:Paper {name:'Paper 1'})
MERGE (paper2:Paper {name:'Paper 2'})
MERGE (paper3:Paper {name:'Paper 3'})
MERGE (paper4:Paper {name:'Paper 4'})
MERGE (paper5:Paper {name:'Paper 5'})
MERGE (paper6:Paper {name:'Paper 6'})

MERGE (paper1)-[:CITES {weight: 10.0}]->(paper0)

MERGE (paper2)-[:CITES {weight: 1.0}]->(paper0)
MERGE (paper2)-[:CITES {weight: 100.0}]->(paper1)

MERGE (paper3)-[:CITES {weight: 10.0}]->(paper0)
MERGE (paper3)-[:CITES {weight: 1.0}]->(paper1)
MERGE (paper3)-[:CITES {weight: 100.0}]->(paper2)

MERGE (paper4)-[:CITES {weight: 10.0}]->(paper0)
MERGE (paper4)-[:CITES {weight: 1.0}]->(paper1)
MERGE (paper4)-[:CITES {weight: 100.0}]->(paper2)
MERGE (paper4)-[:CITES {weight: 10.0}]->(paper3)

MERGE (paper5)-[:CITES {weight: 100.0}]->(paper1)
MERGE (paper5)-[:CITES {weight: 1.0}]->(paper4)

MERGE (paper6)-[:CITES {weight: 10.0}]->(paper1)
MERGE (paper6)-[:CITES {weight: 100.0}]->(paper4)

当我运行此查询时:
CALL gds.alpha.articleRank.stream({
nodeProjection: 'Paper',
relationshipProjection: {
CITES: {
properties: 'weight'
}
},
relationshipWeightProperty: 'weight'
})
YIELD nodeId, score
RETURN gds.util.asNode(nodeId).name AS page, score
ORDER BY score DESC

我得到与运行此查询时相同的结果:
CALL gds.alpha.articleRank.stream({
nodeProjection: 'Paper',
relationshipProjection: 'CITES'
})
YIELD nodeId, score
RETURN gds.util.asNode(nodeId).name AS page, score
ORDER BY score DESC

结果,即:
╒═════════╤═══════════════════╕
│"page" │"score" │
╞═════════╪═══════════════════╡
│"Paper 0"│0.3462769146633946 │
├─────────┼───────────────────┤
│"Paper 1"│0.31950147982279303│
├─────────┼───────────────────┤
│"Paper 4"│0.21375000253319743│
├─────────┼───────────────────┤
│"Paper 2"│0.21092906260164457│
├─────────┼───────────────────┤
│"Paper 3"│0.18028125041164458│
├─────────┼───────────────────┤
│"Paper 5"│0.15000000000000002│
├─────────┼───────────────────┤
│"Paper 6"│0.15000000000000002│
└─────────┴───────────────────┘

鉴于关系具有不同的权重,如何在使用权重的同时运行 ArticleRank 算法会产生与不使用权重时相同的分数?

最佳答案

GDS 1.2 中的文章排名实现不支持权重。

该文档无益地列出了 relationshipWeightProperty在配置参数中。这在技术上是正确的,因为算法配置确实接受这个参数。但是算法会忽略它。看起来像这样的原因是 a) 文章排名与页面排名共享 API,它确实支持权重,b) 文章排名是一个 alpha 层算法,因此它不受产品支持,并且没有经过任何诸如正确性、性能之类的问题以及对完全支持的算法的可用性审查。

文档确实在标题 Graph type support 下继续说,算法支持:

  • 定向,未加权
  • 无向,未加权


  • 这是一个很好的答案,让我们继续在 Github 上进行对话。

    关于neo4j - ArticleRank 似乎忽略了关系权重,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61896861/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com