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 6     6   716455 use strict;
  6         11  
  6         207  
3 6     6   22 use warnings;
  6         9  
  6         1335  
4             our $VERSION = '0.02';
5             require XSLoader;
6             XSLoader::load('Data::Graph::Shared', $VERSION);
7              
8             sub nodes {
9 1     1 0 930 my ($self) = @_;
10 1         3 my @nodes;
11 1         10 for my $i (0 .. $self->max_nodes - 1) {
12 10 100       37 push @nodes, $i if $self->has_node($i);
13             }
14 1         6 return @nodes;
15             }
16              
17             sub each_neighbor {
18 1     1 0 244159 my ($self, $node, $cb) = @_;
19 1         15 for my $pair ($self->neighbors($node)) {
20 2         13 $cb->($pair->[0], $pair->[1]);
21             }
22             }
23              
24             1;
25             __END__