---
title: Graph Networks
description: Explore Graph Neural Networks (GNNs) and their applications in analyzing graph-structured data. Learn about key architectures including GCNs, GATs, and GINs, message passing mechanisms, and applications in computer vision, drug discovery, and physics.
canonical_url: https://superlinked.com/glossary/graph-neural-networks
last_updated: 2026-06-11
---

# What are Graph Neural Networks (GNNs)?

A Graph Neural Network (GNN) is a type of neural network designed to operate on graph-structured data, where entities (nodes) are connected by relationships (edges). GNNs learn representations by aggregating information from a node's neighbourhood, capturing both the node's own features and the structure of its connections. They are used in knowledge graphs, recommendation systems, molecular modelling, and fraud detection.

---

## Why do GNNs matter for search and retrieval?

Graph structures appear naturally in many retrieval problems:

- **Knowledge graphs**: entities and their relationships form a graph that can be traversed or queried alongside vector search
- **Document graphs**: documents citing each other, co-authored papers, or linked web pages
- **Entity relationships**: in enterprise RAG, documents are connected to authors, topics, and projects
- **Recommendation**: user-item interaction graphs underpin many modern recommendation systems

GNNs can produce graph-aware embeddings where a node's representation is informed by its neighbours, enriching retrieval beyond what a text-only embedding captures.

---

## How does a GNN work?

GNNs operate through **message passing**: each node aggregates feature vectors from its neighbours, combines them with its own features, and updates its representation. This repeats for K layers, gradually expanding the neighbourhood considered.

```
h_v^(k) = UPDATE(h_v^(k-1), AGGREGATE({h_u^(k-1) : u ∈ N(v)}))
```

Where:
- `h_v^(k)` = representation of node v at layer k
- `N(v)` = neighbours of v
- `AGGREGATE` = sum, mean, max, or attention-weighted combination
- `UPDATE` = neural network (MLP, GRU)

After K layers, each node's representation encodes information from its K-hop neighbourhood.

---

## Main GNN architectures

| Architecture | Aggregation | Key feature |
|---|---|---|
| GCN (Graph Convolutional Network) | Normalised sum | Simple, effective for homogeneous graphs |
| GAT (Graph Attention Network) | Attention-weighted | Learns which neighbours to weight more |
| GraphSAGE | Mean/max/LSTM | Inductive: generalises to unseen nodes |
| GIN (Graph Isomorphism Network) | Sum + MLP | Maximum expressive power |

GATs are particularly useful when neighbour importance varies, e.g. some citations are more relevant than others.

---

## GNNs vs standard embedding models

| | Standard embedding model | GNN |
|---|---|---|
| Input | Sequence (text, image) | Graph (nodes + edges) |
| Context | Within document | Across connected nodes |
| Captures | Semantic content | Content + graph structure |
| Self-hostable with SIE | ✓ (text/image models) | Requires graph infrastructure |

For most RAG and search use cases, text embedding models are the right tool. GNNs add value when the relationship structure between entities is itself informative.

---

## GNNs in recommendation systems

GNNs power several major recommendation systems (Pinterest PinSage, Alibaba EGES) by encoding both item content and user-item interaction graphs. The user's embedding becomes a function of items they've interacted with and their graph-neighbours' interactions, capturing collaborative filtering signals alongside content signals.

For a more accessible introduction to embedding-based recommendation, see the [SIE Recommendation Systems example](/docs/examples) and the [Recommendation Systems glossary article](/glossary/introduction-to-recommendation-systems).

---

## Frequently asked questions

**When should I use a GNN instead of a standard embedding model?**
When relationships between entities are informative and you have explicit graph structure. For plain document retrieval, text embeddings are simpler and usually sufficient.

**Can GNN embeddings be stored in a vector database?**
Yes. After training, GNN node embeddings are fixed-size vectors and can be indexed in any vector DB (Qdrant, Weaviate) for ANN search.

**What's the difference between a GNN and a knowledge graph embedding?**
Knowledge graph embeddings (TransE, RotatE) learn entity and relation representations optimised for link prediction. GNNs are more general; they can incorporate rich node features and are trained end-to-end for arbitrary tasks.

---

## Related resources

- [What is a recommendation system?](/glossary/introduction-to-recommendation-systems)
- [What is semantic search?](/glossary/what-is-semantic-search)
- [What is a transformer?](/glossary/transformers)
- [What is a neural network?](/glossary/neural-networks)
- [Browse embedding models on SIE](/models)
