Skip to main content
NIHPA Author Manuscripts logoLink to NIHPA Author Manuscripts
. Author manuscript; available in PMC: 2026 May 16.
Published in final edited form as: Physica A. 2025 Mar 27;667:130536. doi: 10.1016/j.physa.2025.130536

CALF-SBM: A covariate-assisted latent factor stochastic block model

Sydney Louit a, Evan A Clark b, Alexander H Gelbard b, Niketna Vivek c, Jun Yan a, Panpan Zhang d,*
PMCID: PMC13178508  NIHMSID: NIHMS2172906  PMID: 42147753

Abstract

We propose a novel network generative model extended from the standard stochastic block model by concurrently utilizing observed node-level information and accounting for network-enabled nodal heterogeneity. The proposed model is so called covariate-assisted latent factor stochastic block model (CALF-SBM). The inference for the proposed model is done in a fully Bayesian framework. The primary application of CALF-SBM in the present research is focused on community detection, where a model-selection-based approach is employed to estimate the number of communities which is practically assumed unknown. To assess the performance of CALF-SBM, an extensive simulation study is carried out, including comparisons with multiple classical and modern network clustering algorithms. Lastly, the paper presents two real data applications, respectively based on an extremely new network data demonstrating collaborative relationships of otolaryngologists in the United States and a traditional aviation network data containing information about direct flights between airports in the United States and Canada.

Keywords: Bayesian estimation, Community detection, Gibbs sampler, Network analysis, Nodal heterogeneity, Node-level covariates

1. Introduction

Community detection garners widespread interest in network data analysis, with important applications in various fields such as social networks [1,2], brain networks [3], input–output networks [4], citation networks [5], and recommendation systems [6]. Broadly, there are two predominant classes of approaches to network community detection (or network clustering). The first class involves probabilistic graphical models characterizing network community structure, including stochastic block models [7,8], latent space models [1,9], and random dot product graphs [10], among others. The second class defines a network-metric-based objective function for each possible community structure, and then finds the community structure that optimizes the objective function. Most commonly used metrics are modularity [11] and its variants [12,13].

Most community detection methods focus primarily on network topology, represented by the adjacency matrix, but often overlook node-level attributes or edge features that could be informative. A pertinent question arises: can community detection accuracy improve by integrating auxiliary information from nodes or edges? Several recent studies addressed this by combining network topology with node attributes. Yang et al. [14] developed a scalable algorithm for binary-valued node attributes, later adapted for multilayer networks by Contisciani et al. [15]. Concurrently, Zhang et al. [16] introduced a joint community detection criterion that balances node connections and features through a tuning parameter. More recently, Yan and Sarkar [17] targeted sparse networks using a covariate regularized community detection algorithm, a concept subsequently extended to multilayer networks by Xu et al. [18]. Other recent developments in community detection algorithms accounting for covariates include the following: Binkiewicz et al. [19] improved spectral clustering by leveraging node covariates; Zhang et al. [20] proposed a stochastic block model based on the fusion of block-wise effects and node features; Relvas et al. [21] used node covariates to model cluster centroids; Hu and Wang [22] considered a community detection method using node covariates modified by network connectivity. To the best of our knowledge, research simultaneously considering node covariate information and nodal heterogeneity for network generation process under the general stochastic block modeling framework is scarce.

In this paper, we propose a novel stochastic block model that leverages observed node-level covariates influencing network connectivity and latent node-level variables determining nodal heterogeneity. The model aims to enhance clustering accuracy by incorporating auxiliary node information. The inference is done in a Bayesian framework. The number of communities is assumed unknown, and will be chosen through a standard but effective model selection procedure. Our model is distinct from a very recent algorithm [23], which is based on a covariate-dependent random partition model without taking nodal heterogeneity into account. Our main contribution is a new network generative model accounting for both node-level covariates and nodal heterogeneity. Through comparisons with popular competing methods and real data applications, we illustrate the importance of taking these factors into account in network clustering. Our implementation is publicly available via a user-friendly R package calfsbm on GitHub.

The rest of the manuscript is organized as follows: Section 2 introduces a novel stochastic block model simultaneously accounting for node-level covariates and heterogeneity. Section 3 provides the details of a Bayesian estimation algorithm for the proposed model, including prior distribution derivations, a practical strategy for hyperparameter initialization, a post-sampling procedure necessary for model identifiability and an effective approach for estimating community number when it is unknown. Simulations are presented in Section 4, which is split into two subsections respectively for known and unknown community numbers. Two real network data applications based on an otolaryngologist collaboration network and an airport reachability network are discussed in Section 5, followed by concluding remarks and discussions about the limitations and future works in Section 6.

2. Model

Given an undirected network G≔(V,E) with node set V and edge set E, let n=|V| be the number of nodes in G. By convention, the structure of G is characterized by the associated adjacency matrix A≔Aijn×n with Aij=1 indicating the existence of an edge between nodes i∈V and j∈V;Aij=0, otherwise. Self-loops are not considered throughout. For each i∈V, we define a membership vector Zi≔Zi1,Zi2,…,ZiK∈{0,1}K, where Zik=1 indicates that node i belongs to community k∈[K]={1,2,…,K}. The number of communities K is unknown. The vector Zi is typically modeled by a multinomial distribution: Zi~Multinomial1,αi, where αi≔αi1,αi2,…,αiK is a hyperparameter vector with αik∈[0,1] and ∑k=1Kαik=1. The membership indicator for node i (denoted as πi) is fully dependent on Zi, defined as πi≔argmaxk∈[K]Zi for each i. In a standard stochastic block model [SBM,8,24], the probability of the existence of an edge between nodes i and j follows a Bernoulli distribution with probability ηπi,πj∈[0,1], which depends on the communities that i and j belong to. Given πi=k and πj=l with k,l∈[K], we write ηπi,πj as ηi,j∣k,l for simplicity and clarity.

