Skip to contents

[Experimental]

A wheel graph is created by connecting a center vertex to all vertices of a cycle graph. A wheel graph on n vertices can be thought of as a wheel with n - 1 spokes. The cycle graph part makes up the rim, while the star graph part adds the spokes.

Note that the two and three-vertex wheel graphs are non-simple: The two-vertex wheel graph contains a self-loop, while the three-vertex wheel graph contains parallel edges (a 1-cycle and a 2-cycle, respectively).

Usage

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

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

Arguments

n

Number of vertices.

...

These dots are for future extensions and must be empty.

mode

It defines the direction of the edges. in: the edges point to the center, out: the edges point from the center, mutual: a directed wheel is created with mutual edges, undirected: the edges are undirected.

center

ID of the center vertex.

Value

An igraph graph.

wheel()

Examples

make_wheel(10, mode = "out")
#> ── <igraph> Out-wheel ─────────────────────────────────────────────── a202db8 ──
#>  directed
#>  10 vertices · 18 edges
#> 
#> ── Attributes ──────────────────────────────────────────────────────────────────
#> → graph:  name <chr>, mode <chr>, center <dbl>
#> 
#> ── Edges ───────────────────────────────────────────────────────────────────────
#>  [1] 1 → 2   1 → 3   1 → 4   1 → 5   1 → 6   1 → 7   1 → 8   1 → 9   1 → 10 
#> [10] 2 → 3   3 → 4   4 → 5   5 → 6   6 → 7   7 → 8   8 → 9   9 → 10  10 → 2 
make_wheel(5, mode = "undirected")
#> ── <igraph> Wheel ─────────────────────────────────────────────────── b02176a ──
#>  undirected
#>  5 vertices · 8 edges
#> 
#> ── Attributes ──────────────────────────────────────────────────────────────────
#> → graph:  name <chr>, mode <chr>, center <dbl>
#> 
#> ── Edges ───────────────────────────────────────────────────────────────────────
#> [1] 1 ─ 2  1 ─ 3  1 ─ 4  1 ─ 5  2 ─ 3  3 ─ 4  4 ─ 5  2 ─ 5