Relational graph convolutional network

Also known as: R-GCN

On this page 7

A relational graph convolutional network (R-GCN) is a graph neural network that extends graph convolution to multi-relational graphs, where edges carry types such as “works for” or “located in”, by learning a separate transformation for each relation type. In graph learning, it is the classic architecture for knowledge graphs, used mainly for entity classification and, together with a scoring decoder, for link prediction.

The model was introduced in 2017 as a direct answer to a limitation of the standard graph convolutional network, which treats every edge the same way. By keeping relation types distinct during neighborhood aggregation, an R-GCN can learn that a citation, an authorship link and a shared venue each carry different evidence about a node.

How an R-GCN layer aggregates typed neighbors

Each R-GCN layer updates a node by summing messages from its neighbors grouped by relation type. For every relation r, the neighbor representations are multiplied by a relation-specific weight matrix W_r, normalized by a constant such as the number of neighbors under that relation, and added together. A separate self-connection weight W_0 carries the node’s own previous state, and a nonlinearity such as ReLU produces the new representation.

In compact form, the update is h_i' = σ( W_0 h_i + Σ_r Σ_{j ∈ N_i^r} (1 / c_i,r) W_r h_j ). Because directed knowledge graphs have asymmetric edges, implementations usually add an inverse relation for every original relation, so information flows in both directions while the two directions keep separate weights.

The following table names the parts of a single layer and their roles.

ElementSymbolRole
Relation weightW_rTransforms messages along relation r
Self-loop weightW_0Preserves the node’s own features
Typed neighborhoodN_i^rNeighbors of node i under relation r
Normalization constantc_i,rScales the sum, often by neighbor count
ActivationσAdds nonlinearity, typically ReLU
Inverse relationsr and r⁻¹Separate weights for each edge direction
Elements of one R-GCN layer

Parameter sharing through basis and block decomposition

A naive R-GCN needs one full weight matrix per relation and per layer, so the parameter count grows linearly with the number of relations. Large knowledge graphs can contain hundreds or thousands of relation types, many of them rare, which leads to overfitting on infrequent relations and high memory use.

Two regularization schemes address this problem. Basis decomposition writes each W_r as a learned linear combination of a small set of shared basis matrices, so rare relations borrow statistical strength from frequent ones. Block-diagonal decomposition restricts each W_r to a set of small blocks on the diagonal, which reduces parameters and assumes that groups of features interact mainly within the group.

SchemeParameters per layerMain benefitMain cost
Full matricesR × d × dMaximum expressivenessOverfits rare relations
Basis decompositionB × d × d plus R × BShares strength across relationsLimits relation diversity
Block-diagonalR × d² / KSparse, memory-efficient weightsIgnores cross-block interactions
Weight parameterizations in R-GCN

In this table, R is the number of relations, d the hidden size, B the number of bases and K the number of blocks. A typical setting uses a few dozen bases or fewer, chosen by validation performance.

R-GCN compared with other graph neural networks

R-GCN is best understood as a message passing neural network in which the message function depends on the edge type. It sits between the homogeneous GCN and later heterogeneous graph neural networks that also distinguish node types or use attention over relations.

ModelHandles edge typesAggregationTypical use
GCNNoNormalized sumHomogeneous citation or social graphs
GATNo, unless extendedLearned attention weightsGraphs with uneven neighbor importance
R-GCNYes, per-relation weightsNormalized typed sumKnowledge graphs, multi-relational data
CompGCNYes, with relation embeddingsComposition of node and relationLink prediction at scale
HGTYes, plus node typesType-aware attentionLarge heterogeneous graphs
R-GCN relative to neighboring architectures

Compared with shallow knowledge graph embeddings such as TransE, DistMult or RotatE, an R-GCN does not learn an isolated vector per entity. It computes entity representations from the local graph structure, which helps entities with few direct facts but many informative neighbors.

For entity classification, a stack of usually two R-GCN layers feeds a softmax output on each labeled node, and the model is trained with cross-entropy on a small labeled subset. This setting is semi-supervised: unlabeled nodes still pass messages that shape the representations of labeled ones.

For link prediction, the R-GCN acts as an encoder that produces entity embeddings, and a decoder scores candidate triples. The original work used a DistMult decoder, which multiplies subject, relation and object vectors element by element and sums the result. Training uses negative sampling, in which corrupted triples are generated by replacing the subject or the object.

  • Typical depth is two layers, because deeper stacks suffer from over-smoothing and rising memory cost.
  • Input features can be one-hot node identities when no attributes exist, at the price of a large first layer.
  • Evaluation metrics for link prediction are mean reciprocal rank and Hits@k under the filtered protocol.

Limitations and practical pitfalls

R-GCNs are memory-intensive on large graphs because every relation type needs its own sparse multiplication, and full-batch training rarely fits on a single accelerator. Practitioners rely on neighbor sampling or subgraph training, which introduces variance and requires careful tuning.

Later studies also showed that a well-tuned R-GCN encoder does not always beat strong shallow embeddings on standard link prediction benchmarks, so its advantage is clearest when node features or rich neighborhoods exist. The table below summarizes frequent issues.

ProblemCauseRemedy
Overfitting rare relationsToo many free parametersBasis or block decomposition
Out-of-memory errorsFull-graph propagationNeighbor sampling or mini-batches
Over-smoothingToo many layersKeep two layers, add residual links
Weak link predictionPoor decoder or samplingTune negatives, try stronger decoders
Leaky evaluationInverse triples in test setUse filtered, leakage-free splits
Common R-GCN problems and remedies

The short version

Many networks have different kinds of links. A person can work for a company, live in a city or know another person. An R-GCN treats each kind of link separately.

Each node collects information from its neighbors. A different rule applies to each type of link. The node then combines everything into one summary. The result is a smarter picture of each item, based on who it is connected to and how.

Where it makes a difference

A pharmaceutical research team maintains a biomedical knowledge graph with about 100,000 entities such as drugs, proteins, genes and diseases, linked by roughly 40 relation types including “inhibits”, “binds to” and “treats”. The team wants to rank candidate drug-disease pairs for drug repurposing studies.

The team trains a two-layer R-GCN encoder with basis decomposition and a DistMult decoder, using known treatment links as positives and sampled corrupted triples as negatives. Because each relation keeps its own transformation, the model can distinguish inhibition from binding, which a plain GCN would merge.

On a held-out set of treatment links, the R-GCN ranks true pairs higher than a shallow embedding baseline, with a clear gain in mean reciprocal rank. Researchers then review the top candidates manually, and the model shortens the list for laboratory validation from thousands of pairs to a few dozen.