graph-data
Guides Spektral graph containers, datasets, transforms, data modes, and loader workflows.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- graph-data
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Guides Spektral graph containers, datasets, transforms, data modes, and loader workflows.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-reference.md5.1 KB
- 参考文档references/dataset-catalog.md3.6 KB
- 参考文档references/troubleshooting.md3.4 KB
- 参考文档references/workflows.md3.9 KB
- 脚本scripts/smoke_data_modes.py3.2 KB
03 SKILL.md 正文
Spektral Graph Data
Use this sub-skill when a task is about graph representation, dataset construction, built-in datasets, transforms, data modes, loaders, batching, or data-shape errors in Spektral.
Read first
references/api-reference.mdforGraph,Dataset, loader, transform, and data utility signatures.references/workflows.mdfor custom datasets, loader selection, transforms, and safe in-memory examples.references/dataset-catalog.mdfor built-in datasets and cache/download behavior.references/troubleshooting.mdfor shape, mode, label, sparse/dense, and dataset-cache failures.scripts/smoke_data_modes.pyfor a no-download sanity check of all four data modes and common transforms.
Core workflow
- Represent each graph as
Graph(x=None, a=None, e=None, y=None, **kwargs). - Group graphs in a
Datasetsubclass whoseread()method returns a list ofGraphobjects. - Choose a data mode from the task shape:
- single: one graph, often node-level learning.
- disjoint: many variable-size graphs as one sparse block-diagonal graph.
- batch: many graphs zero-padded into dense tensors.
- mixed: one shared adjacency matrix with many node/edge signals.
- Pick the matching loader and confirm the emitted tuple before building the Keras model.
- Apply transforms to mutate graphs before loading, especially
GCNFilterorLayerPreprocessfor layer-specific adjacency preprocessing. - Hand model/layer architecture questions to
../gnn-models/SKILL.md.
Loader selection cheat sheet
| Data shape | Loader | Output idea | Use when |
|---|---|---|---|
| One graph | SingleLoader |
(x, a[, e])[, y[, sample_weights]] |
Single network, citation graph, node labels on one graph |
| Many variable-size graphs | DisjointLoader |
(x, a[, e], i), y |
Graph classification/regression with sparse adjacency and global pooling |
| Many graphs padded to dense tensors | BatchLoader |
(x, a[, e]), y |
Dense pooling such as MinCut/DiffPool, or fixed-size batch processing |
| Pre-padded dense data | PackedBatchLoader |
Same as BatchLoader |
Same graph sizes or enough memory to pre-pack all graphs |
| Shared graph support, many signals | MixedLoader |
(x, a[, e]), y |
Graph signal classification, e.g. MNIST on a grid graph |
Common decisions
- Prefer sparse adjacency (
scipy.sparse) for graph containers unless a batch-mode layer requires dense tensors. - Keep sparse edge attributes in row-major order matching nonzero adjacency entries.
- For graph-level tasks with variable-size graphs, start with
DisjointLoaderand global pooling. - For dense pooling, use
BatchLoader(mask=True)and thenGraphMaskingin the model route. - Built-in datasets may download data; avoid them for tiny smoke tests unless a cache already exists.
Validation steps
Run this sub-skill's script from the generated skill tree after installing Spektral:
python sub-skills/graph-data/scripts/smoke_data_modes.py
Expected signal: loader shapes for single, disjoint, batch, and mixed modes, transform shape updates, and final smoke_ok.
Route away when
- The user asks how to choose or implement convolution or pooling layers: use
../gnn-models/SKILL.md. - The user asks generic TensorFlow/Keras training-loop questions without Spektral data structures: use TensorFlow/Keras guidance first.
- The user asks for PyG or DGL data objects: do not map those APIs to Spektral names without an explicit migration task.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).