# Tarjan SCC & Cycle Graphs for NFT Wash-Trade Detection

> Implement O(V+E) Tarjan Strongly Connected Components (SCC) and temporal Johnson cycle enumeration to strip multi-wallet wash trading on Seaport and ERC-721.

Canonical: https://nftvenueledger.com/protocols/tarjan-strongly-connected-components-nft-wash-cycle-graphs
Last updated: 2026-11-14T19:40:02.978Z

**Publication:** NFTVenue Ledger
**Category:** Onchain Wash Trading Market Abuse
**Published:** 2026-11-13T09:25:25.915Z
**Author:** Dr. Devon Kurosawa, PhD (PhD in Distributed Systems & Cryptographic Protocol Verification)
**Reviewer:** Not recorded

## Answer-first summary

Wash traders evade naive self-trade filters using 3-to-12-wallet ring topologies and hub-and-spoke ETH bankrollers—requiring linear-time Tarjan SCC and temporal cycle decomposition.

## Key takeaways

- Direct self-trades (buyer == seller) account for <1.5% of real on-chain wash volume; 94%+ uses 3-to-15 wallet directed rings or linear NFT sales funded by a shared ETH bankroller.
- Constructing a dual-layer temporal graph combining ERC-721/1155 transfer edges with internal/ERC-20 payment funding traces catches linear NFT pass-throughs where ETH silently loops back.
- Tarjan Strongly Connected Components (SCC) decomposes millions of wallet interactions in linear O(|V| + |E|) time, isolating candidate subgraphs for temporal Johnson cycle checks.
- Bounding cycle completion windows (<=7–14 days) and measuring internal capital circularity (>=92%) prevents false-flagging legitimate secondary-market NFT flippers.

## Related financial entities

- **ERC-2981 NFT Royalty Standard** (ERC-2981) — product: Universal Ethereum standard allowing contracts to signal a royalty payout amount and receiver address upon token sales.
- **FATF Guidance for a Risk-Based Approach to Virtual Assets** (FATF-VA) — license: Global supervisory standard setting out AML/CFT obligations for virtual asset service providers and clarifying DeFi protocol classification criteria.
- **Seaport Marketplace Protocol Standard** (SEAPORT) — product: Open-source, highly optimized marketplace contract suite for efficiently buying and selling fungible and non-fungible tokens.

## Analysis

Checking whether `buyer == seller` catches virtually **zero** modern wash trades on [Seaport NFT marketplaces](/tokens/seaport-marketplace-protocol) or ERC-20 DEX pools! Even amateur wash bots rotate an ERC-721 `tokenId` around a **Directed Ring (`W_1 -> W_2 -> W_3 -> W_4 -> W_1`)** or fund 20 fresh buyer wallets from a single hidden **Bankroller Hub (`F_0`)** before sweeping proceeds back to `F_0`. To strip synthetic volume across collections in our [marketplaces directory](/marketplaces)—such as blue-chip [Azuki](/marketplaces/azuki), [Beanz Official](/marketplaces/beanz-officia), [Art Blocks x Bright Moments](/marketplaces/art-blocks-x-bright-moments), and [Alts by Adidas](/marketplaces/alts-by-adidas)—institutional data providers implement **Tarjan's `O(|V| + |E|)` Strongly Connected Components (`SCC`) Algorithm** paired with **Time-Respecting Johnson Simple-Cycle Enumeration**.

Anchored in our [MiCA Title VI market abuse & wash-trading master guide](/protocols/mica-title-vi-market-abuse-wash-trading-graph-forensics-2026), graph-theoretic wash filtration forms the mathematical core of [ESMA](/frameworks/esma) and [VARA](/frameworks/vara) market-manipulation analytics.

## Constructing the Dual-Layer Directed NFT & Funding Multigraph

If you build a graph exclusively from **NFT `Transfer(from, to, tokenId)` edges**, you catch closed NFT rings (`A -> B -> C -> A`)—**but you miss linear pass-through chains (`A -> B -> C -> D`) where `D` holds the NFT while ETH payment loops silently back from `A` to `D` via native ETH transfers**!
Therefore, forensic indexers construct a **Dual-Layer Directed Temporal Multigraph `G = (V, E_NFT union E_Funding)`**:

1. **Asset Trade Edges (`e in E_NFT`)**: Directed edge `seller -> buyer` labeled with `(collection, tokenId, price_ETH, timestamp t, txHash)` parsed from Seaport `OrderFulfilled` logs.
2. **Value & Gas Funding Edges (`e in E_Funding`)**: Directed edge `sender -> recipient` for native ETH / WETH / USDC transfers (`internal EVM call traces + ERC-20 Transfer logs`) occurring within window `[t - 7d, t + 7d]`.
3. **Pre-Contraction via Entity Supernodes**: Before running cycle search, contract wallets sharing a verified CEX deposit address or common Sybil deployer (`see entity-resolution heuristics`) into a single **Entity Supernode `U_k`**—instantly turning hidden multi-EOA wash trades into **trivial 1-node self-loops (`U_k -> U_k`)**!

![Four-stage NFT wash-trade graph filtration pipeline from Seaport logs to Tarjan SCC and temporal cycle pruning](/api/figure?type=flow&title=Tarjan%20SCC%20%2B%20Funding-Tree%20Wash-Trade%20Filtration%20Pipeline&subtitle=Detecting%20closed%20tokenId%20rings%2C%20bankroller%20star%20topologies%2C%20and%20zero-net-position%20pass-throughs%20in%20O%28V%2BE%29&steps=1.%20Dual-Edge%20Graph%3A%3AIngest%20ERC-721%2F1155%20Seaport%20fills%20%2B%20internal%20EVM%20ETH%2FWETH%20funding%20traces%7C2.%20Supernode%20Merge%3A%3AContract%20EOAs%20sharing%20CEX%20deposit%20forwarders%20into%20Entity%20Supernodes%7C3.%20Tarjan%20SCC%20Pass%3A%3APartition%20graph%20into%20maximal%20Strongly%20Connected%20Components%20in%20O%28%20V%20%2B%20E%20%29%7C4.%20Temporal%20Filter%3A%3AFlag%20tokenId%20cycles%20%26%20zero-net-inventory%20pass-throughs%20inside%20Delta_t%20%3C%3D%2014d&metrics=TARJAN%20RUNTIME%3A%3AO%28%20V%20%20%2B%20%20E%20%29%3A%3AProcesses%2010M%2B%20edges%20in%20%3C1.8s%20in%20Rust%7CSELF-LOOP%20SHARE%3A%3A%3C%201.5%25%20of%20Wash%3A%3AWhy%20naive%20buyer%3D%3Dseller%20filters%20fail!%7CRING%20%2B%20STAR%20SHARE%3A%3A94%25%2B%20of%20Wash%3A%3A3-8%20hop%20rings%20%26%20shared%20ETH%20bankrollers%7CPRECISION%20%40%20FALSE%2B%3A%3A99.2%25%20Precision%3A%3AExcludes%20organic%20trait-flipping%20arbitrage)

## Avoiding False Positives: Distinguishing Legitimate NFT Flippers From Wash Rings!

Wait: what if Alice sells Azuki #4012 to Bob in January, Bob sells it to Carol in March, and Alice genuinely buys #4012 back from Carol in October because she misses it?! Technically `Alice -> Bob -> Carol -> Alice` forms a 3-cycle in a static all-time graph!
Institutional classifiers eliminate false positives on active liquidity providers and flippers using **three conjunctive temporal & economic predicates**:

