summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2009-06-21 17:04:19 -0500
committerJesse Luehrs <doy@tozt.net>2009-06-21 17:04:19 -0500
commitfa7ff8c5e7e9ea86a7e44353a1519616afeb3ef8 (patch)
tree3ef6f6575a81db7f769ad97fe874314c47610e90
parent51da33d62c0977d6bcab989abb26db971653022c (diff)
downloadgraph-implicit-fa7ff8c5e7e9ea86a7e44353a1519616afeb3ef8.tar.gz
graph-implicit-fa7ff8c5e7e9ea86a7e44353a1519616afeb3ef8.zip
make the dfs/bfs callback optional
-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 7310cd5..bab96f3 100644
--- a/lib/Graph/Implicit.pm
+++ b/lib/Graph/Implicit.pm
@@ -107,7 +107,7 @@ sub _traversal {
while ($notempty->($bag)) {
my ($pred, $vertex) = @{ $remove->($bag) };
if (not exists $marked{$vertex}) {
- $code->($pred, $vertex);
+ $code->($pred, $vertex) if $code;
$pred{$vertex} = $pred if defined wantarray;
$marked{$vertex} = 1;
$insert->($bag, [$vertex, $$_[0]], $$_[1]) for $self->($vertex);