Loop-erased partitioning of a graph: mean-ﬁeld analysis *

Given a weighted ﬁnite graph G , we consider a random partition of its vertex set induced by a measure on spanning rooted forests on G . The latter is a generalized parametric version of the classical Uniform Spanning Tree measure which can be sampled using loop-erased random walks stopped at a random independent exponential time of parameter q > 0 . The related random trees—identifying the blocks of the partition—tend to cluster nodes visited by the random walk on time scale 1 /q . We explore the emerging macroscopic structure by analyzing two-point correlations, as a function of the tuning parameter q . To this aim, it is deﬁned an interaction potential between pair of vertices, as the probability that they do not belong to the same block. This interaction potential can be seen as an afﬁnity measure for “densely connected nodes” and capture well-separated regions in network models present-ing non-homogeneous landscapes. In this spirit, we compute this potential and its scaling limits on a complete graph and on a non-homogeneous weighted version with community structure. For such geometries we show phase-transitions in the behavior of the random partition as a function of the tuning parameter and the edge weights. Moreover, as a corollary of our main results, we infer the right scaling of the parameters that give rise to the emergence of “giant” blocks.


Introduction
Consider an arbitrary simple, undirected, weighted and connected graph G = (V, E, w) on N = |V | vertices where E = {e = (x, y) : x, y ∈ V } stands for the edge set and w : E → [0, ∞) is a given edge-weight function. We call the Random Walk (RW) associated to G the continuous-time Markov chain X = (X t ) t≥0 with state space V and the discrete Laplacian as infinitesimal generator, i.e., the N × N matrix: (1.1) where for any x, y ∈ [N ] := {1, 2, . . . , N }, A(x, y) = w(x, y)1 {x =y} is the weighted adjacency matrix and D(x, y) = 1 {x=y} z∈[N ]\{x} w(x, z) is the diagonal matrix guarantying that the entries of each row in L sum up to 0. In other word, the quantity w(x, y) represents the rate at which the random walk moves from x to y, while D(x, x) is the total transition rate from x.
Given the weighted graph G(V, E, w), a rooted spanning forest is a spanning subgraph in which each connected component is a tree and, for each tree, there is a special vertex which we call the root. We call F the set of all the possible rooted spanning forests of G and, for some fixed parameter q > 0, we consider the following probability measure on the set F: (1.2) where |F | denotes the number of trees in the forest F and w(F ) is the weight of F , defined as the product of the weights on the edges in F , i.e., w(F ) := e∈F w(e). (1. 3) The quantity Z(q) in the denominator of (1.2) is the normalizing constant needed to make µ q a probability measure and, as is common in statistical physics, we are going to refer it to as the partition function of the measure µ q . As shown, e.g., in [7, Proposition 2.1], the partition function Z(q) admits a particularly simple algebraic expression in terms of the characteristic polynomial of the generator L, namely 1 Z(q) := F ∈F q |F | w(F ) = det[qI − L]. (1.4) We notice that the measure µ q can be interpreted as a measure supported on the set of spanning trees of an appropriately defined extended graph. To this aim, given G(V, E, w), consider an extended graph G ∆ having as vertex set V ∪ {∆} and as edge set E ∪ E ∆ , where E ∆ = {(x, ∆) : x ∈ V }, with w(e) = q for all e ∈ E ∆ . The extra state ∆ is usually referred to as cemetery (or ghost, or coffin) state. Given the extended graph G ∆ , the set F of rooted forests spanning G is in bijection with the set of ∆-rooted trees spanning G ∆ and the weight of such extended tree can be thought off as the product of the weights of the edges in the tree.
Bern q q + λ i , (1.5) where 0 = λ 1 ≤ · · · ≤ λ N are the eigenvalues of −L. Notice that, as one can easily figure out, for every given weighted graph the expected number of roots is an increasing function of q. Moreover, given the independence of the Bernoulli random variables in (1.5), in the "thermodynamic regime" in which N → ∞, the number of roots concentrates around its mean 2 .
On the other hand, the displacement of the roots on the graph enjoys a special feature: the set of roots of Φ q is determinantal point process on the vertex set. Formally, called ρ(F ) the set of roots of the rooted spanning forest F , for every A ⊆ V it holds (see [7, Proposition 2.2]) where K q (x, y) := q(q − L) −1 (x, y) (1.7) and, for a square matrix M ∈ R |V |×|V | , and A ⊆ V , det A [M ] denotes the determinant of the sub-matrix of M restricted to the rows and columns which are indexed by A. Let us remark that (see [4,Eq. 17]) the matrix K q enjoys a particularly simple probabilistic interpretation: it coincides with the Green's kernel of the Markov process (X t ) t≥0 generated by L and killed at an independent exponentially distributed time of rate q.
Namely, K q (x, y) = P(X τq = y | X 0 = x), (1.8) where τ q is a random variable with law Exp(q) independent from the RW.
The results in (1.5)-(1.6) provide a precise understanding of the roots' marginal of the measure µ q in the finite volume setting. What we aim at understanding in this paper is the behavior of another marginal of the rooted spanning forest measure, i.e., the random partition induced by the forest Φ q . With a slight abuse of notation, in what follows we let µ q denote the marginal distribution of the forest measure when restricted to the partition induced by the forest Φ q . Such a probability distribution is formally introduced in the following definition.

