Skip to contents

A circulant graph \(C_n^{\textrm{shifts}}\) consists of \(n\) vertices \(v_0, \ldots, v_{n-1}\) such that for each \(s_i\) in the list of offsets shifts, \(v_j\) is connected to \(v_{(j + s_i) \mod n}\) for all \(j\).

Usage

make_circulant(n, shifts, directed = FALSE)

circulant(n, shifts, directed = FALSE)

Arguments

n

Integer, the number of vertices in the circulant graph.

shifts

Integer vector, a list of the offsets within the circulant graph.

directed

Boolean, whether to create a directed graph.

Value

An igraph graph.

Details

The function can generate either directed or undirected graphs. It does not generate multi-edges or self-loops.

Examples

# Create a circulant graph with 10 vertices and shifts 1 and 3
g <- make_circulant(10, c(1, 3))
plot(g, layout = layout_in_circle)


# A directed circulant graph
g2 <- make_circulant(10, c(1, 3), directed = TRUE)
plot(g2, layout = layout_in_circle)