In the present research, the standard SBM is extended from two aspects. First, we incorporate observed node-level information into the model. For each i∈V, we consider a p-dimensional covariate vector Xi, which contains auxiliary information that may contribute to node connectivity pattern. For any pair of nodes i,j∈V, we define a dual measure Sij≔gXi,Xj∈R to quantify the similarity between the two nodes based on their covariates, where, for the special case of Xi=Xj, the function gXi,Xj yields 0. Moreover, the function g(⋅) is symmetric for undirected networks. Then we model the probability ηi,j∣k,l using a logit function as follows:

logitηi,j∣k,l=β0+βklSij,

where β0 presents a baseline commonality across all communities, and βkl specifies the homogeneity of edge connection preserved between communities k and l. For compactness, let β denote the collection of β0 and all βkl’s.

The second extension involves incorporating node-level latent factors that reflect nodal heterogeneity and their propensity for connections. Let θi denote the latent factor for node i∈V, presenting its tendency of generating links. Then, ηi,j∣k,l is characterized by

logitηi,j∣k,l=β0+βklSij+θi+θj, (1)

where large, positive values of θi and θj jointly promote the connection between i and j. For tractability, we assume that θi’s, for i=1,2,…,n, are independent and follow a normal distribution with mean 0 and unknown variance σ2 as suggested by Hoff [25].

To summarize, we propose a covariate-assisted latent factor stochastic block model (CALF-SBM) that simultaneously accounts for observed node-level characteristics and latent node-level factors. Given the number of communities K, Eq. (1) defines the rate parameter ηi,j∣k,l for a Bernoulli trial characterizing the presence of an edge between nodes i and j. That is

PrAij=1∣πi=k,πj=l,β,θi,θj,σ2;K,Xi,Xj=ηi,j∣k,l. (2)

In addition to the parameters in Θ≔β⊤,θ⊤,σ2⊤, we are interested in Z which determines community structure and K which is unknown in practice. The inference of Z is done together with the other parameters in Θ through a Bayesian estimation framework. To infer K, we employ a model selection procedure. Both will be detailed in a subsequent section. Consequently, the observed data likelihood, assuming that K is known, is formulated under the standard assumption of conditional independence given membership information. The likelihood of the proposed CALF-SBM with a given K is

ℒ(Θ,Z∣A;K,X)=∏i<jηi,j∣k,lAij1-ηi,j∣k,l1-Aij, (3)

where ηi,j∣k,l is defined in Eq. (1). Likelihood estimation of Eq. (3) is computationally challenging due to the large number of parameters and the marginal likelihood derivation of each parameter (or latent factor) requires a high dimensional integration. Therefore, we adopt a Bayesian estimation approach. We would like to note that the proposed model can be extended to directed networks with effortless modifications.

3. Bayesian estimation

We consider a fully Bayesian estimation for the proposed model using a Markov Chain Monte Carlo (MCMC) algorithm, for which K is fixed, followed by a model selection procedure to determine the optimal K value.

3.1. Prior and posterior

In our model, we impose hierarchical prior structures in order to make the prior assumptions vague assuming known K. Inspired by Handcock et al. [1], we propose the following prior distributions to complete the Bayesian specification:

  1. β≔β0,β11,β12,…,βKK~MVN(μ,Σ),

  2. σ2~IG(a,b),

  3. αi≔αi1,αi2,…,αiK~i.i.d.Dir(γ),

where MVN(μ,Σ) represents the multivariate K2+K/2+1-variate in our model) normal distribution with mean vector μ and covariance structure Σ,IG(a,b) represents the Inverse-Gamma distribution with shape parameter a and scale parameter b, and Dir(γ) represents the Dirichlet distribution with concentration parameters γ. The symbols μ,Σ,a, and γ≔γ1,γ2,…,γK comprise our hyperparameters. All hyperparameters are specified by the users based on actual available prior knowledge about unknown parameters and latent factors.

The MCMC algorithm iterates over the model parameters and latent factors with the given priors. For those with full conditional distributions in closed forms, we sample them directly via Gibbs sampling; otherwise we adopt a Metropolis–Hastings algorithm [26]. For succinctness, we use ‘others’ to denote all the unknowns other than the parameter or latent factor explicitly specified in the formulas. The full conditional posterior distributions are given as follows:

  1. p(β∣others)∝ϕ(β;μ,Σ)ℒ(Θ,Z∣A;K,X);

  2. pθi∣others)∝ϕθi;0,σ2ℒ(Θ,Z∣A;K,X);

  3. σ2∣others~IGa+n/2,b+∑i=1nθi2/2;

  4. pZi∣others)∝fZi;αiℒ(Θ,Z∣A;K,X);

  5. αi∣others~Dirγ+Zi;

where ϕ(⋅) in (1) is the density of a K2+K/2+1-variate normal distribution, ϕ(⋅) in (2) is the density of a univariate normal distribution, and f(⋅) in (4) is the density of a Dirichlet distribution, respectively.

The prior distributions were set to be vague but proper to ensure proper posterior distributions. In particular, for the regression coefficients, we set μ=0 and Σ=100I, where I is the identity matrix. This prior distribution covers a wide range of regression coefficient values. Then for σ2, we set a=b=1 such that the associated Inverse-Gamma distribution has an infinite mean, and meanwhile provides a sufficiently large variation for θi values. Lastly, we sample each γi in γ independently from Beta(1,K), which provides large but not excessive variability in cluster size.

3.2. Initialization strategy

Appropriate initial values are critical for the convergence of MCMC-based algorithms. We propose an effective strategy for initial value specifications to greatly reduce the number of iterations and computing time for the proposed MCMC algorithm.

Specifically, we set the initial node memberships (i.e, πi(ini) for i=1,2,…,n) by implementing a K-medians clustering algorithm [27] to the observed data. The initial value of θi, for i=1,2,…,n, depends on the observed degree of node i (denoted di), given by θi(ini)=logdi/∑i=1ndi/n+c), where c=10-4 is an offset constant ensuring the validity of logarithm function (especially for isolated nodes with di=0). Given πi(ini)’s and θi(ini)’s, we ran a logistic regression [28] on observed adjacency matrix Aij’s with calculated Sij’s (based off fully observed Xi’s and Xj’s) and (θi(ini)+θj(ini))’s as covariates to get the initial values for the regression coefficients: β(ini).

3.3. Implementation