Definition 1.1 (Loop-Erased Partitioning)
. Given G = (V, E, w), fix a positive real parameter q > 0. We call Loop-Erased Partitioning (LEP) the random partition of V sampled according to the following probability measure: for all partition π of the vertices, µ q (π) := q |π| F :π(F )=π w(F ) Z(q) , (1.9) where π(F ) stands for the partition of V induced by a rooted spanning forest F and |π| is the number of blocks in the partition π. Moreover, we let Π q denote the random partition having law as in (1.9).
2 See (4.9) below for a proof of this fact in our setting.
Loop-erased partitioning of a graph Clearly, the law of the number of blocks in the random partition Π q satisfies (1.5).
What we aim at understanding herein are more refined properties of the block structure of Π q . A first natural question concerns the size of the blocks: should we expect an high heterogeneity in this respect as, e.g., the existence of a unique giant block when N → ∞? How likely is that two vertices lie in the same block of Π q ? Clearly, the answer to these questions depend on the underlying geometry, i.e., on the specification of the weighted graph G. Indeed, the first factor q |π| in (1.9) favors partitions having many small blocks if q > 1, while as q vanishes, the measure degenerates into a one-block partition. The second combinatorial factor takes into account the underlying geometry and, in the unweighted case (i.e., constant edge-weights w ≡ 1), counts how many rooted forests are compatible with a given partition. We will start our analysis in the simplest setup of an unweighted complete graph on N vertices, where the measure in Definition 1.1 reduces to for a partition π = {B 1 , . . . , B |π| } constituted of |π| blocks with sizes |B i | =: n i , i ≤ |π| such that i≤m n i = N . In particular, we see in this setup that this second factor favors partitions with a few "fat" blocks. Notice that (1.10) holds true because, by Cayley's formula, n ni−2 i unrooted trees can cover block B i , and since we are dealing with rooted trees, an extra factor n i for the choice of the root is needed. Using the distributional identity in (1.5) it is easy to check that, when N → ∞ and q = N α for some α > 0, in the complete graph setting of (1.10) the number of roots is with high probability of order Θ(N α∧1 ). Nonetheless, it is less clear which are the sizes of the blocks of Π q , e.g., for which values of α should we expect the existence of a block having size of order N ?
As we will argue in Section 1.2, the measure in (1.9) has the tendency to cluster in the same block vertices that can be visited by the RW on time scale 1/q. In this sense the LEP has the tendency to capture metastable-like regions, namely, regions of vertices from which it is difficult for the RW to escape on such a time scale. This makes the the LEP an interesting measure for randomized coarse-graining procedures, see in this direction [3] and [4,Section 5]. Yet, a-priori it is not clear how strong and stable is this feature of capturing "metastable landscapes", since it heavily depends on the underlying geometry and the choice of the killing parameter q. The scope of this paper is to start making precise this heuristic by analyzing the typical resulting blocks on the simplest dense informative geometries 3 . To this aim, we will consider a complete weighted graph on 2N vertices with a "community structure", i.e., for all x = y ∈ [2N ] .
with w 1 > w 2 . Notice that, when N → ∞, the RW on such weighted graph exhibit metastability as soon as w 1 = w 1 (N ) w 2 = w 2 (N ), in the sense that for all the times w2 the distribution of the RW is concentrated on the community where the process started, despite the fact that the equilibrium distribution is uniform.
A natural question to ask is to what extent the measure in (1.9) is sensitive to the ratio w 1 /w 2 : is there a proper scaling for q = q(N ) such that a typical partition put vertices in the same community into the same block? Are there one or more giant blocks and, in the affirmative case, are their supports localized on the two communities?
Finally, how does the interaction between the ratio w 1 /w 2 and the parameter q determine 3 We point out that in the recent work [6]-appeared after the first release of this paper-the authors extend our approach to the case in which the underlying graph is sparse and, in particular, contains no cycles.
the answer to these questions? In what follows we will provide a rigorous answer to each of these questions, showing a rich phenomenology captured by the emergence of phase-transitions.

Related literature
In this section we highlight the connections between the measure µ q and several topics of current interest in the literature. We start by describing the link between the rooted spanning measure and the celebrated Random-Cluster Model and by stressing the similarities and the differences between the measure in (1.2) and other similar forest measures.
Finally, we briefly mention the applications that the measure µ q recently found in approaching problems in network analysis, which was the starting motivation that led us to this manuscript.

Relations with the random-cluster model
The so-called Random-Cluster Model (RCM) is a meta-model unifying the theory of percolation, Ising/Potts model and electrical networks (see, among others, [20]). This can be thought off as a probability measure on subgraphs of a given graph G. More precisely, given a finite, undirected and unweighted graph G(V, E), the RCM is a probability distribution over the set of subgraphs of G, namely, fixed parameters γ > 0 and p ∈ [0, 1] E , and to every configuration ω ∈ {0, 1} E assign probability where k(ω) is the number of connected components in the subgraph of G in which only the edges e ∈ E such that ω(e) = 1 are retained, and Z γ, p is a normalizing constant. It is well know that the Uniform Spanning Tree (UST) measure as well as the Uniform Spanning Forest (USF) measure can be obtained from (1.12) by choosing p → 0 ∧ γ/p → 0 and p = γ → 0, respectively. As pointed out in [6,Lemma 1], also the rooted spanning forest measure in (1.2) can be obtained from the RCM measure by taking a proper limit.
To this aim, given G(V, E), consider an extended (unweighted) graph G ∆ (V ∪{∆}, E ∪E ∆ ) as explained right below (1.4). Then, fixed γ > 0 and r, λ ∈ [0, 1], consider the following RCM measure on {0, 1} E∪E ∆ with p(e) = r, if e ∈ E and p(e) = λ, if e ∈ E ∆ . Namely, we focus on the probability measure defined by (1.13) Assume that both r and λ are functions of γ such that, as γ → 0, λ/r → q > 0. An easy algebraic manipulation shows that, in the case in which the graph is unweighted, i.e., w(e) ≡ 1, one has µ q (F ) = lim γ→0 ν γ,r,λ (F ), (1.14) where µ q is the rooted forest measure defined in (1.2). Let us remark that, in the case in which λ/r → 0 as γ ↓ 0, the latter coincides with the UST measure on the graph G(V, E). This is not surprising, as it can also be seen by the definition of µ q that the UST measure can be obtained by taking the limit q ↓ 0 in (1.2).
Limits of the RCM giving rise to measures which are supported on forests are usually referred to as arboreal gases. Most of the literature on arboreal gas models is focused on unrooted forests; see, e.g., [11,12,13,34,18] for some very recent mathematical EJP 27 (2022), paper 67. work in this direction. In [12,Appendix A] the authors consider what they call arboreal gas with an external field and they notice that this can be interpreted as a marginal of a measure over rooted spanning forests. Yet, let us remark that the model in [12,Appendix A] differs from the measure we are considering here, since in their case each tree in the forest can have multiple roots or even none.

