1. Introduction
2. Model and methods
2.1. Community partition and spin states
Figure 1. (Left) Partition of community detection problem with 3 groups. (Right) Potts model with 3 spins, the spin glass analogy of group assignment partition. Those high lighted edges are examples of how Jij for edge (i, j) effect states (partitions) of both nodes. |
2.2. Distribution better than single optimum
Figure 2. Comparison of modularity maximization on random and structured networks. The adjacency matrices of two networks with N = 1000 nodes and average degree c = 3. Non-zero elements (edges) are shown as dots. (Left) An Erdős-Rényi (ER) random graph sorted by communities found using a greedy modularity maximization algorithm. Despite lacking true community structure, the algorithm 'discovers' illusory communities with a high modularity (Q ≈ 0.635). (Right) A network generated by the stochastic block model (SBM) with true community structure ($c_{\mathrm{out}}/c_{\mathrm{in}} = 0.2$), sorted by its ground truth partition. The modularity of the true partition (Q ≈ 0.326) is lower than that of the random graph's optimized partition, illustrating that maximizing modularity can lead to overfitting on random noise. |
2.3. Variational autoregressive method
2.3.1. Masked autoencoder for distribution estimation (MADE).
Figure 3. Multilayer perceptron (MLP) in 2 layer width with MADE. An initial spin configuration is input as a sample to the network. The colored sites denote the receptive field of a site in sample′, which is sampled from the possibility distribution $\tilde{x}$. We could extend the depth by connecting $\tilde{x}$ with an activation function tanh and the output would be the input to next layer. |
2.3.2. Multi-channel sampling.
Figure 4. Expanded output architecture of MADE. The representation for each node is expanded into q channels to model the probability distribution over q communities. The red highlighted sites illustrate the computational flow for determining the probability of assigning node 1 and node n to a specific group (e.g. the $(q-1)$th group). A softmax layer normalizes the logits across the q channels to produce a valid probability distribution for each node, from which the final discrete state σ is sampled. |
Figure 5. Multi-channel autoregressive framework and variational inference. We illustrate the process using an example graph with N vertices and 3 groups. The sample size (batch size) is denoted by B. The element $\sigma_{b,i,k} \in \{0,1\}$ represents the sampling outcome for vertex i assigned to group k in batch b. During the training process, sampling is performed based on a categorical distribution. |
3. Numerical experiments
3.1. Synthetic networks
Figure 6. Inference on SBM networks. Each data point represents the average result over 10 independent network generated by models under the same parameters. All with N = 100, q = 3. As the community structure becomes more pronounced (increasing $p_{\mathrm{in}}/p_{\mathrm{out}}$), VAN consistently identifies solutions with significantly lower variational free energy and stabler NMI (shorter error bar) compared to BP and naive mean field (NMF). |
Figure 7. Inference on DCSBM networks. Each data point represents the average result over 10 independent network generated by models under the same parameters. All with N = 100, q = 3. The expected degrees sampled from $\theta_i \sim \Gamma(3c, 1/c)$. As the community structure becomes more pronounced (increasing $\omega_{\mathrm{in}}/\omega_{\mathrm{out}}$), VAN consistently identifies solutions with significantly lower variational free energy and stabler NMI (shorter error bar) compared to belief propagation (BP) and naive mean field (NMF). |
Figure 8. Autonomous determination of the effective number of communities ($q^\star$) using VAN. The plots illustrate the robustness of our method against the hyperparameter $q_{\mathrm{max}}$. (a) On a synthetic graph generated by SBM with a ground truth of 3 groups, setting (N = 100, c = 3, η = 6.0), the detected number of communities accurately converges to 3 and remains stable even as $q_{\mathrm{max}}$ increases. (b) On the real-world Dolphins social network, the model identifies an optimal structure with 5 groups and avoids overfitting, maintaining this result despite the expansion of the search space ($q_{\mathrm{max}}$). These results demonstrate that VAN can effectively infer the intrinsic community structure without requiring an exact prior on the number of groups. |
Figure 9. Quantification of microscopic node-level uncertainty across synthetic and real-world networks. Vertices are colored according to their marginal Shannon entropy, computed directly from the continuous conditional probability distributions inferred by the VAN. (a) A low-noise SBM network (q = 3). (b) A highly structured DCSBM network (q = 2). (c) The empirical Contiguous USA network. |
Figure 10. Evolution of average node entropy across the detectability phase transition. The mean marginal entropy, S, evaluated over all nodes in synthetic SBM networks (N = 100, q = 3) is plotted against the signal-to-noise ratio, $p_{\mathrm{in}}/p_{\mathrm{out}}$, for average degrees $c = 3, 6, 10$. Vertical dashed lines indicate the respective theoretical Kesten-Stigum (KS) bounds. |
Figure 11. Visual comparison of node-level uncertainty at extreme signal-to-noise ratios. Both panels display synthetic SBM networks generated with an identical average degree (c = 6) but differing community strengths: (a) $p_{\mathrm{in}}/p_{\mathrm{out}} = 1.2$, deep within the undetectable phase; (b) $p_{\mathrm{in}}/p_{\mathrm{out}} = 8.0$, well within the detectable phase. |
3.2. Real-world networks
| • | ($\text { ● }$)On the 17-Nov network, VAN achieves $Q = 0.276\,056\,06$, marginally outperforming CNM ($0.276\,056\,01$). |
| • | ($\text { ● }$)On the Zebras network, VAN yields $Q = 0.276\,803\,86$, slightly higher than LN and Louvain ($0.276\,803\,83$). |
| • | ($\text { ● }$)On the classic Karate Club network, the score obtained by VAN ($0.444\,9036$) surpasses that of the greedy optimization-based Louvain algorithm ($0.444\,903\,58$). |
| • | ($\text { ● }$)For the larger Polbooks network, VAN evaluates to $0.527\,20$, improving upon the ∼0.527 00 scores of LN and Louvain. |
| • | ($\text { ● }$)On the largest and relatively dense Jazz Collab network in our test set (n = 198, m = 2742), where high-order nodal correlations become increasingly complex, VAN reaches a modularity of $0.444\,871\,19$, providing a slight edge over the strong spectral clustering baseline LN ($0.444\,666\,89$). |
Table 1. Performance comparison on real-world networks. The columns show the number of nodes (n), edges (m), and the modularity scores (Q) for various algorithms. For VAN, we report results under a unified upper bound of channels $q_{\mathrm{max}}$ (shown in parentheses) without prior knowledge of the true number of communities. The column $q_{\mathrm{VAN}}$ denotes the effective number of communities retained upon convergence. Bold entries indicate the highest modularity achieved on each network (displayed to three decimal places). |
| Network | n | m | $q_{\mathrm{VAN}}$ ($q_{\mathrm{max}}$) | $Q_{\mathrm{VAN}}$ | $Q_{\mathrm{BP}}$ | $Q_{\mathrm{NMF}}$ | $Q_{\mathrm{Louvain}}$ | $Q_{\mathrm{CNM}}$ | $Q_{\mathrm{LN}}$ |
|---|---|---|---|---|---|---|---|---|---|
| 17-Nov | 22 | 66 | 3 (8) | 0.276 | 0.000 | 0.096 | 0.275 | 0.276 | -0.024 |
| Zebras | 27 | 111 | 3 (8) | 0.277 | 0.021 | 0.256 | 0.277 | 0.277 | 0.277 |
| Karate Club | 34 | 78 | 4 (8) | 0.445 | 0.065 | 0.149 | 0.445 | 0.411 | 0.420 |
| Montreal | 35 | 78 | 4 (8) | 0.284 | -0.010 | -0.116 | 0.276 | 0.277 | 0.282 |
| Dutch Criticism | 35 | 81 | 3 (8) | 0.335 | 0.015 | -0.341 | 0.326 | 0.306 | 0.319 |
| Windsurfers | 43 | 336 | 2 (8) | 0.371 | 0.369 | 0.370 | 0.371 | 0.365 | 0.365 |
| Contiguous USA | 49 | 107 | 4 (8) | 0.597 | 0.469 | 0.408 | 0.596 | 0.582 | 0.597 |
| Terrorists 911 | 62 | 152 | 6 (8) | 0.536 | 0.225 | 0.356 | 0.519 | 0.500 | 0.534 |
| Dolphins | 62 | 159 | 5 (8) | 0.529 | 0.440 | 0.390 | 0.519 | 0.495 | 0.528 |
| Lesmis | 77 | 254 | 6 (8) | 0.560 | 0.533 | 0.361 | 0.549 | 0.501 | 0.560 |
| Polbooks | 105 | 441 | 5 (8) | 0.527 | 0.518 | 0.508 | 0.527 | 0.502 | 0.527 |
| Jazz Collab | 198 | 2742 | 4 (8) | 0.445 | 0.444 | 0.396 | 0.436 | 0.439 | 0.445 |
3.3. Hierarchical clustering
| Algorithm 1. Hierarchical node partitioning. |
|---|
| Require: Node embeddings $\mathbf{X} \in \mathbb{R}^{N \times D}$, Variational distribution $q_\theta(s)$, Initial node groups $\mathcal{G}_0$,Number of hierarchy levels K |
| Ensure: Hierarchical groups $\mathcal{H} = [\mathcal{G}_1, \mathcal{G}_2, \dots, \mathcal{G}_K]$ |
| 1: $\mathcal{H} \gets \emptyset$ |
| 2: for level $k \gets 0$ to K - 1 do |
| 3: $\mathcal{G}_{k+1} \gets \emptyset$ |
| 4: for each group $g \in \mathcal{G}_k$ do |
| 5: Initialize sub-groups: $\widetilde{g} \gets \{\widetilde{g}^1, \dots, \widetilde{g}^q\}$ as empty sets |
| 6: for each node $i \in g$ do |
| 7: Find next best assignment: $t_i = \operatorname{argmax}_{s} q_\theta(s_i)$ |
| 8: Mask current max: $q_\theta(t_i) \gets 0$ $\triangleright$Prepare for next level |
| 9: Add node i to sub-group $\widetilde{g}^{\mathrm{T}}_{i}$ |
| 10: end for |
| 11: Remove empty sets from $\widetilde{g}$ |
| 12: $\mathcal{G}_{k+1} \gets \mathcal{G}_{k+1} \cup \widetilde{g}$ |
| 13: end for |
| 14: $\mathcal{H}.\text{append}(\mathcal{G}_{k+1})$ |
| 15: end for |
| 16: return $\mathcal{H}$ |
Figure 12. Hierarchical community structure detection. In the hierarchical diagram, each leaf node represents a community within the network, with its size proportional to the number of nodes it contains. The colors of the leaves and edges indicate the sub-group assignments. The text below each subfigure lists the number of communities (Scales) and the corresponding modularity (Q) at various evolutionary hierarchical levels. |
