Expand description
Community-detection algorithms (ALGO-CO-*). Phase 1: modularity
(Newman-Girvan modularity of a partition). Phase 4: louvain
multilevel community detection, leiden (Traag-Waltman-van Eck 2019),
label_propagation (Raghavan-Albert-Kumara 2007 +
Traag-Šubelj 2023 fast variant), fluid_communities
(Parés et al. 2017), edge_betweenness_community (Girvan-Newman 2002),
fast_greedy_modularity (Clauset-Newman-Moore 2004),
walktrap (Pons-Latapy 2005), leading_eigenvector (Newman 2006),
infomap (Rosvall-Bergstrom 2008),
spinglass (Reichardt-Bornholdt 2006).
Helpers: community_to_membership
(cut a dendrogram at k merges), reindex_membership (densify a
membership vector to 0..k-1 by first occurrence).
Structs§
- Community
ToMembership Result - Result of
community_to_membership: per-vertex cluster ids densified to0..k, plus the size of each cluster in the same order. - Community
Voronoi Result - Result of
community_voronoi. - Edge
Betweenness Result - Result of
edge_betweenness_community. - Fast
Greedy Result - Result of
fast_greedy_modularity/fast_greedy_modularity_weighted. - Fluid
Options - Full option bag for
fluid_communities_with_options. - Fluid
Result - Result of
fluid_communities/fluid_communities_with_options. - Infomap
Result - Result of an Infomap run.
- Leading
Eigenvector Result - Result of the leading eigenvector community detection.
- Leiden
Options - Full set of options for
leiden_with_options. Construct viaLeidenOptions::default()and then mutate the fields you care about, mirroring the way upstream C exposes per-parameter defaults. - Leiden
Result - Result of a Leiden run.
- Louvain
Result - Result of a Louvain run.
- LpaOptions
- Full option bag for
label_propagation_with_options. - LpaResult
- Result of a label-propagation run.
- Reindex
Membership Result - Result of
reindex_membership: a densified membership vector[0, k), the old cluster id behind each new id (sonew_to_old[i]is the original id that now maps toi), and the number of distinct clustersk = new_to_old.len(). - Spinglass
Options - Options for spinglass community detection.
- Spinglass
Result - Result of spinglass community detection.
- Split
Join Distance - Asymmetric split-join distances between two community partitions.
- Walktrap
Options - Tuning knobs for
walktrap_with_options. - Walktrap
Result - Result of
walktrap/walktrap_weighted/walktrap_with_options.
Enums§
- Community
Comparison - Which partition-comparison measure
compare_communitiesreturns. - Leiden
Objective - Quality function (objective) that Leiden optimises. Mirrors
igraph_leiden_objective_t. - LpaVariant
- Which variant of label propagation to run. Mirrors
igraph_lpa_variant_t. - Spinglass
Update Rule - Update rule for the spinglass null model.
Constants§
- FLUID_
DEFAULT_ MAX_ ITERATIONS - Default safety cap on outer iterations for
fluid_communities/fluid_communities_with_options. - LEIDEN_
DEFAULT_ BETA - Default randomness used in the refinement step — same default as
upstream
igraph_community_leiden_simple(β = 0.01). - LEIDEN_
DEFAULT_ ITERATIONS - Default number of outer iterations. The reference paper and upstream both note that two iterations are usually enough.
- SPINGLASS_
DEFAULT_ SPINS - Default number of spins for spinglass.
- WALKTRAP_
DEFAULT_ STEPS - Default random-walk length matching the igraph reference (
steps = 4).
Functions§
- community_
to_ membership - Cut a binary dendrogram at
stepsmerges, returning the resulting membership and cluster-size vectors. - community_
voronoi - Voronoi-based community detection.
- compare_
communities - Compare two community membership vectors over the same vertex set.
- edge_
betweenness_ community - Run edge-betweenness community detection on
graph. - edge_
betweenness_ community_ weighted - Run weighted edge-betweenness community detection on
graphwith per-edgeweights. - fast_
greedy_ modularity - Run fast greedy modularity community detection on
graph(unweighted). - fast_
greedy_ modularity_ weighted - Run fast greedy modularity community detection on
graphwith edgeweights. - fluid_
communities - Run Fluid Communities with default options
(seed = 0,
max_iterations=FLUID_DEFAULT_MAX_ITERATIONS). - fluid_
communities_ with_ options - Run Fluid Communities with full option control.
- infomap
- Run Infomap with the default options (unweighted, 1 trial).
- infomap_
weighted - Run Infomap with per-edge weights (1 trial).
- infomap_
with_ options - Run Infomap with full control over parameters.
- label_
propagation - Run label propagation with the default options
(
LpaVariant::Fast, no initial labels, no fixed vertices, seed0). - label_
propagation_ weighted - Run label propagation with per-edge weights (default variant, no
initial labels, no fixed vertices, seed
0). - label_
propagation_ with_ options - Run label propagation with the full option bag.
- le_
community_ to_ membership - Cut an incomplete dendrogram after
stepsmerges, starting from an initial (non-singleton) cluster assignment. - leading_
eigenvector - Detect communities using Newman’s leading eigenvector method.
- leading_
eigenvector_ weighted - Weighted leading eigenvector community detection (convenience wrapper).
- leiden
- Run Leiden with the default modularity objective,
γ = 1,β = 0.01, two iterations, seed0. - leiden_
weighted - Run Leiden with per-edge weights (modularity objective,
γ = 1,β = 0.01, two iterations, seed0). - leiden_
with_ options - Run Leiden with the full set of options.
- louvain
- Run Louvain with the default options (
γ = 1, unweighted, deterministic seed0). - louvain_
weighted - Run Louvain with per-edge weights (
γ = 1, deterministic seed0). - louvain_
with_ options - Run Louvain with the full set of options.
- modularity
- Modularity of
graphwith respect to community assignmentmembership. - modularity_
directed - Directed modularity (Leicht-Newman, ALGO-CO-001b).
- modularity_
matrix - Compute the modularity matrix B of a graph.
- modularity_
weighted - Weighted modularity (ALGO-CO-001c).
- reindex_
membership - Relabel a membership vector so cluster ids run contiguously over
0..k, wherekis the number of distinct clusters. The partition is unchanged: two vertices share a cluster in the output iff they shared one in the input. New ids are assigned in first-occurrence order — the first cluster id you encounter when sweeping left to right becomes0, the next new one becomes1, and so on. - spinglass
- Spinglass community detection with default options.
- spinglass_
weighted - Spinglass community detection with edge weights.
- spinglass_
with_ options - Spinglass community detection with full options.
- split_
join_ distance - Compute the two asymmetric projection distances between
comm1andcomm2. - walktrap
- Run Walktrap on an unweighted, undirected graph with default
steps = 4. - walktrap_
weighted - Run Walktrap on a weighted, undirected graph with default
steps = 4. - walktrap_
with_ options - Run Walktrap with a custom
WalktrapOptions.