Wilson's algorithm, UST and loop-erased RW
As previously mentioned, the measure in (1.2) can be sampled efficiently using Wilson's algorithm [40]. Beside the algorithmic efficiency 4 , Wilson's algorithm has shown to be also a powerful computational tool to analyze observable of the UST model, and we will in fact make use of this algorithm in our analysis.
One of the key ideas in the algorithm proposed by Wilson is related to the connection between uniform spanning trees and Loop-Erased RW (LERW) on the underlying graphs.
LERW is a time-indexed probability distribution on the set of trajectories of a RW on G in which "loops" are neglected. LERW has become in the last twenty years a prominent topic in mathematical literature (see, among others, [14,23,25,24,35,36,37]). Another main tool that is crucial in our approach is a closed formula for the LERW trajectory statistics, due to Marchal [26].
A detailed exact and asymptotic analysis of observables related to Wilson's algorithm on a complete graph have been pursued in [32,30]. The derivation of our results is in the same spirit, although we deal with the additional randomness given by the presence of the killing parameter, which in turns makes the combinatorics more involved. In fact, as we explain in Section 1.2.1 below, the main difference between the sampling algorithm for the forest measure µ q and the original Wilson's algorithm is that we need to deal with killed LERW on the graph G, namely loop-erased paths that are stopped at an exponentially distributed time.
We remark that the algebraic properties of the measure in (1.2), e.g., the form the partition function in (1.4), can be traced back to the seminal work of Kirchhoff [22] on the theory of electrical networks. See also [38] for a more recent account on the analysis of partition functions of the form (1.4).
We conclude this section by mentioning that, in dense geometries, the UST has been studied under the perspective of the continuous random tree topology on the complete graph in [2] and with respect to local weak convergence still on the complete graph in [19] and, more recently, on growing expanders admitting a limiting graphon in [21]. These other interesting lines of investigation could also be naturally considered for the forest measure µ q but we will not pursue these approaches in this work.

Applications to network analysis
Several properties of the forest measure associated to the loop-erased partitioning have been derived in the papers [7,8]. Recently, a number of algorithms based on these results have been proposed as tools for tackling different problems in data science. These applications include: wavelets basis and filters for signal processing on graphs [3,29,28], trace estimation [10], network renormalization [4,5], centrality measures [16] and statistical learning [9]. The fact that random rooted forests proved a powerful tool in such different applied areas, was one of the staring motivation for the analysis of the partition measure in (1.9).

Pairwise interaction potential
This section is devoted to the introduction of the main tool of our analysis, which we call pairwise LEP-interaction potential, which-as it will become clear in Section 1.2.2can be thought off a two-point correlation function. The results presented in the forthcoming sections are based on a precise understanding of the behavior of this object on the graphs under analysis. Before introducing the potential, we will explain a sampling technique for the random forest Φ q , which follows by [40].

Sampling algorithm
An attractive feature of the probability measure in (1.2) is that there exists a simple and exact sampling algorithm based on the associated LERW killed at random times. The LERW with killing is the process obtained by running the RW (X t ) t≥0 , erasing cycles as soon as they appear, and stopping the evolving self-avoiding trajectory at an independent random time τ q with law Exp(q).
The algorithm can be described as follows: 1. pick any arbitrary vertex in V and run a LERW up to an independent time τ q d ∼ Exp(q). Call γ 1 the obtained self-avoiding trajectory.
2. pick any arbitrary vertex in V that does not belong to γ 1 . Define again τ q as a new exponential random variable of rate q independent from everything else. Run a LERW until min{τ q , τ γ1 }, τ γ1 being the first time the RW hits a vertex in γ 1 . Call γ 2 the union of γ 1 and the new self-avoiding trajectory obtained in this step.
3. Iterate step (2) with γ +1 in place of γ until exhaustion of the vertex set V .
In step (2) we note that if the killing occurs before τ γ1 , then γ 2 is a rooted forest in G, else γ 2 is a rooted tree.
When the above algorithm stops, it produces a rooted spanning forest Φ q ∈ F, where the roots are the points where the involved LERWs were killed along the algorithm steps, and the trees are specified by the loop-erased paths (γ ) ≥1 . The resulting forest Φ q on G induces the partition Π q = π(Φ q ) of the vertex set V , where each block is identified by vertices belonging to the same tree. It can be shown that the probability to obtain a given rooted spanning forest F coincides with µ q as in (1.2). It then follows that the induced partition is distributed according to Definition 1.1. We refer the reader to [7,Section 2] for the proof of the latter and for more detailed aspects of this algorithm, including dynamical variants.

Two-point correlations
For a pair of distinct vertices x, y ∈ V , consider the event in which they belong to different blocks of Π q , i.e., where B q (z) stands for the block in Π q containing z ∈ V . The probability of this event induces a 2-point correlation function which turns out to be analyzable by means of LERW explorations, and it encodes relevant information on how the resulting partition behaves as a function of the parameters. Below we provide a formal definition together with an operative characterization.
In the sequel we will denote by P a probability measure on an proper probability space sufficiently rich for the randomness required by this algorithm.
EJP 27 (2022), paper 67. Definition 1.2 (Pairwise LEP-interaction potential). For given q > 0 and G, and any pair x, y ∈ V , we call pairwise LEP-interaction potential the following probability: where P

LEq x
and P x stand for the laws of the LERW killed at rate q and of the RW, respectively, starting from x ∈ V , and Γ is the loop-erased path starting at x as in point (1) in the algorithm in Section 1.2.1. Therefore, the above sum runs over all possible self-avoiding paths γ starting at x.
The representation in (1.15) is a consequence of Wilson's sampling procedure described in Section 1.2.1 and it holds true since, remarkably, in steps (1) and (2) of the algorithm the starting points can be chosen arbitrarily.
We further stress that, as for any generic random partition of V , the LEP interaction potential defines a distance on the vertex set 5 . This specific metric U q (x, y) can be interpreted as an affinity measure capturing how densely connected vertices x and y are in the graph G.
Still, the observable captured by U q (x, y) is not the only one inducing a natural notion of two-point correlations associated to Π q . For example, if we express the LEP-potential in Definition 1.2 as an expectation, i.e., U q (x, y) = E 1 {Bq(x) =Bq(y)} , and normalize it with the equilibrium mass of the related blocks, we could obtain another natural two-point correlation function. This is captured in the following definition.

