# Network motif

Part of a series on :
Network science :
Theory :
Graph
Complex network
Contagion
Small-world
Scale-free
Community structure
Percolation
Evolution
Controllability
Graph drawing
Social capital
Link analysis
Optimization
Reciprocity
Closure
Homophily
Transitivity
Preferential attachment
Balance theory
Network effect
Social influence :
Network types :
Informational (computing)
Telecommunication
Transport
Social
Scientific collaboration
Biological
Artificial neural
Interdependent
Semantic
Spatial
Dependency
Flow
on-Chip :
Graphs :
MetricsAlgorithms :
Centrality
Degree
Motif
Clustering
Degree distribution
Assortativity
Distance
Modularity
Efficiency :
Models :
ListsCategories :
Topics
Software
Network scientists
Category:Network theory
Category:Graph theory :
vte :
Network motifs are recurrent and statistically significant subgraphs or patterns of a larger graph. All networks, including biological networks, social networks, technological networks (e.g., computer networks and electrical circuits) and more, can be represented as graphs, which include a wide variety of subgraphs.
Network motifs are sub-graphs that repeat themselves in a specific network or even among various networks. Each of these sub-graphs, defined by a particular pattern of interactions between vertices, may reflect a framework in which particular functions are achieved efficiently. Indeed, motifs are of notable importance largely because they may reflect functional properties. They have recently gathered much attention as a useful concept to uncover structural design principles of complex networks. Although network motifs may provide a deep insight into the network's functional abilities, their detection is computationally challenging.

## Definitions

Let G = (V, E) and G′ = (V′, E′) be two graphs. Graph G′ is a sub-graph of graph G (written as G′ ⊆ G) if V′ ⊆ V and E′ ⊆ E ∩ (V′ × V′). If G′ ⊆ G and G′ contains all of the edges ⟨u, v⟩ ∈ E with u, v ∈ V′, then G′ is an induced sub-graph of G. We call G′ and G isomorphic (written as G′ ↔ G), if there exists a bijection (one-to-one correspondence) f:V′ → V with ⟨u, v⟩ ∈ E′ ⇔ ⟨f(u), f(v)⟩ ∈ E for all u, v ∈ V′. The mapping f is called an isomorphism between G and G′.
When G″ ⊂ G and there exists an isomorphism between the sub-graph G″ and a graph G′, this mapping represents an appearance of G′ in G. The number of appearances of graph G′ in G is called the frequency F$_G$ of G′ in G. A graph is called recurrent (or frequent) in G when its frequency F$_G$(G′) is above a predefined threshold or cut-off value. We use terms pattern and frequent sub-graph in this review interchangeably. There is an ensemble Ω(G) of random graphs corresponding to the null-model associated to G. We should choose N random graphs uniformly from Ω(G) and calculate the frequency for a particular frequent sub-graph G′ in G. If the frequency of G′ in G is higher than its arithmetic mean frequency in N random graphs R$_i$, where 1 ≤ i ≤ N, we call this recurrent pattern significant and hence treat G′ as a network motif for G. For a small graph G′, the network G, and a set of randomized networks R(G) ⊆ Ω(R), where R(G) = N, the Z-score of the frequency of G′ is given by
$Z(G^{\prime })={\frac {F_{G}(G^{\prime })-\mu _{R}(G^{\prime })}{\sigma _{R}(G^{\prime })}}$
where μ$_R$(G′) and σ$_R$(G′) stand for the mean and standard deviation of the frequency in set R(G), respectively. The larger the Z(G′), the more significant is the sub-graph G′ as a motif. Alternatively, another measurement in statistical hypothesis testing that can be considered in motif detection is the p-value, given as the probability of F$_R$(G′) ≥ F$_G$(G′) (as its null-hypothesis), where F$_R$(G′) indicates the frequency of G' in a randomized network. A sub-graph with p-value less than a threshold (commonly 0.01 or 0.05) will be treated as a significant pattern. The p-value for the frequency of G′ is defined as
$P(G^{\prime })={\frac {1}{N}}\sum _{i=1}^{N}\delta (c(i))\quad c(i):F_{R}^{i}(G^{\prime })\geq F_{G}(G^{\prime })$
where N indicates the number of randomized networks, i is defined over an ensemble of randomized networks, and the Kronecker delta function δ(c(i)) is one if the condition c(i) holds. The concentration of a particular n-size sub-graph G′ in network G refers to the ratio of the sub-graph appearance in the network to the total n-size non-isomorphic sub-graphs' frequencies, which is formulated by
$C_{G}(G^{\prime })={\frac {F_{G}(G^{\prime })}{\sum _{i}F_{G}(G_{i})}}$
where index i is defined over the set of all non-isomorphic n-size graphs. Another statistical measurement is defined for evaluating network motifs, but it is rarely used in known algorithms. This measurement is introduced by Picard et al. in 2008 and used the Poisson distribution, rather than the Gaussian normal distribution that is implicitly being used above.
In addition, three specific concepts of sub-graph frequency have been proposed. As the figure illustrates, the first frequency concept F$_1$ considers all matches of a graph in original network. This definition is similar to what we have introduced above. The second concept F$_2$ is defined as the maximum number of edge-disjoint instances of a given graph in original network. And finally, the frequency concept F$_3$ entails matches with disjoint edges and nodes. Therefore, the two concepts F$_2$ and F$_3$ restrict the usage of elements of the graph, and as can be inferred, the frequency of a sub-graph declines by imposing restrictions on network element usage. As a result, a network motif detection algorithm would pass over more candidate sub-graphs if we insist on frequency concepts F$_2$ and F$_3$.

## History

The study of network motifs was pioneered by Holland and Leinhardt who introduced the concept of a triad census of networks. They introduced methods to enumerate various types of subgraph configurations, and test whether the subgraph counts are statistically different from those expected in random networks.
This idea was further generalized in 2002 by Uri Alon and his group when network motifs were discovered in the gene regulation (transcription) network of the bacteria E. coli and then in a large set of natural networks. Since then, a considerable number of studies have been conducted on the subject. Some of these studies focus on the biological applications, while others focus on the computational theory of network motifs.
The biological studies endeavor to interpret the motifs detected for biological networks. For example, in work following, the network motifs found in E. coli were discovered in the transcription networks of other bacteria as well as yeast and higher organisms. A distinct set of network motifs were identified in other types of biological networks such as neuronal networks and protein interaction networks.
The computational research has focused on improving existing motif detection tools to assist the biological investigations and allow larger networks to be analyzed. Several different algorithms have been provided so far, which are elaborated in the next section in chronological order.
Most recently, the acc-MOTIF tool to detect network motifs was released.

