arXiv:2610.17958cs.DSOct 2026

Manuscript Offprint

arXiv:2610.17958

Mining Correlated Motifs with Wildcards in PPI Networks: Exact and Optimal

Lucas P. Oliveira, Ben Bals, Aalt D. J. van Dijk, Solon P. Pissis

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Lucas P. Oliveira ∗^{*}

Ben Bals †^{\dagger}

Aalt D. J. van Dijk ‡^{\ddagger}

Solon P. Pissis §^{\S}

Abstract. A protein–protein interaction (PPI) network is a graph whose nodes are protein sequences and whose edges represent physical interactions between proteins. Correlated Motif Mining (CMM) seeks pairs of sequence motifs whose co-occurrence in interacting proteins reveals binding sites and interaction mechanisms. Formally, in the (ℓ,d)(\ell,d)-CMM problem, we are given a graph G=(V,E)G = (V, E), with V⊆Σ∗V \subseteq \Sigma^* for an alphabet Σ\Sigma, and integers 0≤d<ℓ0 \leq d < \ell, and we seek a pair {X,Y}\{X, Y\} of motifs, each of length ℓ\ell and containing dd wildcards, that maximizes a support measure f(G,{X,Y})f(G, \{X, Y\}); e.g., the count fEf_E of edges {u,v}∈E\{u, v\} \in E such that XX matches a substring of uu and YY matches a substring of vv, or vice versa. Although existing approaches have produced biologically meaningful results, they are either inefficient or heuristic-based, as the underlying optimization problem is NP-hard. Here, we revisit (ℓ,d)(\ell, d)-CMM. For d=0d = 0, we give an exact O(N2)\mathcal{O}(N^2)-time and O(N)\mathcal{O}(N)-space algorithm, where NN is the total length of the node strings, and prove that this time is conditionally optimal under the Strong Exponential-Time Hypothesis. For any d>0d > 0, we give an exact O((ℓd)2N2)\mathcal{O}\left(\binom{\ell}{d}^2 N^2\right)-time and O(N)\mathcal{O}(N)-space algorithm, and observe that the problem is W[1]-hard parameterized by dd. The latter algorithm improves the state of the art by exponentially large factors in both time and space. We further demonstrate experimentally that our algorithms are practical on real-world PPI networks and find significantly higher-scoring motif pairs than the state of the art. Moreover, we show that our algorithms find many top-scoring motif pairs that the state of the art misses entirely. Taken together, our results suggest that exact CMM with wildcards is more tractable in practice than previously assumed.

1 Introduction. Large-scale biological networks capturing protein–protein interactions (PPIs) are now available for a wide range of organisms [20–22]. While such data reveal how proteins function within a PPI network, they offer no direct insight into how those interactions are encoded at the sequence level—in particular, which regions of protein sequences correspond to physical interaction sites. Popular tools such as AlphaFold [11] have revolutionized protein structure prediction, but experimental validation of interaction interfaces at scale remains a major bottleneck: the human proteome alone contains tens of thousands of binary interactions [20], and determining their structural basis experimentally is infeasible at this scale. Moreover, even large-scale structural characterization of interacting proteins would not directly answer the question of how interaction specificity is encoded in protein sequence or structure. In other words: which specific residues determine which partners a protein can bind?

To answer this question, a variety of bioinformatics approaches have been developed [8,10,23]. In particular, several algorithmic approaches have been proposed for locating binding sites by mining overrepresented pairs of sequence patterns, called motif pairs, from sequences of interacting proteins [1, 15–18, 25]. One such approach, known as Correlated Motif Mining (CMM), identifies binding sites by searching for a consensus pattern in one group of proteins that interacts with nearly all proteins containing a second consensus pattern. When such a pair is found, both patterns are likely to represent complementary surface regions that enable physical binding. Figure 1.1 illustrates this idea: {G◊P◊NY,P◊P}\{G\lozenge P\lozenge NY, P\lozenge P\} and {R◊R◊pS,L◊R◊pS}\{R\lozenge R\lozenge pS, L\lozenge R\lozenge pS\} are two correlated motif pairs, where an undirected edge connects two protein sequences if the first contains motif G◊P◊NYG\lozenge P\lozenge NY and the second contains motif P◊PP\lozenge P, and analogously for {R◊R◊pS,L◊R◊pS}\{R\lozenge R\lozenge pS, L\lozenge R\lozenge pS\}. Although it remains unclear what fraction of protein interfaces can be described by correlated motifs of this kind, existing approaches consistently show that such motifs do contain meaningful information about interaction interfaces.

Existing computational approaches fall into two broad categories: (i) interaction-driven approaches [16–18]; and (ii) motif-driven approaches [1, 15, 25]. Interaction-driven approaches search for (quasi-)bicliques—that is, subsets of nodes in a PPI network, in which nearly every node on one side is connected to nearly all nodes on the other. These subgraphs capture an all-versus-all, or most-versus-most, interaction

*CWI, Amsterdam, The Netherlands and University of Campinas, Campinas, Brazil (lucas.peres@students.ic.unicamp.br).

†^{\dagger}CWI, Amsterdam, The Netherlands and Vrije Universiteit Amsterdam, Amsterdam, The Netherlands (bjjb@cwi.nl).

‡^{\ddagger}University of Amsterdam, Amsterdam, The Netherlands (a.d.j.vandijk@uva.nl).

§The Cyprus Institute, Nicosia, Cyprus (s.pissis@cyi.ac.cy).

pattern, from which a representative motif pair is then derived from the sequences labeling the nodes. Motif-driven approaches, by contrast, begin with candidate motif pairs and evaluate their support directly in the PPI network. While both paradigms have been shown to yield biologically meaningful results, the motif-driven approach has several conceptual advantages over its interaction-driven counterpart. First, motif pairs are identified directly rather than derived in post-processing. Second, all proteins containing a given motif are taken into account, rather than an arbitrarily selected subset. Third, when the interactions between two groups of proteins arise from multiple compatible binding sites—e.g., {G◊P◊NY,P◊P}\{G\lozenge P\lozenge NY, P\lozenge P\} and {R◊R◊pS,L◊R◊pS}\{R\lozenge R\lozenge pS, L\lozenge R\lozenge pS\} in Figure 1.1—interaction-driven methods are forced to merge them into one motif pair, thereby losing this structural distinction.

Figure

Figure 1.1: Motif pairs {G◊P◊NY,P◊P}\{G\lozenge P\lozenge NY, P\lozenge P\} and {R◊R◊pS,L◊R◊pS}\{R\lozenge R\lozenge pS, L\lozenge R\lozenge pS\} as correlated motifs. The colored edges show their correlation.

1.1 The problem and the state of the art. In this paper, we focus on the motif-driven approach to CMM. The vanilla version of the problem is defined as follows.

CORRELATED MOTIF MINING (CMM)

Input: A graph G=(V,E)G = (V, E), with V⊆Σ∗V \subseteq \Sigma^* for an alphabet Σ\Sigma, and an integer ℓ>0\ell > 0.

Output: A pair {X,Y}\{X, Y\}, with X,Y∈ΣℓX, Y \in \Sigma^\ell, that maximizes a support measure f(G,{X,Y})f(G, \{X, Y\}).

We next define the CMM problem with wildcards; wildcards are placeholder symbols, denoted by ◇, that can match any character from the underlying alphabet.

CMM WITH WILDCARDS ((ℓ, d)-CMM)

Input: A graph G=(V,E)G = (V, E), with V⊆Σ∗V \subseteq \Sigma^* for an alphabet Σ\Sigma, and integers ℓ>0\ell > 0 and 0≤d<ℓ0 \leq d < \ell.

Output: A pair {X,Y}\{X, Y\}, with X,Y∈(Σ⊔{⋄})ℓX, Y \in (\Sigma \sqcup \{\diamond\})^\ell, each containing exactly dd wildcards, that maximizes a support measure f(G,{X,Y})f(G, \{X, Y\}).

While we formalize the problems in a general form, the motivating application leads us to use the following widely-used support measures [1,15,25]: the count fEf_E of edges {u,v}∈E\{u, v\} \in E such that XX matches a substring of uu and YY matches a substring of vv, or vice versa; and the χ2\chi^2-score fχ2f_{\chi^2} of GG with respect to {X,Y}\{X, Y\} [25].

To the best of our knowledge, three techniques have so far been proposed. Unfortunately, these techniques differ not only in their mining method, but also in the matching relation and the support measure used.

