How to split an igraph into connected subgraphs?

萝らか妹 提交于 2019-11-27 12:25:40

You could calculate the connected components of your graph by using:

clusters(g)
# $membership
# [1] 1 1 1 1 1 1 2 2 3 1
# 
# $csize
# [1] 7 2 1
# 
# $no
# [1] 3

Or you could create a separate graph for each component of your graph by using:

dg <- decompose.graph(g) # returns a list of three graphs
plot(dg[[1]]) # plot e.g. the 1st one

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!