The MCMC was implemented with R package NIMBLE [29], which provides an interface of programming algorithms using modeling languages from the BUGS (Bayesian inference Using Gibbs Sampling) project. NIMBLE is particularly popular for generating samples from the complicated posterior distributions that are not in closed forms via the Metropolis–Hastings algorithm. Meanwhile, NIMBLE is appealing for automatically determining available conjugate families to improve sampling efficiency. For more detailed features and advantages of NIMBLE, we refer the interested readers to the pioneering paper by de Valpine et al. [30].

The codes for practical implementation are made publicly available in an R package, which collects all the functions needed to fit the CALF-SBM (including diagnostic tools). The package, called calfsbm, is available on GitHub: https://github.com/sydneylouit539/calfsbm.

3.4. Post-sampling procedure

Like many other network models for community detection, the proposed CALF-SBM experiences non-identifiability since the likelihood described in Eq. (3) is invariant to the permutation of node membership labels Z. This particular dilemma is referred to as the label-switching problem [31]. Thus, a post-processing procedure must be implemented prior to drawing inference for Z.

Specifically, we post-process the posterior MCMC samples by applying the artificial identifiability constraints method. More precisely, we re-organize the rows and columns of the coefficient matrix β according to the constraint: β11<β22<⋯<βKK for each posterior sample, followed by a re-assignment of individual membership in accordance with the re-ordered βkl’s. In practice, the implementation is done by using a built-in function from the label.switching package [32], which is available in the CRAN. We find that this approach is particularly useful for smaller networks with fewer available data.

3.5. Number of clusters

In the majority of existing research for community detection, the number of clusters, K, is assumed to be known a priori [2,16]. However, this assumption appears unrealistic in practice. Estimating the number of clusters itself is a challenging problem that has received a great deal of attention.

Recent research [23,33] proposed a dynamic framework that estimates K in an iterative manner, together with other unknown parameters and latent factors. However, as mentioned by Geng et al. [33], these methods tend to create small extraneous communities with roughly even size, resulting in overestimating K, which is also observed in our simulations in Section 4. Besides, the change of K causes the change of dimension of regression coefficients for the proposed model, giving rise to additional challenges for algorithm convergence (even with an informative prior on K).

Thus, we resort to a model selection approach as performed by Handcock et al. [1], where the fundamental idea is to make inference about unknown parameters and latent factors with a wide range of K values, and then select the optimal value of K according to some information criterion. While the Bayesian information criterion (BIC) was selected by Handcock et al. [1], we choose the widely applicable information criterion [WAIC,34], since the WAIC averages over the posterior distribution instead of conditioning on a point estimate [35], making it more helpful for models with hierarchical and mixture structures like the proposed CALF-SBM. The calculation of WAIC can be conveniently done via a built-in function from NIMBLE.

4. Simulation studies

In this section, we carry out extensive simulations to assess the goodness-of-fit of the proposed model and its performance against popular competing methods in the literature. The simulation study is divided into two parts: known K and unknown K. For each, different competing methods are considered alongside sensitivity analyses that will be elaborated explicitly. The R codes for all the simulations are available in the online supplements with well-documented random numbers for reproducibility.

4.1. Data generation

Motivated from the two real network data in Section 5, we generated synthetic networks with n∈{200,400} and K∈{2,3,4}, with 100 networks being generated for each combination of n and K. Concurrently, node membership Zi, for i=1,2,…,n, was drawn from an unbalanced multinomial distribution of size K and probability parameters proportional to (K,K-1,…,1)⊤. The intercept term β0 was fixed to 1, leading to network density of approximately 10%. We set the within-cluster effects βkk, for k=1,2,…,K to equally-spaced values between −1.6 and −1. Assuming K=4, for instance, the values of βkk for k=1,2,3 and 4 were respectively set to −1.6, −1.4, −1.2 and −1. On the other hand, all the between-cluster effects (i.e., βkl with k≠l) were fixed to −3, resulting in a smaller probability of establishing links across nodes from different communities.

Given the clustering configuration, we generated the p-dimensional covariates X in two steps. First, we chose K equally spaced points on the surface of a p-dimensional ball with radius 2ω(ω>0) as the centers of K communities. Since these selected points were invariant in rotation, we, in practice, proposed to use the polar coordinate system for the center selection; For instance, the points denoted by (2ω,2kπ/K) with k=1,2,…,K were chosen for p=2. Second, for i=1,2,…,n, we independently drew Xi from a p-variate normal distribution with mean at the selected point corresponding to the clustering membership (of node i) in the first step and covariance matrix Ip. Since the variance–covariance structure of X is fixed, the ball radius 2ω determines the degree of cluster overlapping explained by Xi’s from different communities, with a larger value of ω signifying a more significant community structure governed by observed covariates, and consequently indicating a stronger signal-to-noise ratio. For each pair of generated Xi and Xj, we employed the Euclidean distance to construct the covariate-based similarity structure Sij.

After generating latent factors presenting node connectivity tendency using θi~i.i.d.𝒩(0,0.3), we created Aij=Aji based on the proposed model given in Eq. (2) for each pair of distinct nodes i and j. Accordingly, the generated networks were undirected. Throughout the simulation, we set Aii=0 for all i=1,2,…,n to exclude self-loops. For each replicate, the adjacency matrix and node covariates are assumed to be observed, whereas the true clustering and nodal heterogeneity information are latent.

4.2. Results

In this section, we present our simulation results that help assess the performance of the proposed CALF-SBM as well as its comparison to other competing methods in the literature. For each study, a total of 200 independent synthetic network data were generated according to the approach detailed in Section 4.1. For each simulation run for CALF-SBM, we fixed the burn-in number and the (follow-up) number of iterations to 5000 and 104, respectively. The thinning parameter was set to 10 to reduce the auto-correlation in the posterior samples. In addition, three chains were run simultaneously for a combination of posterior samples. We employed the Gelman–Rubin diagnostic [36] alongside trace plots to examine the convergence of posterior samples, where we found that the total number of iterations under the current setting was sufficiently large to ensure convergence.

4.2.1. Known K

