graphfaker
Synthetic graph data that behaves like the real thing.
GraphFaker generates graph data that behaves the way real people and real money do: customers paid on payday, rent leaving on the first, the same few shops and people paid again and again, friends who know each other's friends, and not one real person in the data. You describe the graph you need, or pick a ready-made domain such as a bank with laundering patterns, and GraphFaker produces the entities, the relationships between them and the events over time, with a record of everything it planted. Use it to build and demo graph applications without touching real data, to benchmark graph databases and algorithms at any size, and to train and evaluate fraud detectors, entity resolution and knowledge-graph pipelines against a known answer.
Join our Discord server: 
The authors and GraphGeeks Lab do not hold any responsibility for the correctness of this generator.
Why graphs need their own generator
Tabular generators such as NVIDIA Data Designer, SDV and Mostly AI produce rows. A graph needs more than rows joined together: a degree distribution with hubs, clustering and communities, events that happen in a plausible order over time, and labels for what was injected. None of that comes from generating a table of people and a table of payments and joining them. Data Designer generates the tables; GraphFaker generates the connections.
The graphs people most want to test against, such as who pays whom, who knows whom, or who shares a device with whom, are the ones that cannot be shared. GraphFaker makes them, and because it made them it can tell you the answer: which accounts are the mules, which two nodes are the same person, which community a node belongs to.
Install
pip install graphfaker
pip install "graphfaker[osm]" # the OpenStreetMap fetcher (osmnx and its geo stack, about 150 MB)
pip install "graphfaker[examples]" # adds matplotlib, ladybug and jupyter for the notebooks
pip install "graphfaker[llm]" # `graphfaker schema draft "<a description>"`
The fraud pack, the coordination pack, the social domain, schemas and every sink are in the base install. Database clients, the PyG export and the schema drafter are extras: [neo4j], [ladybug], [duckdb], [pyg], [llm]. graphfaker info shows which are installed. Nothing in a generated dataset depends on [llm]: a model writes a schema file, you read it, and the engine generates from the file.
Or without a Python environment, as a container (docs):
docker run --rm -v "$PWD/bank:/data" ghcr.io/graphgeeks-lab/graphfaker fraud --scale 0.01 --seed 42 --out /data
For development:
git clone https://github.com/graphgeeks-lab/graphfaker.git
cd graphfaker
uv venv && uv pip install -e ".[dev,examples]"
Three things to try
See what can be generated:
graphfaker domains
Generate a bank with labelled laundering patterns, written to disk with its ground truth:
graphfaker generate fraud --scale 0.01 --hardness medium --seed 42 --out ./bank
--scale 0.01 is the size (about 100,000 accounts and 900,000 transactions; 1.0 is a full-size bank). --hardness medium is how well the fraud hides among normal activity. --seed 42 is any whole number you choose; run the same command with the same seed on any machine and you get the same data, change it and you get a different bank of the same shape. The options are explained under Command line.
Load it into an embedded graph database and ask it a question in Cypher:
pip install "graphfaker[ladybug]"
graphfaker generate fraud --scale 0.01 --seed 42 --out ./bank --sink ladybug
import ladybug
conn = ladybug.Connection(ladybug.Database("bank/graph.lbdb"))
conn.execute("MATCH (a:Account)-[t:TRANSFERS]->(b:Account) WHERE t.amount > 9000 RETURN a.id, count(t) ORDER BY count(t) DESC LIMIT 5").get_all()
The same from Python:
from graphfaker import GraphFaker
from graphfaker.domains import fraud
G = GraphFaker(seed=42).generate_graph(source="faker", total_nodes=500, total_edges=2500) # a social graph, as NetworkX
run = fraud.generate(scale=0.01, hardness="medium", seed=42) # the bank, as tables plus truth
Where to read next
What you can generate
| domain |
what it is |
how |
social |
people, places, organizations, events and products; a few hubs and many quiet nodes, friends who know each other's friends, communities whose members are alike, organizations as big as their headcount |
GraphFaker.generate_graph(source="faker") or graphfaker generate social |
fraud |
a bank: customers, accounts, merchants, devices, counterparties; a realistic transaction process; eleven labelled laundering typologies with decoys and a measured hardness |
graphfaker fraud or graphfaker generate fraud |
coordination |
a social platform: accounts, topics, devices; follows, posts, reshares and replies over time; eight labelled coordination playbooks, organic bursts that look exactly like them, and a measured tradecraft level |
graphfaker generate coordination |
supply_chain |
a supplier network in tiers with plants, warehouses, customers, products, carriers and the officers of the few companies that have any; orders, shipments, invoices and deliveries over time; four labelled procurement patterns, legitimate structures that leave the same trace, and a measured hardness level |
graphfaker generate supply_chain |
| your own |
a GraphSchema, or a process with injected patterns |
docs/adding-a-domain.md |
Real-world sources, loaded rather than generated:
| source |
what it gives you |
osm |
road, walking or cycling networks from OpenStreetMap, by place name, address or bounding box (pip install "graphfaker[osm]") |
flights |
airline, airport and flight-leg networks from BTS on-time data, for a month or a date range |
WikiFetcher |
Wikipedia page text, sections, links and references as JSON, for building your own graph or RAG pipeline |
senzing |
a company register you supply, in Senzing's entity resolution format: organisations, their locations and their officers. One file, a directory of shards or a zip, with --state and --city to cut a national export down to a graph (--fetcher senzing --path register.jsonl) |
List the domains and their options with graphfaker domains.
Schemas
A synthetic graph is declared as a GraphSchema: node types with attribute samplers, latent factors shared across them, edge families, and a topology model. The social graph is one; you can read it, change it and save it.
from graphfaker import GraphFaker, GraphSchema
from graphfaker.domains import social
schema = social.schema(total_nodes=1000, total_edges=8000, communities=8)
schema.to_yaml("social.yaml")
schema = GraphSchema.from_yaml("social.yaml")
run = GraphFaker(seed=42).generate(schema)
run.tables.nodes["Person"] # a Polars frame per node type
run.tables.edges["WORKS_AT"] # a Polars frame per relationship
run.truth["community"] # the latent groups and their parameters
run.manifest # schema digest, seed, shard size, versions
run.write("out/") # nodes/, edges/, truth/, schema.yaml, manifest.json
G = run.to_networkx() # the NetworkX view
A small schema of your own:
from graphfaker.schema import *
schema = GraphSchema(
name="tiny_payments",
latent=[LatentFactor(name="region", groups=4, params={"log_wealth": GaussianSampler(mean=8, sd=0.6)})],
nodes=[
NodeType(name="Account", count=500, attributes={
"owner": FakerSampler(provider="name"),
"balance": LognormalSampler(mu="@region.log_wealth", sigma=1.0, decimals=2),
"tier": CategorySampler(values=["basic", "plus", "premium"], weights=[7, 2, 1]),
}),
],
edges=[EdgeType(source="Account", target="Account", share=1.0,
relationships=[Relationship(name="PAYS", attributes={"amount": UniformSampler(low=5, high=500, decimals=2)})])],
total_edges=4000,
topology=SocialTopology(group="region"),
)
A parameter written as "@factor.param" varies by latent group. That is how attributes end up correlated with each other and, through the topology model, with structure. The samplers are constant, category, subcategory, uniform, gaussian, lognormal, poisson, bernoulli, faker, expression, reference, mixture and foreign_key. The full mechanism is in docs/how-it-works.md.
The fraud pack
A bank's transaction graph is the most useful dataset a fraud team cannot share. GraphFaker generates one that behaves like it without containing anyone: customers, accounts, merchants and devices with correlated attributes; a transaction process with salaries, rent, repeat partners and seasonality; and money-laundering typologies injected on top with every account, role and transaction recorded. Realism is measured, not asserted (degree distribution, clustering, communities, assortativity against a random baseline), and so is how hard the fraud is to find (the AUC of every single-feature rule a detector would try first). The result loads into Neo4j, LadybugDB or DuckDB and verifies against the files it came from, with a blind copy for honest benchmarks. No real customer data goes in, so none can come out.
fraud.generate builds a bank and a period of activity: salary on payday, rent on the first, subscriptions, card payments that follow merchant popularity, transfers that go mostly to the same few contacts, seasonality by hour and weekday, amounts that scale with income. Then it injects laundering typologies and records them.
from graphfaker.domains import fraud
from graphfaker.domains.fraud.hardness import hardness_report, realism_report
from graphfaker.domains.fraud.evaluate import evaluate
run = fraud.generate(scale=0.01, hardness="high", seed=42, workers=8)
run.tables.edges["TRANSFERS"] # source, target, tx_id, timestamp, amount, memo, recurring
run.truth["patterns"] # pattern_id, typology, is_fraud, accounts, roles, start, end
run.truth["accounts"] # account_id, pattern_id, typology, role, is_fraud
run.truth["transactions"] # tx_id, pattern_id, typology, is_fraud
print(hardness_report(run).summary())
print(evaluate(run, flagged_accounts=my_detector(run)).summary())
scale follows gen-fraud-graph: 1.0 is about 10M accounts and 90M transactions.
The typologies are fan_in, fan_out, gather_scatter, scatter_gather, cycle, stack, bipartite (the AMLworld set), plus structuring (deposits under the reporting threshold), mule_network (pass-through within hours, a shared device, freshly opened accounts), bust_out (credit built up then maxed out) and synthetic_identity (customers sharing phone, address and device). The edge tables carry no labels, and transaction ids are assigned in time order so the id does not reveal what was injected.
hardness (low, medium, high) blends signature amounts into legitimate ones, spreads timing from hours to weeks, overlaps rings, shrinks ring sizes, keeps or strips normal activity on pattern accounts, and adds decoys: payroll fan-outs, marketplace fan-ins and supplier cycles that are labelled as not fraud. hardness_report measures the result: for each single feature a simple rule might threshold on (amount, round amounts, proximity to the threshold, degree, pass-through, burstiness, account age), the AUC it achieves against the truth. On a 20K-account run:
| hardness |
transaction amount AUC |
best account-level feature AUC |