Back to Deep Learning Mind Map
中文·English
🧠 Deep LearningID: graph-basics

Graph Representation

图表示与邻接矩阵
🎯Core Definition
A graph G=(V,E)G = (V, E) is encoded as matrices so neural networks can process it. The adjacency matrix ARn×nA \in \mathbb{R}^{n \times n} has Aij=1A_{ij} = 1 if nodes i,ji, j share an edge (arbitrary weights for weighted graphs); the degree matrix D=diag(d1,,dn)D = \mathrm{diag}(d_1, \ldots, d_n) is diagonal with di=jAijd_i = \sum_j A_{ij}. GNNs first add self-loops A~=A+I\tilde{A} = A + I and then apply symmetric normalization D~1/2A~D~1/2\tilde{D}^{-1/2}\tilde{A}\tilde{D}^{-1/2}, whose element form is (D~1/2A~D~1/2)ij=A~ijd~id~j(\tilde{D}^{-1/2}\tilde{A}\tilde{D}^{-1/2})_{ij} = \frac{\tilde{A}_{ij}}{\sqrt{\tilde{d}_i \tilde{d}_j}} — it preserves feature scale through propagation and prevents high-degree nodes from dominating (a celebrity's representation is not drowned by its own magnitude). The graph Laplacian L=DAL = D - A (normalized L=ID1/2AD1/2\mathcal{L} = I - D^{-1/2}AD^{-1/2}) satisfies xTLx=(i,j)E(xixj)2x^T L x = \sum_{(i,j)\in E}(x_i - x_j)^2 with eigenvalues in [0,2][0, 2], and is the starting point for spectral GCN. Tasks split into three levels: node-level (node classification), edge-level (link prediction), and graph-level (graph classification/property prediction).
💡Use Cases
the entry point for modeling non-Euclidean data — social networks, molecular property prediction, recommendation, knowledge graphs; in interviews it is the prerequisite layer of the GNN series, often requiring hand-writing adjacency/degree matrices and deriving the element form of symmetric normalization.
Key Problems Solved
CNNs/Transformers assume regular grids or sequences and cannot handle arbitrary graph topology. The adjacency matrix encodes structure into tensors that participate in matrix multiplication; symmetric normalization D~1/2A~D~1/2\tilde{D}^{-1/2}\tilde{A}\tilde{D}^{-1/2} makes aggregation weights inversely related to degree (high-degree nodes are not amplified, low-degree nodes are not ignored) while bounding the spectrum for numerically stable multi-layer propagation — the direct foundation of the GCN/GAT propagation rules.
🎯5 High-Frequency Exam Points
1
Define the adjacency matrix AA and degree matrix DD (AijA_{ij}, di=jAijd_i = \sum_j A_{ij}); why is adding self-loops A~=A+I\tilde{A} = A + I necessary for GNNs?
2
Derive the element form of symmetric normalization D~1/2A~D~1/2\tilde{D}^{-1/2}\tilde{A}\tilde{D}^{-1/2}, i.e. A~ijd~id~j\frac{\tilde{A}_{ij}}{\sqrt{\tilde{d}_i \tilde{d}_j}}, and explain why it prevents high-degree nodes from dominating aggregation.
3
Properties of the graph Laplacian L=DAL = D - A and normalized Laplacian L=ID1/2AD1/2\mathcal{L} = I - D^{-1/2}AD^{-1/2}: the quadratic form xTLx=(i,j)(xixj)2x^T L x = \sum_{(i,j)}(x_i - x_j)^2 and the eigenvalue range [0,2][0, 2].
4
Name one example for each of the three graph task levels (node/edge/graph), and what are the prediction targets and typical loss forms?
5
How to extend the basic matrix representation: weighted graphs, directed graphs (non-symmetric AA), heterogeneous graphs (multiple edge types), and sparse storage for billion-node graphs?
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "Graph Representation"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardDDP & Ring-AllReduceNext CardGraph Conv Network

🔗 More Deep Learning Knowledge Cards

Activation FunctionsAdam & AdamWAutograd Compute GraphBatch Normalization