The first task is to evaluate the performance of the algorithm for recovering the parameters in the CALF-SBM based on the 200 independent replicates of simulated networks. We ran simulations for both n=400 and n=200 with fixed ω=1.5, and observed similar results, so only present those for n=400 with K∈{2,3,4} in Table 1. Specifically, we provide bias, standard error (SE), empirical standard deviation (ESD) and coverage percentage (CP) for each scenario (e.g., {n=400,K=2}), and conclude that the estimates from the proposed algorithm are unbiased and consistent.

Table 1.

Estimation summary for n=400 with K={2,3,4} and ω=1.5. SE: standard error; ESD: empirical standard deviation; CP: coverage percentage (%).

Para. K=2 K=3 K=4
Bias SE ESD CP Bias SE ESD CP Bias SE ESD CP
β0 0.006 0.044 0.042 95 0.001 0.045 0.051 93 0.005 0.051 0.051 94
β11 −0.003 0.026 0.025 95 0.000 0.038 0.039 94 −0.025 0.047 0.061 86
β12 −0.002 0.041 0.039 95 −0.001 0.059 0.065 92 0.000 0.086 0.138 97
β22 −0.001 0.026 0.023 97 −0.004 0.031 0.032 93 −0.013 0.049 0.048 96
β13 −0.005 0.059 0.049 98 −0.022 0.086 0.073 98
β23 0.001 0.058 0.062 95 −0.025 0.089 0.133 96
β33 0.001 0.024 0.021 96 −0.006 0.045 0.043 94
β14 −0.013 0.087 0.075 97
β24 0.004 0.092 0.140 97
β34 −0.002 0.089 0.089 96
β44 0.005 0.046 0.050 93
σ −0.001 0.015 0.015 97 0.001 0.017 0.017 97 0.003 0.012 0.010 98

Further, we compare the proposed CALF-SBM with a collection of competing methods that require the knowledge of the true value of K for community detection. Specifically, we consider k-means algorithm, k-medians algorithm, spectral clustering and covariate-assisted spectral clustering [CASC,19]. We evaluate the performance of each method through the accuracy of node membership assignment, quantitatively measured by the Adjusted Rand Index [ARI,37], which is ranged between 0 and 1 with 0 and 1 indicating random assignment and perfect matching, respectively. For our simulation, ARI is particularly preferred since it is invariant to label-switching and also robust against unbalanced cluster sizes. Fig. 1 exhibits side-by-side box plots for the considered models with varying network size n∈{200,400} and varying signal-to-noise ratio levels (quantified through ω∈{0.5,1.5}) for additional sensitivity investigation.

Fig. 1.

Fig. 1.

Comparisons of clustering results between the proposed CALF-SBM and competing methods using ARI with network size n∈{200,400} and signal-to-noise ratios (S/N ratio) ω∈{0.5,1.5}.

The results in Fig. 1 suggest that the overall performance of the proposed CALF-SBM is better than the competing methods regardless of network size or signal-to-noise ratio level. Specifically, when network size is small and signal-to-noise ratio is weak, CALF-SBM outperforms the competing methods reflected in more accurate clustering as well as smaller variations, although, at the same time, CALF-SBM undergoes with a drawback of more outliers. CACS is slightly more accurate than spectral clustering, whereas k-means and k-medians algorithms do not perform well since they fail to account for observed network structure throughout clustering. When network size is small but cluster signal becomes stronger, the accuracy of CALF-SBM is notably improved and the variance is significantly reduced, while the improvement in the accuracy of CASC is limited. All the other three methods perform similarly in spite of great improvements in k-means and k-medians. When network size increases, the proposed CALF-SBM, in average, provides perfect matching results with minimal variations, but does not seem to be as robust as spectral clustering and CASC due to a greater number of outliers. When the signal-to-noise ratio increases from 0.5 to 1.5, the variance of CALF-SBM decreases further, while the number of outliers does not change much. Meanwhile, the accuracy of spectral clustering and CASC decreases slightly. Nonetheless, k-means and k-medians are less preferred owing to relatively low accuracy.

In addition to ARI, we adopted normalized mutual information [NIM,38] to evaluate the clustering performance of CALF-SBM and compared it with the considered competing methods. Unlike ARI, which measures the agreement between clustering assignments based on pairwise comparisons, NMI uses information theory to quantify the mutual dependence between clustering assignments. NMI scores range from 0 to 1 with 0 and 1 respectively indicating no similarity and perfect similarity. The use of NMI can provide a more comprehensive assessment of CALF-SBM. We provide NMI-based side-by-side box plots to compare CALF-SBM with the four competing methods in Fig. A.5 in Appendix A, and find that CALF-SBM outperform all competing methods in a similar manner as discussed for Fig. 1.

4.2.2. Unknown K

The second simulation study aims to assess the performance of the proposed CALF-SBM for unknown K, alongside comparisons with the standard SBM [24] which ignores node-level covariates, and a recently developed Bayesian community detection model utilizing covariates [BCDC,23]. Analogously, all the simulation results presented in this section are based on 100 independent replicates with fixed n=400 and ω=1.5 suggesting a relatively strong signal-to-noise ratio level. Statistical inferences for both (standard) SBM and BCDC are drawn using MCMC algorithms which can be practically implemented via the utility functions from the R package bcdc [23]. The specific MCMC configurations for all three models are given in Table 2, where the burn-in and iteration numbers for BCDC are based on the default settings in the associated functions. As SBM does not account for node-level covariates throughout clustering, our experiments show that the burn-in number of 500 is sufficiently large for the algorithm to converge when network size is n=400.

Table 2.

A summary of MCMC configuration setup for CALF-SBM, SBM and BCDC.

CALF-SBM SBM BCDC
Burn-in 5000 500 5000
Iteration 10 000 1500 15 000
Thinning 10 1 1

We first evaluate all three methods through their performances of the selection of true community number K. Specifically, we considered two sets of true K values: K=3 and K=4. For CALF-SBM and SBM, we selected the optimal K via model selection from K∈{2,3,…,6}. Specifically, we adopted WAIC for CALF-SBM as elucidated in Section 3.5 and the Bayesian information criterion (BIC) for SBM. The selection of K for BCDC followed the Bayesian framework established by Liu et al. [6]. The dynamic selection of K for BCDC requires a pre-specification of the concentration parameter for the Chinese Restaurant Process used in their algorithm. This concentration parameter in our simulations was determined by the method of moments given the true value of K. The results are summarized in Table 3, where we observe that the proposed method for CALF-SBM has a higher probability of selecting the correct K than the two competing approaches, both of which tend to overestimate K.

