{'fraction_non_alphanumeric': 0.03756272401433692, 'fraction_numerical': 0.011146953405017921, 'mean_word_length': 4.575739408473221, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Slowly evolving random graphs II: Adaptive geometry in finite-connectivity Hopfield models

We present an analytically solvable random graph model in which the connections between the nodes can evolve in time, adiabatically slowly compared to the dynamics of the nodes. We apply the formalism to finite connectivity attractor neural network (Hopfield) models and we show that due to the minimisation of the frustration effects the retrieval region of the phase diagram can be significantly enlarged. Moreover, the fraction of misaligned spins is reduced by this effect, and is smaller than in the infinite connectivity regime. The main cause of this difference is found to be the non-zero fraction of sites with vanishing local field when the connectivity is finite.


Introduction
Random graphs play an important role in a wide range of scientific disciplines. The topological properties of graphs offer, in the language of nodes and edges, a simple, yet powerful representation of many different complex systems. For instance in biophysics, simple models of random graphs have been used to predict the function of a chemical component (a node or a 'spin' on the graph) given information about how different chemicals interact with one another (graph connectivity) and their individual functionality within the cell (spin orientation). In complex systems such as financial markets, one wishes to understand the underlying laws and critical parameter values relating to economic recession or success, given a certain number of connections between traders and their individual decisions. Examples of such complex systems are in abundance, ranging from the aforementioned to ecological and linguistic networks (for recent reviews on the subject see [1,2]). These systems share one common feature: the sparse connectivity between the nodes. Every member of the population is connected on average to only a small fraction of all other members; yet a collective behaviour is observed.
Under this unifying framework, random graphs stand as an interesting entity per se. From a statistical mechanical point of view such systems differ fundamentally from fullyconnected ones, especially in the parameter regime of finite connectivity. In the latter case, even at the level of replica symmetry, one finds that an order-parameter function is required to describe equilibrium [3,4,5,6]. Several applications of analytically solvable models on finite connectivity random graphs can be found for e.g. error-correcting codes [7,8], cryptography [9,10], optimisation problems [11,12], spin glasses [13,14] and neural networks [15,16,17].
Physical systems however hardly ever maintain a static network architecture: the structure of web-links changes continuously over time, as does the connectivity between traders in stock markets, or the proteinic interactions through the evolutionary process; dynamically evolving graphs form the majority of complex systems in nature. Studying such systems from an analytic viewpoint poses an important theoretical challenge, since very little is known about the dynamics of disordered systems with finite connectivity. In this paper, we solve a simple model of a spin system on a random graph in which the network architecture can evolve in time, although on timescales adiabatically slow compared to the dynamics of the spins. Thus spins are always at equilibrium with respect to the dynamics of the connections. This important class of models which can be solved exactly has been first studied for fully-connected systems and Hopfield models [18,19,20,21,22,23,24], whereas, curiously, the extension of these ideas to spin systems evolving on a hierarchy of timescales reproduces the Parisi full replica symmetry breaking scheme [25].
Here we extend these ideas to finite-connectivity systems and, in particular, we apply our formalism to Hopfield models. We show that the retrieval region of the phase diagram becomes significantly enlarged, and in fact, any finite degree of mobility of the graph can lead to recall of a condensed pattern at any finite value of the storage ratio. To get a better understanding of this effect, we also compute the fraction of misaligned spins and the fraction of sites with vanishing local fields as functions of the ratio of the characteristic temperatures of the two dynamic processes. In the limit of extreme dilution our expressions reproduce the results of [26].

Model definitions
The present model is an extension of the one presented in [26] where geometry was of an adaptive nature. There, one could make important analytic simplifications owing to the choice of 'extreme dilution' scaling whereby each node in the graph was connected on average to a vanishing fraction of other nodes although this fraction still contained an infinite number of nodes. Here, we extend the formalism of [26] to consider the more realistic (albeit analytically more involved) scenario in which for every node there is a finite average number of connections, prescribed to a fixed number c. Thus, loops although rare are still present.
To be precise, our model describes a graph of i = 1, . . . , N nodes associated with N (fast) neuron variables σ = (σ 1 , . . . , σ N ) with σ i ∈ {−1, 1}. For every pair of neurons (i, j) we consider the connectivity variables c = {c ij } with c ji = c ij and c ii = 0, which describe whether a connection between neurons σ i and σ j is present (c ij = 1) or not (c ij = 0). We take neuron variables to evolve according to a Glauber dynamics and at equilibrium their energy is described by The (quenched) variables {ξ µ } ∈ {−1, 1} N with µ = 1, . . . , p describe p binary patterns which have been imposed as attractors of the dynamics (stored Hopfield memories). The value of the pattern interactions µ ξ µ i ξ µ j remains unchanged throughout the dynamics. Neuron variables equilibrate with respect to this Hamiltonian at temperature 1/β and are described by the partition function Within the timescale in which neurons evolve to their equilibrium state the connectivity variables c ij are effectively quenched. On larger timescales though, these also evolve dynamically (according to some Glauber prescription and preserving detailed balance) with the total Hamiltonian By this construction, energetically favourable configurations of the connectivity matrix c are taken to be those that minimise the free energy of the neuron (fast) variables. The chemical potential in (3) ensures, as was shown in [26], that on average there are c connections per neuron. Sparse connectivity then requires taking the limit c/N → 0 while our choice of finite connectivity scaling corresponds to c ∼ O(1). The variables c, in turn, equilibrate at an inverse temperatureβ with a total partition function given by This partition sum effectively contains n =β/β replicated copies of the fast system, producing a replica theory with nonvanishing but, generally, noninteger replicadimension. Hence, by definition, a large replica dimension n corresponds to low temperaturesT (or, equivalently, low-energies) of the slow system relative to that of the fast. The formation of a particular graph configuration is then dominated by the Hamiltonian (3) rather than the thermal noiseT . The total construction of equations (1)-(4) therefore rearranges the geometry of the graph into optimised configurations c such that the retrieval performance of pattern recall can be potentially enhanced (due to the minimisation of frustrated bonds).
At total equilibrium we will be interested in the evaluation of the (slow) free energy which generates expressions for the system's macroscopic observables.

Calculation of the RS free energy
To evaluate the partition function (4), first the trace over the connectivity variables is taken. This results in where we introduced the notation σ = (σ 1 , . . . , σ n ) with σ · σ ′ = α σ α σ ′α and ξ i · ξ j = p µ=1 ξ µ i ξ µ j as usual. The methodology required to proceed further from the above equation depends on the scaling regime one considers. For systems with extremedilution where c → ∞ (while c/N → 0) [26] one can expand the above exponential and retain only the lowest two moments, which for N → ∞ describe the system's thermodynamics fully. In contrast, for any finite c moments of order higher than 2 do not vanish. One is therefore required to consider an order-parameter function.
At this stage, it turns out helpful to partition our graph into 2 p sublattices [15,27], Then, upon introducing into our equations the order-function we obtain the following extremisation problem for (5): The order-function P ξ (σ) follows from the self-consistent equation

Replica-and sublattice-symmetric assumptions
Our expressions (9), which describe the underlying order-function of our system, depend on the unpleasant sublattice index ξ. Therefore solving this system of 2 p equations will become increasingly hard with the number of patterns p. However, if the system is in a state where there is a finite overlap only with one pattern (say µ = 1), we expect that one can make a 'condensed ansatz', namely requiring the sublattice distribution of replicated spins to depend only on the component of the sublattice vector ξ corresponding to the condensed pattern, i.e., Taking the traces over the non-condensed pattern components then reduces the order parameter equations (9) to ‡ By inspection of the RHS of (11), one concludes that the dependence on the remaining sublattice ξ can only come in in the form P ξ (σ) = P (ξσ). Upon inserting this form into the RHS of (11), it follows that the resulting equation is self consistent, as it should be: This expression, devoid completely of pattern variables, allows for a significant reduction of numerical costs.
We will now proceed further with assuming replica-symmetry (RS), viz. we require that permutation of spins within different replica groups leaves the order function (12) invariant. In general, this amounts to assuming that the order function acquires e.g. the form since the sum over replica groups acts in the desired permutation-invariant way. In our case, where n can take any finite value, we find that for integer n values, significant simplifications occur if we rewrite replica-symmetry as for some density Q(x) which takes values only at a finite number of integer points and with the normalisation constraint 1 = n l=0 n l Q(2l − n). The special case of (14) can also serve as a test of the accuracy of the more general expression of (13).

Thermodynamic quantities for general n
Using the general-n RS assumption (13) we may convert the self-consistent equation (12) into one for the effective field distribution W (h). To do so, first one expresses (8) ‡ from now on we will use the proportionality symbol ∼ to express distributions modulo their normalisation constant.
Variation now of the above with respect to W (h) results in In the special limit n → 0 this expression recovers [5,4,15] as it should. Typical profiles of W (h) are shown in figure 1.
Using the ansätze (10,13) one can also express the (condensed) retrieval and overlap order-parameters in terms of W (h): In figure 2 we present numerical solutions of equations (17,18) (left panel). From equations (16,17,18) we can identify W (h) = δ(h) as the paramagnetic (P) solution. Using bifurcations analysis as in e.g. [15] one can find possible second-order transitions from this state. Thus, making an expansion of (16) for small fields such that dh W (h) h ℓ = O(ǫ ℓ ) with 0 < ǫ ≪ 1 we find that transitions to ferromagnetic (F: m, q = 0) and spin-glass regions (SG: m = 0, q = 0) are respectively given by In the limit n → 0, when the evolution of connectivity variables is dominated the thermal noiseT , the microscopic distribution of the c ij is uniform, and the calculation is equivalent to a replica theory with quenched randomness. In this limit the above transition lines then reduce indeed to the ones found in [15]. However, one must also keep in mind here that for increasing n, the phase diagram tends to be dominated by first-order transitions [28]. In that case, fields can no longer be regarded as small close to the transition and a bifurcation analysis is not possible. One must then resort to strictly numerical methods evaluating directly all observables of interest.

Thermodynamic quantities for integer n
We will now consider the special case where n is integer whereby replica symmetry implies the order function P (σ) can only have discrete arguments. Introducing the corresponding RS ansatz (14) and replacing the Kronecker δ-functions by their integral representations allows us to rewrite the self-consistent equation for P (σ) (12) in terms of Q(ℓ), namely with the constants (in a particular integral representation) Equation (21) can be solved numerically by iteration. In this representation, and also using the sublattice symmetric ansatz (10), we find that the (condensed) retrieval overlap order-parameter m = σ P (σ)σ 1 reads whereas, the spin glass order parameter q = σ P (σ)σ 1 σ 2 is Finaly, the free energy in this representation is Numerical solutions of equation (23) are shown in figure 2 (right panel).

Phase diagrams
In figure 3 we present the phase diagram of our model for n = 0.1. It is drawn in the (α, T ) plane where α = p/c. Direct evaluation of the observables m and q (16,17,18) shows that the P→R and P→SG transitions occur at the lines predicted by (19) and (20). Generally, sufficiently small values of n lead to second-order P→R and P→SG transitions, as was also the case for c → ∞ [26]. As expected, the transition R→SG is first-order and examples of m along this transition are shown in figure 2. Of special interest is the significant enlargament of the R phase for any n > 0. It physically implies that as soon as the connectivity variables {c ij } can be 'mobile' the graph rearranges itself such that, for sufficiently low T , pattern recall can always be achieved. This effect is more apparent as the ratio n =β/β increases (see figures 4): the range in the parameter space where recall can be achieved increases, while the SG area shrinks. Numerical evaluation of equations (23,24) shows that large values of n (i.e. for n > 1) the P→R transition line becomes first-order above some value of the storage capacity α, which depends on c. In figure 4 we have plotted phase diagrams for n = 2 and n = 3 for different values  [15] where n → 0). For sufficiently small values of n the P→R and P→SG transitions are second-order and the separating line is described from (19,20).
of the connectivity. Compared to the extremely-diluted theory c → ∞, we see that finite-connectivity leads to larger regions in parameter space where recall is possible (to illustrate this we have included the corresponding c → ∞ line in the left figure where n = 2). Physically, this can be understood on the basis of the number of connections per spin: for a system with finite c, there are enough vacancies for the connectivity variables to optimize the energetic contributions. However, for c → ∞, the number of vacancies for optimal configurations is less, creating an entropic countereffect.

