Update README.md
Browse files7 unmodified lines89101112131415161718192021222324252627282930313233343536373839404142434410 unmodified lines555657585960616263644 unmodified lines69707172737475767778798081828384858687888990913 unmodified lines959697989910010120 unmodified lines1221231241251261271281291301311321331341356 unmodified lines14214314414514614714814915015115215315415515615722 unmodified lines1801811821831841851861874 unmodified lines1921931941951961971981992002012022032042052062072082092105 unmodified lines2162172182192202212222232242252262277 unmodified lines- graph-matching- benchmark- cross-dataset-generalization---# GSCBenchGSCBench provides exact graph edit distance (GED) supervision for studyingin-collection, cross-collection, zero-shot and few-shot graph similarity models.It contains **12 collections, 5,612 graphs and 1,907,368 exact graph pairs**.Approximate solver predictions are not supervision labels in this dataset.## Collections| Collection | Graphs | Exact pairs || --- | ---: | ---: || ged_pyg_LINUX | 89 | 3,916 || ogb_ogbg-code2 | 191 | 16,575 || tu_AIDS | 1,488 | 1,106,325 || tu_BZR | 404 | 37,781 || tu_COX2 | 465 | 78,100 || tu_DHFR | 719 | 124,714 || tu_ENZYMES | 117 | 6,286 || tu_IMDB-BINARY | 280 | 22,703 || tu_MUTAG | 175 | 15,220 || tu_NCI1 | 992 | 379,032 || tu_PROTEINS | 364 | 64,010 || tu_PTC_MR | 328 | 52,706 |The `tu_` collections identify their source TU collections, `ogb_ogbg-code2`identifies its source OGB collection, and `ged_pyg_LINUX` is a separate auxiliarytraining source. Similarly named collections from different resources are notinterchangeable. Only the released graph population and exact pair rows areincluded; this is not a complete mirror of each upstream collection.## Files and schema10 unmodified lines- `graph_id_map.csv`: released graph IDs and zero-based original collection IDs.Graph IDs are contiguous from zero within each collection. Pair endpoints referto these released IDs. Node indices are preserved within each graph. Eachalignment is a list of `[left_node, right_node]` pairs; `-1` denotes a deletionor insertion. `alignments` stores optimal mappings, not a claim that everypossible optimal mapping has been enumerated. Solver times are in seconds.`release_manifest.csv` and `release_manifest.json` list collection identitiesand counts.4 unmodified linesGraphs are undirected; each undirected edge is counted once even though`edge_index` stores both directions.| Edit operation | Cost || --- | ---: || Node insertion or deletion | 1 || Substitution of different discrete node labels | 1 || Substitution of equal labels, or matching unlabeled nodes | 0 || Edge insertion or deletion | 1 |Edge attributes are not part of this cost model. Deleting a node also incursthe cost of deleting its incident edges. The distance is not divided by graphsize and is not a similarity score.Mappings run from `graph_id_1` to `graph_id_2`. For example, `[2, 5]` matchesnode 2 in the first graph to node 5 in the second, `[3, -1]` deletes node 3from the first graph, and `[-1, 4]` inserts node 4 of the second graph.Each element of `alignments` is one optimal alignment under the cost modelabove. `exact_elapsed_seconds` records the exact computation's elapsed time;it is not a hardware-independent runtime benchmark.## Download and read3 unmodified linespip install huggingface_hub```Download all 12 collections into a relative local directory:```pythonfrom huggingface_hub import snapshot_download20 unmodified linesbundle = torch.load(root + "/tu_MUTAG/data.pt",map_location="cpu", weights_only=False)row = bundle["rows"][0]left = bundle["graphs_by_gid"][row["graph_id_1"]]right = bundle["graphs_by_gid"][row["graph_id_2"]]```Reading `data.pt` requires PyTorch and PyTorch Geometric. The files have beenchecked with PyTorch 2.5.1 and PyG 2.6.1. The two JSONL files can be read withPython's `json` module without PyG. Neither format requires downloading theoriginal TU, OGB or GED-PyG source collections.To read the portable JSONL representation from a local download:6 unmodified linesgraphs = {record["graph_id"]: record for record in map(json.loads, handle)}with (folder / "ged_pairs.jsonl").open(encoding="utf-8") as handle:row = json.loads(next(handle))left = graphs[row["graph_id_1"]]right = graphs[row["graph_id_2"]]```The benchmark's existing `GSCDataset` loader reads `data.pt` when present.Otherwise it builds and saves that file from `graphs.jsonl` and`ged_pairs.jsonl`. Feature encoding and splits are applied when loading;they are not fixed in the released bundle.For reproducibility, pin downloads to a repository commit.## Use with the benchmark code22 unmodified linesThese values illustrate loading; use the experiment config's seed, ratios,feature encoding and pair budget for paper experiments. Set the config's`gscbench_root_dir` to the downloaded dataset directory. No Hugging Face-specifictraining loader or original source dataset is required.## Experimental splits4 unmodified linestrain-train pairs; validation uses val-train pairs; the main test view containstest-train, test-val and test-test pairs. Zero-shot evaluation does not train onthe target collection. Few-shot fitting uses only the selected target trainingpairs. `ged_pyg_LINUX` is an auxiliary cross-collection training source; thein-collection/zero-shot matrix uses the other 11 collections.Validation-validation pairs remain in the released data but are not used bythe default validation view. A training pair budget caps the number oftrain-train pairs; it does not specify the number of training graphs orchange the held-out graph partition.## SourcesGraph provenance and GED supervision are separate: the graph sources belowidentify the upstream collections, while the released pair tables containGSCBench's exact GED supervision for the released graph representation.- The ten `tu_` collections come from[TUDataset](https://chrsmrrs.github.io/datasets/). The collection names in5 unmodified lines[PyG GEDDataset](https://pytorch-geometric.readthedocs.io/en/latest/generated/torch_geometric.datasets.GEDDataset.html).`graph_id_map.csv` connects each released graph to its zero-based index inthe original source collection. The released graph files are authoritativefor this benchmark; source downloads are not needed for training.## VersionFor a reproducible experiment, record the Hugging Face repository commitand pass it as `revision` to `snapshot_download`, together with the benchmarkcode revision, experiment config and split seed. The paper and code shouldrefer to that same data revision.7 unmodified lines891011121314151617181920212223242526272829303132333435363738394041424344454647484950515210 unmodified lines636465666768694 unmodified lines747576777879808182838485868788899091929394953 unmodified lines9910010110210310410520 unmodified lines1261271281291301311321331341351361371381396 unmodified lines14614714814915015115215315415515615715822 unmodified lines1811821831841851861874 unmodified lines1921931941951961971981992002012022032042052062075 unmodified lines2132142152162172182192202212222237 unmodified lines- graph-matching- benchmark- cross-dataset-generalization---# GSCBenchGSCBench provides exact graph edit distance (GED) supervision for studyingin-collection, cross-collection, zero-shot and few-shot graph similarity models.The GSCBench benchmark data comprise **11 collections, 5,523 graphs and1,903,452 exact graph pairs**. The repository additionally includes aversion of PyG LINUX with isomorphic graphs removed (**89 graphs and 3,916pairs**), used as auxiliary data for model pretraining.## Benchmark collections| Collection | Graphs | Exact pairs || -------------- | -----: | ----------: || tu_AIDS | 1,488 | 1,106,325 || tu_BZR | 404 | 37,781 || tu_COX2 | 465 | 78,100 || tu_DHFR | 719 | 124,714 || tu_PTC_MR | 328 | 52,706 || tu_MUTAG | 175 | 15,220 || tu_NCI1 | 992 | 379,032 || tu_PROTEINS | 364 | 64,010 || tu_ENZYMES | 117 | 6,286 || tu_IMDB-BINARY | 280 | 22,703 || ogb_ogbg-code2 | 191 | 16,575 |The `tu_` prefix identifies TU collections, and `ogb_ogbg-code2` identifiesthe OGB code2 collection.### Auxiliary pretraining data| Collection | Graphs | Pairs || ------------- | -----: | ----: || ged_pyg_LINUX | 89 | 3,916 |This PyG LINUX subset has isomorphic graphs removed and is provided toreproduce auxiliary model pretraining.## Files and schema10 unmodified lines- `graph_id_map.csv`: released graph IDs and zero-based original collection IDs.Graph IDs are contiguous from zero within each collection. Pair endpoints referto these released IDs. Node indices are preserved within each graph.`release_manifest.csv` and `release_manifest.json` list collection identitiesand counts.4 unmodified linesGraphs are undirected; each undirected edge is counted once even though`edge_index` stores both directions.| Edit operation | Cost || --------------------------------------------------------- | ---: || Node insertion or deletion | 1 || Substitution of different discrete node labels | 1 || Substitution of equal labels, or matching unlabeled nodes | 0 || Edge insertion or deletion | 1 |The cost model uses graph structure and discrete node labels. Deleting a nodealso incurs the cost of deleting its incident edges.We retain one optimal mapping per graph pair in `alignments`. Each alignmentis a list of `[data_node, query_node]` pairs, from the data graph (`graph_id_1`)to the query graph (`graph_id_2`); `-1` denotes a deletion or insertion. For example, `[2, 5]` matches data node 2 to query node 5,`[3, -1]` deletes data node 3, and `[-1, 4]` inserts query node 4.`exact_elapsed_seconds` records the exact computation time in seconds.## Download and read3 unmodified linespip install huggingface_hub```Download the 11 benchmark collections and auxiliary LINUX data into a relative local directory:```pythonfrom huggingface_hub import snapshot_download20 unmodified linesbundle = torch.load(root + "/tu_MUTAG/data.pt",map_location="cpu", weights_only=False)row = bundle["rows"][0]data_graph = bundle["graphs_by_gid"][row["graph_id_1"]]query_graph = bundle["graphs_by_gid"][row["graph_id_2"]]```Reading `data.pt` requires PyTorch and PyTorch Geometric. The files have beenchecked with PyTorch 2.5.1 and PyG 2.6.1. The two JSONL files can be read withPython's standard `json` module. The download includes all graphs and pairlabels needed for training.To read the portable JSONL representation from a local download:6 unmodified linesgraphs = {record["graph_id"]: record for record in map(json.loads, handle)}with (folder / "ged_pairs.jsonl").open(encoding="utf-8") as handle:row = json.loads(next(handle))data_graph = graphs[row["graph_id_1"]]query_graph = graphs[row["graph_id_2"]]```The benchmark's existing `GSCDataset` loader reads `data.pt` when present.Otherwise it builds and saves that file from `graphs.jsonl` and`ged_pairs.jsonl`. Feature encoding and splits are applied when loading.## Use with the benchmark code22 unmodified linesThese values illustrate loading; use the experiment config's seed, ratios,feature encoding and pair budget for paper experiments. Set the config's`gscbench_root_dir` to the downloaded dataset directory.## Experimental splits4 unmodified linestrain-train pairs; validation uses val-train pairs; the main test view containstest-train, test-val and test-test pairs. Zero-shot evaluation does not train onthe target collection. Few-shot fitting uses only the selected target trainingpairs.Validation-validation pairs remain in the released data but are not used bythe default validation view. A training pair budget caps the number oftrain-train pairs, rather than training graphs. The graph partition staysthe same across pair budgets for a given split seed.## SourcesThe graphs originate from the following collections:- The ten `tu_` collections come from[TUDataset](https://chrsmrrs.github.io/datasets/). The collection names in5 unmodified lines[PyG GEDDataset](https://pytorch-geometric.readthedocs.io/en/latest/generated/torch_geometric.datasets.GEDDataset.html).`graph_id_map.csv` connects each released graph to its zero-based index inthe original source collection.## ReproducibilityFor a reproducible experiment, record the Hugging Face repository commitand pass it as `revision` to `snapshot_download`, together with the benchmarkcode revision, experiment config and split seed. The paper and code shouldrefer to that same data revision.
README.md+64-68