---
title: 'FOLTY: Triadic Temporal Motif Framework'
url: https://www.emergentmind.com/topics/folty
type: topic
---

# FOLTY: Triadic Temporal Motif Framework

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 \(H\) is sought inside a large input network \(G\), but extends ordinary triadic temporal motif queries by supporting both **existential** and **thresholded universal** quantifiers [2507.17215]. 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 \(\tau\)-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 [2507.17215].

## 1. Formal setting and query model

FOLTY operates on a **temporal network** \(G=(V,E)\), where each temporal edge is a triple \((u,v,t)\) with a timestamp, and multiple temporal edges may exist between the same pair of vertices. The corresponding **underlying static graph** \(G_S\) is obtained by removing timestamps and directions [2507.17215]. The motif predicate of interest is triadic: it involves three vertices \(u,v,w\) and specifies a temporal triangle pattern through direction constraints, ordering constraints, and a time-window bound such as “within one hour” [2507.17215].

The paper defines a **thresholded First Order Logic triadic query** as
\[
Q_1 u \; Q_2 v \; Q_3 w \; \phi(u,v,w),
\]
where each \(Q_i\) is either \(\exists\) or a thresholded universal quantifier \(\forall_\tau\), with \(\tau \in (0,1)\) [2507.17215]. The semantics are local rather than global in the classical logical sense: \(\exists u\) requires the existence of a witness \(u\), while \(\forall_\tau u\) requires the remainder of the formula to hold for **at least a \(\tau\)-fraction** of the relevant universe, typically a neighborhood. The paper’s informal reading is explicit: \(\forall_\tau\) means “for at least a \(\tau\)-fraction of the neighbors” [2507.17215].

A representative example is
\[
\exists u \exists v \forall_{1/2} w \in N(v)\,\phi(u,v,w),
\]
which asks for vertices \(u,v\) such that at least half of the neighbors \(w\) of \(v\) make \(\phi(u,v,w)\) true [2507.17215]. The notion of a **solution** depends on the existential structure of the query. For \(\exists\exists\forall\), the solution is a pair \((u,v)\); for \(\exists\forall\exists\) and \(\exists\forall\forall\), the solution is a single vertex; and for \(\exists\exists\exists\), it is a triple [2507.17215].

This query language is intended to separate ordinary temporal motif detection from richer thresholded semantics. A classical triadic temporal query asks for triples \((u,v,w)\) 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 \(w\) where \((u,w)\) is an edge, \((v,w)\) is also an edge within an hour” [2507.17215]. 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 \(\delta\)-temporal triangle consists of temporal edges \((u,v,t_1)\), \((u,w,t_2)\), and \((v,w,t_3)\) satisfying
\[
t_1 \leq t_2 \leq t_3 \leq t_1 + \delta.
\]
Equivalently, for a fixed temporal edge \(e=(u,v,t)\), the edge \(e\) forms a \(\delta\)-temporal triangle with \(w\) if there exist \((u,w,t_2)\) and \((v,w,t_3)\) such that
\[
t \leq t_2 \leq t_3 \leq t + \delta
\]
[2507.17215].

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 \((u,v,w)\), but to determine whether sufficiently many witnesses \(w\) satisfy the predicate relative to a local universe such as \(N(v)\) [2507.17215].

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 \(\tau\)-fraction of neighbors” [2507.17215]. 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 [2507.17215]. 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 [2507.17215]. The algorithm begins with the underlying static graph \(G_S\), computes a **degeneracy ordering** \(\pi\), and orients every static edge from smaller to larger order. If \(\alpha\) denotes the degeneracy, then each vertex has at most \(\alpha\) out-neighbors under this orientation [2507.17215].

The orientation step is crucial because it imports the classical sparsity control embodied by the Chiba–Nishizeki bound:
\[
\sum_{e \in E(G)} d_e = O(m\alpha),
\]
where \(d_e\) is the degree of the lower-degree endpoint of edge \(e\) [2507.17215]. FOLTY adapts this orientation framework to temporal motifs rather than static triangle listing.

For the main \(\exists\exists\forall_\tau\) query, FOLTY maintains two arrays for every temporal edge \(e\): **in-count** and **out-count**. These record the number of relevant in-neighbors and out-neighbors, respectively, that form at least one \(\delta\)-temporal triangle with \(e\) [2507.17215]. The threshold test is then
\[
\text{in-count}[e] + \text{out-count}[e] \geq \tau |N(v)|
\]
for \(e=(u,v,t)\), in which case \(e\) is a solution to the \(\exists u \exists v \forall_\tau w \in N(v)\) query [2507.17215].

