第一篇帖子,所以请宽大处理.
问题:我尝试使用边缘向量和类型向量来使用R中的iGraph函数make_bipartite_graph(),但是遇到了关于顶点IDs的错误。
错误-在核心/misc/biparte.c:527:无效(负或过大)顶点id,无效顶点id
#types in form of NodesAndType gives the boolean info for all 122 nodes
#whether they belong to nodeSet1 or nodeSet2
> head(NodesAndType[,2])
[1] FALSE FALSE FALSE FALSE FALSE FALSE
> length(NodesAndType[,2])
[1] 122
make_bipartite_graph(types = NodesAndType[,2], edges = EL_vector)#**edges** in form of the EL_vector gives all edges of the graph in from-to format in one vector
> head(EL_vector)
[1] 1 201 2 201 3 201
> head(NodesAndType[,2])
[1] FALSE FALSE FALSE FALSE FALSE FALSE
> length(NodesAndType[,2])
[1] 122
make_bipartite_graph(types = NodesAndType[,2], edges = EL_vector)## make_bipartite_graph is throwing thefollowing error
make_bipartite_graph(types = NodesAndType[,2], edges = EL_vector)
>Error in make_bipartite_graph(types = NodesAndType[, 2], edges = EL_vector) :
> At core/misc/bipartite.c:527 : Invalid (negative or too large) vertex id, Invalid vertex id# the two nodesets are
## nodeset1 (type FALSE for bipartite)
nodeset1 <- 1:103
## nodeset2 (type TRUE for bipartite)
nodeset2 <- 201:211SessionInfo()
>R version 4.1.2 (2021-11-01)
>Platform: x86_64-w64-mingw32/x64 (64-bit)
>Running under: Windows 10 x64 (build 22000)
>Matrix products: default
>attached base packages:
>[1] stats graphics grDevices utils datasets methods base
>other attached packages:
[1] igraph_1.3.1 dplyr_1.0.7发布于 2022-06-27 15:23:46
在make_bipartite_graph中,顶点由types向量定义。顶点数与types长度相同。在你的例子中,你有122个顶点,但是你指的是顶点ID 201,它是无效的(太大)。
https://stackoverflow.com/questions/72769966
复制相似问题