## Motif discovery algorithms

Various solutions have been proposed for the challenging problem of network motif (NM) discovery. These algorithms can be classified under various paradigms such as exact counting methods, sampling methods, pattern growth methods and so on. However, motif discovery problem comprises two main steps: first, calculating the number of occurrences of a sub-graph and then, evaluating the sub-graph significance. The recurrence is significant if it is detectably far more than expected. Roughly speaking, the expected number of appearances of a sub-graph can be determined by a Null-model, which is defined by an ensemble of random networks with some of the same properties as the original network.
Until 2004, the only exact counting method for NM detection was the brute-force one proposed by Milo et al.. This algorithm was successful for discovering small motifs, but using this method for finding even size 5 or 6 motifs was not computationally feasible. Hence, a new approach to this problem was needed.
Here, a review on computational aspects of major algorithms is given and their related benefits and drawbacks from an algorithmic perspective are discussed.

### Classification of algorithms

The table below lists the motif discovery algorithms that will be described in this section. They can be divided into two general categories: those based on exact counting and those using statistical sampling and estimations instead. Because the second group does not count all the occurrences of a subgraph in the main network, the algorithms belonging to this group are faster, but they might yield in biased and unrealistic results.
In the next level, the exact counting algorithms can be classified to network-centric and subgraph-centric methods. The algorithms of the first class search the given network for all subgraphs of a given size, while the algorithms falling into the second class first generate different possible non-isomorphic graphs of the given size, and then explore the network for each generated subgraph separately. Each approach has its advantages and disadvantages which are discussed below.
The table also indicates whether an algorithm can be used for directed or undirected networks as well as induced or non-induced subgraphs. For more information refer to the provided web links or lab addresses.
Classification of Motif Discovery Algorithms :
| Counting Method | Basis | Name | Directed / Undirected | Induced / Non-Induced |
| Exact | Network-Centric | mfinder | Both | Induced |
| Exact | Network-Centric | ESU (FANMOD) | Both | Induced |
| Exact | Network-Centric | Kavosh (used in CytoKavosh) | Both | Induced |
| Exact | Network-Centric | G-Tries | Both | Induced |
| Exact | Network-Centric | PGD | Undirected | Induced |
| Exact | Subgraph-Centric | FPF (Mavisto) | Both | Induced |
| Exact | Subgraph-Centric | NeMoFinder | Undirected | Induced |
| Exact | Subgraph-Centric | Grochow–Kellis | Both | Both |
| Exact | Subgraph-Centric | MODA | Both | Both |
| Estimation / Sampling | Color-Coding Approach | N. Alon et al.'s Algorithm | Undirected | Non-Induced |
| Estimation / Sampling | Other Approaches | mfinder | Both | Induced |
| Estimation / Sampling | Other Approaches | ESU (FANMOD) | Both | Induced |
Addresses of Designers of Algorithms :
| Algorithm | Lab / Dept. Name | Department / School | Institute | Address | E-Mail |
| mfinder | Uri Alon's Group | Department of Molecular Cell Biology | Weizmann Institute of Science | Rehovot, Israel, Wolfson, Rm. 607 | urialon at weizmann.ac.il |
| FPF (Mavisto) | ---- | ---- | Leibniz-Institut für Pflanzengenetik und Kulturpflanzenforschung (IPK) | Corrensstraße 3, D-06466 Stadt Seeland, OT Gatersleben, Deutschland | schreibe at ipk-gatersleben.de |
| ESU (FANMOD) | Lehrstuhl Theoretische Informatik I | Institut für Informatik | Friedrich-Schiller-Universität Jena | Ernst-Abbe-Platz 2,D-07743 Jena, Deutschland | sebastian.wernicke at gmail.com |
| NeMoFinder | ---- | School of Computing | National University of Singapore | Singapore 119077 | chenjin at comp.nus.edu.sg |
| Grochow–Kellis | CS Theory Group & Complex Systems Group | Computer Science | University of Colorado, Boulder | 1111 Engineering Dr. ECOT 717, 430 UCB Boulder, CO 80309-0430 USA | jgrochow at colorado.edu |
| N. Alon et al.'s Algorithm | Department of Pure Mathematics | School of Mathematical Sciences | Tel Aviv University | Tel Aviv 69978, Israel | nogaa at post.tau.ac.il |
| MODA | Laboratory of Systems Biology and Bioinformatics (LBB) | Institute of Biochemistry and Biophysics (IBB) | University of Tehran | Enghelab Square, Enghelab Ave, Tehran, Iran | amasoudin at ibb.ut.ac.ir |
| Kavosh (used in CytoKavosh) | Laboratory of Systems Biology and Bioinformatics (LBB) | Institute of Biochemistry and Biophysics (IBB) | University of Tehran | Enghelab Square, Enghelab Ave, Tehran, Iran | amasoudin at ibb.ut.ac.ir |
| G-Tries | Center for Research in Advanced Computing Systems | Computer Science | University of Porto | Rua Campo Alegre 1021/1055, Porto, Portugal | pribeiro at dcc.fc.up.pt |
| PGD | Network Learning and Discovery Lab | Department of Computer Science | Purdue University | Purdue University, 305 N University St, West Lafayette, IN 47907 | nkahmed@purdue.edu |

### mfinder

