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 ฯ: V โ A maps each node to a node type ( | A | > 1) and ฯ: E โ R maps each edge to an edge type ( | R | > 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 all neighbours, 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 type r. Messages of type r are 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).
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
= PCPC (complex 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_{ฯ(v)} per node type ensures all nodes live in the same embedding space before message passing begins.
Heterogeneous Graph Benchmarks
- OGB-MAG (Open Graph Benchmark: Microsoft Academic Graph): 736,389 papers, 59,965 authors, citation + authorship edges
- 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-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).
