跳到内容

创建一个完整图

用法

make_full_graph(n, directed = FALSE, loops = FALSE)

full_graph(...)

参数

n

顶点数。

directed

是否创建有向图。

loops

是否向图中添加自环。

...

传递给 make_full_graph()

一个 igraph 图

示例

make_full_graph(5)
#> IGRAPH c53efca U--- 5 10 -- Full graph
#> + attr: name (g/c), loops (g/l)
#> + edges from c53efca:
#>  [1] 1--2 1--3 1--4 1--5 2--3 2--4 2--5 3--4 3--5 4--5
print_all(make_full_graph(4, directed = TRUE))
#> IGRAPH 82d3295 D--- 4 12 -- Full graph
#> + attr: name (g/c), loops (g/l)
#> + graph attributes:
#> | + name:
#> |   [1] "Full graph"
#> | + loops:
#> |   [1] FALSE
#> + edges:
#> 1 -> 2 3 4   2 -> 1 3 4   3 -> 1 2 4   4 -> 1 2 3