for my $vertex_pair (sort keys %multiplicity) { print "$vertex_pair $multiplicity{$vertex_pair}\n"; }