Kashtan et al. published mfinder, the first motif-mining tool, in 2004. It implements two kinds of motif finding algorithms: a full enumeration and the first sampling method.
Their sampling discovery algorithm was based on edge sampling throughout the network. This algorithm estimates concentrations of induced sub-graphs and can be utilized for motif discovery in directed or undirected networks. The sampling procedure of the algorithm starts from an arbitrary edge of the network that leads to a sub-graph of size two, and then expands the sub-graph by choosing a random edge that is incident to the current sub-graph. After that, it continues choosing random neighboring edges until a sub-graph of size n is obtained. Finally, the sampled sub-graph is expanded to include all of the edges that exist in the network between these n nodes. When an algorithm uses a sampling approach, taking unbiased samples is the most important issue that the algorithm might address. The sampling procedure, however, does not take samples uniformly and therefore Kashtan et al. proposed a weighting scheme that assigns different weights to the different sub-graphs within network. The underlying principle of weight allocation is exploiting the information of the sampling probability for each sub-graph, i.e. the probable sub-graphs will obtain comparatively less weights in comparison to the improbable sub-graphs; hence, the algorithm must calculate the sampling probability of each sub-graph that has been sampled. This weighting technique assists mfinder to determine sub-graph concentrations impartially.
In expanded to include sharp contrast to exhaustive search, the computational time of the algorithm surprisingly is asymptotically independent of the network size. An analysis of the computational time of the algorithm has shown that it takes O(n$^n$) for each sample of a sub-graph of size n from the network. On the other hand, there is no analysis in on the classification time of sampled sub-graphs that requires solving the graph isomorphism problem for each sub-graph sample. Additionally, an extra computational effort is imposed on the algorithm by the sub-graph weight calculation. But it is unavoidable to say that the algorithm may sample the same sub-graph multiple times – spending time without gathering any information. In conclusion, by taking the advantages of sampling, the algorithm performs more efficiently than an exhaustive search algorithm; however, it only determines sub-graphs concentrations approximately. This algorithm can find motifs up to size 6 because of its main implementation, and as result it gives the most significant motif, not all the others too. Also, it is necessary to mention that this tool has no option of visual presentation. The sampling algorithm is shown briefly:
* mfinder
* Definitions: E$_s$is the set of picked edges. V$_s$ is the set of all nodes that are touched by the edges in E.
* Init V$_s$ and E$_s$ to be empty sets.
* 1. Pick a random edge e$_1$ = (v$_i$, v$_j$). Update E$_s$ = {e$_1$}, V$_s$ = {v$_i$, v$_j$}
* 2. Make a list L of all neighbor edges of E$_s$. Omit from L all edges between members of V$_s$.
* 3. Pick a random edge e = {v$_k$,v$_l$} from L. Update E$_s$ = E$_s$ ⋃ {e}, V$_s$ = V$_s$ ⋃ {v$_k$, v$_l$}.
* 4. Repeat steps 2-3 until completing an n-node subgraph (until |V$_s$| = n).
* 5. Calculate the probability to sample the picked n-node subgraph.

### FPF (Mavisto)

Schreiber and Schwöbbermeyer proposed an algorithm named flexible pattern finder (FPF) for extracting frequent sub-graphs of an input network and implemented it in a system named Mavisto. Their algorithm exploits the downward closure property which is applicable for frequency concepts F$_2$ and F$_3$. The downward closure property asserts that the frequency for sub-graphs decrease monotonically by increasing the size of sub-graphs; however, this property does not hold necessarily for frequency concept F$_1$. FPF is based on a pattern tree (see figure) consisting of nodes that represents different graphs (or patterns), where the parent of each node is a sub-graph of its children nodes; in other words, the corresponding graph of each pattern tree's node is expanded by adding a new edge to the graph of its parent node.
At first, the FPF algorithm enumerates and maintains the information of all matches of a sub-graph located at the root of the pattern tree. Then, one-by-one it builds child nodes of the previous node in the pattern tree by adding one edge supported by a matching edge in the target graph, and tries to expand all of the previous information about matches to the new sub-graph (child node). In next step, it decides whether the frequency of the current pattern is lower than a predefined threshold or not. If it is lower and if downward closure holds, FPF can abandon that path and not traverse further in this part of the tree; as a result, unnecessary computation is avoided. This procedure is continued until there is no remaining path to traverse.
The advantage of the algorithm is that it does not consider infrequent sub-graphs and tries to finish the enumeration process as soon as possible; therefore, it only spends time for promising nodes in the pattern tree and discards all other nodes. As an added bonus, the pattern tree notion permits FPF to be implemented and executed in a parallel manner since it is possible to traverse each path of the pattern tree independently. However, FPF is most useful for frequency concepts F$_2$ and F$_3$, because downward closure is not applicable to F$_1$. Nevertheless, the pattern tree is still practical for F$_1$ if the algorithm runs in parallel. Another advantage of the algorithm is that the implementation of this algorithm has no limitation on motif size, which makes it more amenable to improvements. The pseudocode of FPF (Mavisto) is shown below:
* Mavisto
* Data: Graph G, target pattern size t, frequency concept F
* Result: Set R of patterns of size t with maximum frequency.
* R ← φ, f$_{max}$ ← 0
* P ←start pattern p1 of size 1
* M$_{p1}$ ←all matches of p$_1$ in G
* While P ≠ φ do
* P$_{max}$ ←select all patterns from P with maximum size.
* P ← select pattern with maximum frequency from P$_{max}$
* Ε = ExtensionLoop(G, p, M$_p$)
* Foreach pattern p ∈ E
* If F = F$_1$ then f ← size(M$_p$)
* Else f ← Maximum Independent set(F, M$_p$)
* End
* If size(p) = t then
* If f = f$_{max}$ then R ← R ⋃ {p}
* Else if f > f$_{max}$ then R ← {p}; f$_{max}$ ← f
* End
* Else
* If F = F$_1$ or f ≥ f$_{max}$ then P ← P ⋃ {p}
* End
* End
* End
* End

### ESU (FANMOD)