Table 3.

A summary of the selection of community number K among CALF-SBM, SBM and BCDC for n=400,ω=1.5.

Method True K=3 True K=4
2 3 4 5 6 7 2 3 4 5 6 7
CALF-SBM 0 48 9 15 28 – 0 1 60 23 16 –
SBM 0 0 17 38 45 – 0 1 13 29 57 –
BCDC 0 0 12 51 17 0 0 0 11 39 40 10

Next, we assess the method performances for community detection using box plots analogous to the strategy demonstrated in Section 4.2.1. The results are shown in Fig. 2. For K=3, CALF-SBM outperforms SBM and BCDC on average, but undergoes a much greater variance. SBM and BCDC present comparative performances, but SBM appears slightly preferable to BCDC thanks to fewer ARI outliers on the lower end. For K=4, CALF-SBM is, once again, better than SBM and BCDC on average. In fact, the median ARI for CALF-SBM is close to 1 which refers to a perfect matching (with respect to the ground truth). The improvement of the ARI values (from K=3 to K=4) is related to a higher frequency of selecting the correct K as shown in Table 3. Moreover, we see a substantial reduction in the variance of ARI for CALF-SBM with K=4 (compared to K=3), where the variances of ARI for both SBM and BCDC increase. This is most likely caused by the smaller cluster sizes, leading to higher fluctuation in the fit. At last, Fig. B.6 in Appendix B presents the NMI-based side-by-side box plots corresponding to Fig. 2 as shown above.

Fig. 2.

Fig. 2.

Comparisons of clustering results between the proposed CALF-SBM and competing methods using ARI with n=400,ω=1.5 and varying K∈{3,4}.

5. Real data applications

In this section, we demonstrate the utility of CALF-SBM through two real data applications. The first application explores a collaboration network of otolaryngologists in the United States, utilizing data recently collected by researchers at Vanderbilt University Medical Center. The second application examines an aviation network, which was initially studied to assess the accessibility, in terms of airline travel time, of cities in Canada and the United States [39].

5.1. Otolaryngologist collaboration network

We applied the CALF-SBM to a network of otolaryngologist collaboration (OCN), with data collected and maintained by a subset of the authors at Vanderbilt University Medical Center. The network encompasses all 129 U.S. residency programs accredited by the Accreditation Council for Graduate Medical Education. Comprehensive data on 2494 physician faculty members, including names, genders, institutional affiliations, and specialties, were compiled through extensive web scraping. Our Python scripts facilitated the identification of each physician’s Scopus ID, with subsequent human review for disambiguation. We acquired publication data for those with valid Scopus IDs via multiple Elsevier APIs, collecting all Scopus-indexed articles authored by the identified physicians up to December 2023. The dataset, derived from publications co-authored by at least two identified physicians, included 2259 physicians and 88245 collaborative relationships.

The CALF-SBM application utilized two covariates for each physician: institutional affiliation and specialty. The specialties were categorized into seven types: Laryngology, Rhinology, Head & Neck, Neurotology, Facial Plastics, General, and Pediatric. To enhance the interpretability of results and maintain computational feasibility, we filtered the network data to include only physicians from institutions with at least 20 occurrences. This resulted in a final dataset comprising 309 physicians affiliated with 12 medical schools or hospitals, and 2630 collaborative relationships. For each physician pair i and j, we computed Sij, the similarity measure, based on the average match of their institutions and specialties, formulated as [1(institutei=institutej)+1(specialtyi=specialtyj)]/2, where 1(⋅) is the standard indicator function. We configured the burn-in and iteration numbers at 10000 and 30000, respectively, to ensure the convergence of the MCMC algorithm, verified by the trace plots of the posterior samples. We evaluated potential cluster numbers ranging from K=2 to K=7, ultimately selecting K=6 as optimal based on the WAIC. The clustering results (generated using Pedersen [40]) are shown in Fig. 3, where the node size is proportional to the logarithm of node degree. Cluster 5 is the largest, predominantly comprising physicians with fewer connections within the network. Conversely, Cluster 3, while being the smallest, includes physicians who are densely connected, indicating strong collaborative ties.

Fig. 3.

Fig. 3.

Clustering results for OCN based on the application of CALF-SBM (K=6), where the node sizes are proportional to the logarithm of their degrees.

Given the limited information in Fig. 3, further in-depth analysis on each community is presented in Table 4, which specifically contains cluster size, the most frequent institution (in each cluster), the most frequent specialty (in each cluster), cluster density, and the largest node degree (in each cluster). The smallest communities, Clusters 3 and 5, exhibit extremely high connectivity among their physicians. Specifically, Cluster 3 predominantly consists of specialists in rhinology (50%), while Cluster 5 is mainly composed of pediatric specialists (86%). Clusters 1, 2, and 4 have similar sizes and within-cluster densities. Cluster 1 is primarily made up of physicians from the University of Michigan Health System, specializing in Head & Neck and Pediatric, whereas Cluster 2 includes key participants from Massachusetts Eye and Ear Infirmary/Harvard Medical School and University of North Carolina Hospitals with similar specialties. Montefiore Medical Center/Albert Einstein College of Medicine is notably present in both Clusters 1 and 2, with physician memberships significantly influenced by the community affiliations of their connections. Cluster 4 chiefly involves physicians from Icahn School of Medicine at Mount Sinai/New York Eye and Ear Infirmary at Mount Sinai, specializing in “general”. Despite being the largest, Cluster 5 displays much lower density as nearly half of its physicians have 2 connections or fewer, a contrast to other clusters.

Table 4.

Summary of community properties by applying CALF-SBM, including community size, dominant institution, dominant specialty, community density and maximum (node) degree.

