Real hardware datasets used in "Attributed-graphs kernel implementation using local detuning of neutral-atoms Rydberg Hamiltonian"
收藏资源简介:
Dataset of *Attributed-graphs kernel implementation using local detuning of neutral-atoms Rydberg Hamiltonian* This repository contains JSON dumps of MUTAG and PTC_FM* datasets enriched with quantum-evolution observables (correlation matrices and measurement bitstrings sampled at successive simulation times) used for the paper [*Attributed-graphs kernel implementation using local detuning of neutral-atoms Rydberg Hamiltonian. Each graph is stored as a standalone JSON file and grouped by dataset, simulation duration, and wether local detuning were used or not inside zip archives. 1. Folder layout ├── MUTAG_1_microsec_global.zip ├── MUTAG_1_microsec_local.zip ├── MUTAG_2_microsec_global.zip ├── MUTAG_2_microsec_local.zip ├── PTC_FM_1_microsec_global.zip ├── PTC_FM_1_microsec_local.zip ├── PTC_FM_2_microsec_global.zip └── PTC_FM_2_microsec_local.zip We used the following naming convention: <DATASET>*<DURATION>_microsec*<TYPE>.zip Where <DATASET> can be either MUTAG or PTC_FM*, <DURATION> is the maximal duration of the sequence and <TYPE> flags if we used a global or a local detuning. Field Values Meaning DATASET MUTAG or PTC_FM Source graph-classification benchmark. DURATION 1 or 2 Total simulated evolution time, in microseconds. TYPE global or local Type of detuning for the emulation. Each archive, once extracted, contains one JSON file per graph: <DATASET>*<DURATION>_microsec*<TYPE>/ ├── original_idx_0.json ├── original_idx_1.json ├── original_idx_2.json └── ... The integer in the filename matches the `original_idx` field stored inside the JSON, which is the index of the graph in the original benchmark dataset. This is relevant for PTC_FM* as it is a subset of the original PTC_FM dataset. 2. JSON schema Each `original_idx_*.json` file has the following top-level structure: { "original_idx": <int>, "data": { ... }, "correlation_matrix": { ... }, "bitstrings": { ... } } 2.1 original_idx - Type: `int` - Index of the graph in the original (`MUTAG` or `PTC_FM`). 2.2 data — graph payload (PyG-compatible) Mirrors a torch_geometric.data.Data object serialized as plain Python lists. Key Shape Type Description x [N, F_x] float Node feature matrix. edge_index [2, E] int COO connectivity (source row, target row). Edges are directed; undirected graphs are stored as both directions. | edge_attr [E, F_e] float Edge feature matrix. Depends on the dataset y [1] int Graph-level target label. pos [N, 2] float 2D node coordinates used for the QPU register layout initial_id [1] int same as original_idx embedded_position [N, 2] float Final 2D embedded positions sent to the simulator (often equal to pos) N = number of nodes, E = number of edges, F_x / F_e = node / edge feature dimensions. 2.3 correlation_matrix — time-resolved observables Dictionary keyed by simulation timestamp (in nanoseconds, as a string) and valued by an `N × N` symmetric matrix. "correlation_matrix": { "100": [[...], [...], ...], "200": [[...], [...], ...], ... "<DURATION_in_ns>": [[...], [...], ...] } - Keys are stored as strings; cast to int to sort chronologically. - The set of timestamps depends on `DURATION` (e.g. `100, 200, …, 1000` ns for `1_microsec`, up to `2000` ns for `2_microsec`). - Diagonal entries correspond to single-site observables; off-diagonal entries correspond to two-site correlators. 2.4 bitstrings — measurement samples Dictionary keyed by the same simulation timestamps (as strings) and valued by a histogram of bitstring counts. "bitstrings": { "100": {"00000": 590, "10000": 79, "00010": 69, ...}, "200": {"00100": 168, "10000": 101, ...}, ... } - Each inner dictionary maps a measured bitstring (length N) to its observed shot count. - The position of the qubit in the key strings is the same as in the graph data (e.g. x or pos attributes). 3. Loading utilities (Python) The snippets below are generic: replace `DATASET_NAME`, `DURATION`, and `TYPE` with whichever combination you want to load. They assume each archive has been extracted into a folder of the same name next to it. 3.1 Load every JSON from one archive import json from pathlib import Path # Generic parameters — set these to whatever combination you need. DATASET_NAME = "DATASET_NAME" # e.g. "MUTAG" or "PTC_FM" DURATION = "DURATION" # e.g. "1" or "2" (microseconds) TYPE = "TYPE" # e.g. "global" or "local" dump_root = Path("PATH/TO/JSON_DUMP_ROOT") folder = dump_root / f"{DATASET_NAME}*{DURATION}_microsec*{SCOPE}" all_entries = {} # original_idx -> {"data": ..., "correlation_matrix": ..., "bitstrings": ...} for p in sorted(folder.glob("original_idx_*.json")): with [p.open](http://p.open)("r", encoding="utf-8") as f: obj = json.load(f) all_entries[obj["original_idx"]] = { "data": obj["data"], "correlation_matrix": {int(k): v for k, v in obj["correlation_matrix"].items()}, "bitstrings": {int(k): v for k, v in obj["bitstrings"].items()}, } print(f"Loaded {len(all_entries)} graphs") 3.2 Rebuild a PyTorch Geometric `Data` object import torch from torch_geometric.data import Data def json_to_data(d: dict) -> Data: """Convert the `data` dict of a dump JSON into a torch_geometric Data object.""" tensor_keys = {"x", "edge_index", "edge_attr", "pos", "initial_id", "embedded_position"} kwargs = {} for k, v in d.items(): if k in tensor_keys and v is not None: t = torch.tensor(v) if k == "edge_index": t = t.long() kwargs[k] = t else: kwargs[k] = v return Data(**kwargs) # Example: pick any loaded entry and rebuild its graph some_idx = next(iter(all_entries)) data_obj = json_to_data(all_entries[some_idx]["data"]) print(data_obj) 3.3 Iterate over time-resolved observables import numpy as np entry = all_entries[some_idx] timestamps = sorted(entry["correlation_matrix"].keys()) for t_ns in timestamps: corr_t = np.asarray(entry["correlation_matrix"][t_ns]) # shape [N, N] hist_t = entry["bitstrings"][t_ns] total_shots = sum(hist_t.values()) 3.4 Load a single graph by `original_idx` import json from pathlib import Path def load_graph(dump_root: Path, dataset_name: str, duration: str, type: str, original_idx: int) -> dict: folder = Path(dump_root) / f"{dataset_name}*{duration}_microsec*{type}" path = folder / f"original_idx_{original_idx}.json" with path.open("r", encoding="utf-8") as f: return json.load(f) obj = load_graph(dump_root, DATASET_NAME, DURATION, TYPE, original_idx=0)



