Replays of spatial memories suppress topological fluctuations in cognitive map

The spiking activity of the hippocampal place cells plays a key role in producing and sustaining an internalized representation of the ambient space—a cognitive map. These cells do not only exhibit location-specific spiking during navigation, but also may rapidly replay the navigated routs through endogenous dynamics of the hippocampal network. Physiologically, such reactivations are viewed as manifestations of “memory replays” that help to learn new information and to consolidate previously acquired memories by reinforcing synapses in the parahippocampal networks. Below we propose a computational model of these processes that allows assessing the effect of replays on acquiring a robust topological map of the environment and demonstrate that replays may play a key role in stabilizing the hippocampal representation of space.


INTRODUCTION
Spatial awareness in mammals is based on an internalized representation of the environmenta cognitive map. In rodents, a key role in producing and sustaining this map is played by the hippocampal place cells, which preferentially fire action potentials as the animal navigates through specific domains of a given environment-their respective place fields. Remarkably, hippocampal place cells may also activate due to the endogenous activity of the hippocampal network during quiescent wake states (Johnson & Redish, 2007;Pastalkova, Itskov, Amarasingham, & Buzsáki, 2008) or sleep (Ji & Wilson, 2007;Louie & Wilson, 2001;Wilson & McNaughton, 1994). For example, the animal can preplay place cell sequences that represent possible future trajectories while pausing at "choice points" (Papale, Zielinski, Frank, Jadhav, & Redish, 2016), or replay sequences that recapitulate the order in which the place The activity-dependent changes in the hippocampal network's synaptic architecture occur at multiple timescales (Bi & Poo, 1998;Fusi, Asaad, Miller, & Wang, 2007;Karlsson & Frank, 2008). In particular, statistical analyses of the place cells' spiking times indicate that place cells exhibiting frequent coactivity tend to form short-lived "cell assemblies"-commonly viewed as functionally interconnected groups of neurons that form and disband at a timescale between tens of milliseconds (Atallah & Scanziani, 2009;Bartos, Vida, & Jonas, 2007;Buzsáki, 2010;Harris, Csicsvari, Hirase, Dragoi, & Buzsáki, 2003) to minutes or longer (Billeh, Schaub, Anastassiou, Barahona, & Koch, 2014;Goldman-Rakic, 1995;Hiratani & Fukai, 2014;Kuhl, Shah, DuBrow, & Wagner, 2010;Murre, Chessa, & Meeter, 2013;Russo & Durstewitz, 2017;Zenke & Gerstner, 2017), that is to say the functional architecture of this network is constantly changing. In our previous work (Babichev & Dabaghian, 2017a, 2017bBabichev, Morozov, & Dabaghian, 2018) we used a computational model to demonstrate that despite the rapid rewirings, such a "transient" network can produce a stable topological map of the environment, provided that the connections' decay rate and the parameters of spiking activity fall into the physiological range (Arai, Brandt, & Dabaghian, 2014;Basso, Arai, & Dabaghian, 2016;Dabaghian, Mémoli, Frank, & Carlsson, 2012). Below we adopt this model to study the role of the hippocampal replays in acquiring a robust cognitive map of space. Specifically, we demonstrate that reinforcing the cell assemblies by replays helps to reduce instabilities in the large-scale representation of the environment and to reinstate the correct topological structure of the cognitive map.

