我找到了文档 here关于如何使用 graph.coreness
。
不幸的是,我得到了一个大约有 27000 个条目的数字列表。
我的目的是简单地弄清楚如何找出条目所属的最大 k-core。
我该怎么做?
最佳答案
假设有这张图:
library(igraph)
g <- graph.empty(n=7,directed=FALSE)
g <- add.edges(g, c(1,2,1,3,1,4,3,5,3,4,4,5,2,7,2,6))
g <- set.vertex.attribute(g, name='vert.names',index=V(g),value=LETTERS[V(g)])
你可以通过这种方式得到k核子图:
coreness <- graph.coreness(g)
maxCoreness <- max(coreness)
# if you just need to know the vertices and not to build the subgraph
# you can use this variable
verticesHavingMaxCoreness <- which(coreness == maxCoreness)
kcore <- induced.subgraph(graph=g,vids=verticesHavingMaxCoreness)
plot(kcore,
vertex.label=get.vertex.attribute(kcore,name='vert.names',index=V(kcore)))
关于r - 如何使用 graph.coreness 找到顶点所属的最大 k-core,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19744335/