Skip to contents

A multipartite graph contains multiple types of vertices and connections are only possible between vertices of different types. This function creates a complete multipartite graph where all possible edges between different partitions are present.

Usage

make_full_multipartite(n, directed = FALSE, mode = c("all", "out", "in"))

full_multipartite(...)

Arguments

n

A numeric vector giving the number of vertices in each partition.

directed

Logical scalar, whether to create a directed graph.

mode

Character scalar, the type of connections for directed graphs. If "out", then edges point from vertices of partitions with lower indices to partitions with higher indices; if "in", then the opposite direction is realized; "all" creates mutual edges. This parameter is ignored for undirected graphs.

...

Passed to make_full_multipartite().

Value

An igraph graph with a vertex attribute type storing the partition index of each vertex. Partition indices start from 1.

full_multipartite().

Examples

# Create a multipartite graph with partitions of size 2, 3, and 4
g <- make_full_multipartite(c(2, 3, 4))
plot(g)


# Create a directed multipartite graph
g2 <- make_full_multipartite(c(2, 2, 2), directed = TRUE, mode = "out")
plot(g2)