Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use feature 'say';
- use Algorithm::PageRank::XS;
- my $page_rank = Algorithm::PageRank::XS->new();
- $page_rank->graph([
- 1 => 2
- , 1 => 3
- , 1 => 4
- , 1 => 5
- , 2 => 1
- , 3 => 1
- , 3 => 2
- , 4 => 2
- , 4 => 3
- , 4 => 5
- , 5 => 1
- , 5 => 3
- , 5 => 4
- , 5 => 6
- , 6 => 1
- , 6 => 5
- , 7 => 5
- ]);
- my $r = $page_rank->result();
- foreach my $id (sort keys %$r) {
- say "id: $id, rank: $r->{$id}";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement