From c3c49db31cc8dbb540683fd884b10282bfb5c18a Mon Sep 17 00:00:00 2001 From: doy Date: Sun, 14 Dec 2008 19:21:10 -0500 Subject: the edge calculator returns a pair of [vertex, weight], not just the vertex --- lib/Graph/Implicit.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/Graph/Implicit.pm b/lib/Graph/Implicit.pm index effe18d..6fed28e 100644 --- a/lib/Graph/Implicit.pm +++ b/lib/Graph/Implicit.pm @@ -41,7 +41,7 @@ sub edges { sub neighbors { my $self = shift; my ($from) = @_; - return $self->($from); + return map { $$_[0] } $self->($from); } sub is_bipartite { @@ -143,7 +143,7 @@ sub astar { ($max_vert, $max_score) = ($vertex, $score) if ($score > $max_score); } - $neighbors{$vertex} = [$self->neighbors($vertex)] + $neighbors{$vertex} = [$self->($vertex)] unless exists $neighbors{$vertex}; for my $neighbor (@{ $neighbors{$vertex} }) { my ($vert_n, $weight_n) = @{ $neighbor }; -- cgit v1.2.3-54-g00ecf