Clustering the keys of a dict according to its values

Florian Brucker torf at torfbold.com
Fri Nov 14 08:46:50 EST 2008


> Are you sure? Is this for school?

Yes, I'm pretty sure (the values of the original dict are integers), and 
no, this isn't for school :) If the "We may assume ..." made you think 
so, I guess that's the way everybody formulates requirements after 
having read to many math papers :D

If it is of interest to you: I'm trying to reproduce a certain sorted 
version of the keys of a dict (sorted according to their value) where 
the values are not unique, and thus the sorted version is not unique, 
either. All I have left of the original sorting is some statistics, so I 
can check for every sorted version if it's the same as the original. If 
I have the clustering I'm talking about getting all the valid sorted 
lists is a matter of concatenating permutations of the clusters.


Regards,
Florian



More information about the Python-list mailing list