﻿# GCN normalized adjacency caches require a fixed graph identity

Understand what PyG GCNConv cached normalization retains, why new edges or node relabeling invalidate it, and how self-loop and edge-weight choices enter graph identity.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-gcn-normalized-adjacency-cache-graph-identity/
Language: en

## A new request can carry an old graph operator

A graph inference service may reuse one GCN layer across requests that contain different networks. If normalized connectivity is cached, a new feature array can be processed with the earlier graph operator. Matching node counts makes this error harder to notice because shapes may remain valid.

The [GCN paper](https://arxiv.org/abs/1609.02907) combines local graph structure with node features. A request therefore needs both identities; weights and feature width alone do not define the intended computation.

## The cache concerns normalized connectivity

The [GCNConv API](https://pytorch-geometric.readthedocs.io/en/latest/generated/torch_geometric.nn.conv.GCNConv.html) documents `cached` as reuse of the normalized adjacency computation and restricts its intended use to transductive scenarios. It is not a generic output cache keyed automatically by arbitrary request content.

A model serving several graphs needs a deliberate lifecycle for that state. Inspect whether the layer is reused across independent inputs before enabling a setting that was appropriate for training on one fixed network.

## Edge weights and self-loops belong to the operator

The [layer implementation](https://raw.githubusercontent.com/pyg-team/pytorch_geometric/master/torch_geometric/nn/conv/gcn_conv.py) constructs degree normalization using connectivity, optional edge weights, and self-loop settings. Equal unweighted edge endpoints do not establish equal operators if weights or normalization configuration differ.

Keep these choices with the graph artifact. Changing a source graph's preprocessing while retaining its friendly name should invalidate any state tied to the previous normalized structure. A filename is not an adequate graph identity.

## Node relabeling changes feature correspondence

Even an isomorphic graph requires consistent node mapping. If node identifiers are reordered, adjacency endpoints and feature rows must follow the same permutation. Reusing connectivity under a new row order attaches messages to different entities.

The [tensor-axis guide](/journal/tensor-axes-batch-sequence-hidden/) helps distinguish row position from entity identity. Preserve the external-to-internal node map so predictions can be joined back to source records after batching or graph conversion.

## Compare cached and uncached execution on known graphs

An offline fixture can evaluate one fixed graph repeatedly, then introduce a graph with the same node count but changed connectivity. Compare the intended uncached computation with the service's state lifecycle rather than testing only repeated identical inputs.

The [artifact validation guide](/journal/safetensors-artifact-validation/) motivates recording graph preparation alongside weights. This verifies computational correspondence, not classification accuracy on new network domains or a measured speed improvement from caching.
