Pairwise frequency count from an incidence matrix of group membership

Shafique, M. (UNU-MERIT) kmshafique at yahoo.com
Fri Apr 22 06:36:45 EDT 2011


Hi,
I have a number of different groups g1, g2, … g100 in my data. Each group is 
comprised of a known but different set of members (m1, m2, …m1000) from the 
population. The data has been organized in an incidence matrix:
g1g2g3g4g5
m111101
m210010
m301100
m411011
m500110

I need to count how many groups each possible pair of members share (i.e., both 
are member of). 
I shall prefer the result in a pairwise edgelist with weight/frequency in a 
format like the following:
m1, m1, 4
m1, m2, 1
m1, m3, 2
m1, m4, 3
m1, m5, 1
m2, m2, 2
... and so  on.

I shall highly appreciate if anybody could suggest/share some code/tool/module 
which could help do this.

Best regards,
Muhammad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110422/269bee42/attachment.html>


More information about the Python-list mailing list