Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 26 lines (20 sloc) 1.031 kb
c42b45c @igrigorik readme
authored
1 = Computing PageRank in Ruby
2 Notes & code from RailsConf 2009 presentation: http://en.oreilly.com/rails2009/public/schedule/detail/7966
3
4 Slides: http://bit.ly/railsconf-pagerank
5
6 == Example:
7
8 # page 1 -> page 2 (0.33)
9 # page 2 -> page 3 (0.33)
10 # page 3 -> page 1 (0.33)
11 puts "Circular: ", pagerank(Matrix[[0,0,1], [0,0,1], [1,0,0]])
12
13 # page 1 -> page 3 (0.05) # page 1 & page 2 have minimal postrank values
14 # page 2 -> page 3 (0.05) # min value = min(t * Teleport Vector)
15 # page 3 -> page 3 (0.09) # for uniform teleport vector, min = t * (1/N)
16 puts "Star: ", pagerank(Matrix[[0,0,0], [0,0,0], [1,1,1]])
17
18 # page 1 -> page 2, page 3 (0.05)
19 # page 2 -> page 3 (0.07)
20 # page 3 -> page 3, page 3 (0.87)
21 puts "Converge: ", pagerank(Matrix[[0,0,0], [0.5,0,0], [0.5,1,1]])
22
23 # page 1 -> page 1, page 2 (0.18)
24 # page 2 -> page 1, page 3 (0.13)
25 # page 3 -> page 3 (0.69)
26 puts "Linked:", pagerank(Matrix[[0.5,0.5,0], [0.5,0,0], [0,0.5,1.0]])
Something went wrong with that request. Please try again.