igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

## [igraph] cohesive.blocks()

 From: MATSUDA, Noriyuki Subject: [igraph] cohesive.blocks() Date: Mon, 28 Apr 2008 17:54:20 +0900

```Hello:

```
I have some difficulty in relating the performance of cohesive.blocks() to the original paper by Moody and White (2003), particularly the concepts of components and blocks. Here is my trial on Figures 2 and 3 in the paper: It separates terminal (bottom) blocks 4 and 5, leaving {17-23} unextracted. Do we need to identify {17-23} by taking the difference between blocks 2 and 4? If so, it would require a lot of care even with a graph of medium size. Or have I made errors in specifying edges?
```  Thanks in advance for helping me out.

----------- Here you go ----------------------------
```
# Structural Cohesion and Embeddedness: A Hierarchical Concept of Social Groups
```# James Moody; Douglas R. White
```
# American Sociological Review, Vol. 68, No. 1. (Feb., 2003), pp. 103-127.
```
library(igraph); options(digits=3)

plotting <- function(g,msg){
V(g)\$label=paste("v",1:vcount(g),sep="")
V(g)\$cex=6
V(g)\$color="#FeFeFf"
plot(g,layout=layout.fruchterman.reingold.grid)
title(main=msg)
}
##Main
m <- c(1,2,1,3,1,4,1,5,1,6, 2,3,2,4,2,5,2,7,
3,4,3,6,3,7, 4,5,4,6,4,7, 5,6,5,7,5,21, 6,7,
7,8,7,11,7,14,7,19,  8,9,8,11,8,14, 9,10,
10,12,10,13,11,12,11,14, 12,16,
13,16, 14,15,15,16,
17,18,17,19,17,20, 18,20,18,21, 19,20,19,22,19,23,
20,21, 21,22,21,23, 22,23) - 1
g <- graph(m,directed=F)
plotting(g,msg="Fig.2")

#quartz(width=8,height=8)
gb <- cohesive.blocks(g)
```
#plot(gb, vertex.size=10, emph=c (1,2),layout=layout.fruchterman.reingold)
```  # to emphasize blocks 1 & 2 in bgraph

quartz(width=8,height=8)
plotBlocks <- function(g,gblocks,msg){
V(g)\$label=paste("v",1:vcount(g),sep="")
V(g)\$cex=6
```
colors <- c ("#FeFeFf","#FeDeDf","#BeFeBf","#9e9eFf","#Ae8e8f","#7eAe7f")
```                V(g)\$color[ V(g) %in% gblocks[[2]] ]=colors[2]
for (k in 1:length(gblocks)){
V(g)\$color[ V(g) %in% gblocks[[k]] ]=colors[k]
}
plot(g,layout=layout.fruchterman.reingold.grid)
title(main=msg)
}
plotBlocks(g,gb\$blocks,"Fig.2 by hand")

for (k in 1:length(gb\$blocks)){
b <- gb\$blocks[[k]]
cat("block",k,": cohesion| nodes=", gb\$block.cohesion,"| ",b +1,,"\n")
}
```
#block 1 : cohesion| nodes= 1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
```#block 2 : cohesion| nodes= 2 |  1 2 3 4 5 6 7 17 18 19 20 21 22 23
#block 3 : cohesion| nodes= 2 |  7 8 9 10 11 12 13 14 15 16
#block 4 : cohesion| nodes= 5 |  1 2 3 4 5 6 7
#block 5 : cohesion| nodes= 3 |  7 8 11 14

```
–––––––––––––––––––––––– –––––––––––––––––––––––– –––––––––––
```
MATSUDA, Noriyuki  <Kanji> 松田紀之

```

reply via email to

 [Prev in Thread] Current Thread [Next in Thread]