Definition 1.3 (Pairwise RW-interaction potential).
For given q > 0 and G, and any pair x, y ∈ V , we call pairwise RW-interaction potential the following correlation function: where u(·) is the stationary distribution of the Markov process generated by L and, for any set A ⊆ V , u(A) = x∈A u(x).
As we will see, the functional U q is actually much simpler to analyze but it captures less insightful information on the underlying graph structure. Further, unlike U q , this is neither a probability nor a metric, and it does not allow to derive a description of the macroscopic structure of Π q . In a sense, the latter is not surprising. In fact, as Lemma 2.8 unveils, this alternative correlation function can be actually expressed in terms of the sole RW Green's kernel. Therefore, in order to analyzeŪ q there is no need to introduce the LEP measure in (1.9) nor the rooted forest measure in (1.2).

Paper overview
Our main theorems are presented in Section 2. Therein we identify the LEP-potential in Section 1.2 and its asymptotics on a complete graph, Theorem 2.1, and on a nonhomogeneous complete graph with two communities, Theorems 2.2 and 2.4. Some consequences on the macroscopic emergent partition Π q on these mean-field models are derived in Corollary 2.7. The last result in Proposition 2.9 concerns the asymptotics 5 To prove the triangle inequality it is enough to notice that On the other hand, by a union bound, behavior of the other two-point correlation function in Definition 1.3. The concluding Sections 3 and 4 are devoted to the proofs for the complete graph and the community model, respectively.

Notational conventions
In what follows we will use the following standard asymptotic notation. For given positive sequences f (N ) and g(N ), we write: For k ≤ n ∈ N we will denote by (n) k := n(n−1)(n−2) · · · (n−k) the descendant factorial. Furthermore, we denote by I the identity matrix, 1 and 1 , respectively, for the row and column vectors of all 1's, where the dimensions will be clear from the context. We will write A Tr for the transpose of a matrix A.

Results: correlations and emerging partition on mean-field models
Our first result characterizes the LEP-potential in absence of geometry for finite N , and shows that this probability is asymptotically non-degenerate when q scales as √ N .
Theorem 2.1 (Mean-field LEP-potential and limiting law). Fix q > 0 and let K N be a complete graph on N ≥ 1 vertices with constant edge weight w > 0. Then, for all with Z being a standard Gaussian random variable.
For an intuitive explanation of the non-degeneracy in (2.2) for q = O( √ N ) we remark that this coincides with the typical length of the first branch in Wilson's algorithm on the complete graph, as shown in [32]. Our second result is the analogous of (2.1) when still every vertex is accessible from any other, but the edge weights are non-homogeneous and give rise to a community structure. In this sense we will informally refer to this network as mean-field-community model. Formally, for given positive reals w 1 and w 2 , we denote by K 2N (w 1 , w 2 ) the graph G with V = [2N ], and a weighted adjacency matrix as the one in (1.11). Thus, the weight w 1 measures the pairwise connection intensity within the same community, while w 2 between pairs of nodes belonging to different communities. Given the symmetry of the model, we will use the notation U (N ) q (out) to refer to the potential U (N ) q (x, y), for x and y in different communities. Conversely, we set U (N ) q (in) for the potential associated to two nodes belonging to the same community. EJP 27 (2022), paper 67. Theorem 2.2 (LEP-potential for mean-field-community model). Fix q, w 1 , w 2 > 0 and consider a two-community-graph K 2N (w 1 , w 2 ). Let T q ≥ 1 be a geometric random variable with success parameter ξ q,N := q q + N (w 1 + w 2 ) and letX = X n n∈N0 be a discrete-time Markov chain with state space {1, 2} and transition matrixP Denote by (n) = m<n 1 {Xm=1} the corresponding local time in state 1 up to time n and byP 1 the corresponding path measure starting from 1.
The above theorem is saying that the pairwise LEP-potential can be seen as the double-expectation of the function g (n, k) = N −n+1 f θP † (n, k) in (2.3) with respect to the geometric time T q and to the local time of the (discrete time) coarse-grained RW (X n ) n∈N0 . As it will be clear in the proof, the analysis of this model can be in fact reduced to the study of such a coarse-grained RW jumping between the two "lumped communities" up to the independent random time T q . The function g is the crucial combinatorial term encoding in the different parameter regimes the most likely trajectories for such a stopped two-state macroscopic walkX.

