model <- tna(group_regulation)
Visualization of communities and hyper order networks
2026-03-14
Source:vignettes/articles/cograph-tutorial-communities.qmd
1 Introduction
cograph provides two functions for visualizing community structure and higher-order relationships in networks:
-
overlay_communities()— renders a network withsplot()and overlays smooth blob shapes highlighting communities -
plot_simplicial()— visualizes higher-order pathways (simplicial complexes) as blobs on a ggplot2 canvas
Both accept any network type: tna, matrix, igraph, or cograph_network.
We use a TNA model of collaborative group regulation throughout:
2 overlay_communities()
2.1 Method Name
The simplest way: pass an igraph community detection method name. Partial matching and flexible naming are supported.
overlay_communities(model, "fast_greedy")Any igraph cluster_* method works: "walktrap", "louvain", "fast_greedy", "leading_eigen", "infomap", "leiden", "label_prop", "edge_betweenness", "spinglass", "optimal", "fluid_communities". You can use the full igraph name ("cluster_walktrap"), the short name ("walktrap"), or a partial match ("leading_eige"). Directed graphs are automatically converted to undirected for detection.
overlay_communities(model, "louvain")2.2 Named List
Define communities manually with a named list:
overlay_communities(model, list(
Regulatory = c("plan", "monitor", "adapt"),
Social = c("cohesion", "emotion", "consensus"),
Task = c("discuss", "synthesis", "coregulate")
))