Follow up on Cohesive.blocks.
For other users of the list, here is the loop I wrote following Gabor's
suggestion. There may be a more parsimonious approach but this worked.

camp <- graph.formula(Harry:Steve:Don:Bert - Harry:Steve:Don:Bert,
                      Pam:Brazey:Carol:Pat - Pam:Brazey:Carol:Pat,
                      Holly   - Carol:Pat:Pam:Jennie:Bill,
                      Bill    - Pauline:Michael:Lee:Holly,
                      Pauline - Bill:Jennie:Ann,
                      Jennie  - Holly:Michael:Lee:Ann:Pauline,
                      Michael - Bill:Jennie:Ann:Lee:John,
                      Ann     - Michael:Jennie:Pauline,
                      Lee     - Michael:Bill:Jennie,
                      Gery    - Pat:Steve:Russ:John,
                      Russ    - Steve:Bert:Gery:John,
                      John    - Gery:Russ:Michael)
campBlocks <- cohesive.blocks(camp)
campBlocks

#get the block membership#
bl <- blocks(campBlocks)
#get the cohesion score for each block#
co <- cohesion(campBlocks)

#create the zero matrix#
cohesionmat <- matrix(0,nrow=18, ncol=18)

#loop over the matrix#
for (b in seq(from=1, to=length(bl))){
for (i in seq(from=1, to=18)){
  for (j in seq(from=1, to=18)){
    if(i%in%bl[[b]] & j%in%bl[[b]]) cohesionmat[i,j]<-co[b] else next
    }
  }
}
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to