Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

page rank example

#!/usr/bin/perl

$damp = 0.85;
$norm = 1 - $damp;

$a = 0;
$b = 0;
$c = 0;
$d = 0;
$i = 40; # loop 40 times

# forward links
# a -> b, c	- 2 outgoing links
# b -> c	- 1 outgoing link
# c -> a	- 1 outgoing link
# d -> a	- 1 outgoing link

# i.e. "backward" links (what's pointing to me?)
# a <= c
# b <= a
# c <= a, b, d
# d - nothing
while ($i--) {
    printf(
    	"a: %.5f b: %.5f c: %.5f d: %.5f
",
    	$a, $b, $c, $d
    );
	$a = $norm + $damp * $c;
	$b = $norm + $damp * ($a/2);
	$c = $norm + $damp * ($a/2 + $b + $d);
	$d = $norm;
}
printf("Average pagerank = %.4f
", ($a + $b + $c + $d) / 4);
Comment

PREVIOUS NEXT
Code Example
Shell :: git merge conflict resolve 
Shell :: git bring back deleted branch from local 
Shell :: generate token symfony authentication api platform 
Shell :: use linux to call via android phone 
Shell :: vim get color name at cursor 
Shell :: letsencrypt domain fetch /.well-known error 
Shell :: scp command in unix 
Shell :: .gitignore add files type 
Shell :: drupal update config install 
Shell :: create fish alias 
Shell :: move multiple files cmd 
Shell :: git update another branch 
Shell :: ssh bad owner permissions 
Shell :: jenkins builds 
Shell :: mac make bootable usb 
Shell :: git basics 
Shell :: install pip mac 
Shell :: shell cd 
Shell :: diff between two files 
Shell :: ubuntu adding a monitor 
Shell :: habe to install viber on linux 
Shell :: install gcmcore debian 10 
Shell :: powershell equivalent of rm 
Shell :: ve-restore-user database only 
Shell :: bash temp file extension 
Shell :: install docpars 
Shell :: osx remove env 
Shell :: sigin failed for rsa github signing 
Shell :: langkah-langkah menginstal git di terminal 
Shell :: workspace switch shortcur Gnome 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =