in reply to Depth First Search through Digraph Results in Memory Leak
I just noted a different bug in your code, in sub DFS
should be$explored->{$node->{_id}}++; foreach my $link (@{$node->{_outlinks}}) { $do_search->($link->{_to}) unless ($explored->{$link->{_id}}); }
$explored->{$node->{_id}}++; foreach my $link (@{$node->{_outlinks}}) { $do_search->($link->{_to}) unless ($explored->{$link->{_to}{_id}}); # we stored the node id, not the link id in $explored ^^^^^ }
-- Hofmator
In Section
Seekers of Perl Wisdom