Delete weak correlations from network in igraph (vertices and edges)

送分小仙女□ 提交于 2019-12-05 18:19:35
Spacedman

If I understand your question correctly...

First delete all edges that match your condition.

Then delete all vertices with zero neighbours.

Reproducible example with random data, where I don't want to plot correlations less than 0.1:

set.seed(999);mydata=matrix(runif(24),ncol=2)
rownames(mydata)=LETTERS[1:12]
g=graph.adjacency(cov(t(mydata)),weighted=TRUE)
plot(g)

that's a complete graph of 12 vertices.

g=delete.edges(g, which(E(g)$weight <=.1)) # here's my condition.
plot(g)

that leaves a skinny graph with a few detached vertices.

g=delete.vertices(g,which(degree(g)<1))
plot(g)

that cleans up.

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