clever programming solution wanted

Scott Rifkin sar38 at pantheon.yale.edu
Thu Jul 15 17:34:37 EDT 2004


If anyone has a good, quick solution to the following in python2.3 
I'd appreciate it:

I have a dictionary with keys K1, K2, ..., K10000
Each entry looks like:

dict[K1]=[T1,T4,T500] 

where the T's are indexed from, say, 1 to 20000 and each K has some number 
of Ts (not always 3).

I want to create groups of Ks which share Ts such the groups are maximal, 
for instance:

dict[K1]=[T1,T4,T500]
dict[K2]=[T1]
dict[K3]=[T500,T7000]

these would be grouped [K1,K2,K3].

At the end, most of the Ks will be by themselves, but some will be grouped 
with some number of other Ks.


Thanks for any help,

Scott Rifkin

scott dot rifkin at yale dot edu





More information about the Python-list mailing list