The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Algorithm::PageRank - Calculate PageRank in Perl

SYNOPSIS

  use Algorithm::PageRank;
  $pr = new Algorithm::PageRank;

  $pr->graph([
              0 => 1,
              0 => 2,
              1 => 0,
              2 => 1,
              ]
              );

  $pr->iterate();
  $pr->iterate(50);

  $pr->result();

DESCRIPTION

This is a simple implementation of PageRank algorithm. Please do not expect it to be potent to cope with zilla-size of data.

graph

Feed the graph topology. Vertices count from 0.

iterate

Calculate the pagerank vector. The parameter is the maximal number of iterations. If the vector does not converge before reaching the threshold, then calculation will stop at the maximum. Default iteration number is 100.

You can also reset the dampening factor ($Algorithm::PageRank::d_factor). The default value is 0.05.

result

Return the pagerank vector in PDL object format.

COPYRIGHT

Copyright (C) 2004 by Yung-chung Lin (a.k.a. xern) <xern@cpan.org>

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself