diff options
author | doy <doy@tozt.net> | 2008-12-14 19:21:10 -0500 |
---|---|---|
committer | doy <doy@tozt.net> | 2008-12-14 19:21:10 -0500 |
commit | c3c49db31cc8dbb540683fd884b10282bfb5c18a (patch) | |
tree | 078ca8cd5363765b84e9fada0f88edecd34f9be3 | |
parent | f4713853edb7783e36df098e950c507855ddb29c (diff) | |
download | graph-implicit-c3c49db31cc8dbb540683fd884b10282bfb5c18a.tar.gz graph-implicit-c3c49db31cc8dbb540683fd884b10282bfb5c18a.zip |
the edge calculator returns a pair of [vertex, weight], not just the vertex
-rw-r--r-- | lib/Graph/Implicit.pm | 4 |
1 files changed, 2 insertions, 2 deletions
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 }; |