2012-10-15 72 views
0

在igraph 0.5.4中有沒有一種或多或少的直接方法來估計每個凝聚塊的凝聚力(即cohesive.blocks()的結果)?計算凝聚塊凝聚力igraph 0.5.4

在實際版本(0.6)中有一個函數cohesion(),但在版本0.5.x中沒有。有一種更簡單的方法來計算它,或者我應該單獨爲每個塊執行它(手動!!)?

回答

1

這實際上是在文檔中,即使在例如:

g <- graph.disjoint.union(graph.full(4), graph.empty(2,directed=FALSE)) 
g <- add.edges(g,c(3,4,4,5,4,2)) 
g <- graph.disjoint.union(g,g,g) 
g <- add.edges(g,c(0,6,1,7,0,12,4,0,4,1)) 

## Find cohesive blocks: 
gBlocks <- cohesive.blocks(g) 

## Examine block membership and cohesion: 
gBlocks$blocks 
# [[1]] 
# [1] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 
# [[2]] 
# [1] 12 13 14 15 16 
# [[3]] 
# [1] 0 1 2 3 4 6 7 8 9 10 
# [[4]] 
# [1] 12 13 14 15 
# [[5]] 
# [1] 0 1 2 3 4 
# [[6]] 
# [1] 6 7 8 9 

gBlocks$block.cohesion 
# [1] 1 2 2 3 4 3 
+0

感謝,我沒有在第一次嘗試!把它從那裏我現在可以計算每個'block'一個凝聚力整數。 ! – Vlad