加权 HITS 算法实现(中心和权威分数)

weighted HITS algorithm implementatoion (hub and authority score)

我正在研究 HITS 算法实现的加权版本。

这是 Hits 算法的公式(非加权版本):

其中HITS A为权威评分,HITS H为hub评分,维基百科算法伪代码:

 G := set of pages
 for each page p in G do
   p.auth = 1 // p.auth is the authority score of the page p
   p.hub = 1 // p.hub is the hub score of the page p
 function HubsAndAuthorities(G)

   for step from 1 to k do // run the algorithm for k steps
     norm = 0
     for each page p in G do  // update all authority values first
       p.auth = 0
       for each page q in p.incomingNeighbors do // p.incomingNeighbors is the set of pages that link to p
          p.auth += q.hub
       norm += square(p.auth) // calculate the sum of the squared auth values to normalise
     norm = sqrt(norm)
     for each page p in G do  // update the auth scores 
       p.auth = p.auth / norm  // normalise the auth values
     norm = 0
     for each page p in G do  // then update all hub values
      p.hub = 0
       for each page r in p.outgoingNeighbors do // p.outgoingNeighbors is the set of pages that p links to
         p.hub += r.auth
       norm += square(p.hub) // calculate the sum of the squared hub values to normalise
     norm = sqrt(norm)
     for each page p in G do  // then update all hub values
       p.hub = p.hub / norm   // normalise the hub values

如何更改此算法以适用于问题的加权版本:

请提供伪代码或java实现

对于算法的加权版本,您需要更改更新部分的代码:

p.hub += weight(p,r) * r.auth
           ^^^

同样地:

p.auth += weight(q,p) * q.hub
            ^^^

请注意,如果我们为所有节点设置 wight(u,v)=1,则此更新会衰减到原始算法,这是期望的 属性。