The same pair of arrays is reused to answer other query types after reduction to the \(\exists\exists\forall\) core, specifically \(\exists \forall_{\tau_1}\forall_{\tau_2}\) and \(\exists \forall_\tau \exists\) [2507.17215]. 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 [2507.17215]. 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 \((u,v)\in G_\pi^\to\) and each out-neighbor \(w\in N^+_\pi(u)\) adjacent to \(v\). It forms three timestamp-sorted temporal edge lists,
\[
L_1 = E_{u,v}, \quad L_2 = E_{u,w}, \quad L_3 = E_{v,w},
\]
and uses a set of helper primitives [2507.17215].

These primitives are:

- \(\text{FindExceedingEntryLS}(L_1,L_2)\): for each edge in \(L_1\), find the first edge in \(L_2\) with timestamp at least that edge’s timestamp.
- \(\text{FindExceedingEntryBS}(L_2,L_3)\): for each edge in \(L_2\), binary-search in \(L_3\) for the first edge with timestamp at least the timestamp of the edge in \(L_2\).
- \(\text{FindBoundingEntry}(L_1,L_3,\delta)\): a bounding primitive used to determine whether the temporal window condition can be satisfied [2507.17215].

Using these routines, FOLTY can determine whether an edge \(e\in L_1\) participates in a valid temporal triangle with \(w\) in essentially linear time in the list sizes [2507.17215]. The correctness criterion is stated in the paper as an equivalence: an edge \(e=(u,v,t)\) forms at least one \(\delta\)-temporal triangle with \(w\) if and only if the selected timestamp witnesses satisfy the triangle ordering condition [2507.17215].

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** [2507.17215]. For each static edge \(\{u,v\}\), the algorithm creates two segment trees, \(T_{u,v}\) and \(T_{v,u}\). For an in-neighbor \(w\), it constructs a collection of intervals
\[
I_{w,u,v} := \left\{ [\max\{0, t(L_{23}[e])-\delta\}, t(e)] \;\middle|\; e\in L_2,\; t(e)\le t(L_{23}[e])\le t(e)+\delta \right\},
\]
where \(L_{23}[e]\) is the first edge in \(L_3\) not earlier than \(e\) [2507.17215].

The key theorem states:
\[
\text{The temporal edge } e=(u,v,t) \text{ forms at least one }\delta\text{-temporal triangle with } w
\]
if and only if there exists an interval in \(I_{w,u,v}\) containing \(t\) [2507.17215]. The segment tree then serves as an interval accumulator: intervals from many in-neighbors are inserted, and a lookup at timestamp \(t\) 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 [2507.17215]:

| 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 [2507.17215]. 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 [2507.17215]. This is a practical discretization choice tied directly to the data layout.

## 5. Complexity and implementation characteristics

The theoretical running time of FOLTY is
\[
O(m \alpha \log \sigma_{\max}),
\]
where \(m\) is the number of temporal edges, \(\alpha\) is the maximum core number or degeneracy of the static graph, and \(\sigma_{\max}\) is the maximum multiplicity of any static edge [2507.17215]. The paper states that this matches the **best known running time for sparse temporal triangle counting**, and up to the \(\log \sigma_{\max}\) factor it matches the classical \(O(m\alpha)\) Chiba–Nishizeki bound for static triangle counting [2507.17215].

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 \(\alpha\) 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** [2507.17215]. The implementation uses precomputed static adjacency, timestamp-sorted edge lists \(E_{x,y}\), and \(O(1)\) 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 [2507.17215].

The helper routines `FindExceedingEntryLS`, `FindExceedingEntryBS`, `FindBoundingEntry`, and the segment-tree operations are described as central to the implementation [2507.17215]. 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** [2507.17215]. The reported datasets are **CollegeMsg**, **email-Eu-core-Temporal**, **sx-mathoverflow**, **sx-superuser**, **sx-askubuntu**, **wiki-talk-temporal**, and **sx-stackoverflow** [2507.17215]. For \(\exists\exists\forall\) 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 [2507.17215]. For \(\exists\forall\exists\), the paper reports about **1746 seconds** on StackOverflow, and for \(\exists\forall\forall\) it reports similarly strong performance [2507.17215].

The main empirical comparison is against a triangle-enumeration baseline, **BT (`MinTemporalMotif`)**. FOLTY is reported as consistently faster for the \(\exists\exists\forall\) and \(\exists\forall\forall\) tasks because it does not incur the full cost of enumerating all triangles first [2507.17215]. This aligns with the framework’s design goal of direct query answering.

The paper also reports several qualitative trends [2507.17215]. As the threshold \(\tau\) increases, the number of solutions generally decreases. Beyond relatively high thresholds such as \(70\%\) or \(75\%\), the number of solutions often flattens, suggesting that many surviving solutions are already highly cohesive. As the time window \(\delta\) 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 [2507.17215]. 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 [2507.17215].

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 [2507.17215]. 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 [2507.17215]. 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.

Source: https://www.emergentmind.com/topics/folty