Size Institution Specialty Density Max Deg.
Cluster 1 46 Michigan (35%) Head & Neck (30%) 0.14 22
Cluster 2 59 Harvard (19%) Head & Neck (22%) 0.08 13
Cluster 3 12 Northwestern (33%) Rhinology (50%) 1.00 11
Cluster 4 63 Mount Sinai (33%) General (33%) 0.09 18
Cluster 5 115 Mount Sinai (24%) General (18%) 0.02 15
Cluster 6 14 Michigan (29%) Pediatric (86%) 1.00 13

Further, the estimate of β0 is −0.70, indicating an average probability of connection of 0.33. However, the actual density of OCN is just 0.03, which explains that most estimates of (β11,β12,…,β66) are negative. As expected, the estimates for intra-cluster coefficients of β (average 3.19) are greater than those for inter-cluster coefficients (average −3.51). In particular, there are only two positive estimates for β,βˆ55=11.37 and βˆ66=15.99, which suggests that the connectedness between physicians within Clusters 5 and 6 depends largely on their commonality in institutions and specialties. The estimates of subject-level latent factors, θ, are centered around −0.01, while the estimate of standard deviation is 1.51, suggesting that the effects of individual latent factors on connectivity are lower than those of clustering membership. Moreover, we conduct post-hoc analyses to evaluate the Cramér’s V between clustering membership and institution (0.36, Chi-squared test p = 0.001) and the Cramér’s V between clustering membership and specialty (0.26, Chi-squared test p = 0.001), respectively. Lastly, by fitting a generalized linear model relating clustering membership and θ estimates, adjusted for institutions and specialties, we find p = 0.005, which suggests the need to account for subject heterogeneity in the model.

5.2. Airport reachability network

The second real data application examines an airport reachability network (ARN), as outlined by [ARN,39], which includes data on direct flights among major airports in the U.S. (covering all continental states and Hawaii) and Canada. The ARN comprises a total of 456 airports. The two covariates utilized are the geographical locations of the airports (expressed through latitude and longitude) and the log-transformed metropolitan populations of the cities hosting these airports. In constructing the similarity matrix, two components were considered: the great-circle distances between airports, which account for Earth’s curvature, and the population differences between the associated metropolitan areas. As recommended by Shen et al. [23], these difference measures were scaled to unit variance before being combined with equal weighting to complete the similarity matrix.

The original ARN described in Frey and Dueck [39] is directed. We adapted it to an undirected network by ensuring that a link exists between two airports if there is at least one direct flight in each direction. This modification resulted in an undirected network nearly structurally equivalent to the original directed ARN. Typically, if an airport A has direct flights to another airport B,B often has return flights to A. The nature of ARN necessitates the inclusion of latent factors (i.e., θ) to address the significant degree heterogeneity observed, with major hubs connecting to hundreds of airports, whereas most airports in smaller cities have fewer connections. This degree heterogeneity is illustrated in Fig. 4, where each node’s size is proportional to its degree.

Fig. 4.

Fig. 4.

Clustering result based on the application of CALF-SBM to the undirected ARN.

To apply CALF-SBM to the ARN, we set the burn-in and iteration numbers to 5000 and 10000, respectively, ensuring the convergence of the MCMC algorithm. We determined that K=8 was the optimal number of clusters based on WAIC. The clustering results are also depicted in Fig. 4. Due to the high density of the network, edges are omitted in the figure for clarity. Additional information about the cluster summaries is provided in Table 5.

Table 5.

Summary of community properties of airports across the U.S. and Canada, including community size, (approximate) center, largest airport (in terms of number of connections), metropolitan size median and community density.

Size Center Largest Airport Median Metro Density
Cluster 1 51 Saskatchewan St. Johns, NL 46,850 0.18
Cluster 2 41 Michigan Harrisburg, PA 81,445 0.24
Cluster 3 120 Kentucky Greenville, SC 162,052 0.26
Cluster 4 72 Utah Amarillo, TX 60,129 0.33
Cluster 5 33 Idaho Boise, ID 186,738 0.55
Cluster 6 41 Minnesota Knoxville, TN 110,138 0.85
Cluster 7 31 Indiana Los Angeles, CA 972,634 0.87
Cluster 8 67 Kansas San Francisco, CA 1,795,000 0.97

Table 5 suggest that the estimated clusters correlate with both the geographical locations of airports and the sizes of the cities in which they are situated. Cluster 1 predominantly includes small airports in Canada, with more than 75% located in cities having a metropolitan population under 50,000. Cluster 2 consists of small airports in the Eastern U.S. and smaller Canadian airports not included in Cluster 1. In contrast, Cluster 4 comprises small airports in the Western U.S., with no Canadian airports. Cluster 3 diverges by encompassing medium-sized airports in the Eastern U.S. @and is the largest of the identified communities. Clusters 5 and 6 mainly contain medium to large airports, with Cluster 5 being more western (centered in Idaho) and Cluster 6 more northern (centered in Minnesota).

Clusters 7 and 8 primarily consist of the largest air hubs in North America, exhibiting high internal connectivity. Despite this, there is no clear geographical distinction separating these clusters. Cluster 7, smaller in size, includes fewer hubs located predominantly in the central and western U.S.: Chicago, Illinois; Dallas/Fort Worth, Texas; Las Vegas, Nevada; Los Angeles, California; Minneapolis/St. Paul, Minnesota; and Salt Lake City, Utah. Conversely, Cluster 8, which is twice the size of Cluster 7, contains hubs that are more dispersed across the U.S., with a majority on the east coast: Atlanta, Georgia; Boston, Massachusetts; New York City, New York; Washington, D.C.; the southern U.S.: Denver, Colorado; Phoenix, Arizona; and notable west coast hubs: San Francisco, California; and Seattle/Tacoma, Washington. Despite San Francisco being the most connected with 442 connections, as noted in Table 5, Cluster 8 also features airports of comparable size, such as Washington D.C. (with 432 connections) and New York City (with 428 connections).

6. Discussions

This paper introduces an extended SBM, called CALF-SBM, that simultaneously incorporates node-level covariates and nodal heterogeneity to improve network clustering. The associated MCMC algorithm is capable of generating unbiased estimates for model parameters. The implementation of the proposed algorithm is based on the NIMBLE package which compiles it using C++ for speed. The number of communities is assumed unknown, and can be accurately estimated using a reliable model selection approach. According to our simulation studies, the proposed CALF-SBM outperforms popular competing methods for network clustering. Applications to the two real network data give new insights into their respective community structures. User-friendly functions for directly implementing CALF-SBM are available in an R package on GitHub.

