Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Code from RailsConf '09 pres: Building Mini Google in Ruby

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 web
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 diy-inverted-index.rb
Octocat-spinner-32 pagerank-gsl.rb
Octocat-spinner-32 pagerank-n-web.rb
Octocat-spinner-32 pagerank-zipf-web.rb
Octocat-spinner-32 simple-ferret.rb
Octocat-spinner-32 web-ferret.rb
README.rdoc

Computing PageRank in Ruby

Notes & code from RailsConf 2009 presentation: en.oreilly.com/rails2009/public/schedule/detail/7966

Slides: bit.ly/railsconf-pagerank

Example:

# page 1 -> page 2  (0.33)
# page 2 -> page 3  (0.33)
# page 3 -> page 1  (0.33)
puts "Circular: ", pagerank(Matrix[[0,0,1], [0,0,1], [1,0,0]])

# page 1 -> page 3  (0.05)    # page 1 & page 2 have minimal postrank values
# page 2 -> page 3  (0.05)    # min value = min(t * Teleport Vector)
# page 3 -> page 3  (0.09)    # for uniform teleport vector, min = t * (1/N)
puts "Star: ", pagerank(Matrix[[0,0,0], [0,0,0], [1,1,1]])

# page 1 -> page 2, page 3  (0.05)
# page 2 -> page 3          (0.07)
# page 3 -> page 3, page 3  (0.87)
puts "Converge: ", pagerank(Matrix[[0,0,0], [0.5,0,0], [0.5,1,1]])

# page 1 -> page 1, page 2  (0.18)
# page 2 -> page 1, page 3  (0.13)
# page 3 -> page 3          (0.69)
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.