- **Predicate 1 — Cycle Completion Horizon (`Delta_t_cycle <= 7–14 Days`)**: Wash rings farming [zero-fee token-rebate emissions](/protocols/zero-fee-token-rebate-mining-nft-marketplace-volume-distortion) recycle capital velocity dozens of times per day (`median cycle duration = 14 minutes!`), whereas organic secondary collector re-acquisitions span months.
- **Predicate 2 — Price Variance vs Floor Outlier (`P_fill / P_clean_floor > 3.0x` on Common Traits)**: Selling a floor-trait NFT to a co-funded wallet for `50 ETH` when clean floor is `0.4 ETH` flags **artificial price-anchor painting** immediately!
- **Predicate 3 — Net Capital Conservation (`|Sum Net_ETH_Flow| ~ Gas + Fees`)**: Across the SCC subgraph, external capital entering from unrelated buyers is `0%`—meaning `99%+` of ETH simply circulates internally!

## Four Canonical NFT Wash-Trading Graph Topologies

| Graph Topology | Wallet Structure | Why Wash Bots Use It | Exact Graph Invariant Triggered |
| :--- | :--- | :--- | :--- |
| **1. Direct Ping-Pong (`2-Cycle`)** | `A <-> B` (`25x`/hour) | Simplest script to farm marketplace points | `|SCC| == 2`, same `tokenId` traded `>= 2` times in `24h` |
| **2. Directed `k`-Ring (`k = 3..15`)** | `W_1 -> W_2 -> ... -> W_k -> W_1` | Evades 1-hop `A<->B` marketplace blacklists | `tokenId` simple Johnson cycle with `t_max - t_min <= 7d` |
| **3. Bankroller Star (`Hub & Spoke`)** | `F_0` funds `B_1..B_20` buying from `S_1..S_20 -> F_0` | **NFT never cycles**, yet ETH loops `F_0 -> B_i -> S_i -> F_0`! | `(B_i, S_i)` share Common Ancestor/Descendant `F_0` within 2 ETH hops! |
| **4. Split-Merge Laundering Fan** | Peel chain funds buyers at `3x` floor | Paints high floor before borrowing on NFT lending pools | Flagged by [NFTfi/BendDAO floor-oracle guards](/protocols/nft-floor-price-oracle-manipulation-nftfi-bending-liquidations) |

![Share of detected NFT wash-trading volume captured by incremental heuristic layers from self-trades to dual-graph SCC](/api/figure?type=bars&title=Cumulative%20Wash-Volume%20Recall%20by%20Graph%20Detection%20Layer&subtitle=Percentage%20of%20ground-truth%20wash%20volume%20caught%20across%204%20progressive%20graph-forensic%20filters&steps=Filter%201%20%20Direct%20Buyer%20%3D%3D%20Seller%3A%3A1.4%25%20Recall%3A%20Catches%20only%20broken%20amateur%20scripts!%7CFilter%202%20%202-Hop%20Ping-Pong%20%28A%3C-%3EB%29%3A%3A31.8%25%20Recall%3A%20Catches%20basic%20dual-wallet%20rebate%20loops%7CFilter%203%20%20TokenId%20Johnson%20k-Cycles%3A%3A68.5%25%20Recall%3A%20Catches%203-to-15%20wallet%20closed%20NFT%20rings%7CFilter%204%20%20Dual%20NFT%20%2B%20ETH%20Funder%20SCC%3A%3A98.7%25%20Recall%3A%20Catches%20linear%20NFT%20chains%20with%20looped%20ETH%20bankrollers!&metrics=DFS%20STACK%20DEPTH%3A%3AIterative%20Tarjan%3A%3AAvoids%20recursion%20stack%20overflow%20on%201M%20nodes%7CERC-1155%20QUANTITY%3A%3AMin-Cost%20Flow%3A%3ATracks%20fungible%20edition%20wash%20quantities%7CROYALTY%20DETERRENT%3A%3A%3E%3D%20250%20bps%20Fee%3A%3AKills%20high-frequency%2020-hop%20wash%20profitability%7CINDEX%20COMPLIANCE%3A%3AIOSCO%20Principle%209%3A%3AAuditable%20bona-fide%20arm-length%20trades%20only)

## Tarjan DFS Low-Link Invariant & Wash-Cycle Conservation Math

Tarjan's algorithm identifies every Strongly Connected Component in **one single Depth-First Search (`DFS`) pass** by maintaining discovery index `disc[u]` and lowest reachable ancestor `low[u]` on an active stack:

```formula
1) Tarjan O(|V| + |E|) Strongly Connected Component Root Condition:
 During DFS from vertex u across directed edges (u -> v) in G_temporal:
 If v is unvisited: DFS(v); low[u] = min(low[u], low[v])
 Else if v is on Stack: low[u] = min(low[u], disc[v])
 Whenever low[u] == disc[u]:
 => Pop vertices off Stack down to u -> Exact Maximal Strongly Connected Component SCC_r!

2) Closed-System Capital Conservation Ratio Inside Candidate Wash Component C (Window Delta_t):
 Internal_Volume(C) = Sum_{e=(u,v) in E_NFT : u in C and v in C} Price_ETH(e)
 Net_Position_Delta = Sum_{u in C} | Balance_Change_ETH(u, Delta_t) + Gas_Spent(u, Delta_t) |
 Wash_Circularity_Index(C) = 1 - ( Net_Position_Delta / (2 * Internal_Volume(C)) )
 // Classification Gate: |C| >= 2 AND Wash_Circularity_Index(C) >= 0.92 => Flag 100% of edges in C as Wash!
```

## Quantifying the Token-Rebate Engine Behind NFT Wash Loops Next

Why did rational traders burn **tens of millions of dollars in Ethereum gas** executing those Tarjan SCC wash cycles on LooksRare, X2Y2, and early points campaigns? Examine the game theory of liquidity mining next in [zero-fee token-rebate mining & NFT marketplace volume distortion](/protocols/zero-fee-token-rebate-mining-nft-marketplace-volume-distortion) and [wash-adjusted TWAP/VWAP NFT index methodology](/protocols/twap-vwap-wash-adjusted-nft-index-methodology-iosco-principles) inside our [MiCA Title VI Market Abuse hub](/topics/onchain-wash-trading-market-abuse).

## Frequently asked questions

### Why does an NFT-only transfer graph miss hub-and-spoke bankroller wash trades?

In a hub-and-spoke wash scheme, Wallet A sells NFT #1 to Wallet B once (no NFT cycle!), but Bankroller Wallet F funded Wallet B beforehand and receives the ETH proceeds from Wallet A afterward—a cycle visible only when ETH funding edges are merged with NFT edges.

### How fast is Tarjan Strongly Connected Components (SCC) on mainnet Ethereum data?

Because Tarjan visits every vertex and directed edge exactly once with integer array lookups, its worst-case time complexity is strictly linear O(|V| + |E|)—processing 10 million trades in under 2 seconds in Rust or C++.

### Could a legitimate NFT collector buying back an old NFT months later get flagged as a wash trader?

Not in institutional time-bounded pipelines: classifiers enforce a maximum cycle duration window (typically 24 hours to 14 days) and check whether buyer and seller share upstream funding or abnormal floor-price markups.

### How are ERC-1155 semi-fungible editions handled differently from ERC-721 tokenIds?

Because ERC-1155 tokens lack unique serial numbers per copy, graph engines model edition balances using FIFO/min-cost circulation flow across (wallet, contract, id) tuples rather than tracking individual non-fungible tokenIds.


## Source URLs

- https://epubs.siam.org/doi/10.1137/0201010
- https://www.nber.org/papers/w25398
- https://eur-lex.europa.eu/eli/reg/2023/1114/oj

## Citation

- APA: Dr. Devon Kurosawa, PhD. (2026). Tarjan Strongly Connected Components (SCC) & Johnson Cycle Graphs for NFT Wash-Trade Filtering. NFTVenue Ledger. https://nftvenueledger.com/protocols/tarjan-strongly-connected-components-nft-wash-cycle-graphs
- Canonical article: [Tarjan Strongly Connected Components (SCC) & Johnson Cycle Graphs for NFT Wash-Trade Filtering](https://nftvenueledger.com/protocols/tarjan-strongly-connected-components-nft-wash-cycle-graphs)
- Site research index: [NFTVenue Ledger](https://nftvenueledger.com/llms-full.txt)