The sampling bias of Kashtan et al. provided great impetus for designing better algorithms for the NM discovery problem. Although Kashtan et al. tried to settle this drawback by means of a weighting scheme, this method imposed an undesired overhead on the running time as well a more complicated implementation. This tool is one of the most useful ones, as it supports visual options and also is an efficient algorithm with respect to time. But, it has a limitation on motif size as it does not allow searching for motifs of size 9 or higher because of the way the tool is implemented.
Wernicke introduced an algorithm named RAND-ESU that provides a significant improvement over mfinder. This algorithm, which is based on the exact enumeration algorithm ESU, has been implemented as an application called FANMOD. RAND-ESU is a NM discovery algorithm applicable for both directed and undirected networks, effectively exploits an unbiased node sampling throughout the network, and prevents overcounting sub-graphs more than once. Furthermore, RAND-ESU uses a novel analytical approach called DIRECT for determining sub-graph significance instead of using an ensemble of random networks as a Null-model. The DIRECT method estimates the sub-graph concentration without explicitly generating random networks. Empirically, the DIRECT method is more efficient in comparison with the random network ensemble in case of sub-graphs with a very low concentration; however, the classical Null-model is faster than the DIRECT method for highly concentrated sub-graphs. In the following, we detail the ESU algorithm and then we show how this exact algorithm can be modified efficiently to RAND-ESU that estimates sub-graphs concentrations.
The algorithms ESU and RAND-ESU are fairly simple, and hence easy to implement. ESU first finds the set of all induced sub-graphs of size k, let S$_k$ be this set. ESU can be implemented as a recursive function; the running of this function can be displayed as a tree-like structure of depth k, called the ESU-Tree (see figure). Each of the ESU-Tree nodes indicate the status of the recursive function that entails two consecutive sets SUB and EXT. SUB refers to nodes in the target network that are adjacent and establish a partial sub-graph of size |SUB| ≤ k. If |SUB| = k, the algorithm has found an induced complete sub-graph, so S$_k$ = SUB ∪ S$_k$. However, if |SUB| < k, the algorithm must expand SUB to achieve cardinality k. This is done by the EXT set that contains all the nodes that satisfy two conditions: First, each of the nodes in EXT must be adjacent to at least one of the nodes in SUB; second, their numerical labels must be larger than the label of first element in SUB. The first condition makes sure that the expansion of SUB nodes yields a connected graph and the second condition causes ESU-Tree leaves (see figure) to be distinct; as a result, it prevents overcounting. Note that, the EXT set is not a static set, so in each step it may expand by some new nodes that do not breach the two conditions. The next step of ESU involves classification of sub-graphs placed in the ESU-Tree leaves into non-isomorphic size-k graph classes; consequently, ESU determines sub-graphs frequencies and concentrations. This stage has been implemented simply by employing McKay's nauty algorithm, which classifies each sub-graph by performing a graph isomorphism test. Therefore, ESU finds the set of all induced k-size sub-graphs in a target graph by a recursive algorithm and then determines their frequency using an efficient tool.
The procedure of implementing RAND-ESU is quite straightforward and is one of the main advantages of FANMOD. One can change the ESU algorithm to explore just a portion of the ESU-Tree leaves by applying a probability value 0 ≤ p$_d$ ≤ 1 for each level of the ESU-Tree and oblige ESU to traverse each child node of a node in level d-1 with probability p$_d$. This new algorithm is called RAND-ESU. Evidently, when p$_d$ = 1 for all levels, RAND-ESU acts like ESU. For p$_d$ = 0 the algorithm finds nothing. Note that, this procedure ensures that the chances of visiting each leaf of the ESU-Tree are the same, resulting in unbiased sampling of sub-graphs through the network. The probability of visiting each leaf is Π$_d$p$_d$ and this is identical for all of the ESU-Tree leaves; therefore, this method guarantees unbiased sampling of sub-graphs from the network. Nonetheless, determining the value of p$_d$ for 1 ≤ d ≤ k is another issue that must be determined manually by an expert to get precise results of sub-graph concentrations. While there is no lucid prescript for this matter, the Wernicke provides some general observations that may help in determining p_d values. In summary, RAND-ESU is a very fast algorithm for NM discovery in the case of induced sub-graphs supporting unbiased sampling method. Although, the main ESU algorithm and so the FANMOD tool is known for discovering induced sub-graphs, there is trivial modification to ESU which makes it possible for finding non-induced sub-graphs, too. The pseudo code of ESU (FANMOD) is shown below:
* Enumeration of ESU (FANMOD)
* EnumerateSubgraphs(G,k)
* Input: A graph G = (V, E) and an integer 1 ≤ k ≤ |V|.
* Output: All size-k subgraphs in G.
* for each vertex v ∈ V do
* VExtension ← {u ∈ N({v}) | u > v}
* call ExtendSubgraph({v}, VExtension, v)
* endfor
* ExtendSubgraph(VSubgraph, VExtension, v)
* if |VSubgraph| = k then output G[VSubgraph] and return
* while VExtension ≠ ∅ do
* Remove an arbitrarily chosen vertex w from VExtension
* VExtension′ ← VExtension ∪ {u ∈ N$_{excl}$(w, VSubgraph) | u > v}
* call ExtendSubgraph(VSubgraph ∪ {w}, VExtension′, v)
* return

### NeMoFinder

Chen et al. introduced a new NM discovery algorithm called NeMoFinder, which adapts the idea in SPIN to extract frequent trees and after that expands them into non-isomorphic graphs. NeMoFinder utilizes frequent size-n trees to partition the input network into a collection of size-n graphs, afterward finding frequent size-n sub-graphs by expansion of frequent trees edge-by-edge until getting a complete size-n graph K$_n$. The algorithm finds NMs in undirected networks and is not limited to extracting only induced sub-graphs. Furthermore, NeMoFinder is an exact enumeration algorithm and is not based on a sampling method. As Chen et al. claim, NeMoFinder is applicable for detecting relatively large NMs, for instance, finding NMs up to size-12 from the whole S. cerevisiae (yeast) PPI network as the authors claimed.
NeMoFinder consists of three main steps. First, finding frequent size-n trees, then utilizing repeated size-n trees to divide the entire network into a collection of size-n graphs, finally, performing sub-graph join operations to find frequent size-n sub-graphs. In the first step, the algorithm detects all non-isomorphic size-n trees and mappings from a tree to the network. In the second step, the ranges of these mappings are employed to partition the network into size-n graphs. Up to this step, there is no distinction between NeMoFinder and an exact enumeration method. However, a large portion of non-isomorphic size-n graphs still remain. NeMoFinder exploits a heuristic to enumerate non-tree size-n graphs by the obtained information from the preceding steps. The main advantage of the algorithm is in the third step, which generates candidate sub-graphs from previously enumerated sub-graphs. This generation of new size-n sub-graphs is done by joining each previous sub-graph with derivative sub-graphs from itself called cousin sub-graphs. These new sub-graphs contain one additional edge in comparison to the previous sub-graphs. However, there exist some problems in generating new sub-graphs: There is no clear method to derive cousins from a graph, joining a sub-graph with its cousins leads to redundancy in generating particular sub-graph more than once, and cousin determination is done by a canonical representation of the adjacency matrix which is not closed under join operation. NeMoFinder is an efficient network motif finding algorithm for motifs up to size 12 only for protein-protein interaction networks, which are presented as undirected graphs. And it is not able to work on directed networks which are so important in the field of complex and biological networks. The pseudocode of NeMoFinder is shown below:
* NeMoFinder
* Input:
* G - PPI network;
* N - Number of randomized networks;
* K - Maximal network motif size;
* F - Frequency threshold;
* S - Uniqueness threshold;
* Output:
* U - Repeated and unique network motif set;
* D ← ∅;
* for motif-size k from 3 to K do
* T ← FindRepeatedTrees(k);
* GD$_k$ ← GraphPartition(G, T)
* D ← D ∪ T;
* D′ ← T;
* i ← k;
* while D′ ≠ ∅ and i ≤ k × (k - 1) / 2 do
* D′ ← FindRepeatedGraphs(k, i, D′);
* D ← D ∪ D′;
* i ← i + 1;
* end while
* end for
* for counter i from 1 to N do
* G$_{rand}$ ← RandomizedNetworkGeneration;
* for each g ∈ D do
* GetRandFrequency(g, G$_{rand}$);
* end for
* end for
* U ← ∅;
* for each g ∈ D do
* s ← GetUniqunessValue(g);
* if s ≥ S then
* U ← U ∪ {g};
* end if
* end for
* return U;

