Introduction {#Sec1}
============

Many real-world stochastic networks split into self-organized communities. Social networks feature circles of friends^[@CR1]--[@CR3]^, colleagues^[@CR2]^, members of a karate club^[@CR1]^, communities of dolphins^[@CR4]^ etc. Cellular networks demonstrate modular organization, which optimizes crucial biological processes and relationships, such as synchronization of neurons in the connectome^[@CR5],\ [@CR6]^, efficiency of metabolic pathways^[@CR7],\ [@CR8]^\], genes specialization^[@CR9]^ or interaction between enhancers and promoters^[@CR10]^.

Interest to polymer modular networks has appeared recently in the context of genome spatial folding. Proximity of chromatin loci in space is believed to be deeply connected with gene regulation and function. Hi-C experiments^[@CR11]--[@CR13]^ provide the genome-wide colocalization data of chromatin loci. As the main outcome of the experiment, large genome-wide matrices of contacts from each individual cell or from the population are produced. Analyses of these matrices has revealed that the eukaryotic genome is organized in various and biologically relevant communities, whose main function is to insulate some regions of DNA and to provide easy access to the others. In particular, the data collected from a population of cells suggest that transcribed ("active") chromatin segregates from the, "inactive" one, forming two compartments in the bulk of the nucleus^[@CR12],\ [@CR14]^. Within compartments chromatin is organized further as a set of topologically-associated domains (TADs)^[@CR15]--[@CR17]^ that regulate chromatin folding at finer scales. However, interpretation and validation of communities in individual cells remains vaguely defined due to sparsity of respective data.

The broad field of applications of stochastic modular networks has initiated the boost development of community detection methods. Spectral algorithms exploit the spectrum of various operators (adjacency, Laplacian, modularity) defined on a network to identify the number of communities and to infer the optimal network partition^[@CR18]--[@CR22]^. Typically, leading eigenvectors of these operators positively correlate with the true community structure or with the underlying core-periphery organization of the network^[@CR23]^. These algorithms, along with the majority of theoretical results in the field, are derived for the stochastic block model (SBM)^[@CR18],\ [@CR22]^ as an extension of Erdös-Rényi graphs^[@CR24]^ to graphs with explicitly defined communities. One of the strongest limitations of the SBM is that edges between vertices belonging to the same cluster inevitably attain equal weights. At the same time, biological networks typically have several levels of organization within their communities^[@CR25]^. In particular, identification of several hierarchical levels in the network becomes tremendously important in the case of polymer networks, where different pairs of loci have marginally different probabilities to form a contact in space^[@CR26]^, caused by the frozen linear connectivity along the chain.

Even for simplest polymer systems the contact probability demonstrates a power-law behavior with the dimensional-dependent scaling exponent characterizing universal long-ranged behavior of polymer folding^[@CR27]^. In this work we propose the "polymer stochastic block model" which reflects a specific global polymer network organization with explicit structuring into communities. The main new ingredient of the model under consideration is the average contact probability $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$P(s=|i-j|)$$\end{document}$ between the pairs of loci (*i*, *j*) which is constant for standard non-polymeric networks, however cannot be neglected for polymers.

Chromatin single cell networks are not only polymeric, but also sparse^[@CR13],\ [@CR28]^. It is known that upon reduction of the total number of edges in the network, there is a fundamental resolution limit for all community detection methods^[@CR22],\ [@CR29]^. Furthermore, traditional operators (adjacency, Laplacian, modularity) fail far above this resolution limit, i.e. their leading eigenvectors become uncorrelated with the true community structure above the threshold^[@CR30]^. That is explained by emergence of tree-like subgraphs (hubs) overlapping with true clusters in the isolated part of the spectrum for these operators. The edge of the spectral density of sparse networks is universal and demonstrates the so-called "Lifshitz tail"^[@CR31]--[@CR34]^. Localization on hubs, but not on true communities is a drawback of all conventional spectral methods in the sparse regime.

To prevent the effect of localization on hubs and to make spectral methods useful in sparse regime, Krzakala et al. proposed to deal with non-backtracking random walks on a directed graph that cannot revisit the same node on the subsequent step^[@CR30]^. The crucial property of non-backtracking walks^[@CR35]^ is that they do not concentrate on hubs. It has been shown that the non-backtracking operator is able to resolve the community structure in sparse stochastic block model up to the theoretical resolution limit. Typically, the majority of eigenvalues of the non-backtracking operator (which is a non-symmetric matrix with complex eigenvalues) are located inside a disc in a complex plane, and a number of isolated eigenvalues lie on the real axis.

For the sake of community detection in sparse polymer networks we construct the polymer-type non-backtracking walks, appropriate for community detection in graphs with hidden linear memory ("polymeric background"). We establish the connection between this operator and the generalized polymer modularity, thus, bridging a gap with the maximum entropy principle. We test the performance of different spectral methods (with and without polymer background) on sparse artificial benchmarks of polymer networks that mimic compartmentalization in single cell Hi-C graphs. We show that polymer non-backtracking walks resolve the structure of communities up to the detectability threshold, while all other operators fail above it. In order to demonstrate efficiency of the method on real data, we partition a set of single cell Hi-C contact maps of mouse oocytes into active (A) and inactive (B) compartments by different operators. Found domains are shown to have similar sizes to the compartmental domains and correlate with the compartmental mask from the population-averaged data. Analyses of the GC content within the domains demonstrates enrichment and depression of the genes density in the two clusters, thus, corroborating their biological significance.

The structure of the paper is as follows. In Section "[Stochastic block model with polymer contact probability](#Sec2){ref-type="sec"}" we propose the polymer stochastic block model, derive the entropy and the corresponding generalized modularity functional. In Section "[Polymer non-backtracking flow operator](#Sec5){ref-type="sec"}" we discuss polymer non-backtracking walks, prove their robustness on the benchmarks emulating compartments, and, finally, test them on the real single cell data. In Section "[Conclusion](#Sec9){ref-type="sec"}" we draw the conclusions.

