igraph r 最短路径计算崩溃 - 最大节点数?
Shortest Path calculations crashes with igraph r - maximum number of nodes?
igraph::shortest.paths
函数是否有最大节点数?
以下代码在 RStudio Version 1.4.1106
中崩溃 Microsoft R Open 4.0.2
under Windows 10 with 128GB RAM.
问题:
是不是因为igraph
的功能
这与本地内存有关吗?
有哪些选择?也许使用 cppRouting
包?
library(igraph)
c1 <- sample(1:48000, 293631, replace=TRUE)
c2 <- sample(1:48000, 293631, replace=TRUE)
# column bind the two vectors
el <- cbind(c1, c2)
# convert matrix as an edgelist into an undirected graph
g <- graph.edgelist(el, directed=FALSE)
# obtain distance matrix with shortest path between all pairs of nodes
t <- shortest.paths(g)
目前,igraph 没有针对超出最大数据结构大小的可靠检查。但是,作为准则,您可以假设任何不能用带符号的 32 位整数编制索引的内容都不起作用。您的计算将 return:
的矩阵就是这种情况
> log2(48000^2)
[1] 31.10149
当超过这些大小时,在 Windows 上特别容易出现崩溃等问题,其中 long int
类型(目前 igraph 内部广泛使用)的大小为 32 位,即使在 64 位上也是如此-位系统。
正在进行的工作是使 igraph 的 C 核心完全支持 64 位,并让它检测何时超过最大数据结构大小。不幸的是,目前尚不清楚如何或是否可以为 igraph 的 R 接口带来 64 位支持,因为 R 本身仍然不支持 64 位整数。但是,未来的版本应该会在超过大小时显示错误而不是崩溃。
在我的 Windows 系统上,库 cppRouting
似乎可以处理比 igraph
更大的网络。
library(cppRouting)
gr <-makegraph(cbind(el, 1),directed=FALSE) # add one to indicate tie-strength
outcome <- get_distance_pair(gr)
这将为您提供边缘列表中节点之间的最短路径 el
。
igraph::shortest.paths
函数是否有最大节点数?
以下代码在 RStudio Version 1.4.1106
中崩溃 Microsoft R Open 4.0.2
under Windows 10 with 128GB RAM.
问题:
是不是因为
的功能igraph
这与本地内存有关吗?
有哪些选择?也许使用
cppRouting
包?library(igraph) c1 <- sample(1:48000, 293631, replace=TRUE) c2 <- sample(1:48000, 293631, replace=TRUE) # column bind the two vectors el <- cbind(c1, c2) # convert matrix as an edgelist into an undirected graph g <- graph.edgelist(el, directed=FALSE) # obtain distance matrix with shortest path between all pairs of nodes t <- shortest.paths(g)
目前,igraph 没有针对超出最大数据结构大小的可靠检查。但是,作为准则,您可以假设任何不能用带符号的 32 位整数编制索引的内容都不起作用。您的计算将 return:
的矩阵就是这种情况> log2(48000^2)
[1] 31.10149
当超过这些大小时,在 Windows 上特别容易出现崩溃等问题,其中 long int
类型(目前 igraph 内部广泛使用)的大小为 32 位,即使在 64 位上也是如此-位系统。
正在进行的工作是使 igraph 的 C 核心完全支持 64 位,并让它检测何时超过最大数据结构大小。不幸的是,目前尚不清楚如何或是否可以为 igraph 的 R 接口带来 64 位支持,因为 R 本身仍然不支持 64 位整数。但是,未来的版本应该会在超过大小时显示错误而不是崩溃。
在我的 Windows 系统上,库 cppRouting
似乎可以处理比 igraph
更大的网络。
library(cppRouting)
gr <-makegraph(cbind(el, 1),directed=FALSE) # add one to indicate tie-strength
outcome <- get_distance_pair(gr)
这将为您提供边缘列表中节点之间的最短路径 el
。