The first work by Tan et al. [25] introduced D-MOTIF, an exact algorithm for finding correlated motif pairs under the Hamming distance. D-MOTIF considers fχ2f_{\chi^2} to quantify support. The basic idea of the algorithm is to enumerate all possible motif pairs from every pair {u,v}∈E\{u, v\} \in E, using the Hamming distance neighborhood notion, and then check if they have enough support. The authors also suggested a heuristic counterpart called D-STAR. Unfortunately, neither D-MOTIF nor D-STAR scales to networks with more than 250 proteins.

The second work by Leung et al. [15] introduced FindMotif, an exact algorithm for (ℓ,d)(\ell, d)-CMM. FindMotif uses a different support measure that considers the probability that the observed number of interactions is generated under a null hypothesis. The algorithm builds a table of O((ℓd)2∣Σ∣2(ℓ−d))\mathcal{O}(\binom{\ell}{d}^2|\Sigma|^{2(\ell-d)}) entries, one per possible motif pair over alphabet Σ\Sigma, and computes the support for each using a voting technique. The authors also suggested a heuristic counterpart called MotifHeuristics, which was able to handle larger networks than D-STAR.

The third work by Boyen et al. [1] proved that (ℓ,d)(\ell, d)-CMM is NP-hard for so-called compliant biclique-maximal measures, which include fEf_E and fχ2f_{\chi^2}. They also introduced SLIDER, a generic metaheuristic that incorporates two steepest-ascent procedures. The central component of these procedures is a neighborhood function defined by viewing a motif as a window that slides along the protein sequence of one of the proteins. Unlike more conventional neighborhood functions, this has a clear biological interpretation: if a motif partially overlaps a binding site in a sequence, a few mutations should suffice to convert it into a binding site. In this sense, both neighborhood functions are designed to identify nearby motifs that may correspond to regions close to one another on actual proteins. The difference is that one neighborhood function considers as neighbors all motifs that could, in principle, lie near the given motif on any protein, whereas the other restricts attention to motifs that are actually nearby on a single selected protein. Although SLIDER can be paired with an arbitrary support measure, the authors used fχ2f_{\chi^2}, providing compelling evidence that it is biologically the most relevant, and showing that SLIDER outperforms MotifHeuristics.

1.2 Our contributions. Since the motif-driven approach to CMM is computationally hard, in general [1], it is widely believed that exact optimization is imprac-tical for realistically sized PPI networks. Consequently, the main aim of the existing works [1, 15, 25] has been to design efficient and effective heuristics that identify high-quality motif pairs in reasonable time. This need is particularly acute for modern real-world datasets, which are large, noisy, and in need of methods that scale while still capturing biologically meaningful patterns.

Here, however, we present an exact method that remains efficient in practice on modern datasets, thereby showing that the problem can be solved far more effectively than is commonly believed. Our results thus refute the prevailing view that only heuristic approaches are viable for this task. Our crucial observation is that the hardness proof in [1] proceeds under the assumption that both ℓ\ell and d are unbounded, which is not realistic in the motivating application. Intuitively, we confine the computational hardness to parameter ℓ\ell. Indeed, the values considered for ℓ\ell and d are typically small [1,15,25].

We make the following theoretical contributions:

(1) We give an exact O(N2)\mathcal{O}(N^2)-time algorithm for CMM (the vanilla version), where N:=∑v∈V∣v∣N := \sum_{v \in V} |v|. The space usage is O(N)\mathcal{O}(N). See Section 3.

(2) We show that this algorithm is essentially optimal: no algorithm can solve CMM in time O(N2−εpoly(∣E∣,∣V∣))\mathcal{O}(N^{2-\varepsilon}\text{poly}(|E|,|V|)), for any ε>0\varepsilon > 0, unless the popular Strong Exponential-Time Hypothesis (SETH) [9] is false. See Section 3.

(3) We build on the CMM algorithm to give an exact O((ℓd)2N2)\mathcal{O}\left(\binom{\ell}{d}^{2}N^{2}\right)-time algorithm for (ℓ,d)(\ell,d)-CMM (the wildcards version). The space usage is O(N)\mathcal{O}(N); and the algorithm is embarrassingly parallelizable. This improves dramatically on the state of the art from O∗((ℓd)2∣Σ∣2(ℓ−d))\mathcal{O}^{*}\left(\binom{\ell}{d}^{2}|\Sigma|^{2(\ell-d)}\right) time to O∗((ℓd)2)\mathcal{O}^{*}\left(\binom{\ell}{d}^{2}\right) and from O∗((ℓd)2∣Σ∣2(ℓ−d))\mathcal{O}^{*}\left(\binom{\ell}{d}^{2}|\Sigma|^{2(\ell-d)}\right) space to O(N)\mathcal{O}(N). 1^{1} See Section 4.

(4) Finally, we observe that (ℓ,d)(\ell, d)-CMM is W[1]-hard parameterized by d. See Section 4.

We make the following practical contributions:

(1) We show that the parallelized version of our algorithm for (ℓ,d)(\ell, d)-CMM processes real-world datasets in a reasonable amount of time.

(2) We show that the runtime and space usage predicted by our theoretical results are accurately reflected in practice.

(3) We show that our exact algorithm finds motif pairs with significantly higher support than the state of the art, which highlights its usefulness.

(4) We show that our exact algorithm finds many top-scoring motif pairs that the state of the art misses.

For the above practical contributions, see Section 5. We begin with some preliminaries in Section 2.

2 Preliminaries. We assume throughout that arrays and strings start at position 1.

2.1 Strings. A string is a finite sequence of characters over an alphabet Σ\Sigma. In this work, we consider strings over a totally ordered alphabet. We denote the length of a string TT by ∣T∣|T|. For any index i∈[1,∣T∣]i \in [1, |T|], we denote the ii-th character of TT by T[i]T[i]. A string of the form T[i…j]=T[i]T[i+1]⋯T[j]T[i \ldots j] = T[i]T[i+1] \cdots T[j], where 1≤i≤j≤∣T∣1 \leq i \leq j \leq |T|, is called a fragment of TT. If TT is known, we can encode T[i…j]T[i \ldots j] in O(1)\mathcal{O}(1) space as the pair (i,j)(i, j). A fragment of the form T[1…j]T[1 \ldots j] is called a prefix of TT, and a fragment of the form T[i…∣T∣]T[i \ldots |T|] is called a suffix of TT. A string PP is a substring of TT if P=T[i…i+∣P∣−1]P = T[i \ldots i + |P| - 1], for some ii. In this case, we say that PP occurs in TT. A wildcard is a special symbol ⋄\diamond matching any a∈Σ⊔{⋄}a \in \Sigma \sqcup \{\diamond\}.

Given a string TT of length nn, the suffix array of TT, denoted by SAT[1..n]\mathsf{SA}_T[1..n], stores a permutation of the indices {1,…,n}\{1,\ldots,n\} such that T[SAT[i]..n]T[\mathsf{SA}_T[i]..n] is the ii-th lexicographically smallest suffix of TT. Let lcp(X,Y)\mathrm{lcp}(X,Y) denote the length of the longest common prefix (LCP) of the strings XX and YY. The LCPLCP array of TT, denoted by LCPT[1..n]\mathsf{LCP}_T[1..n], is defined as follows: LCPT[1]=0\mathsf{LCP}_T[1]=0, and for every i∈[2,n]i\in[2,n], LCPT[i]=lcp(T[SAT[i−1]..n],T[SAT[i]..n])\mathsf{LCP}_T[i]=\mathrm{lcp}(T[\mathsf{SA}_T[i-1]..n],T[\mathsf{SA}_T[i]..n]).

2.2 Graphs and motifs. Let G=(V,E)G = (V, E) be an undirected graph, where V⊆Σ∗V \subseteq \Sigma^*, for an alphabet Σ\Sigma. Let N:=∑v∈V∣v∣N := \sum_{v \in V} |v| denote the total length of all v∈Vv \in V. An (ℓ,d)(\ell, d)-motif is a string X∈(Σ⊔{⋄})ℓX \in (\Sigma \sqcup \{\diamond\})^\ell containing exactly dd wildcard symbols ⋄\diamond. When d=0d = 0, the motif is simply a string over Σ\Sigma of length ℓ\ell. An (ℓ,d)(\ell, d)-motif pair {X,Y}\{X, Y\} is an unordered pair of (ℓ,d)(\ell, d)-motifs. We may omit ℓ\ell and dd when they are clear from the context and then simply speak of motifs and motif pairs.

2.3 Motif-induced subgraphs. For a motif X, let VX:={v∈V∣X occurs in v}V_X := \{v \in V \mid X \text{ occurs in } v\} be the set of nodes where X occurs. If a node v contains multiple occurrences of X, then v is included only once in VXV_X.

