Mayura: Temporal Co-Mining for Motif Analysis
- Mayura is a system for exact, high-performance co-mining of temporal motifs in graphs, employing a hierarchical Motif-Group Tree to reuse shared search paths.
- It organizes related motifs into a common prefix tree that reduces redundant candidate exploration by mining shared temporal subpatterns only once.
- The system leverages both CPU and GPU runtimes with tailored load balancing and optimization strategies, achieving significant speedups in fraud detection and cybersecurity applications.
Searching arXiv for the specified paper to ground the article and citation. Mayura is a system for exact, high-performance co-mining of multiple temporal motifs in large temporal graphs. It is introduced in "Mayura: Exploiting Similarities in Motifs for Temporal Co-Mining" (Singapuram et al., 20 Jul 2025) and targets workloads in which several related motifs must be mined at once, a setting that arises in fraud detection, cybersecurity, and dynamic network analysis. Its central premise is that independently mining each query motif wastes work when motifs share structural edge prefixes and temporal orderings. Mayura addresses that redundancy by organizing motifs into a Motif-Group Tree (MG-Tree), reusing partial matches across related motifs, and providing CPU and GPU runtimes that preserve exactness while reducing repeated candidate exploration (Singapuram et al., 20 Jul 2025).
1. Problem setting and conceptual basis
Temporal graphs encode time-stamped interactions between entities. In the formalism used by Mayura, a temporal graph is a directed, time-stamped edge set over a vertex set, and temporal motifs are small, time-ordered patterns whose counts or enumerations serve as signals in anti-money laundering (AML), fraud rings, phishing cascades, insider-threat sequences, social interaction dynamics, and power grid events (Singapuram et al., 20 Jul 2025). The motivating inefficiency is that conventional motif mining approaches treat each query independently, even when multiple motifs share early temporal and structural subpatterns.
The canonical example in the paper is that a 3-cycle and a 4-cycle may share their first two time-ordered edges. If they are mined separately, the graph is re-traversed along the same paths multiple times. Mayura co-mines them once along the shared prefix and then branches. This design makes Mayura a multi-query exact temporal motif miner rather than a single-query optimization. The paper’s stated objective is not approximation, sketching, or relaxed matching, but exact counting and enumeration with strict isomorphism semantics (Singapuram et al., 20 Jul 2025).
A useful distinction in the paper is between common prefixes and motif-specific suffixes. Common prefixes are mined once, while divergence points induce branching in the search. This shifts the computational unit from an isolated motif to a hierarchy of related motifs. A plausible implication is that Mayura is most effective when query design itself reflects domain families of patterns rather than unrelated one-off motifs; the paper formalizes this dependence through its Similarity Metric and confirms it empirically (Singapuram et al., 20 Jul 2025).
2. Formal model of temporal motifs and counting
Mayura defines a temporal graph as
where is a set of vertices and is an ordered list of temporal edges,
with and . Edges are chronologically ordered with unique timestamps, and vertices and edges may carry attributes (Singapuram et al., 20 Jul 2025).
A -temporal motif is an ordered sequence of edges with relative time order and window,
with 0. A motif instance in 1 must satisfy strict temporal order and a time window:
2
Matches are strict subgraph isomorphisms between motif vertices and data graph vertices, using a bijective mapping that adheres to the motif’s edge directions and time constraints (Singapuram et al., 20 Jul 2025).
The exact counting objective is
3
Mayura supports both counting and enumeration, although the paper focuses primarily on counting. The baseline exact miner, following Mackey et al., uses chronological edge-driven backtracking with an e_stack of matched edges in increasing timestamp order, bijective mappings m2g and g2m between motif and graph vertices, and incnt, an incident count per graph vertex over currently matched edges. It selects candidates for each motif edge, prunes by temporal constraints, enforces structural constraints, and recurses until all motif edges are matched, then increments the count 4 (Singapuram et al., 20 Jul 2025).
This baseline is exact but query-isolated. Mayura preserves the same temporal and structural semantics while replacing repeated per-motif search with shared search over a motif hierarchy.
3. MG-Tree: hierarchical organization of shared temporal prefixes
The MG-Tree is the core data structure through which Mayura exploits commonality among motifs. Let 5 be a set of 6-temporal motifs. The MG-Tree, denoted 7, is a rooted tree whose nodes are triples
8
where 9 is a motif prefix common to all descendants, 0 is the set of immediate descendants formed by extending that prefix, and 1 is either 2 or a reference to some query motif 3 when 4 (Singapuram et al., 20 Jul 2025).
The paper imposes three defining properties. First, for any descendant 5, the first 6 edges equal 7, so the node stores a true common prefix. Second, 8 is the longest proper prefix of each child’s common motif. Third, every query motif appears exactly once as some nonempty 9, and the root node has 0 equal to the longest common prefix shared by all motifs in 1 (Singapuram et al., 20 Jul 2025).
Construction proceeds by first building, for each motif 2, a TMap from motif timestamps to edges. A leaf node is inserted for each motif with 3, 4, and empty children. A root node with empty prefix and empty query reference is then created. The recursive CreateTree procedure partitions the current motif group by their edge at timestamp 5 using TMap; if some motif in the subgroup has 6, then the parent’s common motif equals a query motif and Q_parent is set accordingly. If the subgroup does not split, the parent is reused; otherwise an intermediate node is created with prefix edges 7, inserted under the parent, and recursion continues on timestamp 8 (Singapuram et al., 20 Jul 2025).
The principal significance of the MG-Tree is that it identifies “common search paths.” For a shared prefix, mining 9 explores e_stack once and amortizes that work over all children. It also exposes hierarchical parallelism, because sibling subtrees can be mined independently once the common prefix has been matched (Singapuram et al., 20 Jul 2025).
The illustrative example in the paper considers three motifs whose first two edges are identical: 0 and 1. One child leaf corresponds to a 3-cycle with third edge 2; another child is an intermediate node for an extended path, with leaf children depending on the fourth edge. Matching the prefix once allows Mayura to branch without revisiting the same partial matches.
4. Co-mining algorithm and exactness guarantees
Mayura’s co-mining algorithm replaces a single-motif recursive miner with traversal guided by the MG-Tree. The main routine TemporalCoMining(G, N_root, δ) invokes CoMatchEdge(G, N_root, δ, e_idx=0). For a node 3, the algorithm lets 4, the common motif at that node. If e_idx = |E(M)|, then the common prefix has been fully matched; if 5, the count for that motif is incremented and the current e_stack may be recorded for enumeration. The algorithm then recursively mines each child node using the current e_stack as a partial match (Singapuram et al., 20 Jul 2025).
If the current prefix is not yet fully matched, the algorithm selects candidates for the next motif edge. When the motif source vertex is already mapped in m2g, candidates are restricted to its out-edges in the adjacency list; otherwise all graph edges may be considered. Each candidate is filtered by temporal constraints: if e_idx > 0 and the candidate timestamp is earlier than the previous matched edge, it is rejected; if e_idx > 0 and the candidate would violate the 6 window relative to the first matched edge, it is also rejected. Structural constraints then enforce consistency of the current bijection. Valid candidates are pushed onto e_stack, the mappings and incidence counts are updated via RollOnEdge, recursion proceeds to e_idx + 1, and then the context is restored via RollBackEdge (Singapuram et al., 20 Jul 2025).
The paper’s exactness argument has four parts. First, strict isomorphism is maintained because m2g and g2m enforce bijective correspondence throughout exploration, while incnt identifies when a mapping can be released during backtracking. Second, temporal validity is maintained because the algorithm enforces 7 and 8 at every extension. Third, each motif 9 is counted only at the unique node where 0, eliminating duplicate counts from shared prefixes. Fourth, in parallel GPU execution, sibling exploration is restricted or partitioned so that any specific search path is explored by exactly one thread (Singapuram et al., 20 Jul 2025).
The paper therefore states that Mayura’s counts equal 1 for each motif in the motif group. This directly addresses a common misconception about shared-search systems: Mayura is not a heuristic coalescing of approximate searches, but an exact multi-query miner with no double-counting under its stated assumptions.
5. Similarity metric, cost model, and computational behavior
Mayura’s cost model begins from the observation that independent mining cost scales with the number of candidate combinations explored per motif; with 2 motif edges, this is roughly the product of candidate counts per level after pruning. Co-mining changes this scaling by amortizing work spent on a shared prefix 3 across all descendants. If a prefix is shared by 4 motifs and exploring that prefix costs 5, then Mayura pays 6 once instead of 7 (Singapuram et al., 20 Jul 2025).
To quantify reuse potential, the paper proposes the Similarity Metric (SM):
8
where 9 is the number of edges in motif 0. Higher SM implies greater commonality and more reuse opportunities. The empirical results reported in the paper state that observed speedups follow SM trends, while also being modulated by hardware utilization and load balance (Singapuram et al., 20 Jul 2025).
The paper’s toy example makes the savings explicit. For co-mining 1, 2, and 3, suppose the number of candidate 4 edges is 5, and for each, the number of valid 6 edges after temporal pruning is 7. Independent mining evaluates the prefix 8 three times, costing approximately 9 candidate checks before branching. Mayura mines the shared prefix once at cost 0 and then branches, yielding approximately 1 instead of 2, for a savings of approximately 3 candidate checks (Singapuram et al., 20 Jul 2025).
This suggests that the principal determinant of Mayura’s benefit is not merely motif count, but overlap structure: many motifs with little shared prefix are less favorable than fewer motifs with deep common temporal prefixes.
6. Runtime architecture on CPU and GPU
Mayura’s workflow consists of compile-time preprocessing and runtime execution. At compile time, the system builds CSR-like adjacency with edges sorted by time, constructs the MG-Tree, generates backend-specific code specialized to that tree, and compiles the result. At runtime, it loads the graph into host or GPU memory, schedules work across threads or warps, maintains thread-local context such as e_stack, mappings, and counters, and aggregates counts (Singapuram et al., 20 Jul 2025).
The CPU backend distributes candidates for the first edge across threads and uses dynamic task scheduling to balance load. Its code generation unrolls recursive calls into nested loops tailored to MG-Tree levels. The paper reports that this produces predictable control flow, improves branch predictor accuracy, and reduces overhead (Singapuram et al., 20 Jul 2025).
The GPU backend uses two-level load balancing. Intra-warp balancing periodically polls idle threads and redistributes candidate ranges using warp-level primitives; only one source thread explores siblings to avoid duplicate counts, except under sibling-splitting. Inter-warp balancing periodically detects idle warps using global memory flags, serializes thread contexts—partial match stacks and candidate lists—to global memory, repartitions candidate ranges across warps, restores contexts, and resumes mining (Singapuram et al., 20 Jul 2025).
The paper identifies four GPU-specific optimizations. Register-bound context mapping replaces flexible array-based mapping with fixed registers such as 4 derived from MG-Tree motif sizes, eliminating memory accesses and reducing latency. Predicated execution compiles structural checks into predicated arithmetic and logic operations to avoid branch divergence. Expression simplification fuses logical operations into LUT instructions, reducing instruction count and register pressure. Finally, sibling-splitting and multi-offload increase parallelism across the hierarchy: sibling-splitting assigns sibling node exploration to a nominated idle thread within a warp, while multi-offload decomposes serialized contexts across multiple hierarchy levels so that resuming work distributes MG-Tree nodes across warps (Singapuram et al., 20 Jul 2025).
The architectural trade-off is explicit in the paper. Co-mining reduces instruction counts but can reduce occupancy because more per-thread state is required. The GPU optimizations are therefore not incidental; they are mechanisms for recovering performance that would otherwise be lost to warp divergence, register pressure, and uneven search-tree workloads.
7. Empirical evaluation, applications, and limitations
The evaluation uses five real-world datasets and compares Mayura with Mackey et al.’s chronological edge-driven exact miner on CPU and Everest on GPU (Singapuram et al., 20 Jul 2025).
| Dataset | Scale | Temporal setting |
|---|---|---|
| wiki-talk (wtt) | 1.14M vertices, 7.83M temporal edges | 5 day, time span 6.24 years |
| stackoverflow (sxo) | 2.60M vertices, 63.50M edges | 6 day, span 7.6 years |
| reddit-reply (trr) | 8.90M vertices, 646.04M edges | 7 hours, span 10.1 years |
| ethereum (eth) | 66.32M vertices, 628.81M edges | 8 hour, span 3.58 years |
| equinix (eqx) | 6.21M vertices, 872.12M edges | 9ms, span 23.46 minutes; subsampled to fit GPU memory (37.5% edges) |
The query workload contains fourteen motifs grouped into eight queries with MG-Trees emphasizing depth-focused groups 0, fanout-focused groups 1, and heterogeneous groups 2. Across datasets and motif groups, the paper reports an overall average speed-up of approximately 3 on CPU and approximately 4 on GPU, with maximum speedups up to approximately 5 on CPU and approximately 6 on GPU (Singapuram et al., 20 Jul 2025).
The reported microarchitectural effects are equally central. Mayura yields 7 fewer dynamic instructions due to shared prefix pruning and code generation, and the GPU predication and LUT fusion alleviate 8 of divergence penalties. On CPU, the paper attributes speedups to fewer instructions and improved branch throughput. On GPU, the paper notes that co-mining can reduce occupancy because per-thread state increases, but that active threads per warp and workload balance improve after the proposed optimizations (Singapuram et al., 20 Jul 2025).
The dataset-dependent behavior is also explicit. The eqx bipartite traffic dataset shows exceptional speedups because many motifs are impossible when edges within the same partition are disallowed, allowing shared prefix pruning to eliminate entire subtrees. By contrast, eth and trr have higher motif match density 9; threads spend longer on each node, which limits sibling exploration concurrency and reduces co-mining benefit. Smaller windows 0 yield larger speedups than larger windows 1 because temporal pruning is more effective and trees are narrower; the GPU backend’s finer-grained load balancing reduces this sensitivity relative to CPU (Singapuram et al., 20 Jul 2025).
The applications emphasized in the paper include AML and fraud detection, where common prefixes such as 2 occur across multiple rapid-transaction schemes; cybersecurity, where login sequences, privilege escalation patterns, and beaconing cascades share initial temporal edges; social and diffusion analysis, where triadic closures and directed reciprocations share early interactions; and energy disaggregation, where repeated device activation sequences share early event edges (Singapuram et al., 20 Jul 2025).
The limitations are equally well-defined. Benefits depend on inter-motif similarity, and low-SM groups such as C1 may see limited gains. GPU performance can even degrade modestly when overlaps are small because register footprint and warp divergence increase. Larger 3 widens search trees and dilutes pruning and reuse. High match density 4 serializes exploration at nodes, limiting sibling parallelism. The graph model assumes directed edges with unique timestamps and strict isomorphism with chronological order; Mayura does not target homomorphism or snapshot-based definitions. Resource pressure is nontrivial on GPU: the paper reports that increasing per-thread registers from 44 to 67 reduces active blocks by approximately 5 when co-mining many motifs, while context serialization for inter-warp balancing uses approximately 6 of dataset-sized global memory (Singapuram et al., 20 Jul 2025).
For reproducibility, the implementation uses MG-Tree construction, CSR-like adjacency lists sorted by timestamps, C++ with OpenMP for CPU, CUDA C for GPU, backend-specific code generation tailored to the MG-Tree, and periodic intra- and inter-warp balancing with interval parameters INTRA_INTERVAL and INTER_INTERVAL. The datasets are drawn from SNAP, Reddit reply, Ethereum via Zenodo, and Equinix traffic. The paper reports exactness, algorithms, and parameters, but does not include a public code release link. This suggests that reproduction is facilitated by standard graph representations and publicly available datasets, but not by an already packaged reference implementation (Singapuram et al., 20 Jul 2025).