In the current project, there is an issue that requires further study. Variable selection regarding node covariates has not been considered in the proposed CALF-SBM, but there may be noise covariates that do not contribute to network generation and potentially affect inference accuracy. Some preliminary experiments show that the presence of noise covariates leads to biased estimates, but the clustering performance is still satisfactory. Nevertheless, systematic research is still needed to address model robustness. Besides, there are several potential extensions to the current CALF-SBM. First, while the proposed MCMC algorithm is implemented in C++, it remains computationally demanding and faces convergence challenges for large networks. This indicates a need for improvements to enhance scalability. One potential consideration is the variational Bayesian approach [41], but its feasibility and performance (under various scenarios) are not straightforward, deserving a comprehensive study. Secondly, the model is readily extendable to directed networks; however, this generalization, though conceptually simple, requires more network data for reliable inference, emphasizing further the need to improve algorithm scalability for handling big network data. Ultimately, the model should also adapt to both weighted and directed networks with more accurate inference and richer result interpretation. Lastly, by incorporating edge-level attributes alongside node-level covariates, the model could become more powerful and flexible, potentially yielding more insightful network clustering outcomes by leveraging all available data.

Supplementary Material

1
2

Acknowledgments

We would like to thank two anonymous reviewers for their valuable comments and suggestions, which help us in improving the quality of the manuscript.

Evan Clark, Alexander Gelbard and Niketna Vivek were supported in part by NIH Grant 1R01HL146401. Jun Yan was supported in part by NSF Grant DMS2210735 and a seed grant KFS4659496 from the Institute for the Brain and Cognitive Science at the University of Connecticut.

Appendix A. Side-by-side box plots using NMI for the simulations in Section 4.2.1

Fig. A.5 shows that the proposed CALF-SBM outperforms the considered competing methods in all scenarios. The overall clustering accuracy of CALF-SBM improves with the increase of network size and signal-to-noise ratio, while the variance of NMI decreases notably. For CALF-SBM, outliers in NMI are still observed, but become less severe when the network size is larger and the signal-to-noise ratio is higher.

Appendix B. Side-by-side box plots using NMI for the simulations in Section 4.2.2

Fig. B.6 shows that the proposed CALF-SBM outperforms the two competing methods in terms of clustering accuracy. Although CALF-SBM experiences a larger NMI variance when K=3, it has fewer outliers than the other two methods. The NMI variance of CALF-SBM decreases with the increase of K, while the NMI variances of SBM and BCDC both get larger.

Appendix C. Supplementary data

The online supplement collects the R codes for reproducible simulations in Section 4.

Supplementary material related to this article can be found online at https://doi.org/10.1016/j.physa.2025.130536.

Fig. A.5.

Fig. A.5.

Comparisons of clustering results between the proposed CALF-SBM and competing methods using NMI with network size n∈{200,400} and signal-to-noise ratios (S/N ratio) ω∈{0.5,1.5}.

Fig. B.6.

Fig. B.6.

Comparisons of clustering results between the proposed CALF-SBM and competing methods using NMI with n=400,ω=1.5 and varying K∈{3,4}.

Footnotes

CRediT authorship contribution statement

Sydney Louit: Writing – original draft, Visualization, Software, Methodology, Formal analysis, Conceptualization. Evan A. Clark: Investigation, Data curation. Alexander H. Gelbard: Supervision, Investigation, Funding acquisition, Data curation. Niketna Vivek: Investigation, Data curation. Jun Yan: Writing – review & editing, Supervision, Software, Methodology, Funding acquisition, Conceptualization. Panpan Zhang: Writing – review & editing, Writing – original draft, Supervision, Software, Methodology, Formal analysis, Conceptualization.

Declaration of competing interest

The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

Data availability

Data will be made available on request.

