Subject: | Inconsistent traversal on even trivial graphs |
On two Linux machines with perl 5.8.8 (an AMD Athlon 64 X2 and a Pentium
D, though it shouldn't matter), the attached test case shows failures
for on average half of the twenty cases in each run. That is, the
traversal sometimes fails to traverse any edges at all, and this graph
has only one edge!
Graph::Traversal::BFS is shown, but the same is true for ::DFS.
--
--kulp
Subject: | graph-traversal-failure.pl |
#!/usr/bin/env perl
use strict;
use warnings;
use Graph;
use Graph::Traversal::BFS;
print $Graph::VERSION, "\n";
my $ok;
my $g = Graph->new;
$g->add_edge(0,1);
my $sub = sub { warn "@_[0,1]\n"; $ok = 1; };
my $t = Graph::Traversal::BFS->new($g, tree_edge => $sub);
for (1 .. 20) {
$ok = 0;
$t->bfs;
$t->reset;
print "trial $_ was NOT OK\n" unless $ok;
}