Fragility of spectral clustering for networks with an overlapping structure

Groups, or communities, commonly overlap in real-world networks. This is a motivation to develop overlapping community detection methods, because methods for non-overlapping communities may not perform well. However, deterioration mechanism of the detection methods used for non-overlapping communities have rarely been investigated theoretically. Here, we analyze the performance of spectral clustering, which does not consider overlapping structures, by using the replica method from statistical physics. Our analysis on an overlapping stochastic block model reveals how the structural information is lost from the leading eigenvector because of the overlapping structure.


I. INTRODUCTION
A graph or a network that represents related data is a common data structure in multivariate statistics, machine learning, and statistical mechanics. Identifying densely connected subgraphs-community detection-is useful for graph analysis. Such subgraphs are referred to as blocks or communities. Spectral clustering is a popular community detection algorithm that is efficient yet highly accurate on random graph models [1][2][3][4]. Nevertheless, spectral clustering is not recognized as a state-of-the-art algorithm for real-world networks. This is presumably because of specific features of real-world networks that are missing in simple random graph models. To fill this discrepancy, in this paper, we theoretically investigate how overlapping of communities affects the performance of spectral clustering.
We denote an undirected graph as G = (V, E), where V (|V | = N ) is a set of nodes and E (|E| = m) is a set of edges. The graph is represented by the N × N adjacency matrix A, where A ij = 1 when a pair of nodes i and j is connected by an edge and A ij = 0 otherwise. The adjacency matrix of graphs with strong ( Fig. 1a) and weak (Fig. 1b) non-overlapping community structures are illustrated in Fig. 1.
To identify the community structure, spectral clustering [5] computes the leading eigenvalues and eigenvectors of a regularized adjacency matrix; in this paper, as an example, we focus on the so-called modularity matrix [6] as the regularized adjacency matrix. When the community structure can be clearly identified, the isolated leading eigenvectors have relevant information of the communities, while a bulk of eigenvalues emerges from the randomness of a graph. For example, Fig. 2a shows the spectral density of the modularity matrix corresponding to the adjacency matrix in Fig. 1a. In this case, the largest eigenvalue is clearly separated from the bulk of eigenvalues, and we can extract two communities using the isolated leading eigenvector. On the other hand, Fig. 2b shows the case corresponding to the adjacency matrix in Fig. 1b. The eigenvalue correlated to the community structure is buried in the bulk of eigenvalues, and the spectral density is no longer distinguishable from that of a uniformly random graph. The phase transition point that the eigenvalues do not exhibit community structure at all is referred to as the (algorithmic) detectability limit [1,7,8] of spectral clustering.
As a tool for theoretical analysis, we use the replica method that originated from statistical physics. It enables us to calculate the ensemble average over random graph instances. As a result, we obtain a detectability phase diagram that indicates the effect of overlapping on spectral clustering.
Several existing studies have investigated the fragility of spectral clustering. As mentioned above, real-world networks have more complex structures than simple random graphs. Hence, the studies have considered the fragility in case of, e.g., adversarial perturbations [9], noise perturbations [10,11], tangles and cliques [12], and localization of eigenvectors [7,8,13]. In this paper, we analyze the effect of the overlapping structure on the graph spectra. Specifically, we found that, when the size of the community overlap is increased, it is the isolated eigenvalue that is mainly affected. On the other hand, it is the bulk of eigenvalues that is mainly affected when the density of the community overlap is increased.
The rest of the paper is organized as follows. In Sec. II, we introduce the overlapping random graph models that we consider. In Sec. III, we provide the replica analysis for the graph spectra of the random graph model. In Sec. IV, we show the results and their interpretation obtained by the replica analysis. Finally, Sec. V presents a discussion.

II. OVERLAPPING STOCHASTIC BLOCK MODEL
In this section, we consider a class of random graph models called the stochastic block model (SBM). It is a random graph model that has a preassigned (planted) modular structure. Here, as a particular case of the SBM, we introduce the overlapping SBM. Although we focus only on the so-called canonical SBM in the main text, its microcanonical counterpart [14,15] (see Appendix B for a detailed definition) is also analyzed in Appendix B 2.

