Created
October 12, 2014 18:36
-
-
Save domluna/2b9358ccc89fee7d5e26 to your computer and use it in GitHub Desktop.
Simple pagerank in Julia
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Simple pagerank implementation | |
| # M - transition matrix | |
| # r - initial rankings | |
| # \beta - the taxation cost, (1-\beta) is the teleport prob | |
| # iter - iterations to run for | |
| function pagerank(M::Matrix{Float64}, r::Vector{Float64}, β::Float64, iter::Int64) | |
| c = (1-β)/length(r) | |
| v_prime = β*M*r + c | |
| for i = 1:iter | |
| v_prime = β*M*v_prime + c | |
| end | |
| return v_prime | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment