I have a list of lists:
[['suzy', 'joe', ...], ['suzy', 'tom', ...], ['paul', 'kristy',...], ['kristy', 'griffin',...], ...]
My desired output is to cluster the pairs into two lists:
['suzy', 'joe', 'tom']
['paul', 'kristy', 'griffin']
I read this post that had a similar question, but it was answered with networkx
. However, I am avoiding use of networkx
, and have been struggling with doing this.
I tried creating a dictionary with one name, and then appending other names if they were in a pair, but it was getting messy. Any help is appreciated!