### Grochow–Kellis

Grochow and Kellis proposed an exact algorithm for enumerating sub-graph appearances. The algorithm is based on a motif-centric approach, which means that the frequency of a given sub-graph, called the query graph, is exhaustively determined by searching for all possible mappings from the query graph into the larger network. It is claimed that a motif-centric method in comparison to network-centric methods has some beneficial features. First of all it avoids the increased complexity of sub-graph enumeration. Also, by using mapping instead of enumerating, it enables an improvement in the isomorphism test. To improve the performance of the algorithm, since it is an inefficient exact enumeration algorithm, the authors introduced a fast method which is called symmetry-breaking conditions. During straightforward sub-graph isomorphism tests, a sub-graph may be mapped to the same sub-graph of the query graph multiple times. In the Grochow–Kellis (GK) algorithm symmetry-breaking is used to avoid such multiple mappings. Here we introduce the GK algorithm and the symmetry-breaking condition which eliminates redundant isomorphism tests.
The GK algorithm discovers the whole set of mappings of a given query graph to the network in two major steps. It starts with the computation of symmetry-breaking conditions of the query graph. Next, by means of a branch-and-bound method, the algorithm tries to find every possible mapping from the query graph to the network that meets the associated symmetry-breaking conditions. An example of the usage of symmetry-breaking conditions in GK algorithm is demonstrated in figure.
As it is mentioned above, the symmetry-breaking technique is a simple mechanism that precludes spending time finding a sub-graph more than once due to its symmetries. Note that, computing symmetry-breaking conditions requires finding all automorphisms of a given query graph. Even though, there is no efficient (or polynomial time) algorithm for the graph automorphism problem, this problem can be tackled efficiently in practice by McKay's tools. As it is claimed, using symmetry-breaking conditions in NM detection lead to save a great deal of running time. Moreover, it can be inferred from the results in that using the symmetry-breaking conditions results in high efficiency particularly for directed networks in comparison to undirected networks. The symmetry-breaking conditions used in the GK algorithm are similar to the restriction which ESU algorithm applies to the labels in EXT and SUB sets. In conclusion, the GK algorithm computes the exact number of appearance of a given query graph in a large complex network and exploiting symmetry-breaking conditions improves the algorithm performance. Also, GK algorithm is one of the known algorithms having no limitation for motif size in implementation and potentially it can find motifs of any size.

### Color-coding approach

Most algorithms in the field of NM discovery are used to find induced sub-graphs of a network. In 2008, Noga Alon et al. introduced an approach for finding non-induced sub-graphs too. Their technique works on undirected networks such as PPI ones. Also, it counts non-induced trees and bounded treewidth sub-graphs. This method is applied for sub-graphs of size up to 10.
This algorithm counts the number of non-induced occurrences of a tree T with k = O(logn) vertices in a network G with n vertices as follows:
* Color coding. Color each vertex of input network G independently and uniformly at random with one of the k colors.
* Counting. Apply a dynamic programming routine to count the number of non-induced occurrences of T in which each vertex has a unique color. For more details on this step, see.
* Repeat the above two steps O(e$^k$) times and add up the number of occurrences of T to get an estimate on the number of its occurrences in G.
As available PPI networks are far from complete and error free, this approach is suitable for NM discovery for such networks. As Grochow–Kellis Algorithm and this one are the ones popular for non-induced sub-graphs, it is worth to mention that the algorithm introduced by Alon et al. is less time-consuming than the Grochow–Kellis Algorithm.

### MODA

