4

我正在创建我的第一个 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 算法会产生与不使用权重时相同的分数吗?

4

1 回答 1

1

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

relationshipWeightProperty该文档在配置参数中列出了一个无用的列表。这在技术上是正确的,因为算法配置确实接受此参数。但是算法会忽略它。看起来像这样的原因是 a) Article Rank 与 Page Rank 共享 API,它确实支持权重,b) Article Rank 是一个 alpha 层算法,因此它不受产品支持,并且没有经过正确性、性能等任何事情对完全支持的算法进行可用性审查。

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

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

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

于 2020-06-17T23:30:50.160 回答