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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Depth First Search through Digraph Results in Memory Leak
by djantzen (Priest) on Jan 09, 2004 at 13:32 UTC | |
by Hofmator (Curate) on Jan 09, 2004 at 13:44 UTC | |
by djantzen (Priest) on Jan 09, 2004 at 14:00 UTC |