Stochastic block model with polymer contact probability {#Sec2}
=======================================================

Definition of the model {#Sec3}
-----------------------

Characterize a *N*-bead polymer chain by coordinates $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\{x_1,x_2,\ldots ,x_N\}$$\end{document}$ of monomers $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$i = 1,2, \ldots , N$$\end{document}$ and construct a corresponding topological graph $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$${{\mathcal {G}}}=(V, E)$$\end{document}$ with the adjacency matrix $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$A_{ij}$$\end{document}$ (accounting for the bead's proximity in space). Such graphs are typically constructed upon processing of chromatin single cell Hi-C data and in computer simulations of DNA folding^[@CR11],\ [@CR12]^. A graph $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$${{\mathcal {G}}}$$\end{document}$ does not contain pairwise spatial distances of the polymer configuration, however, provides information on spatial proximity of monomers (or groups of monomers), which is usually of major biological relevance. For the 1-bin resolution of $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$${{\mathcal {G}}}$$\end{document}$ the polymer beads (bins) are the nodes *V*. The edge between a pair of nodes (*i*, *j*) is defined by the condition $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$(i,j) \in E$$\end{document}$ iff $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$|x_i-x_j| < \varepsilon $$\end{document}$, where the threshold $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\varepsilon $$\end{document}$ is some cutoff radius with which the contacts between the two loci are registered in Hi-C. Due to finite excluded volume of chromatin, the theoretical number of contacts per monomer that can be registered in single cell experiments is of order of few units, while the total size of the polymer chain, measured in number of beads, is huge ($\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$N \sim 10^5$$\end{document}$ in the 1-kb resolution for human chromosomes). Thus, the single cell contact matrices are essentially sparse^[@CR13],\ [@CR28]^. Summation over realizations of adjacency matrices $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$A_{ij}$$\end{document}$ obtained from different cells results in a "population-averaged" matrix $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$${{\mathcal {A}}}_{ij}$$\end{document}$. By construction, entries of the weight matrix $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$${{\mathcal {A}}}_{ij}$$\end{document}$ are proportional to the probability that the spatial distance between monomers (*i*, *j*) is less than $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\varepsilon $$\end{document}$.

Already for the simplest configurations, such as a conformation of ideal polymer chain isomorphic to the random walk, the matrix $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$${{\mathcal {A}}}_{ij}$$\end{document}$ is not expected to be uniform. This is due to a polymeric power-law behaviour of a contact probability,$$\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\begin{aligned} P(s) \sim s^{-\alpha }, \quad \hbox { for}\ s=|i-j| \end{aligned}$$\end{document}$$By definition, *P*(*s*) is probability to find two beads of a linear chain, separated by a chemical distance *s*, close to each other in space. The critical exponent, $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\alpha $$\end{document}$, is an important parameter, which characterizes the "memory" about the embedding of a polymer loop of length *s* in a *D*-dimensional space^[@CR27]^. Such a memory can arise due to some equilibrium topological state of chromatin, or could be a result of partial relaxation of mitotic chromosomes^[@CR36]^. Notable examples of $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\alpha $$\end{document}$, typically appearing in the chromatin context for chain embedding in a three-dimensional space, are $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\alpha =3/2$$\end{document}$ for ideal chain and $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\alpha \approx 1$$\end{document}$ for the crumpled globule^[@CR12],\ [@CR37]--[@CR39]^.

Communities of folded chromatin refine the background (polymeric) contact probability at small scales and are biologically significant. We treat communities as canonical stochastic blocks^[@CR18],\ [@CR22]^ superimposed over the background. Stochastic block model is a network model in which *N* nodes of a network are split into *q* different groups $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$G_i$$\end{document}$, $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$i = 1,2, \ldots , q$$\end{document}$ and the edges between each pair of nodes are distributed independently with a probability, depending on the group labels ("colors") of respective nodes. In a matrix of pairwise group probabilities $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\Omega = \{\omega _{rt}\}$$\end{document}$ with $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$(r,t) = 1, 2, \ldots , q$$\end{document}$, any randomly chosen pair of nodes (*i*, *j*) (where $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$i \in G_r, j \in G_t$$\end{document}$) is linked by an edge with probability $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\omega _{rt}$$\end{document}$. The corresponding entry in the adjacency matrix $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$A_{ij}$$\end{document}$ is 1 with probability $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\omega _{rt}$$\end{document}$ and 0 otherwise. The sum of many such "single-cell" Bernoulli matrices generates an analogue of the "population-averaged" Hi-C matrix $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$${{\mathcal {A}}}_{ij}$$\end{document}$ with Poisson distributed number of contacts with the mean $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\langle {{\mathcal {A}}}_{ij} \rangle = \omega _{rt}$$\end{document}$ where $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$i \in G_r, j \in G_t$$\end{document}$. To the first approximation, the communities can be considered identical (known as a "planted" version of the model)$$\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\begin{aligned} \Omega _{rt} = \Bigg \{\begin{array}{lr} w_{in}, &{} r=t \\ w_{out}, &{} r \ne t \end{array} \end{aligned}$$\end{document}$$Having ([1](#Equ1){ref-type=""}) and ([2](#Equ2){ref-type=""}), the simplest assumption one can come up with is that formation of compartments in chromatin is independent of the global memory of folding. Indeed, phenomenon of compartments is likely related to preferential interactions of nodes of the same epigenetic type (e.g., "active" or "inactive") and is modelled as a phase separation of block-copolymers^[@CR40]^. This allows to suggest the factorization of ([1](#Equ1){ref-type=""}) and ([2](#Equ2){ref-type=""}), so that the final probability for the edge (*i*, *j*) reads$$\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\begin{aligned} Prob_{ij} = P(|i-j|) \Bigg \{\begin{array}{lr} \omega _{in}, &{} r = t \\ \omega _{out}, &{} r \ne t \end{array}, \quad i \in G_r,\; j \in G_t \end{aligned}$$\end{document}$$To emulate A and B compartments in a single cell Hi-C network, we consider a simple adjacency benchmark of a polymer with two communities. Namely, we represent the chain as a sequence of alternating segments of *A* and *B* type (painted in red and blue), whose lengths are Poisson-distributed with the mean length $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\lambda $$\end{document}$. An example of the resulting adjacency matrix is depicted in Fig. [1](#Fig1){ref-type="fig"}a. Note that due to decay of the contact probability, the "checkerboard" compartmentalization pattern is hardly seen in single cells Hi-C data^[@CR28]^. Since segments of the same type are surrounded in space by segments of the other type, they form local "blob-like" clusters along the main diagonal of the adjacency matrix reminiscent to topologically-associated domains^[@CR15]^. However, they are likely formed by a different mechanism and have an order of magnitude larger size than TADs^[@CR40]^. Such a multi-domain blob structure in Fig. [1](#Fig1){ref-type="fig"}a is a manifestation of the polymeric nature of the network and it cannot be reproduced with communities of general memory-less networks, i.e. in the framework of the canonical stochastic block model with two clusters---see Fig. [1](#Fig1){ref-type="fig"}b for comparison.Figure 1Adjacency matrices of $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$N=1000$$\end{document}$ with *two clusters* generated according to the (**a**) polymer stochastic block model ($\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$w_{in}=1, w_{out}=0.1, P(s)=s^{-1}, \lambda =100$$\end{document}$) and (**b**) canonical stochastic block model ($\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$w_{in}=0.1, w_{out}=0.01, \lambda =500$$\end{document}$). Vertices in the graph are enumerated by the polymer coordinate (**a**) and first all red, then all blue ones (**b**).

Statistical inference of polymer SBM and generalized modularity functional {#Sec4}
--------------------------------------------------------------------------

Suppose that a population-averaged matrix $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$${{\mathcal {A}}}$$\end{document}$ is observed. By definition, each entry $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$${{\mathcal {A}}}_{ij}$$\end{document}$ of this matrix counts the amount of reads between the bins *i* and *j* coming from a population of single cells. Thus, after proper normalization, $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$A_{ij}$$\end{document}$ is a Poisson variable with the mean dictated by ([3](#Equ3){ref-type=""}), $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\langle A_{ij} \rangle =P_{ij} \;\omega _{g_i g_j}$$\end{document}$, and $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\omega _{g_i g_j} = \Omega _{ij}$$\end{document}$ are the pairwise group probabilities (at the moment we do not require all the groups to be identical). Neglecting correlations between the matrix entries, the statistical weight of $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$${{\mathcal {A}}}$$\end{document}$ conditioned on the cluster probability matrix $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\Omega $$\end{document}$, background contact probability *P* and group labels of the nodes $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\{g_i\}$$\end{document}$, can be factorized into the product of the Poisson probabilities for the entries $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$A_{ij}$$\end{document}$$$\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\begin{aligned} Z({{\mathcal {A}}}|\; \Omega , P, \{g_i\}) = \prod _{i<j} \frac{\left( P_{ij}\; \omega _{g_i g_j}\right) ^{{{\mathcal {A}}}_{ij}}}{{{\mathcal {A}}}_{ij}!} \exp \left( -P_{ij}\; \omega _{g_i g_j}\right) \end{aligned}$$\end{document}$$where the product runs over all pairs of nodes in the network. Since there are no self-edges in the network, all the diagonal elements of the matrix $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$${{\mathcal {A}}}_{ij}$$\end{document}$ are zeros and we do not include them into the product ([4](#Equ4){ref-type=""}). The corresponding partitioning entropy of the polymer SBM is$$\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\begin{aligned} \log Z({{\mathcal {A}}}|\; \Omega , P, \{g_i\}) = \sum _{i<j} \left( {{\mathcal {A}}}_{ij} \log \omega _{g_i g_j} - P_{ij}\;\omega _{g_i g_j}\right) \end{aligned}$$\end{document}$$where we have omitted the constant terms $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$-\log {{\mathcal {A}}}_{ij}!$$\end{document}$ and $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$${{\mathcal {A}}}_{ij} \log P_{ij}$$\end{document}$, independent of the partitioning. For identical communities (see ([2](#Equ2){ref-type=""})), we get$$\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\begin{aligned} {\left\{ \begin{array}{ll} \omega _{g_i g_j} = w_{out} + \delta _{g_i g_j}\left( w_{in} - w_{out}\right) \\ \log \omega _{g_i g_j} = \log w_{out} + \delta _{g_i g_j}\left( \log w_{in} - \log w_{out}\right) \end{array}\right. } \end{aligned}$$\end{document}$$Taking ([6](#Equ6){ref-type=""}) into the account and omitting again all irrelevant constant terms, we arrive at the final expression for the entropy ([5](#Equ5){ref-type=""})$$\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\begin{aligned} T \log Z({{\mathcal {A}}}|\;\Omega , P, \{g_i\}) = \sum _{i<j} \left( {{\mathcal {A}}}_{ij} - \gamma P_{ij}\right) \delta _{g_i g_j} \end{aligned}$$\end{document}$$where $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$T = \left( \log w_{in} - \log w_{out}\right) ^{-1}$$\end{document}$ is the effective temperature and$$\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\begin{aligned} \gamma = \frac{w_{in} - w_{out}}{\log w_{in} - \log w_{out}} \end{aligned}$$\end{document}$$is a parameter describing the cluster probabilities inherited from the initial definition of stochastic blocks.

The entropic functional ([7](#Equ7){ref-type=""}), up to normalization coefficients and constant terms, is the generalized modularity functional. For $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$P_{ij} = d_i d_j/\sum _i d_i$$\end{document}$, where *d* is the vector of degrees, ([7](#Equ7){ref-type=""}) reduces to the modularity proposed by Newman^[@CR3],\ [@CR41]^ for the sake of spectral community detection in scale-free networks. Recently it has been shown that the same functional can be used to partition a network with the core-periphery organization^[@CR23]^. The operator of the generalized modularity reads$$\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\begin{aligned} {\mathbf {Q}} = A - \gamma P \end{aligned}$$\end{document}$$The second term in ([9](#Equ9){ref-type=""}) can be understood as an expectation number of contacts between nodes (*i*, *j*) in the population-averaged data, or as a probability of the link in the single cell graph. Indeed, in absence of the stochastic blocks, this value equals $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$P_{ij}$$\end{document}$ by definition. The factor $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\gamma $$\end{document}$ responds for the clustering structure superimposed over the background. In the limit of "weak" communities, when $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$w_{in} = w_{out} \rightarrow 1$$\end{document}$, the partitioning yields $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\gamma \rightarrow 1$$\end{document}$, which corresponds to the pure background. To determine the optimal value of $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\gamma $$\end{document}$, one can run a recursive procedure, which consists of iterative maximization of the generalized modularity and renormalization of $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\gamma $$\end{document}$ according to ([8](#Equ8){ref-type=""}). We realize this approach in our numerical analyses below.

Polymer non-backtracking flow operator {#Sec5}
======================================

Non-backtracking walks on a directed polymer network {#Sec6}
----------------------------------------------------

Search for the global maximum to the modularity functional is a very hard computational problem. One of most promising approaches which avoids a brute force, is to suggest that if the community structure is significantly strong, there is an operator whose eigenvectors encode the network partitioning in these communities^[@CR3],\ [@CR22]^. However, as it was first noted by Krzakala et al.^[@CR30]^, for sparse networks leading eigenvectors become uncorrelated with true community structure well above the theoretical threshold. As a result, all conventional operators such as adjacency, Laplacian and modularity fail to find communities in rather sparse networks.

To overcome this difficulty, it was proposed to exploit the spectrum of the Hashimoto matrix $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$${\mathbf {B}}$$\end{document}$, which is a transfer matrix of non-backtracking walks on a graph^[@CR35]^. It is defined on the edges of the directed graph, $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$i\rightarrow j, k\rightarrow l$$\end{document}$, as follows$$\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\begin{aligned} {\mathbf {B}}_{i \rightarrow j, k\rightarrow l} = \delta _{il}(1-\delta _{jk}) \end{aligned}$$\end{document}$$It is seen from ([10](#Equ10){ref-type=""}) that the non-backtracking operator prohibits returns to the point which a walker has visited at the previous step. Since matrix $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$${\mathbf {B}}$$\end{document}$ is non-symmetric, its spectrum is complex. For Poissonian graphs the spectral density of $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$${\mathbf {B}}$$\end{document}$ is constrained within a circle of radius $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\sqrt{\langle d \rangle }$$\end{document}$ in the complex plain and exhibits no "Lifshits tail" singularities near the spectral edge, in contrast to other conventional operators^[@CR30],\ [@CR31]^. Real eigenvalues of $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$${\mathbf {B}}$$\end{document}$ lying out of the circle become relevant to the community structure even in sparse networks. Associating the corresponding eigenvectors with the network partitioning permits to detect communities all the way down to the theoretical limit. In^[@CR19]^ M. Newman suggested a normalized operator, that conserves the probability flow at each step of the walker.

For the sake of community detection in sparse polymer graphs, we propose a conceptually similar operator that describes the evolution of the non-backtracking probability flow on a graph with intrinsic linear memory$$\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\begin{aligned} {\mathbf {R}}_{i \rightarrow j, k \rightarrow l} = \frac{\delta _{il}\left( 1 - \delta _{jk}\right) }{d_i - 1} - \gamma \left( d_j d_l \right) ^{-1} P_{jl} \end{aligned}$$\end{document}$$In "[Appendix](#Sec10){ref-type="sec"}" we establish the connection between the non-backtracking operator and the generalized modularity, derived in the previous Section from the statistical inference of the polymer SBM. Thus, partitioning of a polymer network into two communities according to the leading eigenvector of the polymer non-backtracking flow operator ([11](#Equ11){ref-type=""}) responds to the maximum entropy principle.

An example of the non-backtracking walk on a polymer graph is illustrated in the Fig. [2](#Fig2){ref-type="fig"}a. Note that despite immediate revisiting of nodes is forbidden, the walker is allowed to make loops. The second term in ([11](#Equ11){ref-type=""}) plays a role of neutralization towards the contact probability, arising from the linear organization of the network. This compensation provides a measure for the non-backtracking operator to tell apart the true communities from the fluctuations, evoked by the polymeric scaling. Trivially, the proposed non-backtracking operator is converged to the Newman's flow operator, when the background is non-polymeric, but rather corresponds to the configuration model with fixed degrees $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$P_{ij} = d_i d_j/2m$$\end{document}$^[@CR19]^. For a pure polymeric graph without contamination by communities, the spectrum of ([11](#Equ11){ref-type=""}) lies inside a circle of radius $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$r = \sqrt{\langle d (d-1)^{-1}\rangle }$$\end{document}$. As sufficiently resolved communities are formed in the network, isolated eigenvalues pop up at the real axis.

In Fig. [2](#Fig2){ref-type="fig"}b we depict the non-backtracking spectrum of a polymer SBM, corresponding to the fractal globule polymer network with $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$P(s)=s^{-1}$$\end{document}$ of the size $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$N=1000$$\end{document}$ with two compartments, organized as contiguous alternating segments with the mean length $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\lambda =100$$\end{document}$. For the parameters $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$w_{in}$$\end{document}$, $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$w_{out}$$\end{document}$ used, the two compartments are well resolved that is provided by the isolated eigenvalue separated from the circle. Since the leading eigenvector $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$u^{(1)}$$\end{document}$ of the polymer non-backtracking flow, in contrast to the adjacency or modularity, is defined on directed edges of the network, one needs to evaluate the Potts spin variables $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$g_i=\pm 1$$\end{document}$ in order to classify the nodes. From the correspondence between the modularity and polymer flow operator one sees that contribution to the *i*-th node $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$g_i$$\end{document}$ comes from the flow along all the directed edges pointing to *i*. Thus, in order to switch from edges to nodes, one needs to evaluate the sign of the sum $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$v_i = \sum _j A_{ij} u_{j\rightarrow i}^{(1)}$$\end{document}$ and to assign the node *i* accordingly, $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$g_i=sign(v_i)$$\end{document}$.Figure 2(**a**) Depiction of the polymer SBM network: the backbone (bold), contacts between genomically distant monomers (dashed) and two chemical sorts of the monomers (red and blue), arranged into contiguous alternating segments. An example of the non-backtracking walk on such graph is shown by arrows. Immediate returns are forbidden, preventing localization on hubs; (**b**) Spectrum of the polymer non-backtracking flow ([11](#Equ11){ref-type=""}) for the fractal globular ($\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$P(s)=s^{-1}$$\end{document}$) large-scale organization of the chain with two overlaid compartments with the mean length $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\lambda =100$$\end{document}$.

Spectral clustering of the polymer stochastic block model {#Sec7}
---------------------------------------------------------

In this section we investigate spectral properties of the polymer non-backtracking flow and compare performance of various linear operators in partition the polymer SBM. The two compartments with $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\lambda =100$$\end{document}$ are superimposed over the fractal globule, $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$P(s)=s^{-1}$$\end{document}$, with total size of the network, $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$N=1000$$\end{document}$. We fix the weight of internal edges at $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$w_{in} = 1$$\end{document}$ and change the resolution of compartments by tuning the weight of external edges, $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$w_{out} = {0.1}-{0.8}$$\end{document}$. Efficiency of splitting is assessed by the fraction of correctly classified nodes.

In Fig. [3](#Fig3){ref-type="fig"}a we compare the performance of adjacency, normalized Laplacian, M. Newman's non-backtracking flow operator, polymer modularity and polymer non-backtracking flow matrices. For the latter two, the optimal value ([8](#Equ8){ref-type=""}) of the parameter $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\gamma $$\end{document}$ was chosen. It is evident that the polymer flow operator surpasses all conventional operators without the background, as well as the polymer modularity everywhere below $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$w_{out}\approx 0.5$$\end{document}$. Qualitatively similar behaviour was demonstrated by the traditional non-backtracking operator without the background, when it was compared to other operators in^[@CR30]^. Therefore, our analyses (i) underscores the importance of taking into account the contact probability (polymer background) when dealing with polymer graphs, and (ii) recapitulates efficiency of non-backtracking walks in resolving communities in sparse networks.

It is worth noting that the abrupt fall in performance of the polymer flow operator coincides with the leveling of its amount of isolated eigenvalues at zero, see Fig. [3](#Fig3){ref-type="fig"}d. Values around $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$w_{out}\approx 0.5$$\end{document}$ define the detectability transition, above which the leading eigenvector becomes uncorrelated with the true nodes assignment. To understand whether it corresponds to the theoretical detectability limit, we translate $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$w_{out}$$\end{document}$ into the average amount of inner, $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$c_{in} = N w_{in}/2$$\end{document}$, and outer, $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$c_{out} = N w_{out}/2$$\end{document}$, edges and plot them as functions of $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$w_{out}$$\end{document}$. As it is shown in Fig. [3](#Fig3){ref-type="fig"}c, the polymer flow operator drops close to the theoretical detectability transition for regular stochastic block models^[@CR42]^ (i.e. each node has *exactly* $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$c_{in}$$\end{document}$ random links with other nodes in its community and *exactly* $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$c_{out}$$\end{document}$ randomly pointed links to nodes from the other community)$$\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\begin{aligned} c_{in}-c_{out} > 2\sqrt{c_{in}+c_{out}} \end{aligned}$$\end{document}$$ Figure 3(**a**) Comparison of performance of different classical operators without background, polymer modularity and polymer non-backtracking flow operators ($\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$N=1000, P(s)=s^{-1}, w_{in}=1, \lambda =100$$\end{document}$); (**b**) The iterative approach that can be used to determine the optimal value of $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\gamma $$\end{document}$ for five values of $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$w_{out}$$\end{document}$; the true optimal values of $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\gamma $$\end{document}$ calculated from ([8](#Equ8){ref-type=""}) are shown by dash; (**c**) The mean numbers of inner $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$c_{in}$$\end{document}$ and outer $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$c_{out}$$\end{document}$ edges are calculated for each value of $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$w_{out}$$\end{document}$ in order to estimate the detectability threshold for the corresponding regular network. (**d**) Amount of isolated eigenvalues of the polymer flow operator plotted against $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$w_{out}$$\end{document}$. Full spectra of the polymer flow operator for the two values of $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$w_{out}$$\end{document}$ are shown in the insets.

For the stochastic block model the number of isolated eigenvalues of $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$${\mathbf {B}}$$\end{document}$ exceeds the number of communities by one^[@CR30]^. However, in case of the polymer operator $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$${\mathbf {R}}$$\end{document}$ the number of isolated eigenvalues can be much larger and "apparent" clusters might be formed "locally" at the main diagonal due to the frozen linear connectivity, see Fig. [1](#Fig1){ref-type="fig"}a. This is evident from the Fig. [3](#Fig3){ref-type="fig"}d, which shows that the number of isolated eigenvalues for the polymer flow operator can be of order of the amount of the segments ($\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$N/\lambda $$\end{document}$), if $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$w_{out}$$\end{document}$ is sufficiently low. Indeed, for the fractal globule probability of the edge between two distant segments of the same type is *s* times smaller than probability of the link for two close monomers ($\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$s=|k-m|$$\end{document}$ is the genomic distance between segments *k* and *m*). Due to the overall small number of contacts in the network, the polymer non-backtracking flow ends up rationalizing them as separate clusters.

The value of $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\gamma $$\end{document}$ cannot be chosen arbitrary since it characterizes optimal parameters of stochastic blocks. Thus, one may propose the following iterative approach: begin with the initial value $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\gamma _0=1$$\end{document}$, for which we obtain the network partition;use the amount of inner and outer edges for estimating $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$w_{in}$$\end{document}$, $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$w_{out}$$\end{document}$;recalculate $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\gamma _1$$\end{document}$ according to ([8](#Equ8){ref-type=""});repeat the procedure iteratively until $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\gamma $$\end{document}$ converges to $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\gamma _{opt}$$\end{document}$.Results of this procedure are demonstrated in the Fig. [3](#Fig3){ref-type="fig"}b for five different values of $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$w_{out}$$\end{document}$. It is seen that just several steps of iteration is sufficient to obtain a reasonable convergence towards the theoretical values provided by ([8](#Equ8){ref-type=""}). A drawback of this iterative procedure is that at each step one needs to evaluate the spectrum of the operator $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$2m\times 2m$$\end{document}$, which could become a hard computational task for large and dense networks. As a reasonable approximation to the optimal value of $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\gamma $$\end{document}$ for the polymer flow operator, one can evaluate $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\gamma _{opt}$$\end{document}$ similarly for the polymer modularity, which is smaller in size and symmetric.

Polymer non-backtracking flow resolves compartments in a single cell Hi-C network {#Sec8}
---------------------------------------------------------------------------------

To check robustness of the polymer non-backtracking flow operator on real Hi-C data we run it on a set of individual oocyte cells of mouse^[@CR28]^. From the public repository we have taken the single cells Hi-C data on cis-contacts of 20 chromosomes from 13 single cells (260 adjacency matrices, in total). While single cells matrices with sufficiently large number of contacts are not sparse and can be split into compartments using conventional methods largely used for the bulk data (e.g., the leading eigenvectors of observed/expected transformation of a population-averaged Hi-C map,^[@CR12]^), here we take the cells with low to moderate amount of contacts for the sake of comparative analyses of clustering performance of different spectral methods on *sparse* polymer graphs.

Before proceeding with the analyses of compartments in single cells, the raw data must be preliminary processed. In order to extract compartmentalization signal from the maps, we have coarse-grained them to the resolution 200 kb. At this resolution all finer genome folding structuring (like topologically-associated domains) is encoded within the coarse-grained blobs and does not communicate with two large-scale *A* and *B* compartments. We note, that, in principle, the method is applicable at higher resolution as well. However, there are two important considerations. The non-backtracking operator is defined on the edges, therefore, the leading eigenvectors need to be computed for much larger matrix than in case of traditional operators, which are defined on the nodes (e.g., modularity). This means that the computation time of the method is very sensitive to the resolution. Furthermore, one needs to be very careful with the overall network density: it decreases by several times upon decreasing of the bin size, so that one can occasionally cross the detectability limit ([12](#Equ12){ref-type=""}). In each particular case the resolution for the annotation should be chosen with respect to the sparsity of the experimental single cell contact maps. According to this logic, we have decided to use the resolution 200 kb for the data of Flyamer et al.

Most of the contacts in the cells have degeneracy 1 at the chosen resolution, however, several pairs of bins have more than 1 contact. To preserve this feature of enhanced connectivity, we consider the counts of contacts between the pairs as weights of the corresponding edges. Furthermore, the single-cell maps are noisy and some of really existing contacts get lost due to technical shortcomings of the experimental protocol. As long as the neighboring blobs in the chromatin chain are connected with probability 1, all lost contacts $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$A_{i,i+1}$$\end{document}$ need be added to the adjacency matrix manually; we assign the weight 1 to such edges. We also cleans the coarse-grained data from the self-edges, assigning $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$A_{ii}=0$$\end{document}$.

To determine the background model for our analyses we calculate the contact probability $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$P(s) = \frac{1}{N-s} \sum _{i=1}^{N-s} A_{i,i+s}$$\end{document}$ for each individual single cell and for the merged cell (summing single cells matrices), see Fig. [4](#Fig4){ref-type="fig"}a. Resulting dependence turns out to be fairly close to the fractal globule contact probability, $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$P(s)\sim s^{-\alpha }$$\end{document}$ with $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\alpha \approx 1$$\end{document}$ at scales from $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\approx $$\end{document}$ 1-2Mb to the end of the chromosome. A shoulder at lower scales around 1 Mb reflects enhancement of the contact probability due to the compartmentalization. Importantly, the fractal globule scaling at the megabase scale is universal across different species and cell types; it is evident in the population-averaged contact matrices in mouse oocytes^[@CR28]^, human lymphoblastoid cells^[@CR12]^ and *Drosophila* cells^[@CR43]^. As it was shown in previous Section, in order to extract compartmentalization profile overlaying a specific long-ranged folding, it is crucial to incorporate the respective background contact probability into the polymer model of the stochastic blocks.Figure 4(**a** The average contact probability *P*(*s*) of single cells (gray) and of the merged cell (solid, black) computed for logarithmically spaced bins with the logfactor 1.4; the fractal globule scaling $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$P(s)\sim s^{-1}$$\end{document}$ is also shown by dashed line for comparison. (**b**) Annotation of active (red) and inactive (blue) compartmental domains for one of the contact maps (cell 29749, chromosome 3, length $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$N=492$$\end{document}$, 200kb resolution) by the polymer non-backtracking flow operator. Below the map the compartmental signal from the corresponding leading eigenvector of the polymer non-backtracking flow matrix is shown. Inset: the full spectrum of the polymer flow for the same contact map. (**c**,**d**) Averaged profiles of the GC content (z-scores) plotted around the centers of the compartmental domains (active---red, inactive---blue) for the population of cells and for a pool of single cells.

Having the background model determined, we construct the polymer non-backtracking flow operator with the variable parameter $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\gamma $$\end{document}$ and run the iterative clustering procedure to derive the optimal value $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\gamma _0$$\end{document}$. Similarly to the analyses on the benchmarks, see Fig. [3](#Fig3){ref-type="fig"}b, a swift convergence to the optimal value is observed here. The spectrum of the polymer flow operator for the cell 29749, chromosome 3 at $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\gamma _0 \approx 0.9$$\end{document}$ is shown in the inset of the Fig. [4](#Fig4){ref-type="fig"}b. Nineteen isolated eigenvalues on the real axis are separated from the bulk spectrum. As we have shown in the previous Section, this is a quite typical scenario for sparse polymer stochastic block models. In the sparse limit of the polymer SBM, the number of isolated eigenvalues could be much larger than the number of compartments.

The partition of the single cells in two compartments has been performed in the leading eigenvector approximation of the different operators. The boundaries of active and inactive domains are determined according to the sign of the respective compartmental signal (see Fig. [4](#Fig4){ref-type="fig"}b and Supplementary Fig. [S1](#MOESM1){ref-type="media"} online). It is known that the gene density is higher in the actively transcribed *A* compartment, thus, the fraction of GC letters in bins of active compartmental domains needs to be larger than in inactive domains. To validate that the clusters found in single cells respond to the transcriptional domains and are biologically significant, we calculate the GC content profiles around the centers of all *A* and *B* domains separately and then take the average of these profiles in each group. The types of the domains were phased in accordance with the leading eigenvector of the bulk data (population Hi-C on embryonic stem cells was used^[@CR44]^; the eigenvector was computed on the observed-over-expected map). We also plot analogous profiles for the leading eigenvector of the bulk data. In absence of direct annotation methods for single cells due to their sparsity, these two measures have been of use to approximate positions of the compartmental domains in single cell Hi-C data^[@CR28]^.

As expected, the GC content for the population-averaged map and the bulk E1 vector both have pronounced peaks at the center of *A* domains and symmetrical dips at the center of *B* domains with the *z*-score amplitude equal to 0.4 (GC) and 0.7 (E1), correspondingly. Single cells profiles demonstrate notably lower amplitudes (see Fig. [4](#Fig4){ref-type="fig"}c,d and Supplementary Figs. [S2](#MOESM1){ref-type="media"}, [S3](#MOESM1){ref-type="media"} online). However, only the polymer non-backtracking flow yields the annotation with the similar shape and span. Both profiles (for *A* and for *B*) of the polymer non-backtracking flow fall symmetrically to zero at the same genomic distance, around $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$4-5$$\end{document}$ bins from the centers of domains, which also strikingly coincides with the span of the bulk profiles. This is also compliment to the similarity of the characteristic sizes of compartmental domains determined by the non-backtracking flow operator ($\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\langle l\rangle \approx $$\end{document}$ 2.2 Mb) and domains from the bulk data ($\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\langle l\rangle \approx $$\end{document}$ 1.7 Mb). To test the effect of different $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\alpha $$\end{document}$, we additionally run the polymer non-backtracking for $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\alpha =3/2$$\end{document}$, which is the scaling exponent of the contact probability for the ideal chain packing. Comparison of the two values of the parameter is demonstrated in Supplementary Fig. [S4](#MOESM1){ref-type="media"} online: the profiles with $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\alpha =3/2$$\end{document}$ show significantly worse correlation with both GC content and the E1 bulk vector. This is consistent with the slope $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\alpha \approx 1$$\end{document}$ of *P*(*s*) for the set of single cells, Fig. [4](#Fig4){ref-type="fig"}a, underscoring the importance of neutralization on the appropriate average polymeric scaling before the clustering.

Note that the partitions of the polymeric operators (non-backtracking, modularity) are visibly much more adequate to apparent clustering of contacts in a particular cell (Supplementary Fig. [S1](#MOESM1){ref-type="media"} online). Despite the similarity in compartmental signals from the polymer modularity and from the polymer non-backtracking flow, the sizes of modularity domains are almost twice larger ($\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\langle l\rangle \approx $$\end{document}$ 4.1 Mb) and show negative z-scores of GC content both for the active and inactive compartments. The profile of the E1 vector plotted for the polymer modularity has a similar bell shape, however, it levels at $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\approx -0.07$$\end{document}$ and stays negative throughout the whole range of the compartmental interval. This is a consequence of sparsity, which results in a limited performance of all traditional spectral methods.

Conclusion {#Sec9}
==========

In this paper we have developed theoretical grounds for spectral community detection in sparse polymer networks. On the basis of suggested polymeric extension of the stochastic block model, we have proposed the polymer non-backtracking flow operator and have proven that its leading eigenvector performs partitioning of a polymeric network into two clusters according the maximum entropy principle. The established connection with the modularity functional provides a computationally efficient tool for the network partitioning and search for the optimal resolution parameter of the partition in polymer networks, which, however, is inferior to the non-backtracking in efficiency for sparse networks.

The proposed theoretical framework is verified by extensive numerical simulations of polymer benchmarks, constructed in order to emulate compartmentalization in sparse chromatin networks. Comparative analyses of different operators on the benchmark has suggested that the polymer flow detects the communities up to the theoretical detectability limit, while all other operators fail above it. At the same time, the amount of isolated eigenvalues of the polymer flow operator can be larger than amount of true communities present in the network, due to frozen linear connectivity that forces the chain to form "blobs" along the chain contour. This result distinguishes the polymer system with thespect the canonical stochastic block model, where the number of isolated eigenvalues of the non-backtracking exactly matches the number of communities.

Analyses of the single cell Hi-C data of mouse oocytes suggests that the non-backtracking walks efficiently split experimental sparse networks into biologically significant communities, characterized by enrichment and depression of the genes density. The sizes of the compartmental domains are fairly close to the sizes of the population-averaged domains. Comparison with characteristics of the domains, inferred by other operators, underscores superiority of the non-backtracking walks in partitioning sparse polymer networks.

In this study we have exploited for the polymer network analysis only the simplest spectral characteristics. More involved ones, e.g. spectral correlators and the level spacing distribution, carry additional information about the propagation of excitations in network. The spectral statistics and non-ergodicity have been discussed in clustered networks in^[@CR45],\ [@CR46]^. In the context of the gene interactions the spectral statistics has been discussed in^[@CR47]^ for the matrices with the real spectrum. The non-backtracking matrices enjoy complex spectrum hence the special means are required to analyze the level spacing in this case. The corresponding tool has been invented recently^[@CR48],\ [@CR49]^, therefore, the spectral statistics of the polymer non-backtracking flow operator certainly deserves a separate study.

Supplementary information {#Sec11}
-------------------------

Supplementary information

Appendix {#Sec10}
========

Methods {#Sec12}
-------

### Quadratic form of the polymer non-backtracking operator {#Sec13}

Let us consider a quadratic form involving the operator over the Potts spin variables $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$g_i, i = 1, 2, \ldots , N$$\end{document}$ and introduce the 2*m*-dimensional (2*m* is the number of edges in the network) vector *u*, such as $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$u_{i \rightarrow j} = g_j$$\end{document}$. Then,$$\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\begin{aligned} R = u^T {\mathbf {R}}\; u = \sum _{\begin{array}{c} (i, j) \in E \\ (k, l) \in E \end{array}} {\mathbf {R}}_{i \rightarrow j, k \rightarrow l}\; g_{j} g_{l} \end{aligned}$$\end{document}$$It can be shown that ([13](#Equ13){ref-type=""}) coincides with the quadratic form of the generalized modularity. Let us consider the terms separately. The quadratic form of the first, non-backtracking term, yields$$\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\begin{aligned} \sum _{\begin{array}{c} i \rightarrow j \\ k \rightarrow l \end{array}} \frac{\delta _{il}\left( 1 - \delta _{jk}\right) }{d_i - 1}\; g_j g_l = \sum _{i, j} \frac{g_i g_j}{d_i - 1} A_{ij} \sum _{k} \left( 1-\delta _{0A_{ik}}\right) \left( 1 - \delta _{jk}\right) = \sum _{ij} A_{ij}\; g_i g_j \end{aligned}$$\end{document}$$where the sum over *k* enumerates the edges of the node *i* except of the edge (*i*, *j*) and, thus, equals $\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$d_i - 1$$\end{document}$. Expanding the quadratic form of the second term similarly, we get$$\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\begin{aligned} \gamma \sum _{\begin{array}{c} i \rightarrow j \\ k \rightarrow l \end{array}} \left( d_j d_l\right) ^{-1}\; P_{jl} \; g_j\; g_l = \gamma \sum _{jl} \left( d_j d_l\right) ^{-1} P_{jl} \; g_j\; g_l \sum _{ik} \left( 1-\delta _{0A_{ij}}\right) \left( 1-\delta _{0A_{kl}}\right) = \gamma \sum _{jl} P_{jl}\; g_{j}\; g_{l} \end{aligned}$$\end{document}$$Collecting ([14](#Equ14){ref-type=""}) and ([15](#Equ15){ref-type=""}) together one arrives at$$\documentclass[12pt]{minimal}
                \usepackage{amsmath}
                \usepackage{wasysym} 
                \usepackage{amsfonts} 
                \usepackage{amssymb} 
                \usepackage{amsbsy}
                \usepackage{mathrsfs}
                \usepackage{upgreek}
                \setlength{\oddsidemargin}{-69pt}
                \begin{document}$$\begin{aligned} R = u^T R\; u = \sum _{ij} \left( A_{ij} - \gamma P_{ij}\right) g_i\; g_j; \quad P_{ij} = \frac{1}{|i-j|^\alpha } \end{aligned}$$\end{document}$$which is the quadratic form of the generalized modularity functional, proportional to the entropy of the polymer SBM.

**Publisher\'s note**

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Supplementary information
=========================

is available for this paper at 10.1038/s41598-020-68182-0.

We are grateful to Leonid Mirny, Mikhail Gelfand, Mikhail Tamm, Maxim Imakaev and Nezar Abdennur for valuable discussions on the subject of the paper. KP, AG and SN acknowledge supports of the Foundation for the Support of Theoretical Physics and Mathematics "BASIS" (respectively 17-1-2-27-8 for KP, 17-11-122-1 for AG and 19-1-1-48-1 for SN). This work was supported by Grants RFBR 18-29-13013 (KP, AG, SN) and RSF 19-14-00016 (SVR, SVU). The authors are grateful to CNRS for the organizational and financial support of the publication.

K.P. designed the study, performed the benchmark and single cell analyses and wrote the manuscript. A.G., S.N., S.V.R. and S.V.U. supervised the work and participated in writing.

The authors declare no competing interests.