Remark 2.3 (Extensions to many communities of arbitrary sizes and weigths).
The formula in (2.3) can be derived also for the general model with arbitrary number of communities of variable compatible sizes and arbitrary weights within and among communities. The corresponding statement is much more involved, but the proof follows exactly the same scheme of the equal-sized-two-community case captured in the above theorem. Therefore, we avoid to present the general case here since, beside the long and convoluted statement of the result, we think it does not add much to the understanding of the general behavior of the model. We refer the reader interested in such an extension to [33].  to the regimes where the difference of the inand out-potential is maximal. In this case, indeed, the RW does not manage to exit its starting community within time scale 1/q and hence it is confined with high probability to "its local universe". In the dust region (f) both in-and out-potential degenerates to 1, it is in fact a regime where the killing rate is sufficiently large (recall from (2.2) that √ N is the critical scale for the complete graph) to produce "dust" as emerging partition. Finally, the global mixing region (d) is the other degenerate regime where the RW "mixes globally" in the sense that it changes community many times within time scale 1/q, hence loosing memory of its starting community. The separating lines (c)-(a)-(e) correspond to the delicate critical phases where the competition of the above behaviors occurs. This will become transparent in the proof in Section 4.7, where such boundaries will deserve a more detailed asymptotic analysis.
The next theorem gives the limit of the LEP-potential computed in Theorem 2.2, the resulting scenario is summarized in the phase-diagram in Figure 1. Then: Remark 2.5 (Link with community detection). Theorem 2.4 says that the measure (1.9) has a tendency to aggregate on the same block two given vertices in the same community iff the ratio between the out and in weights is bigger than √ N . This suggests that estimating the probabilities in Definition 1.2 could be a valuable method to design a EJP 27 (2022), paper 67. community detection algorithm for well-separated regions. Notice that the adjacency matrix of our graph can be thought off as the average adjacency matrix of a Symmetric Stochastic Block Model (SSBM). The community detection problem on SSBM is a widely studied topic, see, among others, the recent review by Abbe [1]. In the language of community detection (see [ Remark 2.6 (Anticommunities for negative β). The above theorem is stated for arbitrary α ∈ R and β > 0. We notice that while for β = 0 we are back to the complete graph with constant weight 1, for β < 0, it would be more appropriate to speak about "anticommunities" rather than communities. In fact in this case, at every step, the RW prefers to change community rather than staying in its original one. Thus, it is somewhat artificial to see what the loop-erased partitioning captures. This is the reason why the plot in Figure 1 is restricted to β ≥ 0. However, the theorem can be easily extended to cover negative β's and, not surprisingly, the difference between the in and out potentials turns out to be zero.
The next corollary collects some simple consequences, deduced by Theorem 2.4, on the macroscopic structure of Π q . We recall that |Π q | stands for the number of blocks in the random partition Π q . Our last result, Proposition 2.9, is the analogous of Theorem 2.4 for the RW-potential in Definition 1.3 and shows that this other potential gives essentially no insight on the emergent partition and very little can be inferred from it. To state the result, we first give in the next lemma a characterization of the RW-potential which reveals that in reality this kind of two-body interaction is determined only by the RW flow in the graph rather than the LEP measure.
where K q is defined as in (1.7). We can now state the RW-potential in the mean-field-community model. As for the LEP-potential we adapt the notation U q (in/out) to distinguish between pairs within the same community or not. Proposition 2.9 (Detectability via RW-potential). Consider the two-community-graph On the other hand: As anticipated, this last statement shows that the RW-potential in Definition 1.3 is less informative than the LEP one. In particular, seen as a 2-point correlation function, it provides relevant informations on the community-structure of our complete network only in the region of the parameters space where α ≤ 0 and β > 1 − α, which is strictly contained on the in "detectability" region of the LEP-potential; see Figure 1.

Strategy of proof
As mentioned, two key tools in our analysis are Wilson's algorithm [40] and the Marchal' formula for LE-paths [26]. All our proofs are a combination of reduction arguments exploiting the rich algebraic determinantal structure and symmetries of the underlying geometries. This can be appreciated in the proof of Theorem 2.1, where the closed formula in (2.1) has been derived after a mapping into a one-dimensional problem (see what we refer below as "bear strategy"). For the two-community model, the proof of Theorem 2.2 is based on a delicate lumping procedure. Finally, in order to derive the phase-diagram in Theorem 2.4 we use soft probabilistic arguments and Theorem 2.1 for the interior of the various regions, and a careful asymptotic analysis of the interplay of the functions appearing in (2.3) for the separating lines.

Proofs of Theorem 2.1: homogeneous complete graph
Proof of (2.1). For convenience, we consider a discretization of the continuous time Markov process with generator L = A − D, with A = w(11 − I) and with D = (N − 1)wI.
and get a discrete RW with transition matrix given by where r := q N w + q . (3.7) It should be clear that a sample of a LE-path starting at a given vertex can be obtained as the output of the following procedure: • With probability r the discrete process reaches the absorbing state. In particular we set T q for a geometric random variable of parameter r = q/(N w + q). • With probability 1 − r the LERW moves accordingly to the law P (v, ·) where v is the last reached node.
• We call H n the vertices covered by the LE-path up to time n. Then, if at time n + 1 the transition X n → X n+1 takes place and the vertex X n+1 ∈ H n , then H n+1 = H n ∪ {X n+1 }. Conditioning on |H n |, the latter event occurs with probability N −Hn N . Conversely, if X n+1 ∈ H n , then we remove from H n all the vertices that has been visited by the LERW since its last visit to X n+1 . As consequence the quantity |H| reduces. One can then compute that the reductions occur with law It would be easier to look at the quantity |H n | by using the following metaphor. We interpret |H n | as the height from which a bear fall down while moving on a stair of height n. In particular, we will assume that • The bear starts with probability 1 from the first step of the stair. • At each time the bear select a step of the stair uniformly at random, including also the step he currently stands on. • If the choice made by the bear is a lower step (or the current one), he moves to that step. • If he chooses an upper step, then he walks in the upper direction by a single step.
• Before doing each step, there is a probability r as in (3.7) that the bear "falls down".
Let us next fix q = 0, that is, r = 0, so that we can study the bear's dynamic independently of his falling. By setting Z(n) for the position of the bear at time n ∈ N, we get P(Z(0) = ·) = (1, 0, 0, 0, . . . , 0) Loop-erased partitioning of a graph The latter implies that at time n = h we reached the ergodic measure over the first h steps of the stair, while at time n = N the probability measure is exactly the ergodic one.
It is interesting to notice that an easier expression can be written for the cumulative distribution of the variable Z(n), i.e.
Next, calling T − the time immediately before the bear falls, we get which gives us the distribution of the last step of the bear before his fall. Recall that this is equivalent to the length of the original LERW starting on x ∈ K N , when the walk is stopped at an exponential time of rate q. Hence, we are now left to compute the probability that another walker, starting on y = x, is killed before it hits the previously sampled LERW.
Thanks to the bear' metaphor, for the size of the LE-trajectory we get: Call T Γ the first hitting time of the LE-path Γ starting at x and, noting that in the complete graph setting the law of T Γ depends only on |Γ|, we obtain where in the last equality we used that P y (T q < T Γ | |Γ| = h, y ∈ Γ) = 0 while P y (T q < T Γ | |Γ| = h, y / ∈ Γ) = q q+hw . Moreover, we used that P(y / ∈ Γ | |Γ| = h) = N −h N −1 . Now we want to make use of (3.16), therefore we rewrite EJP 27 (2022), paper 67.
By taking out the common terms in the difference above, and performing some algebraic manipulations we get and the formula in (2.1) immediately follows by the last identity.
Proof of (2.2). Let ξ q N := q N w + q (3.17) and notice that if q = z · w (3.19) in order to rewrite and notice that the first term in the latter sum is the probability that the geometric random variable T q d ∼ Geom ξq N assumes value k. Moreover it trivially holds that Hence, Let us approximate ln f (k + 1, N ) at the first order as follows where the last inequality holds true by choosing any δ ∈ 1 2 , 2 3 which in particular guarantees that c N (k) = o(1).

Proof of Theorem 2.2
We use here the same line of argument used in the proof of Theorem 2.1. For the moment, let us assume that the two communities have different sizes, and call them N 1 and N 2 , respectively. We will specialize later on the case N 1 = N 2 = N . We will consider the process having state space y and x, y in the same community w 2 if x = y and x, y not in the same community We now consider a killed LERW Γ, and we denote by Γ i the set of points of the i-th community belonging to Γ, i.e. 6 , We can write P LEq 6 Similarly, for every given self-avoiding path γ, we call γ i = γ ∩ V i , for i = 1, 2.
EJP 27 (2022), paper 67. and we assume, without loss of generality, that x ∈ V 1 ; then, by conditioning, we get for y = x with y ∈ V j , j = 1, 2 T Γ being the hitting time of Γ.

The LERW starting from x
A result due to Marchal [26] provides the following explicit expression for the probability of a loop erased trajectory: where det V \γ (qI + L) denotes the determinant of the submatrix of (qI + L) in which the rows and the columns relative to the vertices in γ have been removed. By looking closely at the latter formula we distinguish two parts: a product over the weights of the edges of the path, and an algebraic part containing the ratio of two determinants which encodes the "loop-erased" feature of the process. In particular we notice that the former contains all the details about the trajectory, while the latter only depends on the number of points visited in each community. Let j 1 (respectively, j 2 ) be the number of jumps from the first community to the second (from the second to the first, respectively) along the LE-path. We have P LEq ..,k1,N1+1,N1+2,...,N1+k2} (qI + L) det(qI + L) (4.5) where • The first binomial coefficients stays for the k 1 − 1 possible choices for the points in V 1 (one of those must be x) over the possible N 1 − 1 points of the first community (except x). In the second community we can choose any k 2 vertices over the possible N 2 − 1 vertices of the second community (except y).
• The factorials stay for the possible ordering of the nodes covered in each community.
Notice that the path on the first community must start by x.
• We sum over all the possible jumps from the first community to the second, j 1 , and from the second to the first, j 2 (notice that if j 2 must be equal or one smaller than j 1 ).
• For any choice over the product of the previous three terms we have a path that has probability as given by the Marchal formula. In the case in which we condition on having both x and y in the same (first, say) k1,N1+1,N1+2,...,N1+k2} (qI + L) det(qI + L) .
Namely, only the first combinatorial term changes.