The fraction of misaligned spins
Since our model aims to describe rearrangements of the connectivity matrix {c ij } taylored to lead to optimal performance of pattern recall, we expect on physical grounds, that this will be in fact a result of a minimisation of the number of frustrated bonds in the system. To measure this effect let us introduce the joint distribution of spins and local fields With (26) we can now define the fraction of misaligned spins The latter, in contrast with the c → ∞ regime, is expected not to vanish, since the distribution of local fields is a sum of delta peaks. In the limit c → ∞, this sum of delta peaks is traded for a continuous distribution, with a vanishing measure for the fraction of fields that are exactly zero. Expressions (27) and (28) in combination will allow us to get an idea of the amount of frustration in our system. Note however that a small fraction of misaligned spins does not necessarily imply a small amount of frustration: for a large number of patterns the interactions µ ξ µ i ξ µ j have a large absolute value and therefore with a high prbability spins prefer to align to their local field. On the contrary, a vanishing number of frustrated bonds does imply a vanishing φ. If variations in n induce variations in φ, we expect this to be due to a change in the amount of frustration.

The joint distribution of spins and local fields
To evaluate the joint distribution of spins and local fields we begin by inserting into the partition function (4) appropriate delta functions to define the local fields in the system with {dh i } = n α=1 dh α i . The delta function in the above expression introduces conjugate local fields in our equations. Therefore, we are required to consider the more general from which the joint distribution of spins and local fields follows simply by integrating out the conjugate fieldsĥ. Given (29) and (30), we can now take the trace over {c ij } in (4) and arrive at the free energy where the extremisation problem leads to the self consistent equation for P ξ (σ, h,ĥ): Let us now expand the exponential in the above right-hand side and integrate over the conjugate fieldsĥ: Using now the identity dĥdhe −ia·ĥ P ξ (σ, h,ĥ) = e β 2 a·σ dĥdh P ξ (σ, h,ĥ) we can write where P ξ (σ) is the order function we defined in (7). Equation (34) represents the joint distribution of n spins and local fields. From here, we may find the single-replica joint distribution (26) by integrating out n − 1 replicas. The result is This expression depends only on the order-function P ξ (σ). To proceed further one is now required to substitute either the general-n replica-and sublattice-symmetric assumptions (13,16), or, the corresponding integer-n ones (14,21). For general n we find that tracing over the spins {τ l } results in lengthy expressions of questionable practical value. For integer n however, spins need not be necessarily traced: the fact that their dimensionality is prescribed to the well-defined integer value n allows us to proceed further and rewrite (35) in a numerically tractable form. Using the ansatz (10) in the RHS of (35) and the RS expression (14) we obtain with the abbreviated averages Once the density Q(ℓ) has been obtained from (21) one can evaluate the distribution (36) in the spirit of population dynamics [13]: one considers a population of triplets {ν, τ , ξ}. One then selects a number k from a Poisson distribution of mean c and chooses l = 1, . . . , k triplets {ν l , τ l , ξ ′ l } each according to the distributions (37,39,38). One then evaluates the location and weight of the local field h and thus estimates the probability P ξ (σ, h) (with σ and ξ fixed and modulo the normalisation coefficient). This process is repeated until convergence.

