Algorithm-HITS
view release on metacpan or search on metacpan
lib/Algorithm/HITS.pm view on Meta::CPAN
sub iterate {
my $self = shift;
my $iter = shift || 1;
foreach (1..$iter){
$self->{hub_v} = norm ($self->{aut_v} x $self->{graph});
$self->{aut_v} = norm ($self->{hub_v} x $self->{graph_t});
# print STDERR "Authority => ", $self->{aut_v}->slice(':'), "Hub => ", $self->{hub_v}->slice(':');
}
1;
}
sub result {
my $self = shift;
# print STDERR sdump $self->{aut_v};
# print STDERR sdump $self->{hub_v};
+{
authority => $self->{aut_v},
hub => $self->{hub_v},
}
}
1;
__END__
# Below is stub documentation for your module. You'd better edit it!
=head1 NAME
Algorithm::HITS - Perl implementation of HITS algorithm
=head1 DESCRIPTION
This module implements the HITS algorithm (Kleinberg's
hypertext-induced topic selection).
See also L<http://www2002.org/CDROM/refereed/643/node1.html>
=head1 USAGE
use Algorithm::HITS;
$h = new Algorithm::HITS;
=head2 SET UP GRAPH
$h->graph(
[
0 => 1,
0 => 2,
1 => 0,
1 => 2,
2 => 1,
]
);
=head2 ITERATE THROUGH COMPUTATION
Iterate 1000 times.
$h->iterate(1000);
Default value is 1
$h->iterate();
=head2 RETURN RESULT
Return hub vector and authority vector in PDL object format.
$h->result();
=head2 SETTINGS
Set initial authority vector. Vector is normalized to unit Euclidean
length.
$h->set_authority(\@v);
Set initial hub vector. Vector is normalized to unit Euclidean length.
$h->set_hub(\@v);
=head1 ACKNOWLEDGEMENT
Thanks goes to Hugo Zanghi for pointing out the bug in normalizing vectors.
=head1 COPYRIGHT AND LICENSE
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
=cut
( run in 2.079 seconds using v1.01-cache-2.11-cpan-5b529ec07f3 )