Skip to content

v1.0.0

Choose a tag to compare

@denironyx denironyx released this 23 Sep 20:12
· 41 commits to main since this release

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 ./bank

Or 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 /data

The changes below landed after 0.6.1.

What 1.0 means

  • The public API is stable for 1.x: GraphSchema and its samplers, generate, GraphRun, GraphTables, Manifest, fingerprint, the domain registry, the sinks, the metrics and GraphFaker itself. 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.json records 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 fraud and graphfaker.engine.generate are the schema engine: they write tables, ground truth and a manifest, and they are what the rest of the documentation is about. graphfaker gen and the GraphFaker class 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; use gen for a real-world network or a one-file export.

In this release

  • graphfaker generate --schema my_graph.yaml generates from a schema file, no domain needed; --shard-size sets 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 a schema_note for 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 argsort over an int64 array, and the population keeps ids in the node tables' memory instead of as numpy objects. Peak memory at scale=1.0 went from 32 GB to 15 GB, at scale=0.3 from 10.1 GB to 5.2 GB, and generation got faster too (scale=1.0 in 7 minutes single-process, scale=0.3 122 s to 95 s). Edge files are no longer sorted by timestamp: rows are in generation order and tx_id carries the rank in time across channels. Datasets change for the same seed once more (the ad hoc process draws per block).
  • osmnx moved out of the base install into an osm extra. It brings geopandas, shapely, pyproj and pyogrio, about 150 MB that only the OpenStreetMap fetcher uses. pip install "graphfaker[osm]" restores it; without it graphfaker gen --fetcher osm and GraphFaker.generate_graph(source="osm") say so and name the extra. The examples extra includes it.
  • graphfaker inspect DIR prints 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; --json for scripts. graphfaker validate FILE... checks schema YAML files with the rules generate --schema applies, reports every file and exits non-zero if any fails. generate and fraud take --quiet (-q, warnings and errors only) and --json (the manifest, and for fraud the hardness and realism reports, as one JSON document on stdout; logging is on stderr); evaluate --json prints the scores as JSON. HardnessReport.as_dict() is the data behind it.
  • graphfaker --version (-V) prints the version. graphfaker info prints 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. ladybug is an extra of its own now, next to neo4j and duckdb. The pyg extra includes scikit-learn, which examples/pyg_baseline.py always 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, for linux/amd64 and linux/arm64: the CLI with the DuckDB and Neo4j clients, graphfaker as the entrypoint, /data as 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: main and a short sha from every push to main, the version tags and latest from a v* tag. docs/get-started/docker.md has the commands, the memory note and a compose file with Neo4j.

Documentation: https://graphfaker.readthedocs.io. Full changelog: HISTORY.rst.