Structural vs Positional Encodings in Graphs

7 minute read

Published:

TL;DR: Positional encoding: "node v is at position (x,y) in graph space" — globally unique identifiers. Structural encoding: "node v is a hub/leaf/bridge" — role descriptors independent of global position. Two nodes can have the same structural role in different positions, or the same position with different roles. Both types of information matter for different tasks.
Structural vs positional PE
Structural vs positional graph encodings (Dwivedi et al., 2022)

Intuition First

Imagine two different cities, each with a “central train station.” The structural encoding (hub node, high degree, high betweenness centrality) is the same — both are hubs. But the positional encoding differs — they sit at completely different coordinates in their respective cities.

Now imagine two different train stations in the same city — say, “North Station” and “South Station.” They may have the same structural role (both are hubs) but occupy different global positions. A task about “which station is closer to the airport?” needs positional information. A task about “which station handles more connections?” needs structural information.

Same position, different structure degree 4 (sp3) degree 3 (sp2) Both are the central atom — same PE, different SE Same structure, different position Two hub nodes: same structure (deg-3) but different global positions → different LapPE
Left: two molecules where the central atom occupies the same "central" position but has different bond counts (structural difference). Right: two hub nodes in the same graph with identical local structure but different Fiedler vector values (positional difference).

The Conceptual Distinction

Positional encoding (PE): assigns each node a unique identifier that reflects its global location in the graph. If the graph has a natural linear or spatial ordering (like a sequence or a molecular geometry), PEs capture that.

Analogy: your home address. It uniquely identifies your location in the city.

Structural encoding (SE): assigns each node a descriptor that reflects its local structural role, regardless of where it is globally. Hub nodes (many connections) get one encoding; leaf nodes (one connection) get another.

Analogy: your job title (engineer, manager, intern). Two engineers at different companies have the same structural role but different positions.

Examples

Same position, different structure:
Two molecules where atom A is always the central carbon, but one has 3 bonds (sp2 hybridised) and another has 4 (sp3). Their global “position” (central atom) is the same, but their structural role differs.

Same structure, different position:
In the path A–B–C–D–E, nodes B and D are both interior degree-2 nodes with identical local neighbourhoods. Their structural role is the same, but they sit at different global positions — 2nd and 4th from the start.

This example also shows the limit of the distinction. B and D are exchanged by the path-reversal automorphism, so they are not merely structurally alike, they are genuinely equivalent under the graph’s symmetry. No permutation-equivariant encoding — positional or structural — can assign them different values. LapPE separates them only through the eigenvector’s sign, which is itself an arbitrary choice. The clean cases for “same structure, different position” are graphs without that symmetry: two degree-3 hubs sitting in different communities of an asymmetric network.

Key test: Would two nodes in two different graphs deserve the same encoding? If yes → structural, and the encoding transfers. If no → positional: it is a coordinate within one fixed graph, and the coordinate system does not carry over.

Classification of Common Encodings

EncodingTypeWhat two nodes with same encoding share
Laplacian eigenvectorsPositionalSimilar global position in graph space
DegreeStructuralSame number of connections
RWPE (return probabilities)StructuralSame local cycle/clique structure
Shortest-path from anchor nodesPositionalSame distance from chosen landmarks
Clustering coefficientStructuralSame fraction of triangles among neighbours
Orbit type (from automorphism)StructuralSymmetric role under graph isomorphism

When Each Matters

Use positional encodings when:

  • Node identity matters (e.g., tracking specific atoms in a molecule simulation)
  • Task depends on absolute global position (e.g., node ID in a knowledge graph)
  • Model needs to distinguish globally symmetric nodes (two equivalent atoms that have different contexts in the molecule)

Use structural encodings when:

  • The task is about structural roles (hub detection, bridge node classification)
  • You want to transfer across graphs (same structural role should mean same representation)
  • Isomorphic subgraphs should be treated identically

Use both when:

  • You want maximum expressive power (GPS uses RWPE — structural — plus LapPE — positional)
  • Different task components require different information

Equivariance Considerations

It is often said that positional encodings “break permutation equivariance”. That is not quite right, and getting it right clarifies what SignNet is actually for.

Both families are computed from the graph, so both are permutation equivariant: relabel the nodes and the encodings permute along with them. Neither depends on the node ordering.

The real difference is which extra choice the construction requires:

  • Structural encodings (degree, RWPE, clustering coefficient, orbit counts) are deterministic functions of the graph. Nothing is chosen. They are automorphism-invariant by construction, and they are directly comparable across graphs — the same role gives the same number anywhere.
  • Positional encodings are only defined up to a symmetry group of the construction. Laplacian eigenvectors carry \(2^k\) sign choices plus an \(O(m)\) basis choice inside each degenerate eigenspace; anchor-distance encodings carry the random anchor draw. Fix a choice and you get a usable coordinate system, but the choice is arbitrary, so two runs on the same graph can disagree and two different graphs are not comparable at all.

That is what SignNet and BasisNet address: not equivariance, which was never lost, but invariance to the construction’s own symmetry group. They convert an encoding defined up to sign or basis into one that is a genuine function of the graph — recovering comparability across runs and across graphs, at the cost of discarding whatever information lived in the arbitrary choice.

One consequence follows for both families alike: since every such encoding is a function of the graph, nodes in the same automorphism orbit receive identical values. No encoding of this kind assigns “globally unique node IDs” in a symmetric graph.

Summary

 PositionalStructural
Separating powerDistinguishes non-automorphic nodes by global placementDistinguishes nodes by local role only
Transferable across graphsNo — each graph gets its own coordinate frameYes — the same role gives the same value anywhere
Permutation equivariantYesYes
Extra choice requiredSign, basis, or anchor draw — needs invariantisationNone
Ties automorphic nodesYes (unavoidable)Yes (unavoidable)
ExamplesLapPE, SPD biases, anchor distancesRWPE, degree, clustering coefficient, orbit counts
Best forTasks turning on where a node sitsTasks turning on what a node is like

The distinction is not academic. Choosing a structural encoding for a task that needs position, or vice versa, is a common and quiet source of underperformance in GNN and Graph Transformer design.

References