计算内聚块内聚igraph 0.5.4

时间:2012-10-15 11:21:08

标签: r igraph

是否有或多或少的直接方法来估计igraph 0.5.4中每个内聚块的内聚力(即cohesive.blocks()的结果)?

在实际版本(0.6)中有一个名为cohesion()的函数,但在版本0.5.x中没有。是否有更简单的方法来计算它,或者我应该为每个块单独进行(手动!!)?

1 个答案:

答案 0 :(得分: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