For a motif pair {X,Y}\{X, Y\}, the set of edges whose endpoints contain X and Y, respectively, is

EX,Y:={{u,v}∈E∣u∈VX and v∈VY}.E_{X,Y}:=\left\{\left\{u,v\right\}\in E\mid u\in V_{X}\mathrm{~a n d~}v\in V_{Y}\right\}.

We set fE(G,{X,Y}):=∣EX,Y∣f_E(G, \{X, Y\}) := |E_{X,Y}|. The subgraph selected by {X,Y}\{X, Y\} is then GX,Y:=(VX∪VY,EX,Y)G_{X,Y} := (V_X \cup V_Y, E_{X,Y}). If VX∩VYV_X \cap V_Y is nonempty, we may have an edge between distinct nodes v,u∈VXv, u \in V_X provided that at least one of them is in VX∩VYV_X \cap V_Y. On the other hand, if v,u∈VX∖VYv, u \in V_X \setminus V_Y, they cannot be adjacent by definition of EX,YE_{X,Y}.

A motif pair {X,Y}\{X, Y\} is called a (kX,kY,kX,Y)(k_X, k_Y, k_{X,Y})-motif pair for GG if GX,YG_{X,Y} satisfies ∣VX∣=kX|V_X| = k_X, ∣VY∣=kY|V_Y| = k_Y, and

1^{1}The O∗(⋅)\mathcal{O}^{*}(\cdot) notation suppresses polynomial factors.

∣VX∩VY∣=kX,Y|V_X \cap V_Y| = k_{X,Y}. It is called complete if every node of VXV_X is adjacent to every node of VYV_Y. A complete bipartite graph is called a biclique.

2.4 Support measures. A support measure f on G is a function that maps an (ℓ,d)(\ell, d)-motif pair {X,Y}\{X, Y\} to a nonnegative real number f(G,{X,Y})f(G, \{X, Y\}). Different types of support functions have been considered in the literature [1, 15, 25]. We restrict our attention to fEf_E and fχ2f_{\chi^2}, which we define below. The former is simple and illustrative and will serve to make our theoretical analysis lucid. The second works well in practice [1] and we use it in our experimental evaluation (we also show that our theoretical results extend to it).

2.5 The fχ2f_{\chi^2} support measure. The χ2\chi^2-based support measure of a graph G with respect to an (ℓ,d)(\ell, d)-motif pair {X,Y}\{X, Y\}, denoted by fχ2f_{\chi^2}, is defined as