General Description
The topological model of spatial learning rests on the insight that the hippocampus produces a topological representation of spatial environments and of mnemonic memories-a roughand-ready framework that is filled with geometric details by other brain regions (Dabaghian, Brandt, & Frank, 2014). This approach, backed up by a growing number of experimental (Alvernhe, Sargolini, & Poucet, 2012;Fenton, Csizmadia, & Muller, 2000;Gothard, Skaggs, & McNaughton, 1996;Knierim, Kudrimoti, & McNaughton, 1998;Leutgeb et al., 2005;Moser, Kropff, & Moser, 2008;Touretzky et al., 2005;Wills, Lever, Cacucci, Burgess, & O'keefe, 2005;Yoganarasimha, Yu, & Knierim, 2006) and computational (Chen, Gomperts, Yamamoto, & Wilson, 2014;Curto & Itskov, 2008;Petri et al., 2014) studies, and allows using a powerful arsenal of methods from algebraic topology, in particular persistent (Carlsson, 2009;Lum et al., 2013;Singh et al., 2008) and zigzag (Carlsson & De Silva, 2010;Carlsson, De Silva, & Morozov 2009) homology theory techniques, for studying structure and dynamics of the hippocampal map. In particular, the approaches developed in Arai et al. (2014) ;Babichev, Cheng, & Dabaghian (2016) ;Babichev, Ji, Mémoli, & Dabaghian (2016); Basso et al. (2016); Dabaghian et al. (2012) ;Hoffman, Babichev, & Dabaghian (2016) help to explain how the information provided by the individual place cells combines into a large-scale map of the environment, to follow how the topological structure of this map unfolds in time, and to evaluate the contributions made by different physiological parameters into this process. It was demonstrated, for example, that the ensembles of rapidly recycling cell assemblies can sustain stable qualitative maps of space, provided that the network's rewiring rate is not too high. Otherwise the integrity of the cognitive map may be overwhelmed by topological fluctuations (Babichev & Dabaghian, 2017a, 2017b. Mathematically, the method is based on representing the combinations of coactive place cells in a topological framework, as simplexes of a specially designed simplicial complex ( Figure 1A and 1B). Each individual simplex σ schematically represents a connection (e.g., an overlap) between the place fields encoded by the corresponding place cells' coactivity. The full set of such simplexes-the coactivity simplicial complex T -incorporates the entire pool of connections encoded by the place cells in a given environment E, and hence represents the In the following, we simulate rat's navigation in a square-shaped environment E with a hole in the middle. The curves γ 1 , γ 2 , and γ 3 represent a few short segments of a physical trajectorynavigated by the rat. The place fields-the regions where the corresponding place cells become active-densely cover the environment, forming a place field map M E . An exemplary place field is represented by a highlighted cluster of blue dots in the top left corner of the environment. The right segment of the environment shows a highlighted pair, a triple and a quadruple of the overlapping place fields; the remaining place fields are dimmed into background. (B) Simplexes that correspond to overlapping place fields: a single vertex corresponds to place field (or a single active cell); a link between two vertexes represents a pair of overlapping place fields (or a pair of coactive cells); three overlapping place fields (or a triple of coactive place cells) correspond to a triangle, and so forth. (C) A collection of simplexes forms a simplicial complex, which schematically represents the net structure of the place field map. Shown is a fragment of a two-dimensional (2D) coactivity complex with simplicial paths Γ 1 , Γ 2 , and Γ 3 that represent the physical paths γ 1 , γ 2 , and γ 3 shown on the left. The classes of equivalent simplicial paths describe the topological structure of the coactivity complex: the number of topologically inequivalent, contractible simplicial paths such as Γ 1 and Γ 2 , defines the number of pieces, b 0 , of the coactivity complex (see Methods). The number of topologically inequivalent paths contractible to a one-dimensional (1D) loop defines the number b 1 of holes and so forth (Hatcher, 2002). (D) A schematic representation of a replayed sequence of place cells, shown over the corresponding place fields. The colored ticks in the top left corner schematically represent a sequence of spikes replayed within a short time window w. topological structure of the cognitive map of the navigated space (Best, White, & Minai, 2001;O'Keefe & Dostrovsky, n.d.).

Topological Structure of the Coactivity Complex
The topological structure of the coactivity complex provides a convenient framework for representing spatial information encoded by the place cells. For example, the combinations of the cells ignited during the rat's moves along a physical trajectory γ, or during a mental replay of such a trajectory, is represented by a "simplicial path"-a chain of simplexes Γ = {σ 1 , σ 2 , . . . , σ k } that qualitatively represents the shape of γ. A simplicial path that loops onto itself represents a closed physical rout; a pair of topologically equivalent simplicial paths represent two similar physical paths and so forth ( Figure 1C).
The net structure of the simplicial paths running through a given simplicial complex T can be used to describe its topological shape. Specifically, the number of topologically distinct (counted up to topological equivalence) closed paths that contract to zero-dimensional vertexes-the zeroth Betti number b 0 (T )-enumerates the connected components of T ; the number of topologically distinct paths that contract to closed chains of links-the first Betti number b 1 (T )-counts its holes and so forth (see (Aleksandrov, 1965;Hatcher, 2002); and Methods).

Dynamics of the Coactivity Complexes
In practice, the coactivity complexes can be designed to reflect particular physiological properties of the cell assemblies. For example, the time course of the simplexes' appearance may reflect the dynamics of the cell assemblies' formation (Babichev & Dabaghian, 2017a, 2017bHoffman et al., 2016), or the details of the place cell activity modulations by the brain waves (Arai et al., 2014;Basso et al., 2016) and so on. In particular, a population of forming and disbanding cell assemblies can be represented by a set of appearing and disappearing simplexes, that is, by a "flickering" coactivity complex F studied in Babichev & Dabaghian (2017a, 2017b and . There it was demonstrated that if a cell assembly network rewires sufficiently slowly (tens of seconds to a minute timescale), then the "topological shape" of the corresponding coactivity complex remains stable and equivalent to the topology of the simulated environment E shown on Figure 1A, as defined by its Betti numbers b k (F ) = b k (E ) = 1, k = 0, 1 (see Methods). Physiologically, this implies that cell assemblies' turnover at the intermediate and the short memory timescales does not prevent the hippocampal network from producing a lasting representation of space, despite perpetual changes of its functional architecture (Wang et al., 2006).
In particular, the model  predicts that cell assembly network produces a stable topological map if the connections' mean lifetime exceeds τ ≥ 150−200 s, which corresponds to the Hebbian plasticity timescale (Billeh et al., 2014;Goldman-Rakic, 1995;Hiratani & Fukai, 2014;Russo & Durstewitz, 2017;Zenke & Gerstner, 2017). For noticeably shorter τ, the topological fluctuations in the simulated hippocampal map are too strong and a stable representation of the environment fails to form. For example, in the case of the place field map shown on Figure 2A, the connections' proper lifetime is about τ = 50 s and the corresponding coactivity complex is unstable: its Betti numbers frequently exceed the physical values (b k (F ) > b k (E )), implying that F may split into several disconnected pieces, each one of which may contain transient gaps, holes, and other topological defects that do not correspond to the physical features of the environment. The green and the blue lines show, respectively, the zeroth and the first Betti numbers, b 0 (F τ ) and b 1 (F τ ) (see Methods), as functions of time. For most of the time, both Betti numbers remain small, b 0 (F τ ) ≈ 2.5 ± 2.1 and b 1 (F τ ) ≈ 2.8 ± 2.2, indicating a few disconnected fragments of the coactivity complex F τ and a few spurious holes in them. The rapid increase of the Betti numbers during short "instability intervals" I 1 , . . . , I 6 (highlighted by the pink background) indicate periods of strong topological fluctuations in F τ . (B) A segment of the simulated trajectory taken between the 16th and 18th minute shows that the animal spends time before and during the instability period I 5 in a particular segment of the arena. During this time, the connections over the unvisited segments of E start to decay (here the connections' mean proper lifetime is τ = 50 s), as a result of which the coactivity complex F τ fractures into a large number of disconnected pieces riddled in holes, which explains the splash of b 0 (F τ ) and b 1 (F τ ). (C) Spatial histograms of the links (i.e., centers of the pairwise place field overlaps, left panel) and of the three-vertex simplexes (i.e., centers of triple place field overlaps, right panel) present in F τ during the instability period I 5 . The simplexes concentrate over the northeast corner of the environment, whereas the populations of simplexes over the south and the southwestern parts thin out. (D) The "local" Betti number b 1 (blue numerals) computed separately for the eight sectors of the environment (circled Roman numerals) indicate that the holes emerge in all the "abandoned" parts, for example, sector IV contains 5 holes and sector V contains 16 holes, and so forth. The global Betti number computed at about 16th minute for the entire complex, b 1 (F τ ) = 21, is shown in the middle.
For most of the time, these defects are scarce (b k (F ) < 5, Figure 2A) and may be viewed as topological irregularities that briefly disrupt otherwise functional cognitive map. Indeed, from the physiological perspective, it may be unreasonable to assume that biological cognitive maps never produce topological inconsistencies-in fact, admitting small fluctuations in a qualitatively correct representation of space may be biologically more effective than spending time and resources on acquiring a precise and static connectivity map, especially in dynamically changing environments. However, during certain periods, the topological fluctuations may become excessive, indicating the overall instability of the cognitive map. The origin of such occurrences is clear: if, for example, the animal spends too much time in particular parts of the environment, then the parts of F that represent the unvisited segments of space begin to deteriorate, leaving behind holes and disconnected fragments ( Figure 2B-2D). Outside of these "instability periods," when the rat regularly visits all segments of the environment, most place cells fire recurrently, thus preventing the coactivity complex F from deteriorating.
Although this description does not account for the full physiological complexity of synaptic and structural plasticity processes in the cell assembly network, it allows building a qualitative model that connects the animal's behavior, the parameters describing deterioration of the hippocampal network's functional architecture and the large-scale topological properties of the cognitive map. This, in turn, provides a context for testing the effects produced by the place cell replays, for example, their alleged role in acquiring and stabilizing memories by strengthening the connections in parahippocampal networks (Colgin, 2016;Sadowski et al., 2011Sadowski et al., , 2016. To test these hypotheses, we adopted the topological model  so that the decaying connections in the simulated hippocampal cell assemblies can be Hippocampal cell assemblies: Transient, functionally interconnected groups of place cells that exhibit frequent coactivity. The organized activity of cells in the hippocampal and cortical assemblies is believed to underlie learning and memory mechanisms. (re)established not only by the place cell activity during physical navigation but also by the endogenous activity of the hippocampal network, and studied the effect of the latter on the structure of the hippocampal map, as outlined below.

Implementation of the Coactivity Complexes
Implementation of the coactivity complexes is based on a classical model of the hippocampal network, in which place cells c i are represented as vertexes v i of a "cognitive graph" G, while the connections between pairs of coactive cells are represented by the links, (Babichev, Cheng, & Dabaghian, 2016;Burgess & O'keefe, 1996;Muller, Stead, & Pach, 1996). The assemblies of place cells ς = [c 1 , c 2 , . . . , c n ]-the "graphs of synaptically interconnected excitatory neurons," according to Buzsáki (2010)-then correspond to fully interconnected subgraphs of G, that is, to its maximal cliques (Babichev, Cheng, & Dabaghian, 2016;Hoffman et al., 2016). Since each clique ς, as a combinatorial object, can be viewed as a simplex spanned by the same set of vertexes (see Supplemental Figure 6 in Basso et al., 2016), the collection of cliques of the graph G defines a clique simplicial complex (Jonsson, 2008), which proves to be one of the most successful implementations of the coactivity complex. In previous studies (Babichev, Cheng, & Dabaghian, 2016;Basso et al., 2016;Hoffman et al., 2016), we demonstrated that in absence of decay (τ = ∞), such a complex T effectively accumulates information about place cell coactivity at various timescales, capturing the correct topology of planar and voluminous environments. If the decay of the connections is taken into account (τ < ∞), then the topology of the "flickering" coactivity complex F remains stable for sufficiently small rates, but if τ becomes too small, the topology of F may degrade. A question arises, whether the replays can slow down its deterioration, as the biological considerations suggest.

Dynamics of the Coactivity Graph
Physiologically, place cell spiking is synchronized with the components of the extracellular local field potential-the so-called brain waves that also define the timescale of place cell coactivity (Buzsaki, 2006). Specifically, two or more place cells are considered coactive if they fire spikes within two consecutive θ-cycles-approximately 150-250 ms interval (Mizuseki, Sirota, Pastalkova, & Buzsáki, 2009)-a value that is also suggested by theoretical studies (Arai et al., 2014). In the following, this period will define the shortest timescale at which the functional connectivity of the simulated hippocampal network can change. For example, a new link ς ij = [v i , v j ] in the coactivity graph will appear, if a coactivity of the cells c i and c j was detected during a particular 2θ period. In absence of coactivity, the links can also disappear with probability where t is the time measured from the moment of last spiking of both cells c i and c j and the parameter τ defines the mean lifetime of the synaptic connections in the cell assembly network. In the following, τ will be the only parameter that describes the deterioration of the synaptic connections within the cell assemblies . We will therefore use the notations G τ and F τ to refer, respectively, to the flickering coactivity graph with decaying connections and to the resulting flickering coactivity complex with decaying simplexes.

Replays of Place Cell Sequences
Replays of place cell sequences may in general represent both spatial and nonspatial memories.
Replays of place cell sequences: The endogenous activities in the hippocampal network that recapitulate sequential place cell firing during physical exploration of an environment. Spontaneous replays are observed during sleep, quiescent wakeful states, and active navigation. It is believed that replays mark animals exploration and retrieval of the learned spatial information by "cuing" the hippocampal network.
In the following, we simulate only spatial replays by constructing simplicial paths that represent previously navigated trajectories. Specifically, we select chains of connections that appeared in the coactivity graph G τ at the initial stages of navigation and reactivate them at the later replay times t r , r = 1, 2, . . . , N r (Kudrimoti, Barnes, & McNaughton, 1999;O'Neill, Senior, & Csicsvari, 2006). To replay a trajectory originating at a given timestep t i , we randomly select a coactivity link ς that is active within that time window; this link then gives rise to a sequence of joined links, randomly selected among the ones that activate at the consecutive time steps, ς mn , . . .. Since there are typically several active links at every moment, this procedure allows generating a large number of replay trajectories. The physiological duration of replays-typically about 100-200 ms (Colgin, 2016)-roughly corresponds to the coactivity window widths, that is, to the timesteps in which the coactivity graph evolves; we therefore "inject" the activated links into a particular coactivity window t r in order to simulate rapid replays.
After a simplicial trajectory is replayed, the injected links begin to decay and to (re)activate in the course of the animal's moves across the environment, just as the rest of the links. Most of these "reactivated" links simply rejuvenate the existing connections in G τ . However, some injections instantaneously reinstate decayed connections and produce an additional population of higher order cliques, which affect the topological properties of the coactivity complex F τ , and hence-according to the model-of the cognitive map. As mentioned previously, hippocampal replays are believed to enable spatial learning by stimulating inactive connections, by slowing down their decay, and by reinforcing cell assemblies' stability (Carr et al., 2011;Ego-Stengel & Wilson, 2010;Girardeau et al., 2009;Girardeau & Zugaro, 2011;Jadhav et al., 2012;Sadowski et al., 2016). In the model's terms, this hypothesis translates as follows: the additional influx of rejuvenated simplexes provided by the replays should qualitatively improve the topological structure of the flickering coactivity complex, slow down deterioration of its simplexes, suppress its topological defects, and, in general, help to sustain its topological integrity. In the following, we test this hypothesis by simulating different patterns of the place cell reactivations and quantifying the effect that this produces on the simulated cognitive map.

Initial Testing
The effect produced by the replays on the cognitive map depends on the parameters of the model: the selection of replayed trajectories, the injection times, the frequency of the replays, and so forth. To start the simulations, we selected N s = 80 different replay sequences originating at N i = 25 moments of time, t i , i = 1, . . . , N i , between 20 and 200 s of navigation (the initial interval I init ). During this period, the trajectory covers the arena more or less uniformly: a typical 25-s-long segment of a trajectory extends across the entire environment and contains on average about l s = 100 links (Supporting Information Figure S1). As a result, the corresponding simplicial paths traverse the full coactivity complex F τ , and one would expect that replaying these paths should help to suppress the topological defects in F . To verify this prediction, we replayed the resulting pool of G-link sequences within the main instability period I 5 by using different approaches and tested whether this can suppress the topological fluctuation ( Figure 3A).
In the first scenario, all replay chains were injected into the connectivity graph G τ at once, in the middle of the instability period I 5 ( Figure 3B). As a result of such a "massive" instantaneous replay, the topological fluctuations are initially suppressed but then they quickly rebound, producing about the same number of spurious 0D loops (i.e., the cognitive map remains as fragmented as before) and an even higher number of 1D loops that mark spurious holes in the cognitive map (Supporting Information Movie 1). In other words, our model suggests that a single "memory flash" fails to correct the deteriorating memory map even at a short timescale, which suggests that more regular replay patterns are required.
Indeed, if the same set of replay sequences is uniformly distributed into N r = 5 consecutive groups inside the instability period I 5 (one group per 36 s, N s /N r = 16 chains of links each), then the topological fluctuations in the coactivity complex F τ subside more and over a longer period (see Figure 3C and Supporting Information Movie 2). If the replays are produced even more frequently (every 9 s, i.e., about 20 replays total, N s /N r ≈ 4 chains of links injected per replay) then the topological fluctuations in I 5 are essentially fully suppressed over the entire environment ( Figure 3D, Supporting Information Figure 2 and Supporting Information Movie 3).
One can draw two principal observations from these results: first, that spontaneous reactivation of connections at the physiological timescale can qualitatively alter the topological structure of the flickering coactivity complex, and, second, that the temporal pattern of replays plays a key role in suppressing the topological fluctuations in the cognitive map.

Implementation of the Replays
Electrophysiological data shows that the frequency of the replays ranges between 0.1 Hz in active navigation to 0.4 Hz in quiescent states and 4 Hz during sleep (Colgin, 2016;Jadhav et al., 2012;O'Neill et al., 2006;Sadowski et al., 2016). Since we model spatial learning taking place during active navigation, we implemented replays at the maximal rate of 0.4 Hz, which corresponds to no more than one replay event over 10 consecutive coactivity intervals. Second, we took into account the fact that, in complex environments, the hippocampus may replay a few sequences simultaneously. For example, on the Y-track (O'Neill et al., 2006) two simultaneous replay sequences can represent the two prongs of the Y. In open environments, there may be more simultaneously replayed sequences; however, we used the most conservative estimate and replayed two different sequences at each replay moment t r .
In the simplest scenario, we injected pairs of sequences into the coactivity graph G τ with a constant delay of about ΔT = t i − t r ≈ 14 min after their physical onset, which placed them inside of the instability period I 5 ( Figure 4A). In response, the topological fluctuations in the coactivity complex F τ significantly diminished. In fact, the zeroth Betti number (the number of the disconnected components) regained its physical value b 0 (F τ ) = 1, indicating that the replays helped to pull the fragments of the cognitive map together into a single connected piece. The first Betti number (the number of holes) remains on average close to its physical value, b 1 (F τ ) = 1.5, exhibiting occasional fluctuations, Δb 1 = ±2.2.
As mentioned above, the occasional islets separating from the main body of the simplicial complex or a few small holes appearing in it for a short period should be viewed as topological irregularities rather than signs of topological instability. We therefore base the following discussion on addressing only the qualitative differences produced by the replays on the topology of the cognitive map: whether replays can prevent fracturing of the complex into multiple pieces and rapid proliferation of spurious loops in all dimensions. From such perspective, our results demonstrate that translational replays at a physiological rate can effectively restore the correct topological shape of the cognitive map, which illustrates functional importance of the replay activity.
Since the replays are generated by the endogenous activity of the hippocampal network, the relative temporal order of the replayed sequences can be altered, that is, the replay times t r can be spread wider or denser than their "physical" origination times t i . The effect of the replays will be, respectively, weaker or stronger than in the case of translational delay because of the corresponding changes of the sheer number of the reactivated links. However, one can factor out the direct contribution of the replays' volume and study more subtle effects produced specifically by the replay's temporal organization. To this end, we split the replay period I 5 into a set of N R shorter subintervals, I 1 5 , I 2 5 , . . . I N R 5 , and then replayed the sequences of links originating from the initial 3-min interval I init within each subinterval I n 5 , n = 1, 2, . . . , N R . Since only two sequences are replayed within every coactivity window, the total number of the (re)activated sequences remains the same as in the delayed replay case, even though the source interval I init is compressed N R -fold in time. Thus, the difference between the effects produced by the "compressed" replays will be due solely to the differences in their temporal reorganizations.
The results illustrated in Figure 4B demonstrate that the compressed replays suppress the topological fluctuations more effectively. For example, the repeated replay in a sequence of 20-s intervals (N R = 9 fold compression) not only restores the correct value of the zeroth Betti number, b 0 (F τ ) = 1, but also drives the average number of noncontractible simplicial loops close to physical value, b 1 (F τ ) = 1.2 ± 1. In other words, F τ almost regains its topologically correct shape, with an occasional spurious hole appearing for less than a second. Physiologically, these results suggest that time-compressed, repetitive "perusing" through memory sequences helps to prevent deterioration of global memory frameworks better than simple "orderly" recalls. In all cases, the injection diagram on the left relates the times when the place cell sequences were originally produced (vertical axis) to the times when they are replayed (horizontal axis). Each yellow and brown dot corresponds to a replayed sequence. On the right panel, the replay times are marked by red dots, with the vertical scatter proportional to the simulated speed of the animal. The resulting zeroth Betti number (b 0 (F τ ), green line) and the first Betti number (b 1 (F τ ), blue line) are shown in the foreground, and the original, unstable Betti numbers (without replays) are shown in the background (dark and light dashed gray lines, respectively). (A) A simple translational replay of a couple of sequences repeated over a 3-min period (between 20 and 200 s), with a ΔT = 14-min delay. The zeroth Betti number regains its physical value, b 0 (F τ ) = b 0 (E ) = 1, indicating that cognitive map reconnects into one piece. The first Betti number fluctuates near the physical value b 1 (F τ ) = 1.5 ± 2.2, indicating that nearly all spurious holes are closed. (B) Compressed replay: a 3-min period is replayed repeatedly over several consecutive 20-s intervals. Here the zeroth Betti number remains correct, b 0 (F τ ) = 1, and the fluctuations of the first Betti number reduce farther, b 1 (F τ ) = 1.2 ± 1. (C) Modulating the replay times by slow move periods (v < 15 cm/s) produces sparser replays. As a result, the topological fluctuations in the case of uncompressed, speed-modulated delayed replays increase, b 0 (F τ ) = 4.2 ± 1.9, b 1 (F τ ) = 8.2 ± 3.4. (D) Small compressions (up to 300 s replayed over ∼ 150 second period, same delay) may intensify the fluctuations: b 0 (F τ ) = 5.9 ± 2.4, b 1 (F τ ) = 9.2 ± 4.1. (E) Further compression of the replays improves the results, b 0 (F τ ) = 1.1 ± 1.4, b 1 (F τ ) = 1.7 ± 2, although the variations of b 1 (F τ ) remain high compared with the cases in which the replays are not modulated by the speed. (F) Random replays reduce the fluctuations even further: the coactivity complex acquires the correct zeroth Betti number b 0 (F τ ) = 1 (the map becomes connected), producing occasional spurious loops, b 1 = 1.4 ± 1.2, that is, occasional topological irregularities.

Speed Modulation of the Replays
Since replays are mostly observed during quiescent periods and slow moves (O'Neill et al., 2006;O'Neill, Senior, Allen, Huxter, & Csicsvari, 2008), we studied whether such "low-speed" replays will suffice for suppressing the topological fluctuations in the cognitive map. Specifically, we identified the periods when the speed of the animal falls below 15 cm/sec (which, in our simulations happens during 14% of time (see Supporting Information Figure 3 and Koene & Hasselmo, 2008;Nádasdy, Hirase, Czurkó, Csicsvari, & Buzsáki, 1999), and replayed the place cell sequences only during these periods.
It turns out that although the resulting slow motion replays can stabilize the topological structure of the simulated cognitive map, the effect strongly depends on their temporal organization. Specifically, in the simple delayed replay scenario, the topological fluctuations remain significantly higher than without speed modulation ( Figure 4C and Movie 4, Supporting Information). On average, the coactivity complex contains about a dozen spurious loops: it remains split in a few pieces, b 0 (F τ ) = 4.2, that together contain b 1 (F τ ) = 8.2 holes on average. This is a natural result-one would expect that speed restrictions will diminish the number of the injected active connections and hence that F τ will degrade more. A slightly compressed replay (4 min of activity replayed over 3-min period) does not improve the result: both the number of disconnected components and the number of holes in them increase b 0 (F τ ) = 5.9, b 1 (F τ ) = 9.2 ( Figure 4D). However, if the replays are compressed further, the average number of disconnected components is significantly reduced: for the threefold compression shown on Figure 4E, the mean values are b 0 (F τ ) = 1.1 and b 1 (F τ ) = 1.7, that is, the encoded map approaches the quality of the maps produced with unrestricted replays. The effectiveness of the latter scenario can be explained by noticing that replay compression brings the activities that are widely spread in physical time into close temporal vicinities during the replays. In other words, in compressed replays, a wider variety of connections is activated at each t r : the real-time separation between activity patterns shrinks. This helps to reduce or eliminate the temporal "lacunas" in place cell coactivity across the entire hippocampal network and hence to prevent spontaneous deterioration of its parts. In physiological terms, this implies that the compressed replays of the place cell patterns are less constrained by the physical temporal scale of the rat's navigational experiences, which leads to a more even activation of the connections in the network and helps to prevent the memory map's fragmentation.
To test this idea, we amplified this effect by shuffling the order of the replayed sequences and by randomizing the injection diagram, thus enforcing a nearly uniform pattern of injected activity across the simulated population of cell assemblies. This indeed proved to be the most effective replay strategy: as shown on Figure 4F, such replay patterns restore the topological shape of the coactivity complex, allowing only occasional holes: b 0 (F τ ) = 1, b 1 (F τ ) ≈ 1.4 ± 1.2 (Supporting Information Movie 5). Thus, the model suggests that "reshuffling" the temporal sequence of memory replays helps to sustain memory framework better than orderly recollections, occurring in natural past-to-future succession. The effect of random replays of the place cell sequences over the entire simulated navigation period shown in Figure 5 clearly illustrates the importance of replays for rapid encoding of topological maps: the fluctuations in the cognitive map are uniformly suppressed (for the original values of the Betti numbers during all six instability periods without replays see Table 1 in Methods).

DISCUSSION
The model discussed above suggests that replays of place cell activity help to learn and to sustain the topological structure of the cognitive map. The physiological accuracy of the replay simulation can be increased ad infinitum, by incorporating more and more parameters into the model. In this study we use only a few basic properties of the replays, which, however, capture several key functional aspects of the replay activity. First, the model implements an effective feedback loop, in which the onset of topological instabilities in the flickering coactivity complex F τ triggers the replays that restore its integrity. Indeed, the cell assemblies' (and the corresponding simplexes') decays intensify as the animal's exploratory movements slow down and visits to particular segments of the environment become less frequent. On the other hand, low-speed periods define temporal windows during which the simulated replays are injected into the network, which work to suppress the topological instabilities. Second, the model allows controlling the replays' temporal organization independently from the other parameters or neuronal activity and exploring the replays' contribution into acquiring and stabilizing the cognitive maps. The results demonstrate that in order to strengthen the decaying connections in the hippocampal network effectively, the replays must (1) be produced at a sufficiently high rate that falls within the physiological range and (2) distribute without temporal clustering, in a semi-random order.
An important aspect of the obtained results is a separation of the timescales at which different types of topological information is processed. On the one hand, rapid turnover of the information about local connectivity at the working memory timescale is represented by quick recycling of the cell assemblies and rapid spontaneous replays of the learned sequences. On the other hand, the large-scale topological structures of the cognitive map, described by the instantaneous homological characteristics of the coactivity complex, emerge at the intermediate memory timescale. Thus, the model suggests that the characteristic timescale of the topological loops' dynamics is by an order of magnitude larger than the timescale of fluctuations at the cell assembly level. This observation provides a functional perspective on the role played by the place cell replays in learning: by reducing the fluctuations, replays help separating the fast and the slow information processing timescales and hence to extract stable topological information that can be used to build a long-term, qualitative representation of the environment. This separation of timescales corroborates with the well-known observation that transient information is rapidly processed in the hippocampus and then the resulting memories are consolidated and stored in the cortical areas, but at slower timescales and for longer periods.

Topological Glossary
For the reader's convenience, we briefly outline the key topological terms and concepts used in this paper.
An abstract simplicial complex Σ is a family of abstract simplexes closed under the overlap relation: a nonempty overlap of any two simplexes σ Geometrically, simplexes can be visualized as d-dimensional polytopes: σ (0) as a point, σ (1) as a line segment, σ (2) as a triangle, σ (3) as a tetrahedron, and so forth. The corresponding geometric simplicial complexes are multidimensional polyhedra that have a shape and a structure that does not change with simplex deformations, for example, disconnected components, holes, cavities of different dimensionality, and so on. This structure, commonly referred to as topological (Aleksandrov, 1965), is identical in a geometric simplicial complex to and in the abstract complex built over the vertexes of the geometric simplexes. Thus, abstract simplicial complexes may be viewed as structural representations of the conventional geometric shapes. Topological properties of the simplicial complexes are established based on algebraic analyses of chains, cycles and boundaries.
A chain α (d) is a formal combination d-dimensional simplexes with coefficients from an algebraic ring or a field. Intuitively, they can be viewed, for example, as the simplicial paths described in The Model section. Such combinations permit algebraic operations: they can be added, subtracted, and multiplied by a common factor, and so forth. As a result, the set of all chains of a given simplicial complex, C(Σ), also forms an algebraic entity, for example, if the chains' coefficients form to a field, then C(Σ) forms a vector space.
A boundary of a chain, ∂α (d) , is a formal combination of all the facets of the α-chain, with the coefficients inherited from α and alternated so that the boundary of ∂α (d) vanishes, ∂ 2 α (d) = 0. This universal topological principle-boundary of a boundary is a null set-can be illustrated on countless examples, for example, by noticing that the external surface of a triangular pyramid σ (3) -its geometric boundary-has no boundary itself.
Cycles generalize the previous example-a generic cycle z is a chain without a boundary, ∂z = 0. Intuitively, cycles correspond to agglomerates of simplexes (e.g., simplicial paths) that loop around holes and cavities of the corresponding dimension. Note however, that although all boundaries are cycles, not all cycles are boundaries.
Homologies are two cycles, z 1 and z 2 , that are equivalent, or homologous, if they differ by a boundary chain. The set of equivalent cycles forms a homology class. If the chain coefficients come from a field, then the homology classes of d-dimensional cycles form a vector space H d (Σ). The dimensionality of this vector space is the d-th Betti number of the simplicial complex Σ, b d (Σ) = dim H k (Σ), which counts the number of independent d-dimensional holes in Σ. Flickering complexes F (t) consist of simplexes that may disappear or (re)appear, so that the complex as a whole may grow or shrink from one moment to another (see Figure 2 in , Computing the corresponding Betti numbers, b k (F (t)), requires a special technique-Zigzag persistent homology theory that allows tracking cycles in F on moment-tomoment basis Carlsson & De Silva, 2010;Carlsson et al., 2009). A clique in a graph G is a set of fully interconnected vertices, that is, a complete subgraph of G. Combinatorially, cliques have the same key property as the abstract simplexes: any subcollection of vertices in a clique is fully interconnected. Hence a nonempty overlap of two cliques ς and ς is a subclique in both ς and ς , which implies that cliques may be formally viewed as abstract simplexes and a collection of cliques in a given graph G produces its clique simplicial complex Σ(G) (Jonsson, 2008). In particular, the clique coactivity complexes T ς is induced from the coactivity graphs G Basso et al., 2016;Hoffman et al., 2016) and the flickering clique complexes F τ are constructed using coactivity graph with flickering connections G τ , (Babichev & Dabaghian, 2017a, 2017b. Note however, that the topological analyses address the topology of the coactivity complexes, rather than the network topology of G.

Spike Simulations
The environment shown on Figure 1A is simulated after typical arenas used in typical electrophysiological experiments. Over the navigation period T tot = 30 min, the trajectory covers the environment uniformly. The maximal speed of the simulated movements is v max = 50 cm/s, with the mean valuev = 25 cm/s. The firing rate of a place cell c is defined by where f c is the maximal firing rate and s c defines the size of the place field centered at r c (Barbieri et al., 2004). In addition, spiking is modulated by the θ-oscillations-a basic cycle of the extracellular local field potential in the hippocampus, with the frequency of about 8 Hz (Arai et al., 2014;Mizuseki et al., 2009). The simulated ensemble contains N c = 300 virtual place cells, with the typical maximal firing rate f = 14 Hz and the typical place field size s = 20 cm.

The Statistics of the Betti Numbers
The values during instability periods without replays is provided in Table 1. Note that all values differ significantly from the Betti numbers exhibited by the coactivity complexes with replays (see Results).

ACKNOWLEDGMENTS
This document was prepared as an account of work sponsored by the United States Government. While this document is believed to contain correct information, neither the United States Government nor any agency thereof, nor the Regents of the University of California, nor any of their employees, makes any warranty, express or implied, or assumes any legal responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately owned rights. Reference herein to any specific commercial product, process, or service by its trade name, trademark, manufacturer, or otherwise, does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government or any agency thereof, or the Regents of the University of California. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or any agency thereof or the Regents of the University of California.
This manuscript has been authored by an author at Lawrence Berkeley National Laboratory under Contract No. DE-AC02-05CH11231 with the U.S. Department of Energy. The U.S. Government retains, and the publisher, by accepting the article for publication, acknowledges, that the U.S. Government retains a non-exclusive, paid-up, irrevocable, world-wide license to publish or reproduce the published form of this manuscript, or allow others to do so, for U.S. Government purposes.