1.,使用clusters 命令可以完成分组。如果只看第一组的关系图可使用
clusters(g)
$membership
[1] 1 1 1 1 1 1 2 2 3 1
$csize
[1] 7 2 1
$no [1] 3
dg <- decompose.graph(g) # returns a list of three graphsplot(dg[[1]]) # plot e.g. the 1st one
参见
https://stackoverflow.com/questions/29730624/how-to-split-an-igraph-into-connected-subgraphs