Skip Menu |

This queue is for tickets about the Graph CPAN distribution.

Report information
The Basics
Id: 78465
Status: resolved
Priority: 0/
Queue: Graph

People
Owner: Nobody in particular
Requestors: GENSYM [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: find_a_cycle and has_cycle are broken
my $v1 = \1; my $v2 = \2; my $graph = Graph->new( directed => 1, refvertexed => 1, edges => [[$v1, $v2], [$v2, $v1]] ); $graph->has_cycle; # returns 0 $graph->find_a_cycle; # returns (\2, "SCALAR(0x4278940)")
On Thu Jul 19 14:14:38 2012, GENSYM wrote: Show quoted text
> my $v1 = \1; > my $v2 = \2; > my $graph = Graph->new( directed => 1, refvertexed => 1, edges => [[$v1, > $v2], [$v2, $v1]] ); > $graph->has_cycle; # returns 0 > $graph->find_a_cycle; # returns (\2, "SCALAR(0x4278940)")
has_cycle does not detect cycles, has_a_cycle returns 1.
As commented earlier, has_cycle() is the wrong API here. I now added an alias has_this_cycle() which hopefully makes its intended use cleared. But you meant has_a_cycle(). But wait, there's a second bug: the stringification of the references in the returned cycle. I am fixing that.