Numerical results
In figure 5 we plot the fraction of misaligned spins (27) as a function of the (spin) temperature T for c = 10 and α = 0.1, 0.5 and 1 respectively. As expected on physical grounds, we see that larger values of n, i.e. lower temperaturesT (or, lower timescales, or lower energies equivalently) associated to the slow wiring variables c ij , alignment improves. This effect is due to the ordering of the c ij , reducing the amount of frustration. In all cases we compare the results with those for c → ∞ (as derived in [26]). Clearly, also for finite fixed c, φ decreases as a function of α, which is in fact a result of the scaling choice of the interactions µ ξ µ i ξ µ j /c. The expectation of their absolute value increases with p, as do the local fields, resulting in a high probability of alignment. We find that finite connectivity values of φ are always upper-bounded by those of c → ∞. For temperatures T sufficiently large, such that the system is in a paramagnetic state, the noisy dynamics of the spins dominates on the evolution of the graph and φ becomes independent of the ratio n.
The difference between finite and infinite connectivity, most clearly observed in the paramagnetic regime (large T ), is found to be mainly due to a nonvanishing fraction ψ of sites that have a zero local field (28). This means that for such sites the energetic cost of either of the two possible orientations is identical. To understand the origin of the difference between finite-c and c → ∞ let us consider the quantitŷ which represents the fraction of frustrated sites to which half of the 'indeterminate' spins have been added. This quantity is plotted in figure 6 for c = 14 and α = 0.5, and is compared to φ in the limit of c → ∞ calculated in [26]. We see that the finite-and infinite-c plots become almost identical apart from a small difference close to the R→P transition. This hints that, as far as the fraction of misaligned spins is concerned, ψ is the main discriminator between the two scaling regimes and that the choice of obtaining the c → ∞ fraction φ via (40) is quite accurate. For large c, the quantity ψ is expected to vanish. This is indeed supported by the results of figure 7, where ψ is plotted as a function of c for T = 2, n = 2 and the memory loads α = 0.1, α = 0.5 and α = 1 respectively. Clearly, for small values of c the quantity ψ can be rather large indeed, especially in the paramagnetic phase. It is also clear that the statistics for ψ differ in the case of an odd versus an even number of patterns p, which we have plotted separately in the figures: for an odd number of patterns, there can be no zero-valued interactions µ ξ µ i ξ µ j , whereas for even p this can be the case; hence the smaller values of ψ for odd p. The magnitude of the difference in φ at T = 2 between finite connectivity and infinite connectivity in figure 5 appears to display a slight nonmonotonicity in α at first sight, but is consistent with the corresponding values for ψ in figure 7. Here the cases α = 0.1 and α = 0.5 correspond to odd p, whereas for α = 1 p is even.