A. Canonical overlapping SBM
Before considering the overlapping SBM, we first introduce the (canonical) SBM with a general structure. A graph with K groups is generated from the SBM as follows. For each node of the graph, we preassign a planted block label t = [t i ] t i ∈ {1, · · · , K} (i ∈ V ). These labels are chosen randomly according to the block size distribution p = [p k ] (k ∈ {1, . . . , K}), k p k = 1, 0 < p k ≤ 1. Second, each pair of nodes (i, j) is connected by an edge with probability ρ titj independently and randomly; this probability is provided as an element of the K ×K affinity matrix ρ = [ρ kl ], 0 ≤ ρ kl ≤ 1. Therefore, the probability of a graph instance is expressed as (1) FIG. 3: (a) Block structure of the overlapping SBM that we consider. The first and third blocks correspond to the non-overlapping blocks, while the second one corresponds to the overlapping block. α, , and σ are the fraction of the overlapping block size, the strength of community structure, and the density of the overlapping block, respectively. The value of each block corresponds to an element of affinity matrix (3) divided by p in . (b) Adjacency matrices of graph instances of the overlapping SBM with σ = 0.3, 1, and 3.
Here, because we consider undirected simple graphs, we assume that A ii = 0 and A ij = A ji . Moreover, we focus on sparse graphs throughout this paper; i.e., we assume ρ rs = O(1/N ) for all r and s. When every matrix element of ρ is equal, the model becomes the so-called Erdős-Rényi random graph model. The overlapping SBM has the following parametrization in the parameter space of the SBM. As illustrated in Fig. 3, the overlapping SBM that we consider has three blocks: the first and third blocks correspond to the nonoverlapping blocks, and the second block corresponds to the overlapping block. The model parameters of the overlapping SBM are defined as follows.
We denote the ratio between the community and overlapping blocks as α = p 2 /p 1 . For the parametrization of the affinity matrix, ρ in represents the edge generation probability for pairs of nodes within the same block, while ρ out represents that for pairs of nodes in different blocks. = ρ out /ρ in is the parameter that controls the strength of the community structure. Finally, σ is the density of the overlapping block. c is the average degree of each block, where the degree of a node is the number of edges connected to the node. The ratio c 1 /c 2 can also be expressed as (1 + α + )/(σα + 2) using the affinity matrix elements. Therefore, the parameters of the overlapping SBM are constrained as c 1 (σα + 2) = c 2 (1 + α + ).
For simplicity, we assume the symmetry between the first and the third blocks, i.e., p 1 = p 3 and c 1 = c 3 . The affinity matrix is a symmetric matrix, because we assume an undirected graph.
The overlapping SBM that we consider consists of three blocks. Nevertheless, in the following sections, we consider the partitioning into two blocks. Therefore, we analyze a model-inconsistent scenario.

