← All notes

Learning GNNs: defining a risk graph before passing messages

Distinguish adjacency, physical connections and similarity; calculate one directed aggregation and design edge ablations without claiming causal propagation.

Basis of this note

A study note prepared alongside the author-provided climate-risk abstract, using the sources below and a new standard-library Python example. The example uses invented values and is not the manuscript implementation or a research reproduction.

01 / An edge is a modeling assumption

If a node is a province, an edge could represent geographic adjacency, electricity exchange, a water connection or statistical similarity. These graphs answer different questions. Before choosing a GNN layer, record what an edge means, which direction it follows, its units, source and effective date.

The supplied abstract names GNN-CRP but does not specify edge construction. None of the example graph choices here is asserted to be the paper’s actual graph.

02 / Similarity can leak future information

A correlation graph computed over 2005–2024 and reused in a historical forecast contains later information. Estimate learned or statistical edges within the training period and version them by forecast origin. Externally specified geography has a different provenance, but still needs a clear rule.

Sharing a border does not establish a transmission mechanism. For similarity edges, use language such as predictive association unless additional physical or causal evidence supports propagation.

03 / Calculate one message-passing step

Use invented node values A=2, B=8, C=4. Let A→C have weight 1 and B→C weight 3. Normalizing the incoming weights at C gives (1×2 + 3×8)/(1+3) = 6.5. C’s own value is not included because this example has no self-loop.

A and B have no incoming edges and return None, not a fabricated risk score. Reversing an edge changes its destination. A full GNN would also specify trainable transformations, nonlinearities, multiple layers and a supervised objective; this calculation supplies none of them.

Python
from climate_protocol import incoming_average

values = {'A': 2, 'B': 8, 'C': 4}
edges = [('A', 'C', 1), ('B', 'C', 3)]
assert incoming_average(values, edges)['C'] == 6.5
assert incoming_average(values, edges[:1])['C'] == 2.0

04 / What does an edge ablation establish?

Removing B→C changes C’s aggregation from 6.5 to 2.0. This demonstrates sensitivity to a specified edge. It is not a risk reduction, estimated policy benefit or evidence that B causes a hazard in C.

  • Compare a temporal-only baseline, the proposed graph, a no-neighbor or self-loop-only control and a degree-aware shuffled graph under a shared data split.
  • Document whether each ablation is retrained or changed only at inference. These measure different effects and should not be mixed in one unexplained table.
  • Keep feature availability, forecast horizon and search budget comparable. Report uncertainty across appropriate temporal or regional blocks.

05 / Run and inspect failure cases

Run the shared climate_protocol.py script. The full graph returns C=6.5; the edge-deleted graph returns C=2.0. Tests also reject missing endpoints, duplicate directed edges, negative weights and nonfinite numbers. Zero-weight edges contribute nothing.

Shell
python notebook/examples/climate_protocol.py
python -m unittest discover -s notebook/examples -p test_climate_protocol.py -v

06 / My takeaway for reading graph models

The first question is not the number of GNN layers: it is whether the edge represents a defensible relationship at the time of prediction. A graph provenance sheet and a simple edge-removal example make that assumption easier to inspect than a visually dense network diagram.

Sources & further reading

Compiled from code and documents, with AI-assisted drafting and translation. Examples and proposed checks are learning material; only linked evidence establishes what was run.