如何使用iGraph和RStudio在R中使用"get.adjacency()"保存邻接矩阵?

R_i*_*bie 4 r igraph adjacency-matrix rstudio

是否可以在"get.adjacency()"之后将邻接矩阵保存为R中的邻接矩阵?我试过了

test <- get.adjacency(network)
Run Code Online (Sandbox Code Playgroud)

但是我收到了错误

Error in View : cannot coerce class "structure("dgCMatrix", package = "Matrix")" to a data.frame. 
Run Code Online (Sandbox Code Playgroud)

我正在使用RStudio和iGraph包.

jlh*_*ard 5

尝试sparse=FALSE在通话中使用get.adjacency(...)

g <- graph.full(5)
test <- get.adjacency(g)
class(test)
# [1] "dgCMatrix"
# attr(,"package")
# [1] "Matrix"

test <- get.adjacency(g,sparse=FALSE)
class(test)
# [1] "matrix"
Run Code Online (Sandbox Code Playgroud)