我在这里找到了有关如何使用graph.coreness.
不幸的是,我得到了一份大约有 27000 个条目长的数字列表。
我的目的是简单地弄清楚如何找出条目所属的最大 k 核。
我怎么做?
假设有这个图:
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)])
Run Code Online (Sandbox Code Playgroud)

您可以通过以下方式获得 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)))
Run Code Online (Sandbox Code Playgroud)