Omidi et al. introduced a new algorithm for motif detection named MODA which is applicable for induced and non-induced NM discovery in undirected networks. It is based on the motif-centric approach discussed in the Grochow–Kellis algorithm section. It is very important to distinguish motif-centric algorithms such as MODA and GK algorithm because of their ability to work as query-finding algorithms. This feature allows such algorithms to be able to find a single motif query or a small number of motif queries (not all possible sub-graphs of a given size) with larger sizes. As the number of possible non-isomorphic sub-graphs increases exponentially with sub-graph size, for large size motifs (even larger than 10), the network-centric algorithms, those looking for all possible sub-graphs, face a problem. Although motif-centric algorithms also have problems in discovering all possible large size sub-graphs, but their ability to find small numbers of them is sometimes a significant property.
Using a hierarchical structure called an expansion tree, the MODA algorithm is able to extract NMs of a given size systematically and similar to FPF that avoids enumerating unpromising sub-graphs; MODA takes into consideration potential queries (or candidate sub-graphs) that would result in frequent sub-graphs. Despite the fact that MODA resembles FPF in using a tree like structure, the expansion tree is applicable merely for computing frequency concept F$_1$. As we will discuss next, the advantage of this algorithm is that it does not carry out the sub-graph isomorphism test for non-tree query graphs. Additionally, it utilizes a sampling method in order to speed up the running time of the algorithm.
Here is the main idea: by a simple criterion one can generalize a mapping of a k-size graph into the network to its same size supergraphs. For example, suppose there is mapping f(G) of graph G with k nodes into the network and we have a same size graph G′ with one more edge &langu, v⟩; f$_G$ will map G′ into the network, if there is an edge ⟨f$_G$(u), f$_G$(v)⟩ in the network. As a result, we can exploit the mapping set of a graph to determine the frequencies of its same order supergraphs simply in O(1) time without carrying out sub-graph isomorphism testing. The algorithm starts ingeniously with minimally connected query graphs of size k and finds their mappings in the network via sub-graph isomorphism. After that, with conservation of the graph size, it expands previously considered query graphs edge-by-edge and computes the frequency of these expanded graphs as mentioned above. The expansion process continues until reaching a complete graph K$_k$ (fully connected with k(k-1)⁄2 edge).
As discussed above, the algorithm starts by computing sub-tree frequencies in the network and then expands sub-trees edge by edge. One way to implement this idea is called the expansion tree T$_k$ for each k. Figure shows the expansion tree for size-4 sub-graphs. T$_k$ organizes the running process and provides query graphs in a hierarchical manner. Strictly speaking, the expansion tree T$_k$ is simply a directed acyclic graph or DAG, with its root number k indicating the graph size existing in the expansion tree and each of its other nodes containing the adjacency matrix of a distinct k-size query graph. Nodes in the first level of T$_k$ are all distinct k-size trees and by traversing T$_k$ in depth query graphs expand with one edge at each level. A query graph in a node is a sub-graph of the query graph in a node's child with one edge difference. The longest path in T$_k$ consists of (k$^2$-3k+4)/2 edges and is the path from the root to the leaf node holding the complete graph. Generating expansion trees can be done by a simple routine which is explained in.
MODA traverses T$_k$ and when it extracts query trees from the first level of T$_k$ it computes their mapping sets and saves these mappings for the next step. For non-tree queries from T$_k$, the algorithm extracts the mappings associated with the parent node in T$_k$ and determines which of these mappings can support the current query graphs. The process will continue until the algorithm gets the complete query graph. The query tree mappings are extracted using the Grochow–Kellis algorithm. For computing the frequency of non-tree query graphs, the algorithm employs a simple routine that takes O(1) steps. In addition, MODA exploits a sampling method where the sampling of each node in the network is linearly proportional to the node degree, the probability distribution is exactly similar to the well-known Barabási-Albert preferential attachment model in the field of complex networks. This approach generates approximations; however, the results are almost stable in different executions since sub-graphs aggregate around highly connected nodes. The pseudocode of MODA is shown below:
* MODA
* Input: G: Input graph, k: sub-graph size, Δ: threshold value
* Output: Frequent Subgraph List: List of all frequent k-size sub-graphs
* Note: F$_G$: set of mappings from G in the input graph G
* fetch T$_k$
* do
* G′ = Get-Next-BFS(T$_k$) // G′ is a query graph
* if |E(G′)| = (k – 1)
* call Mapping-Module(G′, G)
* else
* call Enumerating-Module(G′, G, T$_k$)
* end if
* save F$_2$
* if |F$_G$| > Δ then
* add G′ into Frequent Subgraph List
* end if
* Until |E(G')| = (k – 1)/2
* return Frequent Subgraph List

### Kavosh

A recently introduced algorithm named Kavosh aims at improved main memory usage. Kavosh is usable to detect NM in both directed and undirected networks. The main idea of the enumeration is similar to the GK and MODA algorithms, which first find all k-size sub-graphs that a particular node participated in, then remove the node, and subsequently repeat this process for the remaining nodes.
For counting the sub-graphs of size k that include a particular node, trees with maximum depth of k, rooted at this node and based on neighborhood relationship are implicitly built. Children of each node include both incoming and outgoing adjacent nodes. To descend the tree, a child is chosen at each level with the restriction that a particular child can be included only if it has not been included at any upper level. After having descended to the lowest level possible, the tree is again ascended and the process is repeated with the stipulation that nodes visited in earlier paths of a descendant are now considered unvisited nodes. A final restriction in building trees is that all children in a particular tree must have numerical labels larger than the label of the root of the tree. The restrictions on the labels of the children are similar to the conditions which GK and ESU algorithm use to avoid overcounting sub-graphs.
The protocol for extracting sub-graphs makes use of the compositions of an integer. For the extraction of sub-graphs of size k, all possible compositions of the integer k-1 must be considered. The compositions of k-1 consist of all possible manners of expressing k-1 as a sum of positive integers. Summations in which the order of the summands differs are considered distinct. A composition can be expressed as k$_2$,k$_3$,...,k$_m$ where k$_2$ + k$_3$ + ... + k$_m$ = k-1. To count sub-graphs based on the composition, k$_i$ nodes are selected from the i-th level of the tree to be nodes of the sub-graphs (i = 2,3,...,m). The k-1 selected nodes along with the node at the root define a sub-graph within the network. After discovering a sub-graph involved as a match in the target network, in order to be able to evaluate the size of each class according to the target network, Kavosh employs the nauty algorithm in the same way as FANMOD. The enumeration part of Kavosh algorithm is shown below:
* Enumeration of Kavosh
* Enumerate_Vertex(G, u, S, Remainder, i)
* Input: G: Input graph
* u: Root vertex
* S: selection (S = { S$_0$,S$_1$,...,S$_{k-1}$} is an array of the set of all S$_i$)
* Remainder: number of remaining vertices to be selected
* i: Current depth of the tree.
* Output: all k-size sub-graphs of graph G rooted in u.
* if Remainder = 0 then
* return
* else
* ValList ← Validate(G, S$_{i-1}$, u)
* n$_i$ ← Min(|ValList|, Remainder)
* for k$_i$ = 1 to n$_i$ do
* C ← Initial_Comb(ValList, k$_i$)
* (Make the first vertex combination selection according)
* repeat
* S$_i$ ← C
* Enumerate_Vertex(G, u, S, Remainder-k$_i$, i+1)
* Next_Comb(ValList, k$_i$)
* (Make the next vertex combination selection according)
* until C = NILL
* end for
* for each v ∈ ValList do
* Visited[v] ← false
* end for
* end if
* Validate(G, Parents, u)
* Input: G: input graph, Parents: selected vertices of last layer, u: Root vertex.
* Output: Valid vertices of the current level.
* ValList ← NILL
* for each v ∈ Parents do
* for each w ∈ Neighbor[u] do
* if label[u] < label[w] AND NOT Visited[w] then
* Visited[w] ← true
* ValList = ValList + w
* end if
* end for
* end for
* return ValList
Recently a Cytoscape plugin called CytoKavosh is developed for this software. It is available via Cytoscape web page .

### G-Tries

In 2010, Pedro Ribeiro and Fernando Silva proposed a novel data structure for storing a collection of sub-graphs, called a g-trie. This data structure, which is conceptually akin to a prefix tree, stores sub-graphs according to their structures and finds occurrences of each of these sub-graphs in a larger graph. One of the noticeable aspects of this data structure is that coming to the network motif discovery, the sub-graphs in the main network are needed to be evaluated. So, there is no need to find the ones in random network which are not in the main network. This can be one of the time-consuming parts in the algorithms in which all sub-graphs in random networks are derived.
A g-trie is a multiway tree that can store a collection of graphs. Each tree node contains information about a single graph vertex and its corresponding edges to ancestor nodes. A path from the root to a leaf corresponds to one single graph. Descendants of a g-trie node share a common sub-graph. Constructing a g-trie is well described in. After constructing a g-trie, the counting part takes place. The main idea in counting process is to backtrack by all possible sub-graphs, but at the same time do the isomorphism tests. This backtracking technique is essentially the same technique employed by other motif-centric approaches like MODA and GK algorithms. Taking advantage of common substructures in the sense that at a given time there is a partial isomorphic match for several different candidate sub-graphs.
Among the mentioned algorithms, G-Tries is the fastest. But, the excessive use of memory is the drawback of this algorithm, which might limit the size of discoverable motifs by a personal computer with average memory.

### ParaMODA and NemoMap

ParaMODA and NemoMap are fast algorithms published in 2017 and 2018, respectively. They aren't as scalable as many of the others.

### Comparison

Tables and figure below show the results of running the mentioned algorithms on different standard networks. These results are taken from the corresponding sources, thus they should be treated individually.
Runtimes of Grochow–Kellis, FANMOD, and G-Trie for subgraphs from three nodes up to nine nodes on five different networks. :
| Network | Size | Census Original Network | Census Original Network | Census Original Network | Average Census on Random Networks | Average Census on Random Networks | Average Census on Random Networks |
| Network | Size | FANMOD | GK | G-Trie | FANMOD | GK | G-Trie |
| Dolphins | 5 | 0.07 | 0.03 | 0.01 | 0.13 | 0.04 | 0.01 |
| Dolphins | 6 | 0.48 | 0.28 | 0.04 | 1.14 | 0.35 | 0.07 |
| Dolphins | 7 | 3.02 | 3.44 | 0.23 | 8.34 | 3.55 | 0.46 |
| Dolphins | 8 | 19.44 | 73.16 | 1.69 | 67.94 | 37.31 | 4.03 |
| Dolphins | 9 | 100.86 | 2984.22 | 6.98 | 493.98 | 366.79 | 24.84 |
| Circuit | 6 | 0.49 | 0.41 | 0.03 | 0.55 | 0.24 | 0.03 |
| Circuit | 7 | 3.28 | 3.73 | 0.22 | 3.53 | 1.34 | 0.17 |
| Circuit | 8 | 17.78 | 48.00 | 1.52 | 21.42 | 7.91 | 1.06 |
| Social | 3 | 0.31 | 0.11 | 0.02 | 0.35 | 0.11 | 0.02 |
| Social | 4 | 7.78 | 1.37 | 0.56 | 13.27 | 1.86 | 0.57 |
| Social | 5 | 208.30 | 31.85 | 14.88 | 531.65 | 62.66 | 22.11 |
| Yeast | 3 | 0.47 | 0.33 | 0.02 | 0.57 | 0.35 | 0.02 |
| Yeast | 4 | 10.07 | 2.04 | 0.36 | 12.90 | 2.25 | 0.41 |
| Yeast | 5 | 268.51 | 34.10 | 12.73 | 400.13 | 47.16 | 14.98 |
| Power | 3 | 0.51 | 1.46 | 0.00 | 0.91 | 1.37 | 0.01 |
| Power | 4 | 1.38 | 4.34 | 0.02 | 3.01 | 4.40 | 0.03 |
| Power | 5 | 4.68 | 16.95 | 0.10 | 12.38 | 17.54 | 0.14 |
| Power | 6 | 20.36 | 95.58 | 0.55 | 67.65 | 92.74 | 0.88 |
| Power | 7 | 101.04 | 765.91 | 3.36 | 408.15 | 630.65 | 5.17 |
Runtimes of mfinder, FANMOD, Mavisto and Kavosh for subgraphs from three nodes up to ten nodes on three different networks. :
| | Size → | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| Networks ↓ | Algorithms ↓ | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| E. coli | Kavosh | 0.30 | 1.84 | 14.91 | 141.98 | 1374.0 | 13173.7 | 121110.3 | 1120560.1 |
| E. coli | FANMOD | 0.81 | 2.53 | 15.71 | 132.24 | 1205.9 | 9256.6 | - | - |
| E. coli | Mavisto | 13532 | - | - | - | - | - | - | - |
| E. coli | Mfinder | 31.0 | 297 | 23671 | - | - | - | - | - |
| Electronic | Kavosh | 0.08 | 0.36 | 8.02 | 11.39 | 77.22 | 422.6 | 2823.7 | 18037.5 |
| Electronic | FANMOD | 0.53 | 1.06 | 4.34 | 24.24 | 160 | 967.99 | - | - |
| Electronic | Mavisto | 210.0 | 1727 | - | - | - | - | - | - |
| Electronic | Mfinder | 7 | 14 | 109.8 | 2020.2 | - | - | - | - |
| Social | Kavosh | 0.04 | 0.23 | 1.63 | 10.48 | 69.43 | 415.66 | 2594.19 | 14611.23 |
| Social | FANMOD | 0.46 | 0.84 | 3.07 | 17.63 | 117.43 | 845.93 | - | - |
| Social | Mavisto | 393 | 1492 | - | - | - | - | - | - |
| Social | Mfinder | 12 | 49 | 798 | 181077 | - | - | - | - |

## Well-established motifs and their functions

Much experimental work has been devoted to understanding network motifs in gene regulatory networks. These networks control which genes are expressed in the cell in response to biological signals. The network is defined such that genes are nodes, and directed edges represent the control of one gene by a transcription factor (regulatory protein that binds DNA) encoded by another gene. Thus, network motifs are patterns of genes regulating each other's transcription rate. When analyzing transcription networks, it is seen that the same network motifs appear again and again in diverse organisms from bacteria to human. The transcription network of E. coli and yeast, for example, is made of three main motif families, that make up almost the entire network. The leading hypothesis is that the network motif were independently selected by evolutionary processes in a converging manner, since the creation or elimination of regulatory interactions is fast on evolutionary time scale, relative to the rate at which genes change, Furthermore, experiments on the dynamics generated by network motifs in living cells indicate that they have characteristic dynamical functions. This suggests that the network motif serve as building blocks in gene regulatory networks that are beneficial to the organism.
The functions associated with common network motifs in transcription networks were explored and demonstrated by several research projects both theoretically and experimentally. Below are some of the most common network motifs and their associated function.

### Negative auto-regulation (NAR)

One of simplest and most abundant network motifs in E. coli is negative auto-regulation in which a transcription factor (TF) represses its own transcription. This motif was shown to perform two important functions. The first function is response acceleration. NAR was shown to speed-up the response to signals both theoretically and experimentally. This was first shown in a synthetic transcription network and later on in the natural context in the SOS DNA repair system of E. coli. The second function is increased stability of the auto-regulated gene product concentration against stochastic noise, thus reducing variations in protein levels between different cells.

### Positive auto-regulation (PAR)

Positive auto-regulation (PAR) occurs when a transcription factor enhances its own rate of production. Opposite to the NAR motif this motif slows the response time compared to simple regulation. In the case of a strong PAR the motif may lead to a bimodal distribution of protein levels in cell populations.

### Feed-forward loops (FFL)

This motif is commonly found in many gene systems and organisms. The motif consists of three genes and three regulatory interactions. The target gene C is regulated by 2 TFs A and B and in addition TF B is also regulated by TF A . Since each of the regulatory interactions may either be positive or negative there are possibly eight types of FFL motifs. Two of those eight types: the coherent type 1 FFL (C1-FFL) (where all interactions are positive) and the incoherent type 1 FFL (I1-FFL) (A activates C and also activates B which represses C) are found much more frequently in the transcription network of E. coli and yeast than the other six types. In addition to the structure of the circuitry the way in which the signals from A and B are integrated by the C promoter should also be considered. In most of the cases the FFL is either an AND gate (A and B are required for C activation) or OR gate (either A or B are sufficient for C activation) but other input function are also possible.

### Coherent type 1 FFL (C1-FFL)

The C1-FFL with an AND gate was shown to have a function of a 'sign-sensitive delay' element and a persistence detector both theoretically and experimentally with the arabinose system of E. coli. This means that this motif can provide pulse filtration in which short pulses of signal will not generate a response but persistent signals will generate a response after short delay. The shut off of the output when a persistent pulse is ended will be fast. The opposite behavior emerges in the case of a sum gate with fast response and delayed shut off as was demonstrated in the flagella system of E. coli. De novo evolution of C1-FFLs in gene regulatory networks has been demonstrated computationally in response to selection to filter out an idealized short signal pulse, but for non-idealized noise, a dynamics-based system of feed-forward regulation with different topology was instead favored.

### Incoherent type 1 FFL (I1-FFL)

The I1-FFL is a pulse generator and response accelerator. The two signal pathways of the I1-FFL act in opposite directions where one pathway activates Z and the other represses it. When the repression is complete this leads to a pulse-like dynamics. It was also demonstrated experimentally that the I1-FFL can serve as response accelerator in a way which is similar to the NAR motif. The difference is that the I1-FFL can speed-up the response of any gene and not necessarily a transcription factor gene. An additional function was assigned to the I1-FFL network motif: it was shown both theoretically and experimentally that the I1-FFL can generate non-monotonic input function in both a synthetic and native systems. Finally, expression units that incorporate incoherent feedforward control of the gene product provide adaptation to the amount of DNA template and can be superior to simple combinations of constitutive promoters. Feedforward regulation displayed better adaptation than negative feedback, and circuits based on RNA interference were the most robust to variation in DNA template amounts. De novo evolution of I1-FFLs in gene regulatory networks has been demonstrated computationally in response to selection to a generate a pulse, with I1-FFLs being more evolutionarily accessible, but not superior, relative to an alternative motif in which it is the output rather than the input that activates the repressor.

### Multi-output FFLs

In some cases the same regulators X and Y regulate several Z genes of the same system. By adjusting the strength of the interactions this motif was shown to determine the temporal order of gene activation. This was demonstrated experimentally in the flagella system of E. coli.

### Single-input modules (SIM)

This motif occurs when a single regulator regulates a set of genes with no additional regulation. This is useful when the genes are cooperatively carrying out a specific function and therefore always need to be activated in a synchronized manner. By adjusting the strength of the interactions it can create temporal expression program of the genes it regulates.
In the literature, Multiple-input modules (MIM) arose as a generalization of SIM. However, the precise definitions of SIM and MIM have been a source of inconsistency. There are attempts to provide orthogonal definitions for canonical motifs in biological networks and algorithms to enumerate them, especially SIM, MIM and Bi-Fan (2x2 MIM).

### Dense overlapping regulons (DOR)

This motif occurs in the case that several regulators combinatorially control a set of genes with diverse regulatory combinations. This motif was found in E. coli in various systems such as carbon utilization, anaerobic growth, stress response and others. In order to better understand the function of this motif one has to obtain more information about the way the multiple inputs are integrated by the genes. Kaplan et al. has mapped the input functions of the sugar utilization genes in E. coli, showing diverse shapes.

## Activity motifs

An interesting generalization of the network-motifs, activity motifs are over occurring patterns that can be found when nodes and edges in the network are annotated with quantitative features. For instance, when edges in a metabolic pathways are annotated with the magnitude or timing of the corresponding gene expression, some patterns are over occurring given the underlying network structure.

## Criticism

An assumption (sometimes more sometimes less implicit) behind the preservation of a topological sub-structure is that it is of a particular functional importance. This assumption has recently been questioned. Some authors have argued that motifs, like bi-fan motifs, might show a variety depending on the network context, and therefore, structure of the motif does not necessarily determine function. Indeed, an analysis of motifs in the C. elegans brain connectome in terms of “uncolored nodes” (nodes without a functional tag) revealed no significant difference in motif abundance compared to chance. When nodes are assigned colors according to their functional role in the network, however, (for example, different colors for sensory neurons, motor neurons, or interneurons), particular colored motifs are found to be used significantly more than expected by chance, reflecting the functional role of the motif. Certain bi-fan motifs, for example, appear with significantly enhanced frequency, while other colored bi-fan motifs do not. Because the number of colored motifs increases exponentially with the number of colors, a search for colored motifs with significant bias can only be carried out for a small number of colors (node types). Network structure certainly does not always indicate function; this is an idea that has been around for some time, for another example see the Sin operon.
Most analyses of motif function are carried out looking at the motif operating in isolation. Recent research provides good evidence that network context, i.e. the connections of the motif to the rest of the network, is too important to draw inferences on function from local structure only — the cited paper also reviews the criticisms and alternative explanations for the observed data. An analysis of the impact of a single motif module on the global dynamics of a network is studied in. Yet another recent work suggests that certain topological features of biological networks naturally give rise to the common appearance of canonical motifs, thereby questioning whether frequencies of occurrences are reasonable evidence that the structures of motifs are selected for their functional contribution to the operation of networks.