summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2008-12-14 19:13:22 -0500
committerdoy <doy@tozt.net>2008-12-14 19:13:22 -0500
commit39db27488e0e5157df81c2c9b67c89f184438868 (patch)
treef7a811b648234b5c7420d747ccd43151b3f9dcd8
parentb0cf5205e0abbf2c6fd4014755d9e304bf7bd34a (diff)
downloadgraph-implicit-39db27488e0e5157df81c2c9b67c89f184438868.tar.gz
graph-implicit-39db27488e0e5157df81c2c9b67c89f184438868.zip
don't build the %pred hash if we aren't going to use it
-rw-r--r--lib/Graph/Implicit.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Graph/Implicit.pm b/lib/Graph/Implicit.pm
index 03b9ebb..50f7207 100644
--- a/lib/Graph/Implicit.pm
+++ b/lib/Graph/Implicit.pm
@@ -58,7 +58,7 @@ sub _traversal {
my ($pred, $vertex) = @{ $remove->(\@bag) };
if (not exists $marked{$vertex}) {
$code->($pred, $vertex);
- $pred{$vertex} = $pred;
+ $pred{$vertex} = $pred if defined wantarray;
$marked{$vertex} = 1;
$insert->(\@bag, $_) for $self->neighbors($vertex);
}