跳到内容

star() 创建一个星型图,其中每个顶点都连接到中心顶点,没有其他连接。

用法

make_star(n, mode = c("in", "out", "mutual", "undirected"), center = 1)

star(...)

参数

n

顶点数。

mode

它定义了边的方向,in:边指向中心out:边从中心指出,mutual:创建具有互边的有向星型图,undirected:边是无向的。

center

中心顶点的 ID。

...

传递给 make_star()

一个 igraph 图。

示例

make_star(10, mode = "out")
#> IGRAPH 1ab3018 D--- 10 9 -- Out-star
#> + attr: name (g/c), mode (g/c), center (g/n)
#> + edges from 1ab3018:
#> [1] 1-> 2 1-> 3 1-> 4 1-> 5 1-> 6 1-> 7 1-> 8 1-> 9 1->10
make_star(5, mode = "undirected")
#> IGRAPH 7a55f4d U--- 5 4 -- Star
#> + attr: name (g/c), mode (g/c), center (g/n)
#> + edges from 7a55f4d:
#> [1] 1--2 1--3 1--4 1--5