Skip to content

Commit

Permalink
Use named descendants
Browse files Browse the repository at this point in the history
Uses cache

Updates #681
  • Loading branch information
shawnlaffan committed Dec 9, 2017
1 parent fc4bd7b commit e2be192
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/Biodiverse/TreeNode.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2236,16 +2236,16 @@ sub get_node_range {

return $cached_range if defined $cached_range;

my @labels = ($self->get_name);
my $children = $self->get_all_descendants;

# collect the set of non-internal (named) nodes
# Possibly should only work with terminals
# which would simplify things.
foreach my $name (keys %$children) {
next if $children->{$name}->is_internal_node;
push (@labels, $name);
}
my $children = $self->get_all_named_descendants;
my @labels = ($self->get_name, keys %$children);

## collect the set of non-internal (named) nodes
## Possibly should only work with terminals
## which would simplify things.
#foreach my $name (keys %$children) {
# next if $children->{$name}->is_internal_node;
# push (@labels, $name);
#}

my $range = $bd->get_range_union (labels => \@labels, return_count => 1);

Expand Down

0 comments on commit e2be192

Please sign in to comment.