fχ2(G,{X,Y}):={(∣EX,Y∣−EX,Y‾)2EX,Y‾if∣EX,Y∣>EX,Y‾,0otherwise,f_{\chi^{2}}(G,\{X,Y\}):=\begin{cases}\frac{(|E_{X,Y}|-\overline{E_{X,Y}})^{2}}{\overline{E_{X,Y}}}&if|E_{X,Y}|>\overline{E_{X,Y}},\\0&otherwise,\end{cases}

where EX,Y‾\overline{E_{X,Y}} is the expected number of edges between VXV_{X} and VYV_{Y} under a uniform random-graph model. Concretely,

EX,Y‾:=ed(G)⋅EkX,kY,kX,Ymax,\overline{{E_{X,Y}}}:=\mathrm{e d}(G)\cdot E_{k_{X},k_{Y},k_{X,Y}}^{\mathrm{m a x}},

where ed(G):=∣E∣/(∣V∣2)\text{ed}(G) := |E| / \binom{|V|}{2} is the edge density of GG, and

EkX,kY,kX,Ymax⁡:=kXkY−(kX,Y2)−kX,YE_{k_{X},k_{Y},k_{X,Y}}^{\max}:=k_{X}k_{Y}-\binom{k_{X,Y}}{2}-k_{X,Y}

is the maximum possible number of edges in the subgraph selected by any (kX,kY,kX,Y)(k_X, k_Y, k_{X,Y})-motif pair. The parameters kXk_X, kYk_Y, and kX,Yk_{X,Y} are as defined above; ∣V∣|V| and ∣E∣|E| are trivially obtained from the input. Intuitively, this measure captures how much above the average density a subgraph selected by a motif pair is, taking into account its size.

3 An exact algorithm for CMM. To simplify our presentation, we focus on the fEf_E support measure for now, but the same algorithmic ideas also apply to the fχ2f_{\chi^2} support measure. Recall that fE(G,{X,Y})f_E(G, \{X, Y\}) counts the edges {u,v}∈E\{u, v\} \in E such that XX matches a substring of uu and YY matches a substring of vv, or vice versa.

THEOREM 3.1. There is an algorithm for CMM with fEf_E running in time O(N2)\mathcal{O}(N^2), where N:=∑v∈V∣v∣N := \sum_{v \in V} |v|. The space used is O(N)\mathcal{O}(N).

Proof. The algorithm (see Algorithm 3.1) iterates over all motif pairs {X,Y}\{X, Y\}, such that X and Y are substrings of at least one of the labels, and then counts the corresponding number of edges. That is, it computes the value fE(G,{X,Y})f_E(G, \{X, Y\}) explicitly. Therefore, taking the maximum will clearly produce the desired output.

The more interesting part is how to implement some of the operations efficiently enough. The short version is that the suffix array (SA) will give us all the necessary tools. First, observe that we can construct the SA of the concatenation of the node strings (with some separation character) in O(N)\mathcal{O}(N) time [12] after sorting all characters occurring in all strings v∈Vv \in V in O(Nlog⁡N)\mathcal{O}(N \log N) time. The SA (together with the LCP array) gives us a constant-size unique name for each length- ℓ\ell substring of any label that can be computed (after preprocessing) in constant time given a location in a node string. Call this the rank of a substring. Note that the ranks are the same for all occurrences of the same substring. In addition, these are integers bounded by N. One may think of this as a perfect hash function that we can use to (1) compare substrings in constant time, and (2) implement the dictionary C defined in Line 1 using O(N)\mathcal{O}(N) space. Using (1) and (2), we implement the loop in Line 3 so that it runs in O(N)\mathcal{O}(N) time. In particular, after a single linear pass over the node strings, we use these names to build a simple inverse index to access the nodes that contain a given rank, as required in Line 4. As we access the nodes for each label exactly once and this inverse index has total size O(N)\mathcal{O}(N), that is also the total time to access the nodes. Similarly, observe that in a linear pass, we can build a list of the unique ranks that occur in each node, making the loop in Line 6 take O(N)\mathcal{O}(N) time in total for each X. The operations in the innermost loop require constant time. In particular, the operation ⪯\preceq can be any total order on the length- ℓ\ell substrings. To get a constant-time comparator, we choose the rank order.

Thus, we are finally left to argue why the loop in Line 5 does not blow up the running time. Observe that each edge {u,v}\{u, v\} is only considered for a motif pair {X,Y}\{X, Y\} if XX occurs in uu and YY occurs in vv. (Each edge is visited exactly once in Line 5, oriented so that u∈VXu \in V_X; the second loop adds the YY's that occur only in uu.) This can happen at most (∣u∣−ℓ+1)(∣v∣−ℓ+1)(|u| - \ell + 1)(|v| - \ell + 1) times. Then

∑{u,v}∈E(∣u∣−ℓ+1)(∣v∣−ℓ+1)≤∑(u,v)∈V×V∣u∣∣v∣=(∑u∈V∣u∣)(∑v∈V∣v∣)=O(N2),\begin{align*}&\sum_{\{u,v\}\in E}(|u|-\ell+1)(|v|-\ell+1)\\ \leq&\sum_{(u,v)\in V\times V}|u||v|=\left(\sum_{u\in V}|u|\right)\left(\sum_{v\in V}|v|\right)=\mathcal{O}(N^{2}),\end{align*}

yields the desired bound. The space used is O(N)\mathcal{O}(N) as SA and C are implemented in O(N)\mathcal{O}(N) space.

Remark 3.2 (Sparse graphs). It is easy to see that the running time of Algorithm 3.1 can also be bounded by O(Nlog⁡N+∣E∣max⁡v∈V∣v∣2)\mathcal{O}(N \log N + |E| \max_{v \in V} |v|^2). Thus, we expect the algorithm to perform better on sparse graphs where the

Algorithm 3.1 Basic algorithm for CMM with fEf_E. Some operations require care to implement efficiently; see the proof of Theorem 3.1.

Input: Graph G=(V,E)G = (V, E) with V⊆Σ∗V \subseteq \Sigma^*, integer ℓ>0\ell > 0

Output: Motif pair {X∗,Y∗}\{X^*, Y^*\} from Σℓ\Sigma^\ell maximizing fEf_E

1: Let C:Σℓ→Z≥0C : \Sigma^\ell \to \mathbb{Z}_{\geq 0} be indexed using SA ranks

2: (X∗,Y∗)←(⊥,⊥)(X^*, Y^*) \leftarrow (\perp, \perp)

3: for each distinct length-ℓ\ell substring XX in VV

4: VX←{u∈V∣XV_X \leftarrow \{u \in V \mid X is a substring of u}u\}

5: for each {u,v}∈E\{u, v\} \in E with u∈VXu \in V_X

6: for each distinct length-ℓ\ell substring YY of vv

7: if X⪯YX \preceq Y

8: C[Y]←C[Y]+1C[Y] \leftarrow C[Y] + 1

9: for each {u,v}∈E\{u, v\} \in E with u,v∈VXu, v \in V_X

10: for each distinct length-ℓ\ell substring YY of uu

11: if X⪯YX \preceq Y and YY is not a substring of vv

12: C[Y]←C[Y]+1C[Y] \leftarrow C[Y] + 1

13: Update {X∗,Y∗}\{X^*, Y^*\} if max⁡(C)>fE(G,{X∗,Y∗})\max(C) > f_E(G, \{X^*, Y^*\})

14: Reset (the touched entries of) CC

15: return {X∗,Y∗}\{X^*, Y^*\}

labels are relatively short. The latter is natural because in many practical instances, the labels have roughly the same length (thus, relatively short compared to N).

Remark 3.3 (Enumeration). Instead of simply optimizing fEf_E in Algorithm 3.1, we can build a complete sorted list of all motif pairs and their support value (storing them using ranks). Since the values of the support measure are bounded by ∣E∣≤N2|E| \leq N^2, we can do this while maintaining the O(N2)\mathcal{O}(N^2) running time using an algorithm like radix sort. Unfortunately, this increases the space complexity to O(N2)\mathcal{O}(N^2) in the worst case. In practice, we are only interested in the top-k motif pairs. These we can maintain with an O(log⁡k)\mathcal{O}(\log k) multiplicative overhead by keeping a heap with the top-k pairs.

We defer the changes required for fχ2f_{\chi^2} and the SETH lower bounds for both fEf_E and fχ2f_{\chi^2} to Appendix A.

4 An exact algorithm for (ℓ,d)(\ell, d)-CMM. Algorithm 3.1 for CMM (Theorem 3.1) will serve as a basis for our exact algorithm for (ℓ,d)(\ell, d)-CMM.

The basic premise is simple: iterate over all possible combinations of wildcard positions in the two motifs and then run a modified version of Algorithm 3.1 that ignores the characters at these positions. While this seems easy, achieving it without losing efficiency is somewhat tricky, especially when targeting O(N)\mathcal{O}(N) space. Recall that in Algorithm 3.1, we heavily relied on the rank of every length- ℓ\ell substring in the suffix array (SA) of the concatenated node strings. In particular, we relied on the fact that this rank is a compact representation of the substrings. Thus, we were able to compare any two substrings for equality by simply comparing their ranks. With the dd wildcards, we need to treat substrings that are actually different as the same, that is, we have a relaxed notion of equality that ignores the wildcarded positions. Defining the right notion of rank and implementing access to it efficiently requires a substantial amount of care. We show the following core lemma.

LEMMA 4.1. Given a set V⊆Σ∗V \subseteq \Sigma^* of strings of total length NN over Σ={1,2,…,N}\Sigma = \{1, 2, \ldots, N\}, an integer ℓ∈[1,N]\ell \in [1, N], and a set H⊆[ℓ]H \subseteq [\ell] with d:=∣H∣<ℓd := |H| < \ell, we can construct an O(N)\mathcal{O}(N)-size data structure in O((d+1)N)\mathcal{O}((d+1)N) time and O(N)\mathcal{O}(N) working space answering the following queries in O(1)\mathcal{O}(1) time: given (u,i)(u, i), with u∈Vu \in V and i∈[1,∣u∣−ℓ+1]i \in [1, |u| - \ell + 1], return a rank (a unique identifier) of string MM of length ℓ\ell, such that, for all j∈[1,ℓ]j \in [1, \ell]:

M[j]:={⋄ifj∈H,u[i+j−1]ifj∉H.M[j]:=\begin{cases}{\diamond}&{{i f}j\in H,}\\ {u[i+j-1]}&{{i f}j\notin H.}\\ \end{cases}

In particular, the output rank is an integer from [0,N)[0, N).

Proof. Consider Algorithm 4.1. We show that this algorithm solves exactly the claimed task.

Let H={h1<⋯<hd}H = \{h_1 < \cdots < h_d\}. Further let SV=v1#1v2#2⋯v∣V∣#∣V∣S_V = v_1 \# 1 v_2 \# 2 \cdots v_{|V|} \# |V| be the concatenation of the input strings with appropriate separators and let NV:=∣SV∣−∣V∣N_V := |S_V| - |V|. (We will ignore suffixes of SVS_V starting with separators.) In O(NV)\mathcal{O}(N_V) time, we construct the suffix array SASV\mathsf{SA}_{S_V} [12] and the LCP array LCPSV\mathsf{LCP}_{S_V} [13].

Consider the list of the suffixes of SVS_V. The characters that occur at the positions h1,…,hdh_1, \ldots, h_d of every suffix are replaced by wildcards to obtain NVN_V suffixes each split into (d+1)(d+1) fragments. The above replacements are implicit; we never apply them. Moreover, we are interested only in the length- ℓ\ell prefix of each suffix. Some care is needed: if a suffix is shorter than ℓ\ell, we ignore it from any further computation; and if a suffix contains a separator #i\#_i in its length- ℓ\ell prefix, we also ignore it. Using SASV\mathsf{SA}_{S_V} and starting with the first NVN_V substrings (prefixes of suffixes) of length exactly (h1−1)(h_1-1), a new rank is assigned to each of them according to the lexicographical ordering of these substrings; this can be easily derived from a single scan of LCPSV\mathsf{LCP}_{S_V} in O(NV)\mathcal{O}(N_V) time. We then proceed to h2h_2 analogously, and so on. To maintain O(NV)\mathcal{O}(N_V) space, for every consecutively considered pair of wildcard positions, we use radix sort over the NVN_V pairs of ranks (corresponding to the NVN_V suffixes) to obtain a new integer ranking over [0,NV)[0, N_V), and the process continues. In the end, we have a new lexicographical ordering of the length- ℓ\ell prefixes of suffixes of SVS_V that disregards the characters at the h1h_1-th, ..., hdh_d-th positions. Moreover, for every two successive length- ℓ\ell prefixes in this order, we know whether they have an LCP of length at least ℓ\ell, which suffices for our purposes. The whole process thus takes O(NV⋅(d+1))\mathcal{O}(N_V \cdot (d+1)) time. Since this list is sorted, identical length- ℓ\ell prefixes (here identical means with dd wildcards) are grouped and so each group member gets the same rank from [0,NV)[0, N_V).

Two length- ℓ\ell substrings are identical under H if and only if their constituent fragments between the indices of H are identical. By treating each substring as a tuple of ranks corresponding to these fragments—specifically (r1,r2,…,rd+1)(r_1, r_2, \ldots, r_{d+1})—and applying radix sort, we obtain a lexicographical ordering (of the suffixes) based strictly on the subsequence of non-wildcard characters. This correctly groups all occurrences of a specific motif M into a contiguous range in the sorted list.

The ranks (unique identifiers) are stored in the array R returned by Algorithm 4.1, indexed by the starting position of each suffix in SVS_V. Given u∈Vu \in V and an offset i, the length- ℓ\ell prefix of the corresponding suffix is exactly the length- ℓ\ell substring u[i…i+ℓ−1]u[i \ldots i + \ell - 1]; hence, a single lookup in R returns its identifier in O(1)\mathcal{O}(1) time, which is invariant under replacing the positions in H by ⋄\diamond, as claimed. The d radix-sort rounds and the LCP array scans each cost O(NV)\mathcal{O}(N_V) time. In total, the algorithm costs O((d+1)N)\mathcal{O}((d+1)N) time and uses O(N)\mathcal{O}(N) working space.

Remark 4.2. The technique in Lemma 4.1 is inspired by the construction of the gapped suffix array [4]. A notable difference is the following: since ℓ\ell is fixed, we avoid the use of LCE queries (cf. [14]), and compute the relevant LCP values by comparing integers in O(1)\mathcal{O}(1) time (Lines 8–17). While this makes no difference in theory, it is crucial in practice, as LCE data structures are typically either costly to construct or costly to query.

THEOREM 4.3. There is an algorithm for (ℓ,d)(\ell,d)-CMM with fEf_{E} running in time

O((ℓd)2N2),\mathcal{O}\left(\binom{\ell}{d}^{2}N^{2}\right),

where N:=∑v∈V∣v∣N := \sum_{v \in V} |v|. The space used is O(N)\mathcal{O}(N).

Proof. We solve (ℓ,d)(\ell, d)-CMM by a slight adaptation of the algorithm from Section 3. Fix a pair (H,H′)(H, H') of wildcard combinations, one for XX and one for YY. In a pre-processing step, we sort the characters occurring in all strings v∈Vv \in V, thus mapping them onto the range {1,2,…,N}\{1, 2, \ldots, N\}. This is done once in O(Nlog⁡N)\mathcal{O}(N \log N) time. We now apply Lemma 4.1 that takes O((d+1)N)\mathcal{O}((d+1)N) time using O(N)\mathcal{O}(N) space, and obtain, for every length-ℓ\ell substring XX (resp. YY) of a node, an identifier rank(X)(X) (resp. rank(Y)(Y)) under HH (resp. under H′H') such that: any two length-ℓ\ell substrings receive the same identifier if and only if they agree on all non-wildcard positions.

Algorithm 4.1 Rank assignment to (ℓ,d)(\ell, d)-motifs. See the proof of Lemma 4.1.

Input: Wildcard positions H={h1<⋯<hd}⊆[ℓ]H = \{h_1 < \cdots < h_d\} \subseteq [\ell]; string SV=v1#1v2#2…v∣V∣#∣V∣S_V = v_1 \#_1 v_2 \#_2 \ldots v_{|V|} \#_{|V|}; suffix array SASVSA_{S_V}; LCP array LCPSV\mathsf{LCP}_{S_V}

Output: Array R such that R[i]\mathsf{R}[i] is the rank of suffix SV[i…∣SV∣]S_V[i \ldots |S_V|] by its length-ℓ\ell prefix, in lexicographic order ignoring the positions in HH

1: Let S\mathcal{S} be the positions ii such that SV[i…i+ℓ−1]S_V[i \ldots i + \ell - 1] is defined and contains no separator

2: R[i]←0\mathsf{R}[i] \leftarrow 0 for each i∈Si \in \mathcal{S}

3: Add h0:=0h_0 := 0 and hd+1:=ℓ+1h_{d+1} := \ell + 1 to H▹H \triangleright Handle intervals before first and after last wildcard

4: for t←0t \leftarrow 0 to dd

5: It=(ht,ht+1)I_t = (h_t, h_{t+1}) ▹\triangleright Non-⋄\diamond interval

6: if ItI_t is empty then continue

7: ▶ Step 1: Compute ranks for ItI_t

8: rank ←0\leftarrow 0; R′[SASV[1]]←0\mathsf{R}'[\mathsf{SA}_{S_V}[1]] \leftarrow 0

9: for j←2j \leftarrow 2 to ∣SV∣|S_V|

10: if LCPSV[j]<∣It∣\mathsf{LCP}_{S_V}[j] < |I_t| then rank ←\leftarrow rank + 1

11: R′[SASV[j]]←\mathsf{R}'[\mathsf{SA}_{S_V}[j]] \leftarrow rank

12: ▶ Step 2: Refine by (current rank, rank for ItI_t)

13: Stably sort S\mathcal{S} by key(j)=(R[S[j]],R′[S[j]+ht])(j) = (\mathsf{R}[\mathcal{S}[j]], \mathsf{R}'[\mathcal{S}[j] + h_t])

14: rank ←0\leftarrow 0; R^[S[1]]←0\widehat{\mathsf{R}}[\mathcal{S}[1]] \leftarrow 0

15: for j←2j \leftarrow 2 to ∣S∣|\mathcal{S}|

16: if key(j)≠key(j−1)(j) \neq \text{key}(j - 1) then rank ←\leftarrow rank + 1

17: R^[S[j]]←\widehat{\mathsf{R}}[\mathcal{S}[j]] \leftarrow rank

18: R←R^\mathsf{R} \leftarrow \widehat{\mathsf{R}}

19: return R\mathsf{R}

Namely, we view rank(X)\text{rank}(X) as the equivalent of the rank from Algorithm 3.1.

These identifiers satisfy the two properties that the proof of Theorem 3.1 requires of the rank: they let us (1) test equality of two (wildcarded) length- ℓ\ell substrings in O(1)\mathcal{O}(1) time and (2) index the dictionary CC in O(N)\mathcal{O}(N) space. Hence, we run Algorithm 3.1 verbatim on the fixed pair (H,H′)(H, H'), substituting the wildcard-aware ranks for the plain ranks. By Theorem 3.1, this computes the maximum fEf_E over all motif pairs whose wildcards sit at positions (H,H′)(H, H') in O(N2)\mathcal{O}(N^2) time and O(N)\mathcal{O}(N) space.

Since the problem requires maximizing an objective function over unknown (non-fixed) wildcard positions, the algorithm iterates through all possible pairs of d-size subsets H⊂[ℓ]H \subset [\ell]. This exhaustive search guarantees completeness: if an optimal motif pair {X,Y}\{X, Y\} exists with a specific wildcard configuration, the algorithm will inevitably process it during the iteration. Running the above for each of the (ℓd)\binom{\ell}{d} choices of HH and (ℓd)\binom{\ell}{d} choices of H′H' and taking the overall maximum therefore solves

(ℓ,d)(\ell, d)-CMM in O((ℓd)2N2)\mathcal{O}\left(\binom{\ell}{d}^2 N^2\right) time using O(N)\mathcal{O}(N) space.

This algorithm can be extended to the fχ2f_{\chi^2} support measure by adapting the fχ2f_{\chi^2} version of Algorithm 3.1 (see Corollary A.1). We defer the W[1]-hardness for (ℓ,d)(\ell, d)-CMM, parameterized by dd, to Appendix B.

4.1 Parallelization. The algorithm of Theorem 4.3 is easy to parallelize since the computation can be carried out independently for each wildcard combination. As motif pairs are unordered, roughly half of the (ℓd)2\binom{\ell}{d}^2 combinations need to be considered, giving (ℓd)((ℓd)+1)/2\binom{\ell}{d}\left(\binom{\ell}{d} + 1\right)/2 independent jobs, each running in O(N2)\mathcal{O}(N^2) time. For H≠H′H \neq H', the motifs XX and YY are always distinct, so the tie-breaking test X⪯YX \preceq Y of Algorithm 3.1 is applied only in the jobs with H=H′H = H'. Since each thread processes a disjoint subset of the motif pairs, the global optimum is the maximum of the per-job optima, so aggregation is trivial. We will later see that this is both easy to implement and efficient in practice. Moreover, by using Theorem 4.3, O(N)\mathcal{O}(N) space is used per thread.

5 Experimental results. In this section, we compare our exact algorithm against SEQ-SLIDER and M-SLIDER, two variants of SLIDER [1], the state-of-the-art (heuristic) method. Each employs a different neighborhood function when sliding over neighboring motifs during steepest ascent. We also empirically evaluate the time and space complexities of our exact algorithm to confirm our theoretical findings. These goals were split into the following research questions:

RQ1: How do the scores of SLIDER's solution set compare to the ones of the optimal solution set?

RQ2: What is the recall of SLIDER's solution set relative to the optimal solution set?

RQ3: How does our algorithm scale as ∣V∣|V| (and thus NN) grows?

RQ4: How does our algorithm scale as ∣E∣|E| grows?

RQ5: How does our algorithm scale as the number tt of threads used increases?

Remark 5.1. We excluded D-MOTIF [25] and FindMotif [15], as their complexities are prohibitive for our datasets and parameters, and for the same scalability reasons, we excluded their heuristic counterparts, D-STAR and MotifHeuristics. FindMotif and MotifHeuristics also lack publicly available implementations and rely on a different, probabilistic support measure. MotifHeuristics was re-implemented and evaluated in [1], where it was shown to be outperformed by SLIDER.

5.1 Datasets. We selected 5 networks of different species and with varying sizes among the 10 most queried networks from the STRING database [24, 26] (version 12). In order to replicate the setup of [1] for RQ1 and RQ2 (which concern the accuracy of SLIDER), we also included the two networks used in [1]. The characteristics of the networks are summarized in Table 5.1. These networks were preprocessed as described in Subsection C.1. All networks in Table 5.1 were used to address RQ1 and RQ2. For RQ3, RQ4, and RQ5, we also generated smaller artificial networks as described in Subsection C.1 to thoroughly investigate different input parameters.

Table 5.1: Top: Parameters of datasets from the STRING database after preprocessing. Bottom: Parameters of datasets from [1] after preprocessing.

Dataset|V||E|N
E. coli400632,2441,277,734
S. cerevisiae I5791104,1882,744,228
D. melanogaster10,522118,6986,043,033
A. thaliana20,239331,5258,903,236
H. sapiens I16,201236,9309,605,435
S. cerevisiae II16209060862,281
H. sapiens II10,38069,5155,607,838

5.2 Implementations. We implemented our exact algorithm (Theorem 4.3) in C++, which we make available at https://github.com/lucper/cmm. We used libsais64 (version 2.4.10) to construct the SA and the LCP array [6] and implemented the parallel version of Theorem 4.3 (as described in Subsection 4.1) using OpenMP [5]. For SLIDER, we used the Java implementation provided by the authors [1], which is also available in our repository. Since we do not compare the efficiency of the two implementations, using the latter suffices for our purposes.

5.3 Setup. All experiments were conducted on two 32-core Intel Xeon Gold 6530 CPUs (2 threads per core, totaling P=128P = 128 threads across the two CPUs), operating at a base clock frequency of 2.1 GHz (up to 4.0 GHz), and 512 GB RAM. We compiled our implementations with g++ version 15.2.1 at the -03 optimization level. Wall-clock times were measured with std::chrono::steady_clock. Peak RAM usage was measured as the maximum resident set size using the getrusage function.

5.4 Metrics for RQ1 and RQ2.

Similarity index. In order to compare solution sets, we introduce a notion of similarity between (ℓ,d)(\ell, d)-motif pairs. We count the edges in which two (ℓ,d)(\ell, d)-motif pairs, {X,Y}\{X, Y\} and {Z,W}\{Z, W\}, co-occur such that the (ℓ,d)(\ell, d)-motifs in each endpoint of the edge match substrings that are at most hh letters apart, where hh is a non-negative integer. (Note that for h=0h=0, we count the edges in which there exists a substring in each endpoint that both (ℓ,d)(\ell,d)-motifs for that endpoint match.)

Let occX(u)\text{occ}_X(u) denote the set of occurrences of an (ℓ,d)(\ell, d)-motif XX in string uu, namely occX(u)={i∣X matches u[i…i+ℓ−1]}\text{occ}_X(u) = \{i \mid X \text{ matches } u[i \ldots i + \ell - 1]\}. Let Eh′(X,Y),(W,Z)⊆EE_h'(X, Y), (W, Z) \subseteq E be the set of edges {u,v}\{u, v\} such that there exists:

(1) i∈occX(u)i \in \text{occ}_X(u) and j∈occW(u)j \in \text{occ}_W(u) with ∣i−j∣≤h|i - j| \leq h; and

(2) i∈occY(v)i \in \text{occ}_Y(v) and j∈occZ(v)j \in \text{occ}_Z(v) with ∣i−j∣≤h|i - j| \leq h.

Further let Eh({X,Y},{W,Z})=Eh′(X,Y),(W,Z)∪Eh′(X,Y),(Z,W)E_h(\{X, Y\}, \{W, Z\}) = E_h'(X, Y), (W, Z) \cup E_h'(X, Y), (Z, W). Then, we define the similarity index between (ℓ,d)(\ell, d)-motif pairs {X,Y}\{X, Y\} and {Z,W}\{Z, W\} as

sh({X,Y},{Z,W}):=∣Eh({X,Y},{Z,W})∣∣EX,Y∪EZ,W∣.s_{h}(\{X,Y\},\{Z,W\}):=\frac{|E_{h}(\{X,Y\},\{Z,W\})|}{|E_{X,Y}\cup E_{Z,W}|}.

In particular, we note that s0s_{0} corresponds to the similarity index used by [1] in their experimental evaluation of SLIDER. In our evaluation, we used the more lenient version sℓs_{\ell} for a motif length ℓ\ell; that is, we afforded SLIDER's solution set more slack when it was compared to our exact algorithm's solution set.

Reduced solution set. Let S={M1,M2,…,Mk}S = \{M_1, M_2, \ldots, M_k\} be a solution set ranked from the highest-scoring motif pair M1M_1 to the lowest-scoring one, MkM_k. We construct a reduced solution set S∗⊆SS^* \subseteq S with the following property: for any distinct motif pairs M′M' and M′′M'' in S∗S^*, we require that s0(M′,M′′)<1s_0(M', M'') < 1. Note that our similarity relation shs_h is not transitive, so there may exist multiple subsets of SS with this property. Following the approach of [1], our set S∗S^* is constructed with the following greedy strategy: for each i=1,…,ki = 1, \ldots, k, we remove every Mj∈SM_j \in S with j>ij > i satisfying s0(Mi,Mj)=1s_0(M_i, M_j) = 1.

Coverage of one solution set by another. Given two reduced solution sets SAS_A and SBS_B, we define the coverage of SBS_B by SAS_A, parameterized by hh and τ\tau, as

Covh,τ,A(SB):=∣{M∈SB∣∃M′∈SA,sh(M,M′)≥τ}∣∣SB∣.\mathrm{Cov}_{h,\tau,A}(S_{B}):=\frac{\left|\left\{M\in S_{B}\mid\exists M^{\prime}\in S_{A},s_{h}(M,M^{\prime})\geq\tau\right\}\right|}{\left|S_{B}\right|}.

This resembles the notion of recall: we are effectively measuring the fraction of motif pairs from SBS_B retrieved by AA (under similarity shs_h at a threshold τ\tau).

Setup. In order to compare M-SLIDER and SEQ-SLIDER's solution quality with that of our exact algorithm, we used complementary metrics: first, we compared the fχ2f_{\chi^2} score distribution of M-SLIDER and SEQ-SLIDER's reduced solution sets with our exact algorithm's (RQ1); second, we used the similarity index introduced above to measure how similar the reduced solution sets are (RQ2).

We ran M-SLIDER and SEQ-SLIDER over 10 trials, each with a maximum convergence time of 10 minutes (totaling 100 minutes of running time for each dataset), and requested at most 10,000 highest scoring ( ℓ\ell, d)-motif pairs per trial. Then, we concatenated them, removed identical ( ℓ\ell, d)-motif pairs (i.e., the same pair rediscovered across independent trials), sorted by the fχ2f_{\chi^2} score descending, retained at most 10,000 top-scoring distinct ( ℓ\ell, d)-motif pairs, and applied the “deduplication” procedure described above. The resulting reduced solution sets of M-SLIDER and SEQ-SLIDER are denoted by SM−SLIDERS_{M-SLIDER} and SSEQ−SLIDERS_{SEQ-SLIDER}, respectively. We ran our exact algorithm once, retrieved the top 10,000 highest scoring ( ℓ\ell, d)-motif pairs, and applied the “de-duplication” procedure; the resulting reduced solution set is denoted by SExactS_{Exact}. For RQ1 and RQ2, we ran this setup for parameter pairs ( ℓ=8\ell = 8, d=5d = 5) and ( ℓ=8\ell = 8, d=3d = 3), following the setup of [1].

5.5 Results for RQ1. We compared the fχ2f_{\chi^2} scores of SM−SLIDERS_{M-SLIDER} and SSEQ−SLIDERS_{SEQ-SLIDER} with SExactS_{Exact} as follows. Since any solution set is ranked from highest to lowest fχ2f_{\chi^2} score and the highest scoring (ℓ,d)(\ell, d)-motif pair M∗M^* of SExactS_{Exact} has the best possible fχ2f_{\chi^2} score, we normalized the fχ2f_{\chi^2} score of each (ℓ,d)(\ell, d)-motif pair from all (reduced) solution sets by dividing each by fχ2(M∗)f_{\chi^2}(M^*). Since we are comparing the top-scoring (ℓ,d)(\ell, d)-motif pairs across SM−SLIDERS_{M-SLIDER}, SSEQ−SLIDERS_{SEQ-SLIDER}, and SExactS_{Exact}, the resulting solution sets SM−SLIDER′S'_{M-SLIDER}, SSEQ−SLIDER′S'_{SEQ-SLIDER}, and SExact′S'_{Exact} after normalization were truncated to have size min⁡{∣SM−SLIDER∣,∣SSEQ−SLIDER∣,∣SExact∣}\min\{|S_{M-SLIDER}|, |S_{SEQ-SLIDER}|, |S_{Exact}|\}. Figure 5.1 shows the resulting (normalized) fχ2f_{\chi^2} score distributions of SM−SLIDER′S'_{M-SLIDER} and SSEQ−SLIDER′S'_{SEQ-SLIDER} compared to SExact′S'_{Exact} for the parameter pair (ℓ=8,d=5)(\ell = 8, d = 5); for the parameter pair (ℓ=8,d=3)(\ell = 8, d = 3), see Figure 5.2. Firstly, we note that SEQ-SLIDER consistently outperforms M-SLIDER in all datasets, which confirms the evaluation in [1]. Secondly, the fχ2f_{\chi^2} score of SSEQ−SLIDER′S'_{SEQ-SLIDER} is comparable to SExact′S'_{Exact} only for the E. coli, S. cerevisiae (I and II), and D. melanogaster datasets across parameter pairs (ℓ=8,d=3)(\ell = 8, d = 3) and (ℓ=8,d=5)(\ell = 8, d = 5). For the (larger) remaining datasets, A. thaliana and H. sapiens (I and II), the fχ2f_{\chi^2} score of SSEQ−SLIDER′S'_{SEQ-SLIDER} is far from SExact′S'_{Exact}. For instance, for the parameter pair (ℓ=8,d=5)(\ell = 8, d = 5), SSEQ−SLIDERS_{SEQ-SLIDER} has average fχ2f_{\chi^2} score 14,963, 7313, and 1094 for the A. thaliana, H. sapiens I, and H. sapiens II datasets, respectively, whereas SExactS_{Exact} has average fχ2f_{\chi^2} score 26,777, 10,439, and 1514, respectively. We note that these gaps are larger for the parameter pair (ℓ=8,d=3)(\ell = 8, d = 3) (see Figure 5.2).

These results establish that our exact algorithm mines motif pairs whose fχ2f_{\chi^2} scores are at least as high as SEQ-SLIDER's on all datasets and substantially higher on larger ones. Two possible explanations are: (1) our algorithm captures the same interactions with more precise motif pairs, raising the score; or (2)

M-SLIDER --

SEQ-SLIDER --

Exact —

Figure

(a) E. coli

M-SLIDER --

SEQ-SLIDER --

Exact —

Figure

(b) S. cerevisiae I

Figure

(a) E. coli

Figure

(b) S. cerevisiae I

Figure

(c) D. melanogaster

Figure

(d) A. thaliana

Figure

(c) D. melanogaster

Figure

(d) A. thaliana

Figure

(e) H. sapiens I

Figure

(f) S. cerevisiae II

Figure

(e) H. sapiens I

Figure

(f) S. cerevisiae II

Figure

(g) H. sapiens II

Figure 5.1: Distribution of (normalized) fχ2f_{\chi^2} scores of SM−SLIDER′S'_{M-SLIDER} and SSEQ−SLIDER′S'_{SEQ-SLIDER} compared to SExact′S'_{Exact} across datasets of Table 5.1 for parameter pair (ℓ=8,d=5)(\ell=8, d=5).

Figure

(g) H. sapiens II

Figure 5.2: Distribution of (normalized) fχ2f_{\chi^2} scores of SM−SLIDER′S'_{M-SLIDER} and SSEQ−SLIDER′S'_{SEQ-SLIDER} compared to SExact′S'_{Exact} across datasets of Table 5.1 for parameter pair (ℓ=8,d=3)(\ell=8, d=3).

our algorithm finds interactions that SLIDER misses altogether. Subsection 5.6 is designed to show that case (2) is a significant contributor to the observed difference in scores.

5.6 Results for RQ2. We measured the fraction (coverage) of (ℓ,d)(\ell, d)-motif pairs in SExactS_{Exact} that have similarity sℓ≥70%s_{\ell} \geq 70\% to at least one (ℓ,d)(\ell, d)-motif pair in SM−SLIDERS_{M-SLIDER} and SSEQ−SLIDERS_{SEQ-SLIDER}. Here, we summarize the results for SEQ-SLIDER only since it outperformed M-SLIDER in all but one instance (H. sapiens I with (ℓ=8,d=3)(\ell = 8, d = 3)); refer to Table C.2 in the appendix. The coverage of SExactS_{Exact} by SSEQ−SLIDERS_{SEQ-SLIDER} ranges from 8% to 52% across both parameter pairs for the A. thaliana and H. sapiens (I and II) datasets, meaning that SEQ-SLIDER misses at least roughly half of the top-scoring motif pairs, and up to 92% of them (M-SLIDER fares similarly). For the remaining datasets — E. coli, S.

M-SLIDER — SEQ-SLIDER —

M-SLIDER — SEQ-SLIDER —

Figure

(a) E. coli

Figure

(b) S. cerevisiae I

Figure

(a) E. coli

Figure

(b) A. thaliana

Figure

(c) D. melanogaster

Figure

(d) A. thaliana

Figure

(c) H. sapiens I

Figure

(d) S. cerevisiae II

Figure

(e) H. sapiens I

Figure

(f) S. cerevisiae II

Figure

(g) H. sapiens II

Figure 5.3: For every M∈SExactM \in S_{Exact}, we show the highest sℓ(M,M′)s_\ell(M, M') such that M′∈SM−SLIDERM' \in S_{M-SLIDER} (resp. M′∈SSEQ−SLIDERM' \in S_{SEQ-SLIDER}) for parameter pair (ℓ=8,d=5)(\ell = 8, d = 5).

cerevisiae (I and II) and D. melanogaster — the coverage of SExactS_{Exact} by SSEQ−SLIDERS_{SEQ-SLIDER} ranges from 45% to 100%. In particular, it was 100% only for S. cerevisiae I and D. melanogaster with parameter pair (ℓ=8,d=3)(\ell = 8, d = 3). Note that we used the more lenient version sℓs_\ell of the similarity index to derive these results.

Moreover, for each (ℓ,d)(\ell, d)-motif pair M∈SExactM \in S_{\text{Exact}}, we also computed the highest similarity sℓ(M,M′)s_\ell(M, M'), where M′∈SM-SLIDERM' \in S_{\text{M-SLIDER}} (resp. M′∈SSEQ-SLIDERM' \in S_{\text{SEQ-SLIDER}}). Figure 5.3

Figure

(e) H. sapiens II

Figure 5.4: For every M∈SExactM \in S_{Exact}, we show the highest sℓ(M,M′)s_\ell(M, M') such that M′∈SM−SLIDERM' \in S_{M-SLIDER} (resp. M′∈SSEQ−SLIDERM' \in S_{SEQ-SLIDER}) for parameter pair (ℓ=8,d=3)(\ell = 8, d = 3). We omitted the results for S. cerevisiae I and D. melanogaster because SExactS_{Exact} was fully covered by SSEQ−SLIDERS_{SEQ-SLIDER}.

shows the distribution of (ℓ,d)(\ell, d)-motif pairs from SExactS_{\text{Exact}} for the parameter pair (ℓ=8,d=5)(\ell = 8, d = 5) as a density plot. We observe that SExactS_{\text{Exact}} has a substantial amount of (ℓ,d)(\ell, d)-motif pairs with similarity sℓs_\ell below 50% to their closest counterparts in SM-SLIDERS_{\text{M-SLIDER}} and SSEQ-SLIDERS_{\text{SEQ-SLIDER}} for the D. melanogaster, A. thaliana, and H. sapiens (I and II) datasets. On the other hand, for the E. coli and S. cerevisiae (I and II) datasets, most (ℓ,d)(\ell, d)-motif pairs in SExactS_{\text{Exact}} have similarity above 70% to their closest counterparts in SM-SLIDERS_{\text{M-SLIDER}} and SSEQ-SLIDERS_{\text{SEQ-SLIDER}}.

We arrive at the same conclusion for the parameter pair (ℓ=8,d=3)(\ell = 8, d = 3), although SEQ-SLIDER had a better overall performance compared to (ℓ=8,d=5)(\ell = 8, d = 5); see Figure 5.4. In particular, we note that every motif pair in SExactS_{Exact} has similarity sℓ≥70%s_\ell \geq 70\% with some motif pair in SM−SLIDERS_{M-SLIDER} or SSEQ−SLIDERS_{SEQ-SLIDER} on the S. cerevisiae I and

Figure

(t=8,d=4)(t=8, d=4) (t=8,d=5)(t=8, d=5) (t=8,d=6)(t=8, d=6) (t=8,d=7)(t=8, d=7)

(t=5,d=2)(t=5, d=2) (t=5,d=3)(t=5, d=3) (t=5,d=4)(t=5, d=4)

Figure

Figure 5.5: Wall-clock time and peak RAM usage per thread of exact algorithm for ℓ=8\ell = 8, d∈[0,7]d \in [0, 7], ed(G)=5%\text{ed}(G) = 5\%, and varying ∣V∣|V| (and NN). We use log-log axes with the dashed lines indicating a polynomial of degree 2 (resp. degree 1) fitting the data for time (resp. peak RAM). Top: d∈[0,3]d \in [0, 3] with dashed line on d=2d = 2. Bottom: d∈[4,7]d \in [4, 7] with dashed line on d=5d = 5, and lines for d=4d = 4 and d=7d = 7 labeled with MVM_V.

Figure 5.6: Wall-clock time and peak RAM usage per thread of exact algorithm for ℓ=5\ell = 5, d∈[0,4]d \in [0, 4], ed(G)=5%\text{ed}(G) = 5\%, and varying ∣V∣|V| (and NN). We use log-log axes with the dashed lines indicating a polynomial of degree 2 (resp. degree 1) fitting the data for time (resp. peak RAM). Top: d∈[0,1]d \in [0, 1] with dashed line on d=1d = 1. Bottom: d∈[2,4]d \in [2, 4] with dashed line on d=3d = 3, and lines for d=2d = 2 and d=4d = 4 labeled with MVM_V.

D. melanogaster datasets.

Together, these results establish that our exact algorithm mines a substantial amount of (ℓ,d)(\ell, d)-motif pairs that are missed by SEQ-SLIDER and M-SLIDER for the largest datasets from the STRING database (A. thaliana and H. sapiens I) and from [1] (H. sapiens II).

5.7 Results for RQ3. We fixed the edge density ed(G)\text{ed}(G) for all instances to 5%, and varied ∣V∣|V| and NN. We used t:=min⁡{(ℓd)((ℓd)+1)/2,P}t := \min\{\binom{\ell}{d}\left(\binom{\ell}{d} + 1\right)/2, P\} threads, where by P=128P = 128 we denote the number of threads available in our system. For ℓ=8\ell = 8, we varied dd from 0 to 7; the results are shown in Figure 5.5. We also performed this experiment for ℓ=5\ell = 5 with dd varying from 0 to 4. The results are shown in Figure 5.6; they yield the same conclusion, but with smaller running times and peak RAM usage. We observe a quadratic behavior in NN for the running times shown in Figure 5.5 (turned into straight lines with log-log axes for readability), for fixed values of ℓ\ell and dd. The running times further highlight their dependence on the maximum number MVM_V of distinct (ℓ,d)(\ell, d)-motifs in VV across all (ℓd)\binom{\ell}{d} combinations of wildcard positions. For fixed ℓ\ell and NN, observe that MVM_V decreases as dd grows, since more wildcard positions yield fewer distinct (ℓ,d)(\ell, d)-motifs in VV. Indeed, in practice, MVM_V is significantly smaller than NN for larger dd. (We label exemplary lines in Figure 5.5 with MVM_V.) This reflects in faster running times for a fixed wildcard combination. However, when considering all wildcard combinations, the running times are non-decreasing for d∈[0,⌊ℓ/2⌋)d \in [0, \lfloor \ell/2 \rfloor) and non-increasing for d∈[⌊ℓ/2⌋,ℓ)d \in [\lfloor \ell/2 \rfloor, \ell) because the term (ℓd)\binom{\ell}{d} behaves the same way on these intervals. The peak RAM usage shown in Figure 5.5 also confirms the linear behavior in NN per thread.

We also report the running time and peak RAM usage per thread of our exact algorithm on the datasets of Table 5.1; see Table C.3 in the appendix. We remark that for the dataset with the largest N, H. sapiens I, the exact algorithm took roughly 50h with peak RAM 1.29GB per thread for parameter pair (ℓ=8,d=3)(\ell = 8, d = 3) and only 2h with peak RAM 1.28GB per thread for parameter pair (ℓ=8,d=5)(\ell = 8, d = 5). We used t:=P=128t := P = 128 threads for both.

5.8 Results for RQ4. We fixed ∣V∣=200|V| = 200 and varied the edge density ed(G)\text{ed}(G). The rest of the setup is analogous to RQ3: for ℓ=8\ell = 8, we varied dd from 0 to 7 (Figure 5.7); for ℓ=5\ell = 5, we varied dd from 0 to 4 (Figure 5.8); and we used t:=min⁡{(ℓd)((ℓd)+1)/2,P}t := \min\{\binom{\ell}{d}\left(\binom{\ell}{d} + 1\right)/2, P\} threads. Here, our theoretical prediction for the time bound is O((ℓd)2∣E∣max⁡v∈V∣v∣2)\mathcal{O}\left(\binom{\ell}{d}^2 |E| \max_{v \in V} |v|^2\right), which is confirmed by the running times shown in Figure 5.7. Indeed, by

Figure

(t=8,d=4)(t=8, d=4) (t=8,d=5)(t=8, d=5)

(t=8,d=6)(t=8, d=6) (t=8,d=7)(t=8, d=7)

Figure

Figure 5.7: Wall-clock time and peak RAM usage per thread of exact algorithm for ∣V∣=200|V| = 200, ℓ=8\ell = 8, d∈[0,7]d \in [0, 7], and varying ed(G). Top: d∈[0,3]d \in [0, 3]. Bottom: d∈[4,7]d \in [4, 7] and lines for d=4d = 4 and d=7d = 7 labeled with MVM_V.

varying ed(G) and fixing the remaining parameters, the running time grows linearly with input size as ed(G) grows. Moreover, the peak RAM usage for each thread remains constant in this regime, which is particularly appealing for sparse graphs.

Figure

(t=5,d=0)(t=5, d=0)

(t=5,d=1)(t=5, d=1)

(t=5,d=2)(t=5, d=2)

(t=5,d=3)(t=5, d=3)

(t=5,d=4)(t=5, d=4)

Figure

Figure 5.8: Wall-clock time and peak RAM usage per thread of exact algorithm for ∣V∣=200|V| = 200, ℓ=5\ell = 5, d∈[0,4]d \in [0, 4], and varying ed(G). Top: d∈[0,1]d \in [0, 1] and line for (ℓ=5,d=1)(\ell = 5, d = 1) labeled with MVM_V. Bottom: d∈[2,4]d \in [2, 4], and lines for d=2d = 2 and d=4d = 4 labeled with MVM_V.

Figure

Figure 5.9: Wall-clock time and total peak RAM usage of exact algorithm for ∣V∣=200|V| = 200, ed(G)=5%\text{ed}(G) = 5\%, ℓ=8\ell = 8, and d=2d = 2 with varying number tt of threads. We use log-log axes and label the line with the speed-up obtained with the number of threads specified on the xx-axis.

5.9 Results for RQ5. We fixed ∣V∣=200|V| = 200, ed(G)=5%\text{ed}(G) = 5\%, ℓ=8\ell = 8, d=2d = 2, and varied the number tt of threads from 1 to P=128P = 128, the number available in our system, in order to assess the effectiveness of our parallelization. Figure 5.9 shows near-linear speed-up up to 32 threads ( 28.3×28.3\times), after which returns diminish: the speed-up peaks at 36.7×36.7\times with 64 threads and does not improve further. We conjecture that these diminishing returns are due to load imbalance: some wildcard combinations are more costly than others, and at 128 threads, an expensive combination dominates the wall-clock time. Moreover, since the algorithm parallelizes over (ℓd)((ℓd)+1)/2\binom{\ell}{d}\left(\binom{\ell}{d} + 1\right)/2 wildcard combinations, at most that many threads can be productively used; since we test at most 128, this limit is never reached. Finally, the space complexity becomes O(tN)\mathcal{O}(tN) because each thread requires O(N)\mathcal{O}(N) working space, and we have tt parallel threads.

Reproducibility and source code. The source code and datasets utilized in this study are currently available via https://github.com/lucper/cmm. All experimental results presented in this paper are fully reproducible using these provided resources.

AI use disclosure. All theoretical concepts and core proofs originated entirely from the authors' own work. The authors employed AI tools to polish language and style, support verification of proofs, produce LaTeX code for Figure 1.1, Figure A.1, and Figure A.2, and produce code for plotting data. Every AI-generated output was carefully reviewed, verified, and revised by the authors, who assume full responsibility for the paper's content.

Acknowledgments. Lucas P. Oliveira is funded by grant #2025/08034-9, São Paulo Research Foundation (FAPESP).

References (19)