-1

I'm trying to use PageRank and Hits algorithm on a DirectedSparseGraph I have build from a Wikipedia Dump. The graph is huge obviously and its nodes are String, while its Edge are Integer. The problem is that when I run this code:

PageRank<String,Integer> pageRank = new PageRank<String,Integer>(w, alpha);
pageRank.initialize();  
pageRank.setTolerance(0.000001);
pageRank.setMaxIterations(200);
pageRank.evaluate();

HITS<String, Integer> hits = new HITS<String, Integer>(w,alpha);
hits.initialize();
hits.setTolerance(0.000001);
hits.setMaxIterations(200);
hits.evaluate();
for(String s: w.getVertices()){
    writer.write(s + "\th:" + hits.getVertexScore(s).hub + "\ta:" + hits.getVertexScore(s).authority + "\tpagerank:" + pageRank.getVertexScore(s));
    writer.newLine();
}

the results I'm writing on the file txt are always the same for each Node. Maybe I am making a mistake with parameters I pass the methods. I don't know.

4

1 回答 1

0

图有多大?实际执行了多少次迭代?

如果值只是 1/n(其中 n 是顶点数),那么这里可能发生的是它立即退出(您可以检查)。

另一个明显的可能性是您在构建图形时犯了一个错误并使其对称,因此分数都是相同的。您也应该能够很容易地检查这一点。

于 2013-08-12T01:16:32.407 回答