in reply to Comparing graph shapes or soft matching.

I'm picturing that you have two arrays of integers. Can you just count the number of differences? For example:
foreach $value (@listA) { $countsA{$value}++; $seen{$value} = 1; } foreach $value (@listB) { $countsB{$value}++; $seen{$value} = 1; } $diff = 0; foreach $value (keys %seen) { if( not defined $listA{$value} ) { $listA{$value} = 0; } elsif( not defined $listB{$value} ) { $listB{$value} = 0; } $diff += abs($countsA{$value} - $countsB{$value}) }
EDIT: If you are expecting all lists to be similar to some global target, you could calculate the count means of each value over all sets. Then instead of comparing two sets (as above), you could compare each set to the means.