cluster_quality: Cluster Quality Metrics

View source: R/cluster-metrics.R

cluster_qualityR Documentation

Cluster Quality Metrics

Description

Computes per-cluster and global quality metrics for network partitioning. Supports both binary and weighted networks.

Usage

cluster_quality(x, clusters, weighted = TRUE, directed = TRUE)

cqual(x, clusters, weighted = TRUE, directed = TRUE)

Arguments

x

Adjacency matrix (numeric)

clusters

Cluster specification (named list, data frame, or membership vector; see csum)

weighted

Logical; if TRUE (default), use edge weights; if FALSE, binarize the matrix first

directed

Logical; if TRUE (default), treat as directed network

Value

A cluster_quality object (a list) with:

per_cluster

Data frame, one row per cluster, with columns cluster (index), cluster_name, n_nodes, internal_edges (within-cluster weight), cut_edges (boundary-crossing weight), internal_density, avg_internal_degree, expansion, cut_ratio and conductance.

global

List with modularity (Newman-Girvan, computed on the weighted or binarized matrix), coverage (share of total weight that is internal to some cluster) and n_clusters.

References

Newman, M. E. J., & Girvan, M. (2004). Finding and evaluating community structure in networks. Physical Review E, 69(2), 026113. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1103/PhysRevE.69.026113")}

Examples

clusters <- list(C1 = c("Explore", "Reflect", "Discuss"),
                 C2 = c("Plan", "Create", "Share"),
                 C3 = c("Monitor", "Adapt", "Synthesize", "Evaluate"))
cluster_quality(regulation_net, clusters = clusters)

cograph documentation built on Nov. 19, 2026, 5:07 p.m.