跳到内容

使用临时igraph选项设置运行代码

用法

with_igraph_opt(options, code)

参数

options

一个具名列表,包含要更改的选项。

code

要运行的代码。

code的结果。

参见

其他 igraph 选项: igraph_options()

示例

with_igraph_opt(
  list(sparsematrices = FALSE),
  make_ring(10)[]
)
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
#>  [1,]    0    1    0    0    0    0    0    0    0     1
#>  [2,]    1    0    1    0    0    0    0    0    0     0
#>  [3,]    0    1    0    1    0    0    0    0    0     0
#>  [4,]    0    0    1    0    1    0    0    0    0     0
#>  [5,]    0    0    0    1    0    1    0    0    0     0
#>  [6,]    0    0    0    0    1    0    1    0    0     0
#>  [7,]    0    0    0    0    0    1    0    1    0     0
#>  [8,]    0    0    0    0    0    0    1    0    1     0
#>  [9,]    0    0    0    0    0    0    0    1    0     1
#> [10,]    1    0    0    0    0    0    0    0    1     0
igraph_opt("sparsematrices")
#> [1] TRUE