Detect Circular Money Flows in a Payment Transaction Graph
Problem
Given a list of payment transactions [senderId, receiverId, amount], detect all cycles in the directed transaction graph — circular money flows that may signal fraud or represent netted settlement rings. Return the full cycle path, not just a boolean.
Input / Output
- Input: list of
[senderId, receiverId, amount]edges. - Output: the cycles found, each as the ordered list of accounts on the cycle.
Constraints
- Up to 10^5 transactions.
- Account IDs are strings (UUIDs in production).
Example
- transactions = [["A","B",100],["B","C",200],["C","A",150],["D","E",50]] → [["A","B","C"]] (cycle A→B→C→A).
added …