Exemple #1
0
 def testDocMatrix(self):
     links = [
       [0, 2, 2, 3],
       [0],
       [3, 2],
       [0],
     ]
     result = pagerank.page_rank(links)
     self.assertEqual(str(result), '[ 0.36723503  0.0375      0.33665007  0.25861487]')
Exemple #2
0
 def testOneCircle(self):
     links = [
             [1, 1, 1, 1],
             [2],
             [3],
             [4],
             [0]
     ]
     result = pagerank.page_rank(links, alpha=1.0)
     self.assertEqual(str(result), '[ 0.2  0.2  0.2  0.2  0.2]')
Exemple #3
0
 def testTwoCircles(self):
     links = [
             [1, 2],
             [2],
             [3],
             [4],
             [0]
     ]
     result = pagerank.page_rank(links)
     self.assertEqual(str(result), '[ 0.2116109   0.12411822  0.2296187   0.22099231  0.21365988]')