The ratio of determinants
In our mean-field setup, the terms in (4.5) and (4.6) coming from (4.4) can be explicitly computed. We consider here the two communities case, i.e. V = V 1 V 2 , where the communities possibly have different sizes, |V 1 | = N 1 and |V 2 | = N 2 . Now, consider the matrix obtained by erasing k 1 (k 2 ) rows and corresponding columns in the first community (the second one, respectively) in −L. We are left with a square matrix made of two square blocks on the diagonal of size N 1 − k 1 =: K 1 (respectively N 2 − k 2 =: K 2 ).
We will denote this matrix by where the elements on the diagonal are given by  we get the following linear system:  and we have to find K 1 − 1 eigenvalues that are associated with eigenvector orthogonal to constants. By direct computation, A 1 has eigenvalue λ 1 := (N 1 w 1 + N 2 w 2 ) with multiplicity K 1 − 1. With the opposite choice, namely v = (0, ..., 0, Namely, there is an eigenvalue λ 2 := (N 2 w 1 + N 1 w 2 ) with multiplicity K 2 − 1. So the spectrum of M is spec(M ) = (λ 1 , λ 2 , λ 1 , λ 2 ) with multiplicity denoted by µ M (·): (4.14) Therefore, we can see that the ratio of determinants in (4.5) and (4.6) can be written explicitly. Indeed, at the denominator we have while λ 1 and λ 2 are the two solutions of the system in (4.10). In particular, if we specialize in the case N 1 = N 2 = N we can conclude that the ratio of determinants is given by where we defined a := N (w 1 + w 2 ), (4.18) and

The path starting from y
Now we have to consider the second path starting from y which decides the root at which y will be connected in the forest generated by the algorithm. The latter corresponds to the second factor in (4). Notice that it is sufficient to consider such path in the simpler fashion, i.e. without erasing the loops, since we are only concerned with the absorption of the walker: either in γ or killed at rate q. Moreover, we can exploit again the symmetry of the model to reduce it to a Markov chainX with state space {1,2,3,4} corresponding to the sets {V 1 \ γ 1 , V 2 \ γ 2 , γ 1 γ 2 , ∆}, where ∆ is again the absorbing state, i.e., the "state-independent" exponential killing. We will assume that EJP 27 (2022), paper 67. P := Q R 0 I , (4.19) where with a 1 := N 1 w 1 + N 2 w 2 , a 2 := N 1 w 2 + N 2 w 1 . The states represent: (1) nodes of the 1 st community that have not been covered by the LE-path started at x.
(2) nodes of the 2 nd community that have not been covered by the LE-path started at x. (3) nodes of both communities that have been covered by the LE-path started at x. (4) the absorbing state ∆.
Called T abs the hitting time of the absorbing set {3,4}, we want to compute the probability that the processX is absorbed in the state,4 and not in3. In terms of our original process, this means that the process is killed before the hitting of the LE-path starting at x. By direct computation =:P † (2) (4.23) notice that the first component of the vector P † ∈ R 2 corresponds to the intra-community case {x, y} ∈ V i for some i, i.e., U q (in), while the second one to the inter-community case, namely U q (out).
If we now use the assumption that N 1 = N 2 = N , the steps above allow us to write the following formulas θ(k 1 , k 2 ) as in (4.17) and (4.27) By direct computation we see that (4.29)

Local time interpretation
Now consider the part of the formula concerning the jumps among the two communities of the killed-LE-path starting at x, i.e.
The latter can be thought off as a function of a Markov Chain (X n ) n∈N on the state space {1, 2}, with transition matrix where the i-th state stays for the i-th community. Indeed, we can rewrite (4.30) as with being the local time as in the statement of Theorem 2.2.

Geometric smoothing
From the previous steps we get the following expression Next, we would like to make appear a geometric term as in the complete and uniform case of Theorem 2.1. Notice that multiplying and dividing by N k1+k2−1 one obtains ξ q,N := q q + a = q q + N (w 1 + w 2 ) (4.35) in order to obtain and where T q is an independent random variable with law Geom (ξ q,N ).

Conclusions
One can ideally divide the formulas in (4.36) and (4.37) in five terms, namely 1. The entropic term was already present in the complete and uniform case (see (2.1)). Indeed (q − λ 1 (k 1 , k 2 ))(q − λ 2 (k 1 , k 2 )) q(q + 2N w 2 ) which is the same in both in e out community cases. It can be rewritten as the ratio between two parabolas in q, i.e., It is worth noticing that the P † above is slightly different from the P † in the statement of Theorem 2.2 which contains the extra factor η . At this point by setting g out (k 1 , k 2 )P(T q = n)P 1 ( (n) = k 1 ), (4.42) and which is equivalent to the statement in Theorem 2.2.

Proof of Theorem 2.4
Proofs of (a) and (b): 1 − β < α < (=) 1 2 (detectability). As expressed in the following lemma in this regime the RW is confined to its starting community for the entire lifetime.
x is the first time in which the RW moves out of the community in which x lies.
Then, as N → ∞, Proof. Let Z be a r.v. that can assume values in the set {out, in, ∆} with probabilities: Let (Z n ) n∈N be a sequence of i.i.d. r.v.s with the same law of Z and notice that P(T q < T out x ) = P (min{n ≥ 0 | Z n = ∆} < min{n ≥ 0 | Z n = out}) . Loop-erased partitioning of a graph from which the claim.
In view of the decomposition in (1.15) and the above lemma, we can write for any Let us first consider U q (out). In this case, by Lemma 4.1, for any α ≤ 1/2 and uniformly in γ, we have that As a consequence P y (T γ > T q | E c x ) ≥ 1 − o(1), and by plugging this estimate in (4.44), we get U q (out) → 1.
Concerning U q (in), one has to notice that, for every LERW γ starting from x and ending at the absorbing state, we can consider the event Once more, uniformly in γ, we get by Lemma 4.1 that P y (E γ,y ) ≤ P y (E y ) = o(1) Notice that, under such conditioning, the sum can be read as the probability that two vertices in a complete graph with N vertices end up in two different trees. Therefore, this reduces to (2.2), which in turns gives U q (in) → 0 for α < 1/2 and U q (in) → ε 0 (α) otherwise.
Proof of (f) : α > 1 2 (high killing region). We will only show that U q (in) → 1, this will suffice since e.g. by direct computation one can check that U q (in) ≥ U q (out).
Observe first that being α > 1 2 , the length of the Loop-Erased path Γ must be "small" with high probability. In particular we can bound

Remaining proofs of Theorem 2.4
We next prove the remaining items in Theorem 2.4 for which we will implement a similar strategy which we start explaining. In all remaining regimes we need to show that U q ( ), ∈ {in, out} either vanishes or stays bounded away from zero. To this aim, we will use the representation in (2.3).
Depending on the parameter regimes, we will split the sum over t in different pieces to be treated according to the asymptotic behavior of the involved factors. To simplify the exposition we will restrict in what follows to the positive quadrant α, β > 0. We stress however that, as the reader can check, the following estimates hold true and actually converge faster even outside of the positive quadrant.
Let us start with a few observations. We notice thatf (n, k) ≤ 1 for every choice of k, N, n, moreoverf (t, n) = 0 if n ≥ N . Furthermore, for each N , (4.45) and while estimating the involved factors it will be crucial the behavior of the product f θP † (n, k) for which we can in general observe the following facts.
(A) For any ε > 0, if n > N 1/2+ε , then it follows from (3.23) that N →f N decays to zero, uniformly in k, faster than any polynomial as N → ∞. For such n's, since N → θ N P † is polynomially bounded (uniformly in n, k), the contribution in (2.3) of such terms can be neglected.
(B) Whenever we consider n's for which θP † = o(1), because of (4.45) and the uniform control onf , the contribution of such terms in (2.3) can also be neglected.
(C) For n's for which neither Item A nor Item B hold, we will estimate the asymptotics of such part of the sum by controlling the mass of the geometric time T q against θP † , and in the most delicate cases (on the separation lines in Figure 1), taking into account the behavior of the local time too.
We are now ready to treat the remaining parameter regimes using such facts.
Proof of (d): α < min{ 1 2 , 1 − β} (changing-communities before dying). In this regime, the overall picture resembles the phenomenology of the complete graph. In particular, the RW will manage to change community before being killed and up to the killing time scale, it will forget its starting community. Moreover, with high probability a single tree of size 2N (1 − o(1)) will be formed, so that, given any two points x, y, they will end up in the same tree with high probability independently on their communities.
To prove the claim notice that, uniformly in n, k, As a consequence the asymptotics of U q ( ) will be independent of . To show that such a limit is zero we argue as follows. Within this parameter region: We can now plug in this asymptotic representation of θP † in (2.3), and separately treat the four resulting terms.
For the first term, namely the sum in (2.3) with θP † I in place of θP † , we split the sum in n into two parts at N α+ε , for small ε > 0, and show that they both goes to zero, by using Items C and B, respectively In fact, with this "cut" we see that: Analogously, for the second term we split the sum over n into two parts at N 1/2+ε , with small ε > 0. Using Item C for the first part and Item A for the second one, we see that  For the third term we need to split the corresponding sum into three parts at T 1 := N 1−β−ε and T 2 := N 1/2+ε , which will be controlled by Items B, C and A, respectively. That is =o (1).
Finally, for the last term, we split the sum at N 1/2+ε . Indeed we see that: on the one hand, for n ≤ N 1/2+ε , we can use Item C since On the other hand, for n ≥ N 1/2+ε , we can argue as in Item A. Hence, Proofs of (c) and (e) (high-entropy separating lines). We start by proving (e), i.e. and . (4.63) We are going to split the sum over n in (2.3) in three parts: For such n's we have that the product θP † (n, k) is of order 1. Hence we can neglect this part by using Item C together with the estimate • n > N 1 2 +ε . Also this part can be neglected thanks to the argument of Item A.
• N 1 2 −ε < n ≤ N 1 2 +ε . This is the delicate non-vanishing part. We start by noticing that, due to (4.62) and (4.63), the leading term in θP † does not involve k , so that -at first order-U q (in) must equal U q (out). In order to show that the latter two are asymptotically bounded away from zero, we fix c ∈ (0, 1) and estimate: 1 ( (n) = k)θ(n, k)P † (n, k)f (n, k);   Moreover, thanks to (4.66) we can easily deduce that the limit is strictly smaller than 1 2 .
We next conclude by giving the proof of (e), i.e., we are going to show that Observe that, under our assumptions on α and β, we have that and P † (n, k) ∼ N 2α + k N α 3N 2α + 2nN α + k(n − k) , (4.70) hence, their product behaves asymptotically as θP † (n, k) = Θ 1 + k N α . To evaluate the asymptotic behavior of U q ( ), we split the sum over n in (2.3) in three pieces: • n ≤ N α+ε : where, thanks to (4.71), we know that θP † (n, k) = O(N ε ). We argue as in Item C, obtaining n≤N α+ε • N α+ε < n ≤ N 1 2 +ε : in this case we have to distinguish between U q (in) and U q (out).
Consider first U q (in). We call E n the following event concerning the Markov chain (X n ) n∈N E n := {At least one jump occurs before time n} . Notice that if N α+ε < n ≤ N 1 2 +ε then the event E c n occurs with high probability. Hence, for any choice of n ∈ [1, N ] and k ∈ [1, n] we can writẽ P 1 ( (n) = k) =P 1 ( (n) = k|E c n )P 1 (E c n ) +P 1 ( (n) = k|E n )P 1 (E n ) = δ k,n + o(1), δ k,n being the Kronecker delta. Hence Finally, we are left to show that U q (out) is asymptotically bounded away from 1. We consider the further split Focusing on the first sum in the latter display, thanks to (4.71), we have that Concerning the second sum, we have EJP 27 (2022), paper 67.

Remaning proofs
Proof of Corollary 2.7. Let 0 = λ 0 ≤ λ 1 ≤ · · · ≤ λ 2N −1 be the eigenvalues of −L. As shown in [7,Prop. 2.1], the number of blocks of the induced partition, |Π q |, is distributed as the sum of 2N independent Bernoulli random variables with success probabilities q q+λi . That is In case of the two-communities model we have we can deduce the concentration of |Π q |.
Notice also that the second part of the statement is a trivial consequence of the detectability result of Theorem 2.4.
Proof of Lemma 2.8. In this proof we will consider the probability measure µ q on the space of rooted spanning forests studied defined in (1.2).
Proof of Proposition 2.9. We consider here the discrete time version of the process X as presented in Theorem 2.1, see (3.6). As a warm-up, we start by computing the potential in the complete graph with unitary weights. In this case, K q (x, y) = 1 x=y P(T q = 1) + t≥1 P x (X t = y | T q = t + 1) P(T q = t + 1), (4.79) where r q := q N + q and P(T q = t + 1) = r q (1 − r q ) t , ∀t ∈ N 0 .
We next move to the mean-field-community model K 2N (w 1 , w 2 ) with w 1 = 1, w 2 = N −β , β > 0 and arbitrary q. The corresponding discrete-time RW is killed at an independent geometric time T q d ∼ Geom(r q ) with r q := q N + N 1−β + q . Denoting by J t the random variable that counts the number of times, up to time t, in which this random walk changes community, we notice that: that is, conditioning on T q = t + 1, J t has binomial distribution Bin(t, c) with success parameter c := N 1−β N + N 1−β . We are now in shape to compute the probability that x is absorbed in some y. Without loss of generality we assume x ∈ [N ], so that y ∈ [N ] and y ∈ [2N ] \ [N ] determines the in− and out−potential, respectively. Thus K q (x, y) equals K q (x, y) =1 x=y P (T q = 1) + (4.86) + t≥1 P(T q = t + 1) k≥0 P x (X t = y | J t = k; T q = t + 1)P(J t = k | T q = t + 1) and the double sum can be rewritten as K q (x, y) =1 x=y r q + O N −1 , (4.88) where the last asymptotic identity is due to the fact that the sum in (4.87) is a probability and hence bounded above by 1. High killing: When q = N α , with α > 0, r q = ω N −1 , thus the O N −1 term in (4.88) is negligible, and U q (in/out) ∼ N 2 r 2 q . In particular, the potential diverges as N 2 or N 2α depending on α ≥ 1 or α < 1, respectively. Order one killing: In the regime q = O(1), the O(N −1 ) term in (4.88) is no longer negligible and needs to be analyzed further. Let us first consider the sub-regime q = Θ(1). Notice that, when t = Θ(1/r q ),  while, for β < 1: where in (4.90)-(4.91) we used the fact that, in order to compute the first order, it is sufficient to restrict the sum over t to the values on the scale Θ(1/r q ). By (4.86)-(4.87) and the above estimates, we conclude that, for β > 1:   On the other hand, for β < 1, the estimate in (4.91) shows that, regardless of the community of y, K q (x, y) ∼ (1 x=y q + 1/2)/N . Thus the in− and out− potentials are asymptotically equivalent. In particular, U q (in) ∼ U q (in) ∼ 4q 2 + 4q. Vanishing killing: It remains to analyze the case when q = N α for some negative α < 0.
In this case, we have that We can then argue as in the case q = Θ(1) but distinguishing between β being bigger or smaller than 1 − α. In particular, due to (4.94), when β < 1 − α the resulting inand out-potentials are asymptotically equivalent and decay as N α . On the other hand, for β > 1 − α > 1, r q ∼ N α−1 , which together with (4.94) and (4.86)-(4.87) lead to the estimates: K q (x, x) ∼ r q + N −1 ∼ N −1 , K q (x, y) ∼ N −1 for y ∈ [N ] \ {x} and K q (x, y) = o(N −1 ) for pairs (x, y) in different communities. By plugging these estimates in Lemma 2.8 the statement follows.