| 1 | package Graph::Maker::CompleteBipartite; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use Carp qw/croak/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use base qw/Graph::Maker/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Graph; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Graph::Maker; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 2 | our $VERSION = '0.01'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | sub init | ||||||||||||||||||||||||||||
| 13 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=9 SCAR=23.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 14 | 2 | my ($self, %params) = @_; | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 2 | ▶ | my $n1 = delete($params{N1}) || 0; | ||||||||||||||||||||||||||
|
Condition50%1/2
delete $params{'N1'} || 0
MC/DC0%0/1
delete $params{'N1'} || 0
delete $params{'N1'}
Truth table50%1/2
A
A= delete $params{'N1'}
| |||||||||||||||||||||||||||||
| 17 | 2 | ▶ | my $n2 = delete($params{N2}) || 0; | ||||||||||||||||||||||||||
|
Condition50%1/2
delete $params{'N2'} || 0
MC/DC0%0/1
delete $params{'N2'} || 0
delete $params{'N2'}
Truth table50%1/2
A
A= delete $params{'N2'}
| |||||||||||||||||||||||||||||
| 18 | 2 | my $gm = delete($params{graph_maker}); | |||||||||||||||||||||||||||
| 19 | 2 | ▶ | croak "graph_maker must be a reference to a function that creates a Graph.\n" if $gm && ref($gm) ne 'CODE'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$gm and ref $gm ne "CODE"
MC/DC0%0/2
$gm and ref $gm ne "CODE"
$gm
ref $gm ne "CODE"
Truth table33%1/3
A and B
A= $gmB= ref $gm ne "CODE"
| |||||||||||||||||||||||||||||
| 20 | 2 | ▶ | $gm ||= sub { new Graph(@_); }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.6
Condition33%1/3
$gm ||= sub {
"Graph"->new(@_);
}
MC/DC0%0/2
$gm ||= sub {
"Graph"->new(@_);
}
$gm
sub {
"Graph"->new(@_);
}
Truth table33%1/3
A ||= B
A= $gmB= sub {
"Graph"->new(@_);
}
| |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 2 | my $g = $gm->(%params); | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 2 | for my $u(1..$n1) | |||||||||||||||||||||||||||
| 25 | { | ||||||||||||||||||||||||||||
| 26 | 8 | for my $v($n1+1..$n1+$n2) | |||||||||||||||||||||||||||
| 27 | { | ||||||||||||||||||||||||||||
| 28 | 24 | $g->add_edge($u, $v); | |||||||||||||||||||||||||||
| 29 | 24 | ▶ | $g->add_edge($v, $u) unless $g->is_undirected(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 2 | return $g; | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 2 | Graph::Maker->add_factory_type( 'complete_bipartite' => __PACKAGE__ ); | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 2 | 1; | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | __DATA__ | ||||||||||||||||||||||||||||