Graph representation learning

On this page 8

Graph representation learning is the family of methods that automatically maps nodes, edges, subgraphs or entire graphs to low-dimensional vectors, called embeddings, so that the geometry of the vector space reflects the structure and attributes of the graph. It is the central idea of graph learning within artificial intelligence: instead of hand-crafting features such as node degree or clustering coefficient, a model learns representations that downstream tasks can use directly.

The field spans three generations of techniques: matrix factorization of graph matrices, random-walk embeddings such as DeepWalk and node2vec, and graph neural networks that compute representations by message passing. All of them answer the same question, namely how to encode relational data so that similar or connected objects end up close together.

How graph representation learning encodes structure

Every method in the field can be described as an encoder-decoder pair. The encoder maps each node or graph to a vector, and the decoder reconstructs some graph property from those vectors, for example whether an edge exists or how often two nodes co-occur on random walks. Training minimizes the gap between the decoded and the observed property.

What the decoder reconstructs determines what the embedding captures. Reconstructing direct edges emphasizes first-order proximity, reconstructing shared neighbors emphasizes second-order proximity, and reconstructing random-walk co-occurrence captures multi-hop community structure. Role-based objectives instead place structurally similar nodes close together, even when they sit far apart in the graph.

A key distinction is between transductive and inductive methods. Transductive methods learn one free vector per node and cannot embed a node that was absent during training, whereas inductive methods learn a function of node features and neighborhoods that generalizes to new nodes and new graphs.

Main families of methods

The table below compares the three main families by mechanism, inductive capability and typical scale.

FamilyMechanismInductiveTypical examples
Matrix factorizationFactorizes adjacency or Laplacian matricesNoLaplacian eigenmaps, GraRep, HOPE
Random-walk embeddingsSkip-gram on sampled node sequencesNoDeepWalk, node2vec, LINE
Graph neural networksLearned neighborhood aggregationYesGCN, GraphSAGE, GAT, GIN
Graph autoencodersGNN encoder with edge reconstructionPartlyGAE, variational graph autoencoder
Knowledge-graph embeddingsScores relation triples geometricallyNoTransE, DistMult, RotatE
Families of graph representation learning

Random-walk methods were shown to be implicit matrix factorizations of a transformed co-occurrence matrix, which unified the first two families. Graph neural networks added the ability to use node features and to share parameters across nodes, which is why they dominate current practice.

Message passing and expressive power

In a message passing neural network, each layer updates a node’s vector by aggregating messages from its neighbors and combining the result with the node’s own state. After k layers, a node’s embedding summarizes its k-hop neighborhood, and a readout function such as sum, mean or attention pooling produces a graph-level vector.

The expressive power of standard message passing is bounded by the 1-Weisfeiler-Lehman test: two nodes that the test cannot distinguish receive identical embeddings. The graph isomorphism network reaches this bound by using injective sum aggregation, while higher-order GNNs, positional encodings and graph transformers go beyond it at higher computational cost.

Depth brings its own problems. Over-smoothing makes node embeddings converge as layers are added, and over-squashing compresses information from exponentially growing neighborhoods into fixed-size vectors. Typical GNNs therefore use only two to four layers, and remedies include residual connections, graph rewiring and virtual nodes.

Tasks and evaluation

Learned representations serve three levels of prediction, each with its own evaluation protocol. Choosing the wrong split is one of the most common sources of inflated results.

Task levelExample taskTypical metricEvaluation pitfall
Node levelNode classification of users or papersAccuracy, macro F1Random splits leak neighborhood labels
Edge levelLink prediction for recommendationsAUC, Hits@K, MRREasy random negatives overstate quality
Graph levelMolecular property predictionROC-AUC, MAEScaffold overlap between train and test
Downstream tasks for graph embeddings

Benchmark suites such as the Open Graph Benchmark standardize realistic splits, including time-based and scaffold-based ones, and they have shown that many published gains shrink once leakage between training and test data is removed.

Choosing a method in practice

The right technique depends on whether nodes carry features, whether the graph changes and how large it is. The following decision table reflects common practitioner choices.

SituationRecommended approachReason
Static graph without node featuresnode2vec or spectral embeddingStructure is the only signal
Rich node features, new nodes arriveGraphSAGE with neighbor samplingInductive and scalable
Strong heterophilyHeterophily-aware GNN or feature-only baselineNeighbors often belong to other classes
Several node and edge typesRelational or heterogeneous GNNSeparate parameters per relation
Billions of edgesCluster-GCN or precomputed propagationBounded memory per batch
Few labels availableGraph contrastive learningSelf-supervised pretraining
Method selection by situation

A strong recommendation from practice is to compare every GNN against a multilayer perceptron on node features and against label propagation. On many graphs these simple baselines are surprisingly competitive, and a GNN is worth its complexity only when it clearly beats them.

Limitations and open problems

  • Homophily assumption: averaging neighbors helps only when connected nodes tend to share labels.
  • Scalability: full-batch training on large graphs exceeds GPU memory, so sampling introduces variance.
  • Dynamic graphs: static embeddings become stale when edges change, requiring temporal models.
  • Interpretability: embeddings are hard to explain, which matters in fraud and credit decisions.
  • Transfer: graph foundation models remain immature because graphs lack a shared vocabulary.

Privacy is a further concern, because embeddings can leak sensitive links and attributes. Membership inference and link-stealing attacks on trained GNNs have been demonstrated, so graph representations derived from personal data need the same protection as the raw graph.

Stripped to the essentials

Many kinds of data are networks. Friends link to friends. Papers cite papers. Atoms bond to atoms. Computers prefer lists of numbers, not networks.

Graph representation learning turns each point in a network into a short list of numbers. Points that are connected or play similar roles get similar numbers. It works like giving every person in a city a map coordinate based on whom they know. The key takeaway: once a network becomes numbers, ordinary machine learning can use it.

Where it is applied

A payments company wants to detect accounts involved in fraud rings. It builds a graph of about 50 million accounts linked by shared devices, cards, addresses and money transfers. Fraud rings are hard to spot one account at a time, because each account looks normal on its own, yet ring members are densely connected to each other.

The data science team trains a GraphSAGE model with neighbor sampling on two hops of this graph, combining transaction features with structural signals. Because the model is inductive, it embeds newly opened accounts within minutes of their first connection. Compared with the previous feature-based classifier, the graph model flags coordinated rings earlier, and investigators review fewer false alarms because suspicious accounts arrive grouped by the cluster they belong to.