在图表结构中传播评级

时间:2012-12-14 09:13:47

标签: python algorithm graph neural-network graph-algorithm

我有以下问题:

Consider a weighted direct graph. 
Each node has a rating and the weighted edges represents 
      the "influence" of a node on its neighbors.
When a node rating change, the neighbors will see their own rating modified (positively or negatively)

如何在一个节点上传播新的评级? 我认为这应该是标准算法,但哪一个?

这是一个普遍的问题,但实际上我使用的是Python;)

由于

[编辑]
评级是0到1之间的简单浮点值:[0.0,1.0]
肯定存在一个收敛问题:我只想将传播限制为几次迭代......

1 个答案:

答案 0 :(得分:2)

有一种简单的标准方法可以按如下方式进行:

let G=(V,E) be the graph
let w:E->R be a weight function such that w(e) = weight of edge e
let A be an array such that A[v] = rating(v)
let n be the required number of iterations

for i from 1 to n (inclusive) do:
    for each vertex v in V:
          A'[v] = calculateNewRating(v,A,w) #use the array A for the old values and w
    A <- A' #assign A with the new values which are stored in A'
return A

但是,对于某些情况 - 您可能会根据图表的功能以及如何重新计算每个节点的评级来获得更好的算法。例如:

  1. 假设rating'(v) = sum(rating(u) * w(u,v)) for each (u,v) in E,你会得到Page Rank的变体,如果图形强连接(Perron-Forbenius theorem),则保证会收敛到主特征向量,因此计算最终值很简单。
  2. 假设rating'(v) = max{ rating(u) | for each (u,v) in E},它也可以保证收敛,并且可以使用强连接组件线性求解。 This thread讨论了这个案例。