Heterogeneous Graphs: When Nodes and Edges Have Types
Published:

What Is a Heterogeneous Graph?
A heterogeneous graph (or heterogeneous information network, HIN) is defined as:
where \(\tau\) maps each node to a node type from the type set \(\mathcal{A}\), and \(\phi\) maps each edge to a relation from the relation set \(\mathcal{R}\). The graph is heterogeneous when \(\lvert\mathcal{A}\rvert > 1\) or \(\lvert\mathcal{R}\rvert > 1\) โ one of the two suffices. A knowledge graph with a single entity type but hundreds of relations is heterogeneous; so is a bipartite userโitem graph with a single edge type. The homogeneous case that standard GNNs assume is \(\lvert\mathcal{A}\rvert = \lvert\mathcal{R}\rvert = 1\).
Examples:
Academic network:
- Node types: Paper, Author, Venue
- Edge types: cites, written-by, published-in, reviews
Recommender system:
- Node types: User, Item, Category, Brand
- Edge types: clicks, purchases, belongs-to, manufactured-by
Biomedical knowledge graph:
- Node types: Gene, Disease, Drug, Protein
- Edge types: associated-with, treats, inhibits, encodes
Why Standard GNNs Fail on Heterogeneous Graphs
Standard message passing:
applies the same message function to every neighbour in \(\mathcal{N}(v)\), regardless of the edge type connecting them. This conflates semantically very different relationships:
- โUser A clicked Item Bโ and โItem B belongs-to Category Cโ are both aggregated identically
- The model cannot learn that โcitesโ edges carry different information than โco-authored-byโ edges
- Node type differences are ignored โ a Gene node and a Drug node are processed identically
Solutions Overview
1. Type-specific message functions: learn a separate weight matrix \(W_r\) for each relation \(r \in \mathcal{R}\). A message arriving over relation \(r\) is \(W_r h_u\). Used in R-GCN.
2. Meta-path decomposition: define semantically meaningful paths through the graph (e.g., Author โ Paper โ Author = co-authorship). Run separate GNNs along each meta-path. Used in HAN.
3. Relation-aware attention: attend differentially to different relation types when aggregating. Used in HAN, HGT.
4. Type-specific projections: project all node types into a common embedding space with type-specific linear transforms before message passing. Used in HGT (Heterogeneous Graph Transformer).
Visualising a Bipartite Heterogeneous Graph
Meta-Paths: Semantic Bridges
A meta-path is a sequence of node and edge types defining a composite relationship:
Author -[writes]โ Paper -[written-by]โ Author
= APA (Author-Paper-Author) = co-authorship
Paper -[cites]โ Paper -[published-in]โ Venue -[publishes]โ Paper
= PPVP (a longer multi-hop semantic relation)
Meta-paths allow encoding domain knowledge into the graph structure. A model operating on the APA meta-path captures co-authorship patterns; one on the APVPA meta-path (Author โ Paper โ Venue โ Paper โ Author) captures researchers working in the same venue.
Node Projection to Common Space
When node types have different feature dimensions (e.g., Papers have text embeddings, Authors have profile embeddings), we must first project all types to a common dimension \(d\):
A separate linear projection \(W_{\tau(v)}\) per node type ensures all nodes live in the same embedding space before message passing begins. Note this is indexed by node type \(\tau(v)\), not relation type โ it is a different mechanism from the relation-specific \(W_r\) above, and a full heterogeneous architecture typically needs both.
Heterogeneous Graph Benchmarks
- ogbn-mag (Open Graph Benchmark: Microsoft Academic Graph): four node types โ 736,389 papers, 1,134,649 authors, 8,740 institutions and 59,965 fields of study โ connected by citation, authorship, affiliation and topic edges. Only papers carry input features; the other three types do not, which is itself a defining difficulty of the benchmark.
- IMDB (heterogeneous): Movies, Actors, Directors โ classify movie genre
- ACM: Papers, Authors, Subjects โ classify research area
- DBLP: Authors, Papers, Venues, Terms โ author classification
Summary
| Approach | How it handles heterogeneity | Example |
|---|---|---|
| Type-specific weights | Separate \(W_r\) per relation \(r \in \mathcal{R}\) | R-GCN |
| Meta-path aggregation | Run GNNs on meta-path subgraphs | HAN |
| Relation-aware attention | Attention over relation types | HAN, HGT |
| Type projection | Map all types to common space | HGT |
Heterogeneous GNNs extend the MPNN framework to handle the multi-relational, multi-typed structure of real knowledge graphs, recommendation systems, and biomedical networks โ domains where the type structure is often as important as the graph topology.
References
- Sun, Y., Han, J., Yan, X., Yu, P. S., & Wu, T. (2011). PathSim: Meta Path-Based Top-K Similarity Search in Heterogeneous Information Networks. VLDB 2011.
- Schlichtkrull, M., Kipf, T. N., Bloem, P., van den Berg, R., Titov, I., & Welling, M. (2018). Modeling Relational Data with Graph Convolutional Networks. ESWC 2018 (R-GCN).
- Wang, X., Ji, H., Shi, C., Wang, B., Ye, Y., Cui, P., & Yu, P. S. (2019). Heterogeneous Graph Attention Network. WWW 2019 (HAN).
- Hu, Z., Dong, Y., Wang, K., & Sun, Y. (2020). Heterogeneous Graph Transformer. WWW 2020 (HGT).
