| 1 | package Graph::Traversal; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 13 | ▶ | use strict; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 13 | ▶ | use warnings; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # $SIG{__DIE__ } = \&Graph::__carp_confess; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # $SIG{__WARN__} = \&Graph::__carp_confess; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 130 | ▶ | sub reset { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 130 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 130 | require Set::Object; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 130 | $self->{ unseen } = Set::Object->new($self->{ graph }->vertices); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 130 | $self->{ seen } = Set::Object->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 130 | $self->{ order } = [ ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 130 | $self->{ preorder } = [ ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 130 | $self->{ postorder } = [ ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 130 | $self->{ roots } = [ ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 130 | $self->{ tree } = Graph->new(directed => $self->{ graph }->directed); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 130 | delete $self->{ terminate }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1313 | ▶ | sub _see { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_see: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1313 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1313 | $self->see; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 8 | ▶ | sub has_a_cycle { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_a_cycle: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 8 | my ($u, $v, $t, $s) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 8 | $s->{ has_a_cycle } = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 8 | $t->terminate; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 5 | ▶ | sub find_a_cycle { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_a_cycle: called CC=6 SCAR=18.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 5 | my ($u, $v, $t, $s) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 5 | my @cycle = ( $u ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 5 | ▶ | push @cycle, $v unless $u eq $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 5 | my $path = $t->{ order }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 5 | ▶ | if (@$path) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 4 | my $i = $#$path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 4 | ▶ | while ($i >= 0 && $path->[ $i ] ne $v) { $i-- } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$i >= 0 and $path->[$i] ne $v
MC/DC50%1/2
$i >= 0 and $path->[$i] ne $v
$i >= 0
$path->[$i] ne $v
Truth table66%2/3
A and B
A= $i >= 0B= $path->[$i] ne $v
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 4 | ▶ | if ($i >= 0) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 4 | unshift @cycle, @{ $path }[ $i+1 .. $#$path ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 5 | $s->{ a_cycle } = \@cycle; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 5 | $t->terminate; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 13 | my @KNOWN_CONFIG = qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | tree_edge seen_edge | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | next_alphabetic next_numeric next_random | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | has_a_cycle find_a_cycle | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 13 | my @EXTRACT_CONFIG = qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | pre post pre_vertex post_vertex | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | pre_edge post_edge back_edge down_edge cross_edge non_tree_edge | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | first_root next_root next_successor | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 129 | ▶ | sub new { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=19 SCAR=29.6
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 129 | my ($class, $g, %attr) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 129 | ▶ | Graph::__carp_confess("Graph::Traversal: first argument is not a Graph") | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $g and $g->isa("Graph")
MC/DC50%1/2
ref $g and $g->isa("Graph")
ref $g
$g->isa("Graph")
Truth table66%2/3
A and B
A= ref $gB= $g->isa("Graph")
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | unless ref $g && $g->isa('Graph'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 128 | my $self = bless { graph => $g, state => { } }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 128 | $self->reset; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 128 | ▶ | if (exists $attr{ start }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 1 | $attr{ first_root } = delete $attr{ start }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 1 | $attr{ next_root } = undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 128 | my @found_known = grep exists $attr{$_}, @EXTRACT_CONFIG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 128 | @$self{@found_known} = delete @attr{@found_known}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | $self->{ seen_edge } = $attr{ seen_edge } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 128 | ▶ | if exists $attr{ seen_edge } and ($g->multiedged || $g->countedged); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
exists $attr{"seen_edge"} and $g->multiedged || $g->countedged
$g->multiedged or $g->countedged
MC/DC33%1/3
exists $attr{"seen_edge"} and $g->multiedged || $g->countedged
exists $attr{"seen_edge"}
$g->multiedged
$g->countedged
Truth table50%2/4
A and B or C
A= exists $attr{"seen_edge"}B= $g->multiedgedC= $g->countedged
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 128 | ▶ | $self->{ pre_edge } = $attr{ tree_edge } if exists $attr{ tree_edge }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | my $default_next = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | $attr{ next_alphabetic } ? \&Graph::_next_alphabetic : | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 128 | ▶ | $attr{ next_numeric } ? \&Graph::_next_numeric : | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | \&Graph::_next_random; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 128 | ▶ | $self->{ next_root } = $default_next if !exists $self->{ next_root }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | $self->{ first_root } = $self->{ next_root } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 128 | ▶ | if !exists $self->{ first_root }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 128 | ▶ | $self->{ next_successor } = $default_next if !exists $self->{ next_successor }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 128 | ▶ | if (exists $attr{ has_a_cycle }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | $self->{ back_edge } = my $has_a_cycle = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | ref $attr{ has_a_cycle } eq 'CODE' ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 17 | ▶ | $attr{ has_a_cycle } : \&has_a_cycle; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 17 | ▶ | $self->{ down_edge } = $has_a_cycle if $g->is_undirected; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 128 | ▶ | if (exists $attr{ find_a_cycle }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | $self->{ back_edge } = my $find_a_cycle = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | ref $attr{ find_a_cycle } eq 'CODE' ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 3 | ▶ | $attr{ find_a_cycle } : \&find_a_cycle; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 3 | ▶ | $self->{ down_edge } = $find_a_cycle if $g->is_undirected; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 128 | $self->{ add } = \&add_order; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 128 | $self->{ see } = \&_see; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 128 | delete @attr{@KNOWN_CONFIG}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 128 | Graph::_opt_unknown(\%attr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 127 | return $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 15 | ▶ | sub terminate { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
terminate: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 15 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 15 | $self->{ terminate } = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 1325 | ▶ | sub add_order { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_order: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 1325 | my ($self, @next) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 1325 | push @{ $self->{ order } }, @next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 1325 | ▶ | sub visit { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
visit: called CC=3 SCAR=11.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 1325 | my ($self, @next) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 1325 | $self->{ unseen }->remove(@next); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 1325 | $self->{ seen }->insert(@next); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 1325 | $self->{ add }->( $self, @next ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 1325 | ▶ | return unless my $p = $self->{ pre }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 534 | $p->( $_, $self ) for @next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 1325 | ▶ | sub visit_preorder { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
visit_preorder: called CC=2 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 1325 | my ($self, @next) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 1325 | push @{ $self->{ preorder } }, @next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 1325 | $self->{ preordern }->{ $_ } = $self->{ preorderi }++ for @next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 1325 | $self->visit( @next ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 1313 | ▶ | sub visit_postorder { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
visit_postorder: called CC=7 SCAR=19.5
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 1313 | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 1313 | my @post = reverse $self->{ see }->( $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 1313 | push @{ $self->{ postorder } }, @post; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 1313 | $self->{ postordern }->{ $_ } = $self->{ postorderi }++ for @post; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 1313 | ▶ | if (my $p = $self->{ post }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 65 | $p->( $_, $self ) for @post; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 1313 | ▶ | return unless (my $p = $self->{ post_edge }) and defined(my $u = $self->current); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
my $p = $self->{"post_edge"} and defined(my $u = $self->current)
MC/DC100%2/2
my $p = $self->{"post_edge"} and defined(my $u = $self->current)
my $p = $self->{"post_edge"}
defined(my $u = $self->current)
Truth table100%3/3
A and B
A= my $p = $self->{"post_edge"}B= defined(my $u = $self->current)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 9 | $p->( $u, $_, $self, $self->{ state }) for @post; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 1303 | ▶ | sub _callbacks { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_callbacks: called CC=23 SCAR=31.6
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 1303 | my ($self, $current, @all) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 1303 | ▶ | return unless @all; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 1229 | my $nontree = $self->{ non_tree_edge }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 1229 | my $back = $self->{ back_edge }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 1229 | my $down = $self->{ down_edge }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 1229 | my $cross = $self->{ cross_edge }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 1229 | my $seen = $self->{ seen_edge }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 1229 | ▶ | my $bdc = defined $back || defined $down || defined $cross; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
defined $back || defined $down || defined $cross
defined $back or defined $down
MC/DC33%1/3
defined $back || defined $down || defined $cross
defined $back
defined $down
defined $cross
Truth table50%2/4
A or B || C
A= defined $backB= defined $downC= defined $cross
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 1229 | ▶ | return unless (defined $nontree || $bdc || defined $seen); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
defined $nontree or $bdc or defined $seen
defined $nontree or $bdc
MC/DC66%2/3
defined $nontree or $bdc or defined $seen
defined $nontree
$bdc
defined $seen
Truth table75%3/4
A or B or C
A= defined $nontreeB= $bdcC= defined $seen
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 571 | my $u = $current; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 571 | my $preu = $self->{ preordern }->{ $u }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 571 | my $postu = $self->{ postordern }->{ $u }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 571 | for my $v ( @all ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 28276 | ▶ | if (!$self->{tree}->has_edge($u, $v) && (defined $nontree || $bdc) && | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
not $self->{"tree"}->has_edge($u, $v) and defined $nontree || $bdc and exists $self->{"seen"}{$v}
not $self->{"tree"}->has_edge($u, $v) and defined $nontree || $bdc
defined $nontree or $bdc
MC/DC25%1/4
not $self->{"tree"}->has_edge($u, $v) and defined $nontree || $bdc and exists $self->{"seen"}{$v}
not $self->{"tree"}->has_edge($u, $v)
defined $nontree
$bdc
exists $self->{"seen"}{$v}
Truth table50%3/6
not(A) and B or C and D
A= not $self->{"tree"}->has_edge($u, $v)B= defined $nontreeC= $bdcD= exists $self->{"seen"}{$v}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | exists $self->{ seen }->{ $v }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 27233 | ▶ | $nontree->( $u, $v, $self, $self->{ state }) if $nontree; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 27233 | ▶ | if ($bdc) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 23 | my $postv = $self->{ postordern }->{ $v }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 23 | ▶ | if ($back && | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$back and !defined($postv) || $postv >= $postu
not defined $postv or $postv >= $postu
MC/DC66%2/3
$back and !defined($postv) || $postv >= $postu
$back
not defined $postv
$postv >= $postu
Truth table75%3/4
A and not(B) or C
A= $backB= not defined $postvC= $postv >= $postu
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | (!defined $postv || $postv >= $postu)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 14 | $back ->( $u, $v, $self, $self->{ state }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 9 | my $prev = $self->{ preordern }->{ $v }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 9 | ▶ | if ($down && $prev > $preu) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$down and $prev > $preu
MC/DC100%2/2
$down and $prev > $preu
$down
$prev > $preu
Truth table100%3/3
A and B
A= $downB= $prev > $preu
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 1 | $down ->( $u, $v, $self, $self->{ state }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | ▶ | } elsif ($cross && $prev < $preu) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$cross and $prev < $preu
MC/DC50%1/2
$cross and $prev < $preu
$cross
$prev < $preu
Truth table66%2/3
A and B
A= $crossB= $prev < $preu
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 1 | $cross->( $u, $v, $self, $self->{ state }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 28276 | ▶ | next if !$seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 1 | my $c = $self->graph->get_edge_count($u, $v); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 1 | ▶ | $seen->( $u, $v, $self, $self->{ state } ) while $c-- > 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 1490 | ▶ | sub next { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next: called CC=19 SCAR=29.5
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 1490 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 1490 | ▶ | return undef if $self->{ terminate }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 1482 | my @next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 1482 | ▶ | while ($self->seeing) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 2333 | my $current = $self->current; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 2333 | my $next = Set::Object->new($self->{ graph }->successors($current)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 2333 | my @all = $next->members; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 2333 | $next = $next->difference($self->{seen}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 2333 | ▶ | if ($next->size) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 1020 | @next = $self->{ next_successor }->( $self, { map +($_=>$_), $next->members } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 1020 | $self->{ tree }->add_edges(map [$current, $_], @next); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 1020 | ▶ | last unless my $p = $self->{ pre_edge }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 425 | $p->($current, $_, $self, $self->{ state }) for @next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 425 | last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 1313 | $self->visit_postorder; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 1313 | ▶ | return undef if $self->{ terminate }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 1303 | $self->_callbacks($current, @all); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 1472 | ▶ | unless (@next) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 452 | ▶ | if (!@{ $self->{ roots } } and defined(my $first = $self->{ first_root })) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not @{$self->{"roots"};} and defined(my $first = $self->{"first_root"})
MC/DC50%1/2
not @{$self->{"roots"};} and defined(my $first = $self->{"first_root"})
not @{$self->{"roots"};}
defined(my $first = $self->{"first_root"})
Truth table66%2/3
not(A) and B
A= not @{$self->{"roots"};}B= defined(my $first = $self->{"first_root"})
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 131 | ▶ | return unless @next = ref $first eq 'CODE' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | ? $first->( $self, { map +($_=>$_), $self->unseen } ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | : $first; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 443 | ▶ | return if !@next and !$self->{ next_root }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@next or $self->{"next_root"}
MC/DC100%2/2
@next or $self->{"next_root"}
@next
$self->{"next_root"}
Truth table100%3/3
A or B
A= @nextB= $self->{"next_root"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 437 | ▶ | return if !@next and !(@next = $self->{ next_root }->( $self, { map +($_=>$_), $self->unseen } )); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@next or @next = $self->{"next_root"}->($self, {map(($_, $_), $self->unseen)})
MC/DC100%2/2
@next or @next = $self->{"next_root"}->($self, {map(($_, $_), $self->unseen)})
@next
@next = $self->{"next_root"}->($self, {map(($_, $_), $self->unseen)})
Truth table100%3/3
A or B
A= @nextB= @next = $self->{"next_root"}->($self, {map(($_, $_), $self->unseen)})
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 305 | ▶ | return if !defined $next[0] or $self->{ seen }->contains($next[0]); # Sanity check. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $next[0] or $self->{"seen"}->contains($next[0])
MC/DC0%0/2
not defined $next[0] or $self->{"seen"}->contains($next[0])
not defined $next[0]
$self->{"seen"}->contains($next[0])
Truth table33%1/3
not(A) or B
A= not defined $next[0]B= $self->{"seen"}->contains($next[0])
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 305 | push @{ $self->{ roots } }, $next[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 1325 | ▶ | $self->visit_preorder( @next ) if @next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 1325 | return $next[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 163 | ▶ | sub _order { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_order: called CC=2 SCAR=6.9
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 163 | my ($self, $order) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 163 | ▶ | 1 while defined $self->next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 163 | @{ $self->{ $order } }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 19 | ▶ | sub preorder { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
preorder: called CC=1 SCAR=0.0
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 19 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 19 | $self->_order( 'preorder' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 144 | ▶ | sub postorder { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
postorder: called CC=1 SCAR=0.0
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 144 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 144 | $self->_order( 'postorder' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 460 | ▶ | sub unseen { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unseen: called CC=2 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 460 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 460 | ▶ | $self->{ unseen }->${ wantarray ? \'members' : \'size' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 37 | ▶ | sub seen { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
seen: called CC=2 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 37 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 37 | ▶ | $self->{ seen }->${ wantarray ? \'members' : \'size' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 2805 | ▶ | sub seeing { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
seeing: called CC=1 SCAR=0.0
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 2805 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 2805 | @{ $self->{ order } }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 16 | ▶ | sub roots { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
roots: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 16 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 16 | @{ $self->{ roots } }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 9 | ▶ | sub is_root { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_root: called CC=3 SCAR=11.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 9 | my ($self, $v) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 9 | for my $u (@{ $self->{ roots } }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 11 | ▶ | return 1 if $u eq $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 5 | return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 1 | ▶ | sub tree { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tree: called CC=1 SCAR=0.0
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 1 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 1 | $self->{ tree }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 3 | ▶ | sub graph { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
graph: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 3 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 3 | $self->{ graph }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 4 | ▶ | sub vertex_by_postorder { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
vertex_by_postorder: called CC=2 SCAR=7.2
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 4 | my ($self, $i) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 4 | ▶ | exists $self->{ postorder } && $self->{ postorder }->[ $i ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 4 | ▶ | sub postorder_by_vertex { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
postorder_by_vertex: called CC=2 SCAR=7.2
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 4 | my ($self, $v) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 4 | ▶ | exists $self->{ postordern } && $self->{ postordern }->{ $v }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 1 | ▶ | sub postorder_vertices { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
postorder_vertices: called CC=2 SCAR=7.1
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 1 | my ($self, $v) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 1 | ▶ | exists $self->{ postordern } ? %{ $self->{ postordern } } : (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 4 | ▶ | sub vertex_by_preorder { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
vertex_by_preorder: called CC=2 SCAR=7.2
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 4 | my ($self, $i) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 4 | ▶ | exists $self->{ preorder } && $self->{ preorder }->[ $i ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 4 | ▶ | sub preorder_by_vertex { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
preorder_by_vertex: called CC=2 SCAR=7.2
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 4 | my ($self, $v) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 4 | ▶ | exists $self->{ preordern } && $self->{ preordern }->{ $v }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 1 | ▶ | sub preorder_vertices { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
preorder_vertices: called CC=2 SCAR=7.1
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 1 | my ($self, $v) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 1 | ▶ | exists $self->{ preordern } ? %{ $self->{ preordern } } : (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 5 | ▶ | sub has_state { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_state: called CC=2 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 5 | my ($self, $var) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 5 | ▶ | exists $self->{ state } && exists $self->{ state }->{ $var }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 22 | ▶ | sub get_state { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_state: called CC=2 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 22 | my ($self, $var) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 22 | ▶ | exists $self->{ state } ? $self->{ state }->{ $var } : undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 1 | ▶ | sub set_state { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_state: called CC=1 SCAR=0.0
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 1 | my ($self, $var, $val) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 1 | $self->{ state }->{ $var } = $val; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 1 | return 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 1 | ▶ | sub delete_state { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_state: called CC=2 SCAR=7.0
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 1 | my ($self, $var) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 1 | delete $self->{ state }->{ $var }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 1 | ▶ | delete $self->{ state } unless keys %{ $self->{ state } }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 1 | return 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 13 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | __END__ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||