MG-Tree: Temporal Motif Mining Structure
- MG-Tree is a tree data structure that organizes ordered δ-temporal motif sequences by sharing common edge prefixes, reducing redundant computations.
- It hierarchically groups motifs with common early edges, enabling efficient co-mining and improved performance across CPU and GPU implementations.
- Its linear construction and targeted co-mining algorithm lead to significant speed-ups, with reported improvements of 2.4× on CPUs and 1.7× on GPUs.
Searching arXiv for the specified paper and closely related temporal motif mining context. Motif-Group Tree (MG-Tree) is a rooted tree data structure introduced in the Mayura framework to support unified mining of multiple -temporal motifs by exploiting shared structure and temporal ordering across motifs. In Mayura, temporal graphs are treated as evolving interaction networks, and motif mining is framed as exact search over ordered edge sequences with strictly increasing timestamps and duration bounded by . The MG-Tree organizes a set of motifs by their common edge-prefixes so that redundant computation can be eliminated during mining: common sub-sequences are matched once, and divergent suffixes are explored only when needed. This organization underlies Mayura’s co-mining algorithm and its CPU/GPU implementations, which report average speed-ups of on the CPU and on the GPU over state-of-the-art techniques that mine each motif individually, while maintaining exactness for high-stakes applications (Singapuram et al., 20 Jul 2025).
1. Formal definition
Let be a set of -temporal motifs, where each motif is an ordered sequence of edges with strictly increasing timestamps and duration . The Motif-Group Tree, denoted , is defined as a rooted tree whose nodes capture all common prefixes of motif-edge sequences (Singapuram et al., 20 Jul 2025).
Its node set 0 is a collection of nodes 1. For each node 2, three attributes are stored. First, 3 is the common prefix motif, represented as a sequence of edges
4
with 5 for every descendant motif 6. Second, 7 denotes the immediate children of 8. Third, 9 is a pointer to the query motif whose full edge-sequence equals 0, and it is empty when no motif is completed at that node (Singapuram et al., 20 Jul 2025).
A parent-to-child tree edge 1 exists exactly when 2 extends 3 by one additional edge:
4
The root node 5 is unique and has 6 equal to the longest prefix common to all motifs in 7, possibly the empty sequence. By construction, for every motif 8 there exists exactly one node 9 with 0, and the union of all 1 along any root-to-leaf path recovers each motif (Singapuram et al., 20 Jul 2025).
This definition makes the MG-Tree a prefix-sharing structure over ordered temporal motif edge sequences rather than a general-purpose trie over arbitrary graph patterns. A plausible implication is that its utility depends directly on the extent to which a motif set exhibits shared early-edge structure.
2. Hierarchical organization and computational reuse
The MG-Tree is motivated by the observation that many temporal motifs share an initial chain of edges in the same relative order. The hierarchy places common sub-sequences 2 once at their lowest common ancestor, while deeper extensions for distinct motifs are attached at the point where the motifs diverge (Singapuram et al., 20 Jul 2025).
The canonical example given for the structure is a pair of motifs 3 and 4 that both begin with edges 5 and 6 but differ in their third edge. These motifs share a node 7 with
8
and each then has its own child node, 9 and 0, for the distinct third edges (Singapuram et al., 20 Jul 2025). At runtime, any search matching the first two edges is explored once and then forked to the relevant children, instead of rescanning the data graph from scratch for each motif.
This reuse mechanism is central to Mayura’s claim of “temporal co-mining.” The MG-Tree does not merely cluster motifs offline; it changes the execution strategy of the matcher. The practical effect is that search paths corresponding to shared prefixes are amortized across all descendant motifs. This suggests that the benefit of the structure grows when motifs share long common prefixes and declines when the motif set diverges early.
3. Construction procedure and complexity
MG-Tree construction begins from a list of motifs 1. For each motif 2, a map 3 is built from timestamp positions to static edges, and a leaf node corresponding to the full edge sequence is conceptually associated with that motif. A root node is then created with unique identifier 4, empty prefix 5, and 6 (Singapuram et al., 20 Jul 2025).
Construction proceeds through a recursive procedure 7. At each depth 8, motifs are grouped by the static edge appearing at timestamp position 9. For each such edge-group, the algorithm either reuses the parent node when the entire motif group remains undiverged or allocates a new child node when divergence occurs. The new child stores as its prefix the length-0 prefix of any motif in the child group. If a motif terminates at depth 1, then 2 is set to that motif; otherwise the recursion continues to depth 3 (Singapuram et al., 20 Jul 2025).
The reported complexity is linear in the product of the number of motifs and the maximum motif length. With 4 and
5
each depth 6 scans at most 7 motifs to group them by their 8-th edge, yielding total work 9. Node insertion and identifier management are stated to be 0 amortized, and the resulting MG-Tree contains at most 1 nodes (Singapuram et al., 20 Jul 2025).
The significance of this bound is methodological rather than purely asymptotic. Construction cost is controlled tightly enough that the data structure can be treated as a lightweight preprocessing phase relative to the downstream mining workload.
4. Co-mining algorithm
Once the MG-Tree is built, Mayura replaces a single-motif recursive matcher with a tree-guided procedure denoted 2, where 3 is the temporal graph, 4 is a node in the MG-Tree, 5 is the temporal window, and 6 indicates how many edges of the current prefix 7 have been matched (Singapuram et al., 20 Jul 2025).
The current motif prefix is taken as 8. If 9, then the prefix has been matched completely. At that point, one match is reported only when 0. The procedure then iterates over each child 1 and recurses on that child without discarding the partially matched edge stack. This is the point at which shared computation is realized: the already matched prefix is reused for every child motif under the current node (Singapuram et al., 20 Jul 2025).
If the current prefix has not yet been fully matched, the algorithm extracts the next motif edge 2 and consults the previous motif-to-graph vertex mappings from the stack. Candidate graph edges are then taken either from 3 when the source vertex is already mapped, or from the full edge set when no prior mapping exists. Each candidate is checked for two classes of constraints. Temporal ordering requires
4
and
5
Structural isomorphism constraints are enforced by maintaining bidirectional maps 6 and 7 together with an incident count array 8 (Singapuram et al., 20 Jul 2025).
When a candidate passes these checks, it is pushed onto the stack, the vertex mappings are updated through 9, recursion continues with 0, and the state is restored by popping the stack and invoking 1 (Singapuram et al., 20 Jul 2025).
A common misconception would be to view the MG-Tree as changing the semantics of motif matching. The Mayura formulation explicitly states that exactness is preserved: co-mining alters only how shared prefixes are traversed, not the temporal or structural validity conditions imposed on a match.
5. CPU and GPU realization
Mayura couples the MG-Tree with specialized runtime techniques for both CPUs and GPUs. On the CPU side, the framework replaces a generic recursive 2 routine with fully unrolled nested loops corresponding to each level of an MG-Tree path. Each loop is specialized to iterate over an adjacency-list slice—either 3 or the full edge list—with its own bounds. This specialization improves branch prediction and eliminates function-call overhead. OpenMP pragmas are placed at the outermost loop so that threads share distinct first-edge subproblems (Singapuram et al., 20 Jul 2025).
On the GPU side, the implementation includes several code-generation and scheduling techniques. Register-bound context mapping statically allocates registers 4 to hold up to 5 motif-to-data-vertex mappings, eliminating global or static memory accesses for 6 and 7. Predicated control-flow converts small structural checks into predicated instructions in CUDA PTX and SASS, thereby avoiding warp divergence. Expression simplification combines multiple comparison chains into single LUT operations where possible, reducing instruction count and register pressure (Singapuram et al., 20 Jul 2025).
Load balancing is organized in two tiers. Intra-warp balancing allows active threads to split their candidate lists for the same MG-Tree node when other threads in the warp are idle. Inter-warp balancing offloads contexts—partial match stacks plus candidate pointers—to global memory at epoch boundaries so that idle warps can steal work and improve occupancy. The graph itself is stored in a CSR-like layout with each adjacency list sorted by timestamp, which allows temporal pruning to terminate early once 8. The implementation uses 32-bit edge indices and 64-bit timestamps to minimize memory footprint (Singapuram et al., 20 Jul 2025).
These implementation choices show that the MG-Tree is not only a logical abstraction but also a code-generation target. A plausible implication is that the data structure’s value derives from the interaction between search reuse and architecture-aware execution, rather than from prefix grouping in isolation.
6. Similarity measure and empirical behavior
Mayura evaluates the MG-Tree on diverse real-world datasets: wtt (Wiki-talk), sxo (StackOverflow), trr (Reddit reply), eth (Ethereum), and eqx (Equinix internet traffic, subsampled bipartite graph), with edge counts up to 9. Time windows 0 are chosen per dataset, with “1 day for wtt” given as an example (Singapuram et al., 20 Jul 2025).
The experiments use eight motif groups covering “depth” (chains), “fanout” (stars), and “heterogeneous” sets of cycles and trees. To quantify prefix sharing, Mayura defines a similarity metric
1
which measures the fraction of edges in 2 that can be shared (Singapuram et al., 20 Jul 2025).
The reported performance results are summarized below.
| Setting | Reported result |
|---|---|
| CPU (40-core Xeon) | average 3 over single-motif baseline; peak 4 on eqx bipartite |
| GPU (NVIDIA A40) | average 5; peak 6 on eqx |
| Code-level effect | instruction count reduced by up to 7; register pressure / occupancy trade-offs held within 8 |
The empirical trend is that gains increase with 9, and groups with 00 see the largest speed-ups (Singapuram et al., 20 Jul 2025). Mayura further recommends co-mining only when
01
so that algorithmic savings outweigh additional control-flow overhead on the GPU (Singapuram et al., 20 Jul 2025).
This threshold should be interpreted carefully. It is presented as a practical heuristic rather than as a theorem about optimality. The underlying claim is not that low-similarity groups cannot benefit, but that the control-flow overhead may dominate when shared prefixes are insufficiently abundant.
7. Position within temporal motif mining
Within Mayura, the MG-Tree is the central mechanism that unifies the mining of multiple temporal motifs by exploiting “inherent structural and temporal commonalities” across query motifs (Singapuram et al., 20 Jul 2025). Conventional motif mining approaches are described as treating each query independently, which incurs substantial redundant computation when similar substructures exist across multiple motifs. The MG-Tree addresses this specifically by organizing related motifs hierarchically and enabling reuse of common search paths during exact temporal matching (Singapuram et al., 20 Jul 2025).
The conceptual contribution is therefore not a new motif semantics, nor a relaxation of exact matching, but a reorganization of multi-query execution. In summary, the MG-Tree is characterized in Mayura as “a simple but powerful tree of common edge-prefixes” with linear construction cost 02, reduced redundant DFS exploration, and substantial speed-ups on both CPUs and GPUs when combined with code-generation and load-balancing techniques (Singapuram et al., 20 Jul 2025).
A plausible implication is that MG-Tree-like organizations may be relevant wherever query families admit shared ordered prefixes under exact temporal constraints. In the form presented by Mayura, however, the structure is defined specifically for sets of 03-temporal motifs represented as ordered edge sequences and deployed inside a co-mining runtime for temporal graphs (Singapuram et al., 20 Jul 2025).