Simulations
To perform simulation experiments one needs to construct an explicit dynamical process for the transition probabilities W [c ′ ; c] between two graph configurations. To this end, one can easily set up Glauber-type probabilities W [F ij c, c] that automatically obey detailed balance and which are functions of the energetic difference (i, j) = (k, ℓ). Explicit expressions on such processes can be derived equivalently to [26]. The result is The angular brackets denote a thermal average over the distribution p f (σ) ∼ exp[−βH f (σ, c)] while spins are in equilibrium at the timescale of the graph dynamics. Note that this transition probability reduces to the one found in [26] for c → ∞. The practical restrictions for 'coupled' types of simulations, where two nested dynamical processes occur, is that the total equilibration time can in reality be extremely large. So, for all practical purposes one is confined to small system sizes, which, unfortunately induce, in turn, large finite-size effects. Therefore, one has to accept that experiments will always suffer from a non-vanishing statistical error and can at most be satisfactory.
With these practical limitations in mind, we will resort to compare our theory for the fraction ψ of zero local fields in the paramagnetic regime for n = 2 and T = 2, and for small c. In this way we exploit the fact that in the paramagnetic regime equilibration times are relatively short. In figure 8 we have plotted ψ for the 5 first possible values of c at α = 0.5, with T = 2 and n = 2. Even though the system size is still rather modest (we used N = 200), the results clearly support the theory.

