Repository navigation
v1.0.0
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. 1.0 is the first stable release.
pip install graphfaker==1.0.0
graphfaker fraud --scale 0.01 --seed 42 --out ./bank
graphfaker load duckdb ./bankOr without a Python environment:
docker run --rm -v "$PWD/bank:/data" ghcr.io/graphgeeks-lab/graphfaker:1.0.0 fraud --scale 0.01 --seed 42 --out /dataThe changes below landed after 0.6.1.
What 1.0 means
- The public API is stable for 1.x:
GraphSchemaand its samplers,generate,GraphRun,GraphTables,Manifest,fingerprint, the domain registry, the sinks, the metrics andGraphFakeritself. Names are added, not removed or changed in meaning; anything to be removed is deprecated first and kept for the rest of 1.x. The documentation is the contract: if the docs and the code disagree, the code is wrong. - Reproducibility is scoped to a version. Within one release of GraphFaker, a dataset is a pure function of the schema (or the domain and its options), the seed and the shard size: the same inputs give the same bytes on any machine, at any number of workers, under any hash seed. Across releases the bytes may change, because a faster or more realistic generator draws differently, and
manifest.jsonrecords the version that wrote a dataset. Every release that changes the bytes says so in this file. Pin the version alongside the seed when a dataset has to be regenerated exactly, in a paper or a benchmark. - There are two entry points and both are supported.
graphfaker generate/graphfaker fraudandgraphfaker.engine.generateare the schema engine: they write tables, ground truth and a manifest, and they are what the rest of the documentation is about.graphfaker genand theGraphFakerclass are the NetworkX-facing path: they load the real-world sources (OpenStreetMap, flights, Wikipedia), produce a quick in-memory social graph, and export a single file in GraphML, CSV, Cypher, openCypher or GQL. Use the engine for datasets you will load or train on; usegenfor a real-world network or a one-file export.
In this release
graphfaker generate --schema my_graph.yamlgenerates from a schema file, no domain needed;--shard-sizesets the rows per shard for such runs.graphfaker schema <domain> [--key value] [--out FILE]writes a domain's schema as YAML with its options applied, to edit and generate from. The fraud domain prints its entity schema with a note that its transactions and patterns come from code. A domain may register aschema_notefor that purpose. File-not-found, invalid YAML and schema validation problems are reported as such.- A full-size bank fits a 16 GB machine. The transaction process builds each channel a block of accounts at a time (about four million events per block), the accounts a pattern stripped or opened late are filtered out of each block as it is produced, the channels are concatenated from those blocks without a copy, the global time order is one
argsortover an int64 array, and the population keeps ids in the node tables' memory instead of as numpy objects. Peak memory atscale=1.0went from 32 GB to 15 GB, atscale=0.3from 10.1 GB to 5.2 GB, and generation got faster too (scale=1.0in 7 minutes single-process,scale=0.3122 s to 95 s). Edge files are no longer sorted by timestamp: rows are in generation order andtx_idcarries the rank in time across channels. Datasets change for the same seed once more (the ad hoc process draws per block). osmnxmoved out of the base install into anosmextra. It brings geopandas, shapely, pyproj and pyogrio, about 150 MB that only the OpenStreetMap fetcher uses.pip install "graphfaker[osm]"restores it; without itgraphfaker gen --fetcher osmandGraphFaker.generate_graph(source="osm")say so and name the extra. Theexamplesextra includes it.graphfaker inspect DIRprints what a dataset directory contains from its manifest and file layout: schema, seed, shard size, versions, node and edge counts, the truth tables present, the Parquet size and the domain options;--jsonfor scripts.graphfaker validate FILE...checks schema YAML files with the rulesgenerate --schemaapplies, reports every file and exits non-zero if any fails.generateandfraudtake--quiet(-q, warnings and errors only) and--json(the manifest, and forfraudthe hardness and realism reports, as one JSON document on stdout; logging is on stderr);evaluate --jsonprints the scores as JSON.HardnessReport.as_dict()is the data behind it.graphfaker --version(-V) prints the version.graphfaker infoprints it with the engine version, Python and platform, the versions of polars, numpy, pyarrow, faker and networkx, and which extras (neo4j,duckdb,ladybug,pyg,osm) are installed and what each enables.ladybugis an extra of its own now, next toneo4jandduckdb. Thepygextra includes scikit-learn, whichexamples/pyg_baseline.pyalways needed.fingerprint()visits tables by name and sorts their rows, so a run read back from Parquet has the same digest as the run that wrote it. Digests from earlier versions do not carry over.- The documentation site takes the GraphGeeks palette (navy
#141846, pink#D81B5A, pale cyan#E2F3F7, white ground), the landing page shows the same command against DuckDB, LadybugDB and Neo4j in turn, and every mention of unreleased work is gone: the pages describe what this version does. - A Docker image,
ghcr.io/graphgeeks-lab/graphfaker, forlinux/amd64andlinux/arm64: the CLI with the DuckDB and Neo4j clients,graphfakeras the entrypoint,/dataas the working directory to mount a volume on, an unprivileged user. The release workflow builds it on every push, runs a generate, a load and a verify against the built image, and publishes it:mainand a short sha from every push tomain, the version tags andlatestfrom av*tag.docs/get-started/docker.mdhas the commands, the memory note and a compose file with Neo4j.
Documentation: https://graphfaker.readthedocs.io. Full changelog: HISTORY.rst.