in reply to H of A optimization

Removing this would probably help performance a bit as it is totally unnecessary:

if(exists($edgeHash{$a})){ push @{$edgeHash{$a}}, $b; }else{ push @{$edgeHash{$a}}, $b; }
Unless this is a mistake, either condition of the if test does the same thing.

-----------------------------------
Frank Wiles <frank@wiles.org>
http://frank.wiles.org