Google’s PageRank Algorithm from 1996 - the origin of internet search

PHOTO EMBED

Thu Jan 02 2020 19:00:00 GMT+0000 (Coordinated Universal Time)

Saved by @chrissyjones #javascript #python #search #historicalcode #google #algorithms

import numpy as np

def pagerank(M, num_iterations=100, d=0.85):
    N = M.shape[1]
    v = np.random.rand(N, 1)
    v = v / np.linalg.norm(v, 1)
    iteration = 0
    while iteration < num_iterations:
        iteration += 1
        v = d * np.matmul(M, v) + (1 - d) / N
    return v
content_copyCOPY

"PageRank (PR) is an algorithm used by Google Search to rank web pages in their search engine results. PageRank was named after Larry Page, one of the founders of Google. PageRank is a way of measuring the importance of website pages." - Wikipedia

https://en.wikipedia.org/wiki/PageRank