FOLTY: Triadic Temporal Motif Framework
- FOLTY is an algorithmic framework that applies thresholded first-order logic to triadic queries on temporal networks, enabling richer motif analysis.
- It combines existential and thresholded universal quantifiers to detect temporal triangles under ordered, bounded time constraints without full enumeration.
- The method leverages degeneracy orientation, specialized segment trees, and efficient data structures to achieve performance comparable to the best static triangle-counting bounds.
Searching arXiv for the target paper and closely related temporal motif-mining context. FOLTY, short for First Order Logic Triadic Yielder, is an algorithmic framework for answering thresholded First-Order Logic (FOL) triadic queries on temporal networks. It is introduced in the context of motif analysis, where a small pattern graph is sought inside a large input network , but extends ordinary triadic temporal motif queries by supporting both existential and thresholded universal quantifiers (Bhalerao et al., 23 Jul 2025). In this formulation, the target is no longer limited to asking whether a single temporal triangle exists. Instead, the framework supports higher-level structural conditions such as whether at least a -fraction of a vertex’s relevant neighbors satisfy a temporal motif predicate. The paper positions this as a way to mine richer information than standard motif counting, while retaining running time comparable to the best known bounds for sparse temporal triangle counting (Bhalerao et al., 23 Jul 2025).
1. Formal setting and query model
FOLTY operates on a temporal network , where each temporal edge is a triple with a timestamp, and multiple temporal edges may exist between the same pair of vertices. The corresponding underlying static graph is obtained by removing timestamps and directions (Bhalerao et al., 23 Jul 2025). The motif predicate of interest is triadic: it involves three vertices and specifies a temporal triangle pattern through direction constraints, ordering constraints, and a time-window bound such as “within one hour” (Bhalerao et al., 23 Jul 2025).
The paper defines a thresholded First Order Logic triadic query as
where each is either or a thresholded universal quantifier 0, with 1 (Bhalerao et al., 23 Jul 2025). The semantics are local rather than global in the classical logical sense: 2 requires the existence of a witness 3, while 4 requires the remainder of the formula to hold for at least a 5-fraction of the relevant universe, typically a neighborhood. The paper’s informal reading is explicit: 6 means “for at least a 7-fraction of the neighbors” (Bhalerao et al., 23 Jul 2025).
A representative example is
8
which asks for vertices 9 such that at least half of the neighbors 0 of 1 make 2 true (Bhalerao et al., 23 Jul 2025). The notion of a solution depends on the existential structure of the query. For 3, the solution is a pair 4; for 5 and 6, the solution is a single vertex; and for 7, it is a triple (Bhalerao et al., 23 Jul 2025).
This query language is intended to separate ordinary temporal motif detection from richer thresholded semantics. A classical triadic temporal query asks for triples 8 that form a prescribed temporal triangle. A thresholded FOL query instead asks how frequently a local structural relation holds across a neighborhood, for example whether “for half of the 9 where 0 is an edge, 1 is also an edge within an hour” (Bhalerao et al., 23 Jul 2025). This suggests a shift from fixed-instance pattern detection to local, quantified motif semantics.
2. Temporal triangle semantics and expressive scope
The core predicate studied in the paper is a temporal triangle. For the concrete motif used by FOLTY, a 2-temporal triangle consists of temporal edges 3, 4, and 5 satisfying
6
Equivalently, for a fixed temporal edge 7, the edge 8 forms a 9-temporal triangle with 0 if there exist 1 and 2 such that
3
(Bhalerao et al., 23 Jul 2025).
This temporal semantics matters because FOLTY is not merely counting static wedges or static triangles. It evaluates whether timestamped interactions satisfy an ordered, bounded temporal constraint. The distinction becomes especially important when the query contains a thresholded universal quantifier, since the task is no longer to enumerate every valid 4, but to determine whether sufficiently many witnesses 5 satisfy the predicate relative to a local universe such as 6 (Bhalerao et al., 23 Jul 2025).
The paper emphasizes that ordinary triadic motif queries can express standard triangle patterns but do not naturally encode statements such as “for most neighbors” or “for at least a 7-fraction of neighbors” (Bhalerao et al., 23 Jul 2025). The thresholded FOL formalism is introduced to capture this gap. The motivating examples include scatter-gather and bipartite money-laundering patterns, where the number of intermediate vertices is not fixed in advance (Bhalerao et al., 23 Jul 2025). A plausible implication is that the framework is intended for settings where structural prevalence, rather than isolated existence, is the relevant signal.
3. Algorithmic design: orientation, counts, and direct query answering
The central technical goal is to evaluate thresholded queries without enumerating all temporal triangles. FOLTY addresses this by combining degeneracy orientation, sparse triangle listing, and specialized temporal data structures (Bhalerao et al., 23 Jul 2025). The algorithm begins with the underlying static graph 8, computes a degeneracy ordering 9, and orients every static edge from smaller to larger order. If 0 denotes the degeneracy, then each vertex has at most 1 out-neighbors under this orientation (Bhalerao et al., 23 Jul 2025).
The orientation step is crucial because it imports the classical sparsity control embodied by the Chiba–Nishizeki bound: 2 where 3 is the degree of the lower-degree endpoint of edge 4 (Bhalerao et al., 23 Jul 2025). FOLTY adapts this orientation framework to temporal motifs rather than static triangle listing.
For the main 5 query, FOLTY maintains two arrays for every temporal edge 6: in-count and out-count. These record the number of relevant in-neighbors and out-neighbors, respectively, that form at least one 7-temporal triangle with 8 (Bhalerao et al., 23 Jul 2025). The threshold test is then
9
for 0, in which case 1 is a solution to the 2 query (Bhalerao et al., 23 Jul 2025).
The same pair of arrays is reused to answer other query types after reduction to the 3 core, specifically 4 and 5 (Bhalerao et al., 23 Jul 2025). This reuse is a defining aspect of the framework: FOLTY is not presented as a family of unrelated procedures, but as a core counting-and-threshold mechanism that can serve several quantified triadic query forms.
A central point in the paper is that FOLTY answers the query directly rather than by first enumerating all temporal triangles and then post-processing them (Bhalerao et al., 23 Jul 2025). This distinction is algorithmically significant because thresholded FOL queries are solution-oriented: they ask whether enough witnesses exist, not how many total motif instances occur. The design of the in-count and out-count arrays reflects that change in objective.
4. Temporal primitives and segment-tree machinery
The algorithmic treatment of out-neighbors and in-neighbors differs substantially. For out-neighbors, FOLTY considers a directed static edge 6 and each out-neighbor 7 adjacent to 8. It forms three timestamp-sorted temporal edge lists,
9
and uses a set of helper primitives (Bhalerao et al., 23 Jul 2025).
These primitives are:
- 0: for each edge in 1, find the first edge in 2 with timestamp at least that edge’s timestamp.
- 3: for each edge in 4, binary-search in 5 for the first edge with timestamp at least the timestamp of the edge in 6.
- 7: a bounding primitive used to determine whether the temporal window condition can be satisfied (Bhalerao et al., 23 Jul 2025).
Using these routines, FOLTY can determine whether an edge 8 participates in a valid temporal triangle with 9 in essentially linear time in the list sizes (Bhalerao et al., 23 Jul 2025). The correctness criterion is stated in the paper as an equivalence: an edge 0 forms at least one 1-temporal triangle with 2 if and only if the selected timestamp witnesses satisfy the triangle ordering condition (Bhalerao et al., 23 Jul 2025).
For in-neighbors, the situation is harder because the relevant vertices are not all accessible through the oriented source’s out-neighborhood. The solution is an interval representation combined with segment trees (Bhalerao et al., 23 Jul 2025). For each static edge 3, the algorithm creates two segment trees, 4 and 5. For an in-neighbor 6, it constructs a collection of intervals
7
where 8 is the first edge in 9 not earlier than 0 (Bhalerao et al., 23 Jul 2025).
The key theorem states: 1 if and only if there exists an interval in 2 containing 3 (Bhalerao et al., 23 Jul 2025). The segment tree then serves as an interval accumulator: intervals from many in-neighbors are inserted, and a lookup at timestamp 4 returns how many distinct in-neighbors generated a covering interval.
The insertion process is designed to avoid duplicate counting. A naive approach may overcount the same in-neighbor multiple times, so the paper introduces a three-phase procedure with node colors (Bhalerao et al., 23 Jul 2025):
| Phase | Operation | Purpose |
|---|---|---|
| 1 | Mark canonical nodes as grey without updating counters | Delay counting |
| 2 | Recolor only a subset of grey nodes that are “highest” along white paths | Avoid duplicates from nested intervals |
| 3 | Update counters only at surviving grey nodes, using a Vertex field | Prevent incorrect merging across in-neighbors |
The Vertex field records the most recent vertex that caused a node’s counter to be updated (Bhalerao et al., 23 Jul 2025). The paper also notes that the segment trees are built on the timestamps of the edges between a pair of vertices rather than on all real-valued interval endpoints. If an inserted interval does not align with timestamps, it is mapped by binary search to the maximal contained timestamp interval (Bhalerao et al., 23 Jul 2025). This is a practical discretization choice tied directly to the data layout.
5. Complexity and implementation characteristics
The theoretical running time of FOLTY is
5
where 6 is the number of temporal edges, 7 is the maximum core number or degeneracy of the static graph, and 8 is the maximum multiplicity of any static edge (Bhalerao et al., 23 Jul 2025). The paper states that this matches the best known running time for sparse temporal triangle counting, and up to the 9 factor it matches the classical 00 Chiba–Nishizeki bound for static triangle counting (Bhalerao et al., 23 Jul 2025).
This complexity claim is central to the significance of the framework. The query language is richer than ordinary existential motif counting, yet the asymptotic cost remains tied to the same sparsity parameter 01 that controls efficient triangle processing in static graphs. This suggests that the main computational burden is still local sparse-triangle structure, not the logical quantification layer itself.
The implementation is given in C++ and is designed for commodity hardware, specifically an Intel Xeon Platinum 8380 CPU (Bhalerao et al., 23 Jul 2025). The implementation uses precomputed static adjacency, timestamp-sorted edge lists 02, and 03 access to those lists. It stores two temporal edge lists per static edge direction and relies on the degeneracy orientation to keep the number of expensive triangle-like operations bounded (Bhalerao et al., 23 Jul 2025).
The helper routines FindExceedingEntryLS, FindExceedingEntryBS, FindBoundingEntry, and the segment-tree operations are described as central to the implementation (Bhalerao et al., 23 Jul 2025). This emphasizes that the framework’s efficiency is not solely a matter of asymptotic design; it also depends on careful temporal indexing and pairwise list access.
6. Empirical behavior, scope restrictions, and significance
The empirical evaluation uses SNAP temporal datasets ranging from around 50K edges to nearly 70M edges (Bhalerao et al., 23 Jul 2025). The reported datasets are CollegeMsg, email-Eu-core-Temporal, sx-mathoverflow, sx-superuser, sx-askubuntu, wiki-talk-temporal, and sx-stackoverflow (Bhalerao et al., 23 Jul 2025). For 04 queries, runtimes range from fractions of a second on smaller graphs to about 956 seconds on the largest StackOverflow graph with about 63.5M edges, while still producing tens of thousands of solutions (Bhalerao et al., 23 Jul 2025). For 05, the paper reports about 1746 seconds on StackOverflow, and for 06 it reports similarly strong performance (Bhalerao et al., 23 Jul 2025).
The main empirical comparison is against a triangle-enumeration baseline, BT (MinTemporalMotif). FOLTY is reported as consistently faster for the 07 and 08 tasks because it does not incur the full cost of enumerating all triangles first (Bhalerao et al., 23 Jul 2025). This aligns with the framework’s design goal of direct query answering.
The paper also reports several qualitative trends (Bhalerao et al., 23 Jul 2025). As the threshold 09 increases, the number of solutions generally decreases. Beyond relatively high thresholds such as 10 or 11, the number of solutions often flattens, suggesting that many surviving solutions are already highly cohesive. As the time window 12 increases, the number of solutions typically increases, since a larger window makes the motif constraints easier to satisfy.
The scope of the method is deliberately restricted. FOLTY focuses on triadic queries and on predicates based on a temporal triangle (Bhalerao et al., 23 Jul 2025). It does not solve general FOL queries over arbitrary motifs, although the authors suggest that the techniques may generalize. The method assumes access to the temporal network as a static graph plus timestamped edge lists sorted by time. It also assumes that the universe of the universal quantifier is typically a neighborhood or a similar local set, though the paper remarks that intersections of neighborhoods can also be handled with modest changes (Bhalerao et al., 23 Jul 2025).
Another restriction is that the framework does not allow queries beginning with a universal quantifier, because such queries do not naturally yield a set of solutions in the proposed formulation. The paper notes, however, that these can often be transformed using negation and De Morgan’s laws (Bhalerao et al., 23 Jul 2025). A common misconception would therefore be to regard FOLTY as a general-purpose temporal FOL engine; it is more precisely a triadic temporal motif framework with thresholded universal quantification and solution-oriented semantics.
Within those limits, FOLTY is significant because it reframes temporal motif analysis as a richer logical querying problem while preserving near-optimal triangle-counting complexity (Bhalerao et al., 23 Jul 2025). Rather than asking only whether a temporal triangle exists, it can ask how broadly a temporal relation propagates across a local neighborhood. This suggests a substantive extension of motif analysis from fixed-size pattern enumeration toward logic-driven temporal graph mining.