Subject: | Issue... |
Date: | Tue, 30 May 2006 12:57:48 -0400 |
To: | bug-Graph [...] rt.cpan.org |
From: | Brian Osborne <osborne1 [...] optonline.net> |
Jarrko,
I stumbled across something while playing with articulation_points. If you
pass a defined and an undefined variable to add_edges it can have nasty
consequences for articulation_points();
#!/usr/bin/perl -w
use strict;
use Graph;
use Digest::MD5;
my $g = Graph::Undirected->new(refvertexed => 1);
my $temp;
for (my $x = 1 ; $x < 1000 ; $x++) {
my $n1 = Digest::MD5->new();
my $n2 = Digest::MD5->new();
$g->add_vertices($n1,$n2);
$g->add_edges($n1,$n2);
$g->add_edges($n2,$temp); # if defined $temp;
$temp = $n2;
}
my @rts = $g->articulation_points;
Change:
$g->add_edges($n2,$temp); # if defined $temp;
To:
$g->add_edges($n2,$temp) if defined $temp;
And everything's fine. Should add_edges() be complaining about being passed
an undefined variable?
BIO