Conclusions
It is a relatively new insight that a wide range of physical complex systems (viewed as random graphs) evolve towards specific structures and are, surprisingly, characterised by universal features (e.g. scale-free degree distributions). Preferential attachment models describing network growth, such as the Barabási-Albert algorithm [2], provide possible explanations for the occurrence of certain network-architectures. In the present paper we have presented a simple solvable model describing evolving random graphs of a fixed number of nodes, with finite connectivity, in which the analytic hurdles imposed by the explicit dynamics are overcome by taking the adiabatic limit: we consider connectivities which evolve much slower than nodes. This allows us to study directly thermodynamic properties of graphs at equilibrium.
In particular, we have focused our attention on Hopfield neural network models on random graphs. By a suitable choice of chemical potential, the average connectivity per neuron is forced to a finite regime, as opposed to a previous study [26] in which it was infinite. The resulting theory is, traditionally (see [18,19,20,21,22,23,24]), a finite dimensional replica theory, in which the replica dimension represents the ratio of temperatures between the fast and the slow system.
The consequences of the finite connectivity regime, as compared to the regime of so called extreme dilution, are drastic at the mathematical level, since a finite set of order parameters is traded for an infinite dimensional order parameter function. The case of integer replica dimension, however, is an exception to the latter statement, simplifying the mathematics, so that observables can be calculated accurately. In this paper we have presented phase diagrams and observables for both integer replica dimension and non-integer replica dimension. For integer replica dimension, we were able to calculate the fraction of misaligned spins, as well as the fraction of vanishing fields. The latter quantity, which vanishes in the case of infinite connectivity, is the most important discriminator between the parameter regimes of finite connectivity and extreme dilution. Qualitatively, the frustration effects are minimised as the temperature of the slow system decreases, enhancing the retrieval state of a condensed pattern. Moreover, for larger n, phase transition lines are mainly first order, and the retrieval phase is dramatically enlarged in comparison with the case n = 0. For any nonzero n there is no critical storage capacity beyond which retrieval is not possible. In other words, as soon as the statistics for the graph realisations becomes nonuniform, the graph in principle can organise itself in favour of the retrieval of a pattern, regardless of the number of patterns present in the Hopfield interactions (note that this statement is in principle true for an arbitrarily large but finite p, due to the scaling regime of finite connectivity). Our theoretical findings are supported by simulation results, which, due to the difficulties of nested equilibrations, we have restricted to a simple (paramagnetic) region in the phase diagram. All results obtained in this paper are replica symmetric approximations. However, as in the case of infinite connectivity [26], we expect replica symmetry breaking to occur only at sufficiently low values of n i.e. below n = 1, and small values of T or large values of α.
Several extensions of this work are possible: in a similar fashion one may also consider evolution models of random poissonian graphs to e.g. scale-free ones. In the context of the present paper this amounts to appropriate modifications of our chemical potential while the remaining theory would remain largely the same.
Furthermore, one may investigate the local stability of non-condensed pattern retrieval states once the c ij are equilibrated in favour of one particular pattern, as was done in [26]. To that end, one needs to overcome the problem of taking the replica limit n → 0 in only one of two spin systems {σ i } and {τ i }, described by a coupled order function P ξ (σ, τ ). So far, we have not been able to solve this problem.