Sub topic 12
Using graph analysis to find mule networks
This chapter assumes you have read the earlier chapters on funnel accounts, mule networks, and fan-in detection. It also assumes you can read short Python.
Why look at a graph
Rules such as the fan-in query judge one account at a time. A mule network spreads activity across many accounts, so each account can look ordinary. The pattern only shows up when you look at the links between accounts.
A graph is a set of nodes joined by edges. In AML work:
- A node is an account, a customer, or a shared attribute such as a device, phone number, or address.
- An edge is a relationship, such as a transfer from one account to another.
What a mule network looks like
Recruited mules receive money, then pass it to a collector. The collector forwards it to a cash-out point. The structure is a tree that narrows toward the exit.
Three measures help you spot this shape:
- In-degree is the number of distinct senders to a node. A high value is the fan-in signal.
- Connected component is a group of nodes joined by any path of edges. A component that contains several flagged accounts suggests one network.
- Shared attributes are links outside transfers, such as the same device ID on accounts with different owners.
Finding connected components
The function below groups accounts into components with a breadth-first search. It uses only the standard library.
from collections import defaultdict, deque
def components(transfers):
"""transfers: iterable of (source, destination, amount)."""
graph = defaultdict(set)
for src, dst, _ in transfers:
graph[src].add(dst)
graph[dst].add(src)
seen = set()
result = []
for start in graph:
if start in seen:
continue
comp = set()
queue = deque([start])
seen.add(start)
while queue:
node = queue.popleft()
comp.add(node)
for nxt in graph[node]:
if nxt not in seen:
seen.add(nxt)
queue.append(nxt)
result.append(comp)
return result
transfers = [
("m1", "hub", 900), ("m2", "hub", 950), ("m3", "hub", 880),
("m4", "hub", 910), ("m5", "hub", 940),
("hub", "cashout", 4400),
("alice", "bob", 50),
]
for comp in components(transfers):
if len(comp) >= 4:
print(sorted(comp))The output is:
['cashout', 'hub', 'm1', 'm2', 'm3', 'm4', 'm5']The small alice and bob component is ignored because it is below the size cutoff. In practice, you would combine this with the earlier detection rules. Start from accounts flagged by flag_passthrough, then pull in their component to see who else is involved.
Common errors
- Merging everything through a hub. A payroll provider, a landlord, or a large merchant connects thousands of unrelated accounts into one huge component. Remove known high-degree legitimate nodes before computing components.
- Ignoring time. Two accounts that transacted once, years apart, are not a network. Build the graph from a bounded review window.
- Ignoring direction and amount. An undirected component shows who is connected, not where the money flowed. Check the direction and the amounts to confirm the pass-through pattern.
- Treating a link as proof. Family members share addresses and devices. A shared attribute is a reason to look, not a conclusion.
From graph to case
A component gives an investigator a list of accounts to pull customer due diligence files for. Compare each account's expected activity with what the graph shows. Mules recruited through job scams often have little history and no business reason to receive money from many strangers.
Exercise
A component contains 4,000 accounts and includes one flagged collector. What is the most likely cause, and what should you do before reviewing it?
Show answer
A high-degree legitimate node, such as a payroll provider or large merchant, is probably joining unrelated accounts. Remove known legitimate hubs, limit the graph to a short time window, and recompute the components before reviewing.