References

  • [1].Handcock MS, Raftery AE, M. TJ, Model-based clustering for social networks, J. Roy. Statist. Soc. Ser. A 170 (2) (2007) 307–354. [Google Scholar]
  • [2].Ouyang G, Dey DK, Zhang P, A mixed-membership model for social network clustering, J. Data Sci 21 (3) (2023) 508–522. [Google Scholar]
  • [3].Sporns O, Betzel RF, Modular brain networks, Annu. Rev. Psychol 67 (2016) 613–640. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [4].Wang T, Xiao S, Yan J, Zhang P, Regional and sectoral structures of the Chinese economy: A network perspective from multi-regional input-output tables, Phys. A 581 (2021) 126196. [Google Scholar]
  • [5].van Eck NJ, Waltman L, CitNetExplorer: A new software tool for analyzing and visualizing citation networks, J. Inf 8 (4) (2014) 802–823. [Google Scholar]
  • [6].Liu J, Ye Z, Chen K, Zhang P, Variational Bayesian inference for bipartite mixed-membership stochastic block model with applications to collaborative filtering, Comput. Statist. Data Anal 189 (2024) 107836. [Google Scholar]
  • [7].Zhao Y, A survey on theoretical advances of community detection in networks, WIREs Comput. Stat 9 (5) (2017) e1403. [Google Scholar]
  • [8].Abbe E, Community detection and stochastic block models: Recent developments, J. Mach. Learn. Res 18 (177) (2018) 1–86. [Google Scholar]
  • [9].Hoff PD, Raftery AE, Handcock MS, Latent space approaches to social network analysis, J. Amer. Statist. Assoc 97 (460) (2002) 1090–1098. [Google Scholar]
  • [10].Athreya A, Fishkind DE, Tang M, Priebe CE, Park Y, Vogelstein JT, Levin K, Lyzinski V, Qin Y, Sussman DL, Statistical inference on random dot product graphs: A survey, J. Mach. Learn. Res 18 (226) (2017) 1–92. [Google Scholar]
  • [11].Newman MEJ, Modularity and community structure in networks, Proc. Natl. Acad. Sci. USA 103 (23) (2006) 8577–8582. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [12].Ouyang G, Dey DK, Zhang P, Clique-based method for social network clustering, J. Classification 37 (1) (2020) 254–274. [Google Scholar]
  • [13].Shang K-K, Small M, Wang Y, Yin D, Li S, A novel metric for community detection, Europhys. Lett 129 (6) (2020) 68802. [Google Scholar]
  • [14].Yang J, McAuley J, Leskovec J, Community detection in networks with node attributes, in: Xiong H, Karypis G, Thuraisingham B, Cook D, Wu X (Eds.), Proceedings of IEEE 13th International Conference on Data Mining, ICDM 2013, IEEE, Piscataway, NJ, USA, 2013, pp. 1151–1156. [Google Scholar]
  • [15].Contisciani M, Power EA, De Bacco C, Community detection with node attributes in multilayer networks, Sci. Rep 10 (2020) 15736. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [16].Zhang Y, Levina E, Zhu J, Community detection in networks with node features, Electron. J. Stat 10 (2) (2016) 3153–3178. [Google Scholar]
  • [17].Yan B, Sarkar P, Covariate regularized community detection in sparse graphs, J. Amer. Statist. Assoc 116 (534) (2021) 734–745. [Google Scholar]
  • [18].Xu S, Zhen Y, Wang J, Covariate-assisted community detection in multi-layer networks, J. Bus. Econom. Statist 41 (3) (2022) 915–926. [Google Scholar]
  • [19].Binkiewicz N, Vogelstein JT, Rohe K, Covariate-assisted spectral clustering, Biometrika 104 (2) (2017) 361–377. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [20].Zhang Y, Chen K, Sampson A, Hwang K, Luna B, Node features adjusted stochastic block model, J. Comput. Graph. Statist 28 (2) (2019) 362–373. [Google Scholar]
  • [21].Relvas CEM, Nakata A, Chen G, Beer DG, Gotoh N, Fujita A, A model-based clustering algorithm with covariates adjustment and its application to lung cancer stratification, J. Bioinform. Comput. Biol 21 (4) (2023) 2350019. [DOI] [PubMed] [Google Scholar]
  • [22].Hu Y, Wang W, Network-adjusted covariates for community detection, Biometrika 111 (4) (2024) 1221–1240. [Google Scholar]
  • [23].Shen L, Amini A, Josephs N, Lin L, Bayesian community detection for networks with covariates, 2023, arXiv:2203.02090. [Google Scholar]
  • [24].Nowicki K, Snijders TAB, Estimation and prediction for stochastic blockstructures, J. Amer. Statist. Assoc 96 (455) (2001) 1077–1087. [Google Scholar]
  • [25].Hoff PD, Random effects models for network data, in: Breiger R, Carley K, Pattison P (Eds.), Dynamic Social Network Modeling and Analysis: Workshop Summary and Papers, National Academy Press, Washington, DC, USA, 2003, pp. 303–312. [Google Scholar]
  • [26].Hastings WK, Monte Carlo sampling methods using Markov chains and their applications, Biometrika 57 (1) (1970) 97–109. [Google Scholar]
  • [27].Godichon-Baggioni A, Surendran S, Kmedians: K-Medians, Sorbonne Université, 2023. [Google Scholar]
  • [28].Gelman A, Su Y-S, arm: Data Analysis Using Regression and Multilevel/Hierarchical Models, Columbia University, 2022. [Google Scholar]
  • [29].de Valpine P, Paciorek CJ, Turek D, Michaud N, Anderson-Bergman C, Obermeyer F, Wehrhahn Cortes C, Rodríguez A, Temple Lang D, Paganin S, NIMBLE: MCMC, Particle Filtering, and Programmable Hierarchical Modeling, University of California, Berkeley, 2023. [Google Scholar]
  • [30].de Valpine P, Turek D, Paciorek C, Anderson-Bergman C, Temple Lang D, Bodik R, Programming with models: Writing statistical algorithms for general model structures with NIMBLE, J. Comput. Graph. Statist 26 (2) (2017) 403–413. [Google Scholar]
  • [31].Stephens M, Dealing with label switching in mixture models, J. R. Stat. Soc. Ser. B Stat. Methodol 62 (4) (2000) 795–809. [Google Scholar]
  • [32].Papastamoulis P, label.switching: An R package for dealing with the label switching problem in MCMC outputs, J. Stat. Softw. Code Snippets 69 (1) (2016) 1–24. [Google Scholar]
  • [33].Geng J, Bhattacharya A, Pati D, Probabilistic community detection with unknown number of communities, J. Amer. Statist. Assoc 114 (526) (2019) 893–905. [Google Scholar]
  • [34].Watanabe S, Asymptotic equivalence of Bayes cross validation and widely applicable information criterion in singular learning theory, J. Mach. Learn. Res 11 (116) (2010) 3571–3594. [Google Scholar]
  • [35].Gelman A, Hwang J, Vehtari A, Understanding predictive information criteria for Bayesian models, Stat. Comput 24 (2013) 997–1016. [Google Scholar]
  • [36].Gelman A, Rubin DB, Inference from iterative simulation using multiple sequences, Statist. Sci 7 (4) (1992) 457–472. [Google Scholar]
  • [37].Rand WM, Objective criteria for the evaluation of clustering methods, J. Amer. Statist. Assoc 66 (336) (1971) 846–850. [Google Scholar]
  • [38].Danon L, Díaz-Guilera A, Duch J, Arenas A, Comparing community structure identification, J. Stat. Mech. Theory Exp 2005 (2005) P09008. [Google Scholar]
  • [39].Frey BJ, Dueck D, Clustering by passing messages between data points, Science 315 (5814) (2007) 972–976. [DOI] [PubMed] [Google Scholar]
  • [40].Pedersen TL, Tidygraph: A tidy API for graph manipulation, 2024, R package version 1.3.1. [Google Scholar]
  • [41].Blei DM, Kucukelbir A, McAuliffe JD, Variational inference: A review for statisticians, J. Amer. Statist. Assoc 112 (518) (2017) 859–877. [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Supplementary Materials

1
2

Data Availability Statement

Data will be made available on request.

RESOURCES