Subject: | deep_copy does not return a true clone |
With the code below, I believe that if deep_copy is working properly
then the two asserts should either both succeed or both fail. However I
have seen the first succeed but the second fail.
sub induced_graph {
my ( $G, $accepted ) = @_;
assert_graph_valid($G);
my $ret = $G->deep_copy();
assert_graph_valid($ret);
}
sub assert_graph_valid {
my ($G) = @_;
foreach my $edge ( $G->edges() ) {
my @nodes = @$edge;
my $num_nodes = @nodes;
if ($num_nodes != 2
|| ! defined ($nodes[0])
|| ! defined ($nodes[1])) {
print "Error with graph ($G)\n";
printf "Error with edge (%s)\n", Dumper($edge);
die "assert failed";
}
}
}
Perl version: This is perl, v5.10.0 built for cygwin-thread-multi-64int
(with 6 registered patches, see perl -V for more detail)
OS : CYGWIN_NT-5.1 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin
I am happy to provide example data if the maintainer requests it.