← Back to Deep Learning Mind Map
🧠 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 A∈Rn×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=D−AL = D - A (normalized L=I−D−1/2AD−1/2\mathcal{L} = I - D^{-1/2}AD^{-1/2}) satisfies xTLx=∑(i,j)∈E(xi−xj)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.
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of Graph Representation.
Use Cases
In production engineering, what are the primary use cases for Graph Representation and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
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=D−AL = D - A and normalized Laplacian L=I−D−1/2AD−1/2\mathcal{L} = I - D^{-1/2}AD^{-1/2}: the quadratic form xTLx=∑(i,j)(xi−xj)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
🎯
Verify Mastery: Practice Exam Questions for "Graph Representation"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
← Previous CardDDP & Ring-AllReduceNext Card →Graph Conv Network

🔗 More Deep Learning Knowledge Cards

引用出处: TalentMe 450+ 工业级 AI 架构考点知识库 (Tech Vault) · 遵循 CC-BY-4.0 知识共享协议
URL: https://talentme.airsota.com/resources/tech/roadmap/mindmap/DL/card/graph-basics
中文速览与面试要点

图表示与邻接矩阵 (Graph Representation)

定义: 图 G = (V, E) 用矩阵表示以便神经网络处理。邻接矩阵 A R^n n: A_ij = 1 表示节点 i, j 有边(加权图可为任意权重); 度矩阵 D = diag(d_1, , d_n) 为对角阵, d_i = _j A_ij 是节点 i 的度数。GNN 聚合前先加自环 A = A + I 再对称归一化: D^-1/2 A D^-1/2, 其元素形式为 ( D^-1/2 A D^-1/2)_ij = A_ij d_i d_j——既保证传播不改变特征尺度, 又抑制“度大节点主导”(像社交网络大 V 的表示不被自身淹没)。图拉普拉斯 L = D - A(归一化 L = I - D^-1/2AD^-1/2)满足 x^T L x = _(i,j) E(x_i - x_j)^2, 特征值落在 [0, 2], 是谱域 GCN 的出发点。任务分三类: 节点级(节点分类)、边级(链接预测)、图级(图分类/性质预测)。 使用场景: 社交网络、分子性质预测、推荐系统、知识图谱等非欧几里得数据的建模入口; 面试中作为 GNN 系列题的前置基础, 常被要求手写邻接/度矩阵、推导对称归一化的元素形式。 解决的问题: CNN/Transformer 假设规则的网格或序列结构, 无法直接处理任意拓扑的图。邻接矩阵把图结构编码为可参与矩阵乘法的张量; 对称归一化 D^-1/2 A D^-1/2 使聚合权重与度数成反比(度大节点不被放大、度小节点不被忽略), 同时把特征值限制在有限范围, 保证多层传播数值稳定——这是 GCN/GAT 传播公式的直接基础。

核心要点

  • 写出邻接矩阵 A 与度矩阵 D 的定义(A_ij, d_i = _j A_ij), 自环 A = A + I 为什么是 GNN 的必要操作?
  • 推导对称归一化 D^-1/2 A D^-1/2 的元素形式 A_ij d_i d_j, 并解释它为什么能避免度大节点主导聚合结果。
  • 图拉普拉斯 L = D - A 与归一化拉普拉斯 L = I - D^-1/2AD^-1/2 的性质: 二次型 x^T L x = _(i,j)(x_i - x_j)^2 与特征值范围 [0, 2] 的含义。
  • 图任务的三大层级(节点级/边级/图级)各举一例, 各自的预测目标与常用 loss 形式是什么?
  • 如何扩展基本矩阵表示: 加权图、有向图(非对称 A)、异质图(多类型边)以及超大图的邻接矩阵稀疏存储?