Basic Functions

community.prism()

Pairwise Resolution Iteration via Subgraph Modularity (PRISM)

EGAnet::community.prism()View source

Description

Iteratively tests pairwise unions of communities for a modularity gain at the subgraph level and merges communities whenever the union increases modularity relative to the communities' separate memberships. Iteration continues until no pair of communities yields a consistent, positive gain, at which point the partition is returned. The approach operates on single subgraphs rather than the full network at each comparison, which is intended to overcome the modularity resolution limit described by Fortunato and Barthelemy (2007)

Usage

community.prism(
  network,
  algorithm = c("edge_betweenness", "fast_greedy", "fluid", "infomap", "label_prop",
    "leading_eigen", "leiden", "louvain", "optimal", "spinglass", "walktrap"),
  allow.singleton = FALSE,
  seed = NULL,
  ...
)

Arguments

network

Matrix or igraph network object

algorithm

Character or igraph cluster_* function (length = 1). Available options:

  • "edge_betweenness" — See cluster_edge_betweenness for more details

  • "fast_greedy" — See cluster_fast_greedy for more details

  • "fluid" — See cluster_fluid_communities for more details

  • "infomap" — See cluster_infomap for more details

  • "label_prop" — See cluster_label_prop for more details

  • "leading_eigen" — See cluster_leading_eigen for more details

  • "leiden" — See cluster_leiden for more details. Note: The Leiden algorithm will default to the modularity objective function (objective_function = "modularity"). Set objective_function = "CPM" to use the Constant Potts Model instead (see examples)

  • "louvain" — Applies EGAnet's own C implementation of the Louvain algorithm (Blondel et al., 2008), which replaces cluster_louvain. Accepts resolution (defaults to 1), seed (defaults to NULL, i.e., not reproducible), and order ("higher" or "lower"; defaults to "higher"). Unlike igraph::cluster_louvain, which draws on R's global random number generator, this implementation's randomness depends only on seed – making it reproducible regardless of R's RNG state, call order, or parallelization

  • "optimal" — See cluster_optimal for more details

  • "spinglass" — See cluster_spinglass for more details

  • "walktrap" — See cluster_walktrap for more details

allow.singleton

Boolean (length = 1). Whether singleton or single node communities should be allowed. Passed on to the function selected via algorithm. When FALSE, singleton communities will be set to missing (NA); otherwise, when TRUE, singleton communities will be allowed

seed

Numeric (length = 1). Sets seed for reproducible results. Defaults to NULL or random results. Passed on to the function selected via algorithm (relevant for algorithm = "louvain") for every pairwise subgraph comparison performed during the iterative procedure, making the entire PRISM procedure reproducible

...

Additional arguments to be passed on to the community detection function selected via algorithm (see community.consensus or community.detection for their respective arguments)

Value

Returns a named vector of final community memberships obtained by iterating pairwise resolution over subgraph modularity until convergence (i.e., until no further consistent modularity gain is found)

Author(s)

Alexander P. Christensen <alexpaulchristensen@gmail.com>

References

Granell, C., Gomez, S., & Arenas, A. (2012). Hierarchical multiresolution method to overcome the resolution limit in complex networks. International Journal of Bifurcation and Chaos, 22(07), 1250171.

Fortunato, S., & Barthelemy, M. (2007). Resolution limit in community detection. Proceedings of the National Academy of Sciences, 104(1), 36-41.

Examples

# Load data
wmt <- wmt2[,7:24]

# Estimate network
network <- EBICglasso.qgraph(data = wmt)

# Compute PRISM memberships (Louvain-based consensus)
community.prism(network)

# Compute PRISM memberships (single-algorithm community detection)
community.prism(network, algorithm = "walktrap")