III. REPLICA ANALYSIS
We now calculate the spectrum of the overlapping SBM and show that a phase transition point of the largest eigenvalue exhibits the detectability limit. It should be noted that the same result is obtained in the case of the microcanonical SBM (Appendix B 2).
A. Spectrum and the detectability limit of the overlapping SBM As an example of a regularized adjacency matrix, we consider the modularity matrix. Each element of the matrix is defined as is the degree of a node i and m (= |E|) is the total number of the edges. Partitioning into two blocks can be identified by the eigenvector of the largest eigenvalue. Thus, our goal is to solve the following maximization problem.
where λ(M ) is the largest eigenvalue of M , and x T is the transpose of a vector x. This problem can be expressed where Z(M, β) is the partition function. The constraint (7) is imposed by the delta function in (10), and taking β → ∞ in (9) leads to the maximization of the exponent of the exponential function in (10). Because we are interested in the typical behavior of the graph instances, we analyze where [· · · ] M represents the ensemble average over graph instances. Unfortunately, it is difficult to calculate the average [log Z(M, β)] M analytically. To overcome this difficulty, we use the replica trick, namely, Here, the exponent n in [Z n ] M is a real value. However, we treat n as an integer for a moment. In the end, we perform the analytic continuation to the real value.
From Eq. (10), the nth moment the partition function is obtained as where a ∈ {1, . . . , n} is an index of n identical copies. For further calculations, we introduce several order parameters and approximations. Detailed calculations are described in Appendix A. As a result, the average largest eigenvalue in the limit of N → ∞ is obtained by the following saddle-point (extremum) condition of nine auxiliary variables (φ, Ω,Ω, m 1k , m 2k ,m 1k ,m 2k , a k ,â k ). [ Here, i∈V k is the sum over the node indices that belong to the kth block. W kl andc are defined as W kl ≡ p k ρ kl p l andc ≡ 2m/N , respectively. P c k (d) is the Poisson probability mass function of degree d of each node in block k that has expectation c k . m 1k is the mean of the largest eigenvector elements that correspond to the kth block. Definitions of the other auxiliary variables are described in Appendix A.
The detectability limit is derived by solving the equations of the nine auxiliary variables. In particular, m 11 (= −m 13 ) plays an important role for the detectability limit. When m 2 11 > 0, the spectral clustering retains the ability to detect the community structure (detectable condition). On the other hand, when m 2 11 = 0, the result of spectral clustering is uncorrelated to the planted structure (undetectable condition). Accordingly, the phase transition point is derived by the condition m 2 11 = 0. This corresponds to the condition that the largest eigenvalue is buried in the bulk of the eigenvalues, as we mentioned in Introduction.

IV. PERFORMANCE OF THE SPECTRAL CLUSTERING ON THE OVERLAPPING SBM
In this section, using the results obtained by the replica analysis, we show how the size and density of the overlapping block affect the spectrum. We also check the validity of our analytical calculations by comparing them to the results of numerical experiments. We use the microcanonical SBM in the numerical experiments to avoid some problems of the canonical SBM, as mentioned in Appendix B 4. We used graph-tool [16] to generate graph instances of the microcanonical SBM.
A. Detectability phase diagram and the leading eigenvalue First, to observe the overall dependency of overlapping structures, we show the detectability phase diagram. Figure 4 shows the detectability phase diagram of the ( , α) plane, where is the strength of the community structure and α is the size of the overlapping block (α = p 2 /p 1 ). The boundary between the blue and orange regions represents the detectability limit of the spectral clustering predicted by the replica analysis. The dots represent the results of the numerical experiments; the color gradient represents the fraction of correctly classified nodes, which is often referred to as the overlap. We can see that both boundaries are in a good agreement. Note that the numerical experiment is possible only on the discrete points in the parameter space because of constraint (5), and c 2 can take only natural numbers in the microcanonical SBM. In this experiment, we set c 1 = 10 and σ = 2. Then, the range c 2 can take is restricted between 11 and 19 because of the assortative condition 0 ≤ ≤ 1. This phase diagram is the result that shows how fragile the spectral clustering is against the overlapping structure. Figure 5 shows the leading eigenvalue and the edge of the bulk of the eigenvalues 1 , which are predicted by the We set c 1 = 10, c 2 = 18, and σ = 2. The solid and dashed lines represent the isolated leading eigenvalues and the bulk edges of eigenvalues, respectively. The boundary between the blue and orange regions represents the detectability limit. The green dots represent the top ten eigenvalues computed in the numerical experiments.
replica analysis, and the top ten eigenvalues computed in the numerical experiments. We can confirm that the replica analysis accurately describes the behavior of numerical experiments. When α is small, the leading eigenvalue is separated from the bulk of the eigenvalues. As α increases, the leading eigenvalue approaches the bulk of the eigenvalues. As we described in Introduction, when it reaches the bulk of the eigenvalues, the spectral clustering loses ability to detect the community structure, i.e., the detectability limit. Note the value of also varies according to (5) as α varies. Thus, the horizontal axis in We now investigate the effect of the overlapping structure on the performance of the spectral clustering when we increase the size of the overlapping block. Because the overlapping block can have denser (or sparser) edge density than the other blocks, the average degree also increases (or decreases) accordingly, as the size of the overlapping block increases. This implies that the width of the bulk of the eigenvalues is trivially influenced, because the bulk is known to depend on the average degree However, it is not trivial if it is the only effect. Namely, the overlapping structure may affect the isolated eigenvalue or the bulk in another way. To assess the effect of the overlapping structure rather than the effect of the average degree, we compare the overlapping SBM with the model with no overlapping structures but that has the same degree distribution as the overlapping SBM. In the case of the microcanonical overlapping SBM, the degree distribution is bimodal: all the nodes in the overlapping block have the same degree, while all the other nodes have the other degree. Therefore, we consider the nonoverlapping SBM with a bimodal degree distribution (see Appendix C for a detailed definition). We assume that the sizes of the blocks are equal. Hereafter, we refer to this model as the bimodal SBM. Figure 6 shows the bulks of eigenvalues and the leading eigenvalues of the overlapping and bimodal SBMs. We can confirm that both bulk edges almost coincide. In contrast, the leading eigenvalue of the bimodal SBM is separated from the bulk in the whole space, while that of the overlapping SBM approaches to its bulk as α increases. This indicates that the increase of the size of the overlapping block mainly affects the leading eigenvalue instead of the bulk.
The fact that the bulk is not considerably affected is not very trivial. If we take a closer look, the bulk edges do not exactly coincide in Fig. 6, although the deviation is very small. This is because the models are not identical even when there is no community structure (i.e., = 0). When α = 0, the two models reduce to the c 1 -regular SBM. Thereby, their bulk edges become equal to 2 √ c 1 − 1. When α = 1, the overlapping SBM becomes a uniform (one block) model with (average) degree c 2 , while the bimodal SBM has the community structure with (average) degree c 2 . However, the bulk edge of the SBM with no overlapping blocks depends only on its average degree. Thus, although the models are not identical, their bulk edges are both 2 √ c 2 − 1.
C. Effects of the density of the overlapping structure Next, we investigate how density σ of the overlapping block affects the detectability. As mentioned in the previous subsection, the higher density of the overlapping block trivially makes the width of the bulk of the eigenvalues expand wider.
Figures 7a-7b show the detectability phase diagram derived by the replica analysis and the results of the corresponding numerical experiments for σ = 0.5 and 2. Notably, the detectable region is wider when σ is small. This indicates that the higher density deteriorates the detectability more significantly.
Let us examine σ dependency. Figure 8a shows the α dependencies derived by the replica analysis of the canonical SBM. They are the isolated leading largest eigenvalues and the bulk of the eigenvalues for σ = 0, 0.5, 1, 1.5, and 2. Interestingly, the isolated largest eigenvalue does not depend on σ considerably. In contrast, the bulk is highly dependent on σ. This indicates that the deterioration of the detectability due to σ is caused by the expansion of the bulk rather than the shrinkage of the isolated leading eigenvalue. Figure 8b similarly shows the dependencies. Again, we can see that the isolated largest eigenvalue does not depend on σ considerably while the bulk is highly dependent.
Notably, we cannot test the result of Fig. 8a directly in numerical experiments, because α cannot be varied continuously as is fixed. This is due to the constraints of the microcanonical SBM. Similarly, in Fig. 8b, cannot be varied continuously as α is fixed. Nevertheless, we can draw smooth curves in the replica analysis, because we consider the canonical SBM that is not subject to the constraints of the microcanonical SBM. Importantly, the results of the microcanonical SBM coincide with those of the canonical SBM with the regular approximation at the points where the microcanonical SBM is realizable. We also note that (Appendix B 2) the distinction between the canonical and microcanonical SBMs is invisible in infinite graph size limits.

V. SUMMARY
We investigated the effect of the size and the density of the overlapping block on the performance of spectral clustering using the replica method. Both larger size and higher density help the isolated eigenvalue to be buried in the bulk of the eigenvalues, i.e., deteriorate the detectability. Importantly, however, their mechanisms are strikingly different. We found that increasing the size of the overlapping block has a prominent effect on making the isolated eigenvalue smaller (Fig. 6). In contrast, increasing the density of the overlapping block makes the bulk width larger, while the isolated eigenvalue remains almost the same (Fig. 8a).
According to our findings, the results of the replica analysis are consistent with those of the numerical experiments. This indicates that the detectability phase transition of the spectral clustering in the present setting is regarded as a phenomenon that can be understood in the scope of the mean-field theory.
Although spectral clustering typically deals with nonoverlapping structures, we showed that it is also possible to analyze the model-inconsistent case, such as the overlapping SBM. It is possible, in principle, to investigate even more complex situations using the replica method. However, for example, we would need to deal with saddlepoint equations with many variables if we were to analyze a general three-block SBM. Therefore, we believe that the present model is an extreme case where the analytical calculation is executable and the results are interpretable.

VI. ACKNOWLEDGEMENTS
This study was funded by the New Energy and Industrial Technology Development Organization (NEDO), JSPS KAKENHI No. 18K18127 (T.K.) and JST CREST Grant Number JPMJCR1912.
[1] R. R. Nadakuditi and M. E. Newman, Graph spectra and the detectability of community structure in networks, Physical review letters 108, 188701 (2012) Appendix A: Derivation of the spectrum and the detectability limit of the canonical SBM The goal of this appendix is to derive saddle-point expression of the average largest eigenvalue (14). Note that a similar calculation using the replica method can be found in Refs. [7,8,17]. We start with the average of nth moment of the partition function where we can recast exponential factor e − β 2 a (γ xa) 2 in (A2) as We have setc ≡ 2m/N . Moreover,Ω a is the auxiliary variable that is conjugate to Ω a . To derive this expression, we transformed the delta function to Inserting Eq. (A6) into the exponential factor in (A2), we obtain Here, we took the configuration average over the canonical SBM (1) and approximated ρt i t j 1−ρt i t j ≈ ρ titj by using the fact that ρ titj = O(N −1 ).
Let us now introduce the order-parameter functions where i∈V k is the sum over the node indices that belong to the kth block. Then, the last exponential factor in (A9) can be approximated as where we approximated that the contribution from the diagonal elements is negligible, and we defined W kk ≡ p k ρ kk p k . Inserting Eq. (A11) into (A9), Eq. (A1) is now expressed as Here, we use the expansion of the delta function Here, DQ k is the functional integral with respect to Q k (µ), andQ k (µ) was introduced as the conjugate of Q k (µ). To derive Eq. (A15), we used the expansion of the delta function. By inserting the identity, we can focus on a Q k (µ) corresponding to the replacement in (A10). Note that without the insertion of the identity, the replacement of (A10) becomes invalid. From these, we can recast Eq. (A12) as where Here, we assume the functional form of Q k (u) and Q k (u) are restricted to Gaussian mixtures. This indicates that Q k (u) andQ k (u) can be expressed as where q k (A, H) is the weight of a Gaussian distribution with the mean and precision parameter equal to H/A and H, respectively.q k (Â,Ĥ) is defined analogously. q 0 k and q 0 k are the normalization constants; it can be deduced that q 0 k = 1 andq 0 k = c k from the saddle-point conditions when n = 0. Inserting Eq. (A20) and (A21) into (A17)-(A19), we have To derive Eq. (A24), we expanded the exponential as eQ k (xi) = ∞ d=0 Hereafter, let us assume no distinction among the variables with different replica indices, i.e., φ a = φ, Ω a = Ω, andΩ a =Ω. This is referred to as the replica symmetric assumption. We insert Eq. (A22)-(A24) into (A16) under this assumption. Then, we obtain the following saddle-point equation for the average largest eigenvalue from Eqs. (8), (9), and (12) Here, P c k (d) is the probability mass function of degree d of each node in block k that has expectation c k . From the saddle-point condition in Eq. (A26), we obtain the functional equations with respect to q k (A, H) andq k (Â,Ĥ) as To derive Eq. (A27), we used the fact that the expectation of H 2 /A becomes 0, which is derived by substitutinĝ H =Â = 0. Moreover, the saddle-point condition with respect to φ yields Equation (A29) corresponds to the normalization constraint in (7). Equations (A27) and (A28) constitute functional equations under constraint (A29), and solving these equations yields the distribution of the largest eigenvector elements. Note that q k (A, H) was introduced as the weight in the Gaussian mixture, which approximates the empirical distribution of the largest eigenvector elements in (A10). This indicates that q k (A, H) exhibits the probability density of the eigenvector-element distribution.
Unfortunately, solving the functional form of equations is still not analytically tractable. Thus, we introduce further approximations that q k (A) = δ(A − a k ) and q k (Â) = δ(Â −â k ), i.e., we ignore the fluctuation of the precision parameters. This is called the effective medium approximation (EMA) [17,18]. Performing the EMA for (A26), we arrive at where m k andm k stand for the th moments of H and H, respectively, i.e., m k = dHH q k (H) andm k = dĤĤ q k (Ĥ).
The saddle-point conditions from (A31) lead to the equations for the auxiliary variables φ, Ω,Ω, m k ,m k , a k , andâ k . Here, we focus on a model with the symmetry between the first and the third blocks: p 1 = p 3 and c 1 = c 3 . Due to this assumption, we can apply the same assumptions to the physical quantities a k ,â k , m 2k ,m 2k , that is, a 1 = a 3 ,â 1 =â 3 , m 21 = m 23 , andm 21 =m 23 . This is because these quantities are the second-order statistics and do not depend on the signs.
Further, we assume m 12 = 0. This assumption stems from the fact that the second block corresponds to the overlapping block, which does not contain the two communities. Thus, the corresponding elements of the eigenvector come from a random structure of the graph. Moreover, we classify the solution into the cases of m 11 = 0 and m 11 = 0. For the solution with m 11 = 0, we can assume m 13 = 0 owing to the symmetry. On the other hand, for the solutions with m 11 = 0, we can assume m 11 = −m 13 due to the symmetry and the fact that the eigenvector elements of x tend to have the same signs in the same block. In summary, we have two types of solutions: m 11 = −m 13 = 0, m 12 = 0 and m 11 = m 12 = m 13 = 0. In fact, the former corresponds to the detectable condition and the latter corresponds to the undetectable condition. The leading eigenvalue is calculated for each of the two conditions, and the detectability limit is derived as the boundary between these two conditions. We further simplify the problem using the regular approximation with respect to the degree, namely the random variables following the Poisson distribution d in (14) are fixed as their means c k .
These equations are analogous to those for the detectable conditions (A32)-(A35). A crucial difference is that we have conditionm 2 11 = 0 instead of Eq. (A35). We let the solutions of these equations be a und 1 , a und 2 ,â und 1 , and a und 2 . Using this solution, we obtain the average leading eigenvalue in the undetectable conditions as follows.

Appendix B: Microcanonical overlapping SBM
In this appendix, we discuss the microcanonical SBM. In Sec. B 1, we introduce the definition of the microcanonical overlapping SBM. In Sec. B 2, we provide the replica analysis to derive its spectrum and the detectability limit. In Sec. B 3, we derive the saddle-point conditions for normalization constant N G , from which we can derive crucial relations used in Sec. B 2. Finally, in Sec. B 4, we discuss the distinction between the canonical and microcanonical SBMs and discuss the reason of their use in our numerical experiments.

Model definition
Microcanonical SBM is an SBM that is formulated on the basis of different constraints from its canonical model. Although the canonical SBM specifies the expected number of edges within the blocks, the microcanonical SBM specifies the number of edges within the blocks as well as the degree sequence as hard constraints. The microcanonical SBM generates a graph uniformly and randomly from all realizable graphs under these constraints. We denote the sequence of node degrees as d = [d i ]. We let e kl be the number of edges between blocks k and l; we denote the corresponding matrix as e = [e kl ]. Moreover, t = [t i ] t i ∈ {1, · · · , K} (i ∈ V ) are the planted block labels of the nodes. An instance of the microcanonical SBM is generated according to the following probability distribution.
where Ω(d, e, t) is the number of all realizable graphs under given d, e, and t.
We consider a microcanonical SBM with an overlapping structure with the following parametrization. p = (p 1 , p 2 , p 3 ) = (p 1 , αp 1 , p 1 ) , Although we can provide an arbitrary degree sequence, for simplicity, we assume the nodes belonging to the same group k have equal degree c k . As in the canonical SBM, the model parameters must satisfy constraint (5).
2. Derivation of the spectrum and the detectability limit of the microcanonical SBM Here, we conduct an analysis analogous to Appendix A for the microcanonical SBM. As a result of the present analysis, we obtain the same average largest eigenvalues as those of the canonical case in (A36) and (A47). However, a different technique is required to impose the microcanonical constraints. The calculations in this appendix are extensions of those in Refs. [7,8]. We start with the nth moment of the partition function (13) As defined in Appendix B 1, we assume the three blocks model. Then, the exponential factor in (B5) can be recast as where u ij , y ij , v ij , and w ij are the adjacency matrix elements. These parameters were introduced to distinguish blocks that obey different statistics. Again, the summation i∈V k is taken over indices of the nodes that belong to block k.
To calculate the ensemble average over the microcanonical SBM, we take the sum over all possible graph configurations as imposing the microcanonical constraints by delta functions. Thus, the configuration average of the exponential factor in (B5) is Here, N G is the number of all realizable graphs that satisfy the constraints. The first three delta functions in (B7) represent Kronecker's deltas that impose the degree constraints, while the remaining ones represent Dirac's deltas that impose the constraints with respect to the number of edges between blocks, as specified by matrix e.
We use the integral expression of the delta functions as follows.
where parameters ζ, ξ, τ, κ, η, and θ are the auxiliary variables provided by the integral representation of the delta function. Because variables u ij , y ij , v ij , and w ij only take binary values, their summations in (B10) can be calcu-lated straightforwardly. For example, To derive the last equation in (B11), we assume that |z i | and |z j | are sufficiently small.
Here, we introduce the order-parameter functions δ(x ia − µ a ), (k = 1, 2, 3) (B12) which is similar but not completely equivalent to (A10). Using the order-parameter functions (B12), when N 1, Eq. (B11) can be approximated as where we approximated that the contribution from the diagonal elements is negligible. Using the similar calculations, (B5) is now written as where dµ a dν a Q 2 (µ)Q 2 (ν)e β a µaνa+2ξp3+2ζp1 + (p 3 N ) 2 2 n a=1 dµ a dν a Q 3 (µ)Q 3 (ν)e β a µaνa−2κp2−2θ + p 1 p 2 N 2 n a=1 dµ a dν a Q 1 (µ)Q 2 (ν)e β a µaνa−σζp2+2τ p1 + p 2 p 3 N 2 n a=1 dµ a dν a Q 2 (µ)Q 3 (ν)e β a µaνa−σξp2+2κp3 and Here, Ω a is the order parameter defined in (A3). As in the case of the canonical SBM in (A14), for Eq. (B16), we insert the identity In (B17), we perform the functional integration over the space of function Q k (µ). It is required to insert identity (B17), because it indicates that we performed the replacement of a function in (B12) by Q k (µ). Furthermore, using the integral representation of the delta functions (A7) and (A13), we obtain where Here, we used the relation Now, the variable depending on the node index i only appears as x i . Hence, after the integral with respect to x i is carried out in L k Q k , {Ω a }, {φ a } , Eq. (B19) can be expressed only with integrals over the auxiliary variables φ a , Ω a ,Ω a , ζ, ξ, τ , κ, η, θ and functional integrals over Q k (µ) andQ k (µ). For further calculations, as in the case of the canonical SBM (Eqs. (A20) and (A21)), we assume the functional form of Q k andQ k are restricted to the Gaussian mixtures as follows.

Saddle-point conditions for NG
The goal of this subsection is to derive the relations of the normalization constants of the Gaussian mixtures T k andT k in (B25) and (B26). They can be derived using saddle-point conditions for the number of all realizable graphs N G . This can be calculated by taking the sum over all possible graph configurations as imposing the microcanonical constraints by delta functions. Thus, we have Using the integral representation of the delta function (B8) and (B9), we have Here, we introduce the order parameters q k = 1 p k N i∈V k z i . (k = 1, 2, 3) (B43) Equation (B42) is now written as × exp 1 2 e −2τ p2−2 η (p 1 N q 1 ) 2 + 1 2 e 2ζp1+2ξp3 (p 2 N q 2 ) 2 + 1 2 e −2κp2−2ξθ (p 3 N q 3 ) 2 + e −σζp2+τ p1 p 1 p 2 N 2 q 1 q 2 +e −σξp2+κp3 p 2 p 3 N 2 q 2 q 3 + e η+θ p 1 p 3 N 2 q 1 q 3 ) .
Second, under the undetectable case, we obtain the equations for a and φ as follows. (C8) When we let the solutions of these equations be a und and φ und , we obtain the average largest eigenvalue as [λ(M )] M = φ und .
Appendix D: Accuracies of the EMA and the regular approximation For the replica analysis, we introduced two approximations: the regular approximation and EMA. Here, we investigate the dependencies of the average degree on the accuracy of each approximation. It is known that when the average degree is sufficiently large, the effect of these approximations can be asymptotically ignored. However, it is not trivial how the approximations affect the results for a graph with a low average degree.
To derive the detectability limit of the canonical SBM, we used both the EMA and the regular approximation. To derive that of the microcanonical SBM, we used the EMA only. Thus, by comparing both results, we can measure how each approximation differs from the original result. Figs. 9a and 9b show the results of the canonical and microcanonical SBMs, respectively. We can see that the results of the replica analysis and the numerical experiments are in agreement for c 1 ≥ 30 in the canonical case. On the other hand, they are in agreement for c 1 ≥ 6 in the microcanonical case. Therefore, we can conclude that the effect of the EMA is smaller than that of the regular approximation. Therefore, for the numerical experiments in Sec. IV, we used the microcanonical SBM and set c 1 = 10, so that the effect of the approximation can be ignored.