Graph machine learning

Also known as: graph learning · machine learning on graphs

On this page 7

Graph machine learning is the branch of artificial intelligence that learns from data structured as graphs, where entities are nodes and their relationships are edges. Within the Graph learning topic, it covers graph neural networks, node and graph embeddings, link prediction and knowledge-graph embeddings. The field is also called graph learning or machine learning on graphs.

Its defining challenge is that graphs have no fixed size, no natural ordering and irregular connectivity, so methods designed for grids such as images or sequences such as text cannot be applied directly. Graph models must instead be invariant or equivariant to node permutations.

How graph machine learning represents structure

Graph machine learning represents a graph through an adjacency structure plus feature vectors attached to nodes, edges or the whole graph. The goal is to compute embeddings, dense vectors that capture both a node’s own attributes and its position in the network, which downstream classifiers or scoring functions can use.

Early approaches such as DeepWalk and node2vec generated random walks and trained word2vec-style models on them, producing shallow embeddings that cannot generalize to unseen nodes. Modern message passing neural networks instead compute each node’s representation by repeatedly aggregating information from its neighbors, which makes the learned function inductive.

The main families of representation methods are compared below.

ApproachExamplesInductiveKey idea
Shallow embeddingsDeepWalk, node2vecNoRandom-walk co-occurrence
Spectral methodsChebNet, spectral graph convolutionLimitedFilters on the graph Laplacian
Message passing networksGCN, GraphSAGE, GAT, GINYesNeighborhood aggregation per layer
Graph transformersModels with Laplacian positional encodingYesGlobal attention with structural encodings
Knowledge-graph embeddingsTransE, RotatE, DistMultNoRelations as vector operations
Representation approaches in graph machine learning

Core tasks on nodes, edges and graphs

Graph machine learning tasks are organized by the level at which predictions are made: individual nodes, pairs of nodes or entire graphs. Each level requires a different output head and a different evaluation protocol, and splitting data correctly is harder than in tabular learning because examples are connected rather than independent.

LevelTaskTypical applicationCommon metric
Node levelNode classificationFraud detection on accountsAccuracy, F1
Edge levelLink predictionProduct or friend recommendationHits@K, MRR, AUC
Graph levelGraph classification or regressionMolecular property predictionROC-AUC, MAE
GenerativeGraph generationDrug candidate designValidity, novelty
UnsupervisedCommunity detectionNetwork segmentationModularity
Prediction levels and typical tasks

For graph-level tasks, a readout function or graph pooling layer combines node embeddings into a single vector. Benchmarks such as the Open Graph Benchmark provide standardized splits, which matter because random splits can leak information between connected nodes.

Message passing and its expressive limits

In a message passing layer, every node collects messages from its neighbors, aggregates them with a permutation-invariant function such as sum, mean or max, and updates its own state. After k layers, a node’s embedding reflects its k-hop neighborhood.

Standard message passing networks are at most as powerful as the 1-dimensional Weisfeiler-Lehman test at distinguishing non-isomorphic graphs. The graph isomorphism network reaches this bound by using sum aggregation with injective updates, while higher-order networks, subgraph methods and positional encodings go beyond it at higher computational cost.

Depth introduces further problems. Over-smoothing makes node embeddings converge to similar values as layers increase, and over-squashing compresses information from exponentially growing neighborhoods into fixed-size vectors. Graph rewiring, virtual nodes and graph transformers are common remedies.

In practice, most production graph neural networks use only two or three message passing layers. Deeper receptive fields are usually obtained through sampling strategies, personalized PageRank propagation or precomputed multi-hop features, which separate feature propagation from the trainable network and reduce training cost on very large graphs.

Attention-based aggregation, as in the graph attention network, lets each node weight its neighbors differently. This helps when some connections are far more informative than others, although attention weights should not be read as reliable explanations of a prediction without further analysis.

Choosing a method for a graph problem

Method choice depends mainly on graph size, whether new nodes appear, and whether connected nodes tend to be similar. Many classic models assume homophily, where linked nodes share labels; on heterophilous graphs, such as fraud rings that connect to legitimate accounts, simple GCNs can perform worse than models that ignore structure entirely.

SituationRecommended approachReason
Static graph, transductive settingGCN or node2vec embeddingsSimple and strong baselines
New nodes arrive constantlyGraphSAGE with neighbor samplingInductive and scalable
Billions of edgesCluster-GCN or sampled mini-batchesFits memory limits
Multiple node and edge typesHeterogeneous or relational GNNSeparate weights per relation
Low homophilyHeterophily-aware models or graph transformersAvoids misleading neighbor averaging
Molecules with 3D coordinatesEquivariant graph neural networkRespects rotations and translations
Decision guide for common situations

Limitations and practical pitfalls

Graph machine learning inherits the quality of the graph construction itself. Missing edges, spurious connections and stale snapshots can matter more than model architecture, and many reported gains disappear when compared against well-tuned simple baselines such as label propagation or a multilayer perceptron on node features.

  • Neighborhood explosion makes full-batch training infeasible on large graphs.
  • Data leakage in link prediction occurs when test edges remain in the message passing graph.
  • Temporal leakage arises when future interactions are used to predict past events.
  • Explainability is limited, which complicates use in regulated domains such as credit scoring.

Research on graph foundation models aims to pretrain transferable models across many graphs, but transfer between domains with different node features and semantics remains an open and actively debated problem.

A plain-language summary

Graph machine learning teaches computers to learn from connections, not only from individual items. Many kinds of data are networks. People follow people. Atoms bond to atoms. Bank accounts send money to other accounts.

A graph model looks at each item and at its neighbors. It is a little like judging a person partly by the company they keep. The pattern of links carries useful information, and the model learns to use it to classify items, suggest new links or describe whole networks.

An example from practice

A payment provider processes millions of transactions per day and wants to detect organized fraud rings that create many accounts sharing devices, cards and addresses. Rules applied to single transactions miss these groups because each account looks normal on its own.

The risk team builds a heterogeneous graph with account, device, card and address nodes, about 40 million nodes in total. It trains a relational graph neural network with neighbor sampling and time-based splits, so that every prediction uses only edges that existed before the event.

Compared with the previous gradient-boosted model on account features alone, the graph model raises recall of confirmed fraud accounts by about 15 percentage points at the same false-positive rate. Investigators also receive the connected subgraph for each alert, which shortens manual review time for linked cases.