File Coverage

blib/lib/Data/Graph/Shared.pm
Criterion Covered Total %
statement 14 14 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 0 2 0.0
total 20 22 90.9


line stmt bran cond sub pod time code
1             package Data::Graph::Shared;
2 1     1   188410 use strict;
  1         2  
  1         65  
3 1     1   5 use warnings;
  1         2  
  1         250  
4             our $VERSION = '0.01';
5             require XSLoader;
6             XSLoader::load('Data::Graph::Shared', $VERSION);
7              
8             sub nodes {
9 1     1 0 589 my ($self) = @_;
10 1         6 my @nodes;
11 1         10 for my $i (0 .. $self->max_nodes - 1) {
12 10 100       33 push @nodes, $i if $self->has_node($i);
13             }
14 1         5 return @nodes;
15             }
16              
17             sub each_neighbor {
18 1     1 0 169635 my ($self, $node, $cb) = @_;
19 1         8 for my $pair ($self->neighbors($node)) {
20 2         7 $cb->($pair->[0], $pair->[1]);
21             }
22             }
23              
24             1;
25             __END__