title: R: igraph, matching members of a "known" cluster to members of observed clusters returning a %match
body: <p>I'm using the Walktrap community detection method to return a number (19 in this case) of clusters. I have a list of members which belong to one or more of these clusters. </p>
  
  <ol>
  <li><p>I need a method to search each cluster for the presence of the
  members and return the percentage of matches found. ( e.g cluster[0]
  = 0%, cluster[1] =Y%.....cluster[18]=Z%) Thus selecting the optimum cluster that represents the members on the list. </p></li>
  <li><p>Once the optimum cluster is found, I need a method to count the
      number of members of the optimum cluster and from the original
      (19-1) clusters  select another cluster that is nearest in size
      (number of members)</p>
  
  <pre><code> library(igraph)
   edges &lt;- read.csv('http://dl.dropbox.com/u/23776534/Facebook%20%5BEdges%5D.csv')
   list&lt;-read.csv("http://dl.dropbox.com/u/23776534/knownlist.csv")
   all&lt;-graph.data.frame(edges)
   summary(all)
  all_wt&lt;- walktrap.community(all, steps=6,modularity=TRUE,labels=TRUE)
  all_wt_memb &lt;- community.to.membership(all,all_wt$merges,steps=which.max(all_wt$modularity)-1)
  all_wt_memb$csize
  
  &gt;[1] 176  13 204  24   9 263  16   2   8   4  12   8   9  19  15   3   6   2   1
  </code></pre></li>
  </ol>