Graph-Fast
view release on metacpan or search on metacpan
lib/Graph/Fast.pm view on Meta::CPAN
# find the edge. assume it only exists once -> only delete the first.
# while we're at it, delete the edge from the source vertex...
my $e = $self->{vertices}->{$from}->{edges_out}->{$to};
return undef if (!defined($e));
delete($self->{vertices}->{$from}->{edges_out}->{$to});
# now search it in the destination vertex' list, delete it there
# also only delete the first matching one here (though now there
# shouldn't be any duplicates at all because now we're matching the
# actual edge, not just its endpoints like above.
delete($self->{vertices}->{$to}->{edges_in}->{$from});
# and remove it from the graph's vertex list
@{$self->{edges}} = grep { $_ != $e } @{$self->{edges}}
}
1;
__END__
( run in 0.367 second using v1.01-cache-2.11-cpan-2b1a40005be )