make_full_multipartite: Create a full multipartite graph

View source: R/make.R

make_full_multipartiteR Documentation

Create a full multipartite graph

Description

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(n, directed = FALSE, mode = c("all", "out", "in"))

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.

Value

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

Related documentation in the C library

full_multipartite(), vcount()

See Also

Other deterministic constructors: graph_from_atlas(), graph_from_edgelist(), graph_from_literal(), make_(), make_chordal_ring(), make_circulant(), make_empty_graph(), make_full_citation_graph(), make_full_graph(), make_graph(), make_lattice(), make_ring(), make_star(), make_tree(), make_turan(), make_wheel()

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)

igraph documentation built on April 21, 2026, 5:06 p.m.