#!/usr/bin/perl
print "Content-Type: text/html\n\n<pre>\n";
$damp = 0.85;
$a = $b = $c = $d = $e = 0;
$f = 1; # We'll give the external site an "average" pagerank
$iterate = 40; # loop 40 times
# Looping with extras
# forward links
# a -> b - 1 outgoing link - home
# b -> c - 1 outgoing link - about
# c -> d,e - 2 outgoing links - products
# d -> a - 1 outgoing links - more info
# e - nothing - site B
# f -> a - 1 outgoing link - exclusive link!
# i.e. "backward" links (what's pointing to me?)
# a <= d,f
# b <= a
# c <= b
# d <= c/2
# e <= c/2
# f <= we're going to assume it has enough incoming links to maintain a PR of 1.
while ($iterate--) {
printf("a: %.5f b: %.5f c: %.5f d: %.5f e: %.5f f: %.5f\n", $a, $b, $c, $d, $e, $f);
$a = 1 - $damp + $damp * ($d + $f);
$b = 1 - $damp + $damp * ($a);
$c = 1 - $damp + $damp * ($b);
$d = 1 - $damp + $damp * ($c/2);
$e = 1 - $damp + $damp * ($c/2);
$f = 1; # this site has average SEO
}
print("</pre><a href=http://www.ianrogers.net/google-page-rank/#ex9>Back to example 9</a>");
Design by Ian Rogers based on Connections 1.0
