motif_census: Network Motif Analysis

View source: R/motifs.R

motif_censusR Documentation

Network Motif Analysis

Description

Analyze recurring subgraph patterns (motifs) in networks and test their statistical significance against null models.

Usage

motif_census(
  x,
  size = 3,
  n_random = 100,
  method = c("configuration", "gnm"),
  directed = NULL,
  seed = NULL
)

## S3 method for class 'cograph_motifs'
print(x, ...)

Arguments

x

A matrix, igraph object, or cograph_network

size

Motif size: 3 (triads) or 4 (tetrads). Default 3.

n_random

Number of random networks for null model. Default 100.

method

Null model method: "configuration" (preserves degree) or "gnm" (preserves edge count). Default "configuration".

directed

Logical. Treat as directed? Default auto-detected.

seed

Random seed for reproducibility

Value

A cograph_motifs data frame with motif count, null-model mean, null-model standard deviation, z-score, p-value, and significance columns. The motif size, directed flag, null-model method, and number of random networks are stored as attributes.

See Also

motifs() for the unified API, extract_motifs() for detailed triad extraction, plot.cograph_motifs() for plotting

Other motifs: extract_motifs(), extract_triads(), get_edge_list(), motifs(), plot.cograph_motif_analysis(), plot.cograph_motifs(), subgraphs(), triad_census()

Examples

# Create a directed network
mat <- matrix(c(
  0, 1, 1, 0,
  0, 0, 1, 1,
  0, 0, 0, 1,
  1, 0, 0, 0
), 4, 4, byrow = TRUE)

# Analyze triadic motifs
m <- motif_census(mat)
print(m)
plot(m)


cograph documentation built on May 31, 2026, 5:06 p.m.