# 图划分

图划分是一种组合优化方法，它将图的顶点划分为 \( k \) 个不相交的块，同时保持各块大小大致相等，并最小化跨越块之间的边数。给定一个图 \( G = (V, E) \) 和一个整数 \( k \geq 2 \)，块 V₁, …, V_k 必须覆盖 V，优化某个目标函数，并满足形如 |V_i| ≤ (1 + ε)⌈|V|/k⌉ 的平衡约束，其中 ε ≥ 0 为不平衡参数。<sup>[1](https://link.springer.com/rwe/10.1007/978-3-319-63962-8_312-1)</sup> 该方法支撑着并行计算中的区域分解、超大规模集成电路网表划分，以及社交网络和路径规划工作负载的负载均衡。<sup>[2](https://ar5iv.labs.arxiv.org/html/1311.3144)</sup>

| 关键事实 | 详情 |
|---|---|
| 目标 | 最小化边割，即跨越块之间的边的总权重，受 \( \varepsilon \)-平衡约束<sup>[1](https://link.springer.com/rwe/10.1007/978-3-319-63962-8_312-1)</sup> |
| 复杂度 | 即使最大节点度不超过三也是NP难的；完美平衡情形下不存在常数因子近似<sup>[3](https://dl.acm.org/doi/fullHtml/10.1145/3571808)</sup> |
| 标准算法 | 粗化、初始划分和细化的多级范式<sup>[2](https://ar5iv.labs.arxiv.org/html/1311.3144)</sup> |
| 最早的局部搜索 | 克尼格汉与林，贝尔系统技术杂志，1970年<sup>[4](https://doi.org/10.1002/j.1538-7305.1970.tb01770.x)</sup> |
| 割质量 | 在大图上，KaFFPa Strong 产生的割比 kMetis 小约33%<sup>[5](https://ae.iti.kit.edu/documents/research/kahip/engineering_multilevel.pdf)</sup> |
| 规模 | KaMinPar 在96核上不到6分钟内将 hyperlink-2012 图（约35亿顶点、1120亿条边）划分为30,000个块<sup>[6](https://github.com/KaHIP/KaMinPar)</sup> |
| 流式 | FENNEL 在约40分钟内割开 Twitter 图14亿条边中的6.8%，而 METIS 需要超过8.5小时才能达到11.98%的割<sup>[7](https://doi.org/10.1145/2556195.2556213)</sup> |

## 工作原理

默认目标是边割：即两个端点位于不同块中的边的权重之和。对于超图——其中一个网络（超边）可能连接多个引脚——有两种代价函数占主导地位：割网络度量 \( f_c(\Pi) = \sum_{e \in E'} \omega(e) \)，对所有被割网络求和；以及连通性度量 \( f_\lambda(\Pi) = \sum_{e \in E'} (\lambda(e) - 1)\omega(e) \)，其中 \( \lambda(e) \) 计算一个被割网络所触及的块数；对于普通图，两者都退化为边割。<sup>[3](https://dl.acm.org/doi/fullHtml/10.1145/3571808)</sup><sup> • </sup><sup>[8](https://dl.acm.org/doi/fullHtml/10.1145/3529090)</sup> 对于并行计算，通信量 \( \mathrm{comm}(V_{i}) = \sum_{v \in V_{i}} c(v) \cdot D(v) \)（其中 \( D(v) \) 计算包含 v 的邻居的其他块的数量）通常比割更为合适。<sup>[2](https://ar5iv.labs.arxiv.org/html/1311.3144)</sup>

该问题在计算上是难解的。最基本的变体——将图划分为 \( k \) 个大致相等的块同时最小化割边——是NP难的（归因于 Hyafil 和 Rivest，1973年），<sup>[1](https://link.springer.com/rwe/10.1007/978-3-319-63962-8_312-1)</sup> 而1978年伯克利的一份报告表明，即使最大节点度不超过三，该问题仍是NP完全的。<sup>[9](https://www2.eecs.berkeley.edu/Pubs/TechRpts/1978/Archive/ERL-m-78-13.pdf)</sup> Andreev 和 Räcke 证明了对于一般图上的完美平衡版本 \( (\varepsilon = 0) \)，不存在常数因子近似，<sup>[10](https://doi.org/10.1007/s00224-006-1350-7)</sup> 而对于 \( \varepsilon \in (0, 1] \) 可以达到 \( O(\log^{2} n) \) 近似，对于 \( \varepsilon > 1 \) 可以达到 \( O(\log n) \) 近似。<sup>[2](https://ar5iv.labs.arxiv.org/html/1311.3144)</sup> 由于最优解或良好近似解难以企及，实际求解器都是实现在免费软件和商业软件包中的启发式算法。<sup>[11](https://people.eecs.berkeley.edu/~vazirani/pubs/arvcacm.pdf)</sup>

## 实现方法

**局部搜索。** 克尼格汉与林的 KL 算法通过多轮扫描，在两个块之间寻找并交换接近最优的等大小顶点子集，在一轮扫描的剩余过程中固定已交换的顶点对。<sup>[4](https://doi.org/10.1002/j.1538-7305.1970.tb01770.x)</sup> 据一种说法，一轮 KL 扫描的代价约为 \( O(|V|^{2}) \)，<sup>[12](https://twiki.di.uniroma1.it/pub/CI/WebHome/HighPerformanceMultilevel_Graphs.pdf)</sup> 据另一种说法为 \( O(n^{2} \log n) \)。<sup>[2](https://ar5iv.labs.arxiv.org/html/1311.3144)</sup> Fiduccia–Mattheyses（FM）算法保留了扫描结构，但移动单个顶点：它定义单元 i 的增益 \( g(i) \) 为若将该单元移至互补块，割集将减少的网络数（增益可以为负），将顶点保存在以增益为键的优先队列中，允许负增益移动以逃离局部极小值，在一轮扫描中锁定每个已移动的顶点，并回滚到所见到的最佳解。<sup>[13](https://limsk.ece.gatech.edu/course/ece6133/papers/fm.pdf)</sup> 其每轮扫描的最坏情况时间随网络规模线性增长，<sup>[13](https://limsk.ece.gatech.edu/course/ece6133/papers/fm.pdf)</sup> 通过适当的数据结构将 KL 的代价降低到 \( O(|E|) \)。<sup>[14](https://www.cs.albany.edu/~jhh/courses/readings/karypis.siam98.metis.pdf)</sup>

**谱二分。** 拉普拉斯矩阵 \( Q = D - A \)（\( D \) 为度矩阵，\( A \) 为邻接矩阵）对其第二小特征值有一个特征向量，即菲德勒向量，其分量度量顶点之间基于连通性的距离；按此分量对顶点排序并分割排序结果，或按分量的符号进行分割，即可得到二分。<sup>[14](https://www.cs.albany.edu/~jhh/courses/readings/karypis.siam98.metis.pdf)</sup><sup> • </sup><sup>[12](https://twiki.di.uniroma1.it/pub/CI/WebHome/HighPerformanceMultilevel_Graphs.pdf)</sup> 菲德勒向量是割优化整数规划经松弛后的解，<sup>[2](https://ar5iv.labs.arxiv.org/html/1311.3144)</sup> 而特征分解的代价高达 \( O(n^{3}) \) 时间和 \( O(n^{2}) \) 空间，这是一个主要的可扩展性缺陷。<sup>[15](https://link.springer.com/article/10.1007/s44163-024-00102-x)</sup>

**基于流的细化。** 一类细化方法选择割周围的一个顶点区域 R，将 \( V_{1} \setminus R \) 收缩为一个源点，将 \( V_{2} \setminus R \) 收缩为一个汇点，并利用所得的最大流来导出一个可能改进的割。<sup>[3](https://dl.acm.org/doi/fullHtml/10.1145/3571808)</sup> 这一思想在 KaHyPar-MF 中得以实例化，由 Heuer、Sanders 和 Schlag 于2019年报告。<sup>[16](https://doi.org/10.1145/3329872)</sup>

**多级范式。** 针对大图最成功的启发式算法运行三个阶段：粗化（将顶点集收缩为单个节点，其权重为成员权重之和，通常沿重边进行）、对小图进行初始划分、以及在每一级用 FM 风格的细化进行细化。<sup>[2](https://ar5iv.labs.arxiv.org/html/1311.3144)</sup> 由于投影后的划分已经很好，细化过程中的 KL 细化通常在三到五次迭代内收敛。<sup>[14](https://www.cs.albany.edu/~jhh/courses/readings/karypis.siam98.metis.pdf)</sup> 基本思想可追溯到线性系统的多重网格求解器。<sup>[5](https://ae.iti.kit.edu/documents/research/kahip/engineering_multilevel.pdf)</sup>

## 起源

克尼格汉与林于1970年在《贝尔系统技术杂志》上报告了他们的划分方法。<sup>[4](https://doi.org/10.1002/j.1538-7305.1970.tb01770.x)</sup> 面向超大规模集成电路领域的多级超图划分由 Karypis、Aggarwal、Kumar 和 Shekhar 于1999年在《IEEE超大规模集成电路系统汇刊》上报告。<sup>[17](https://doi.org/10.1109/92.748202)</sup> Sanders 和 Schulz 于2010年在 arXiv 上报告了 KaFFPa（卡尔斯鲁厄高质量划分）算法。<sup>[18](https://doi.org/10.48550/arxiv.1012.0006)</sup> 后续几代包括 KaMinPar——一种深度多级图划分器，由 Gottesbüren 及其同事于2021年报告，<sup>[19](https://doi.org/10.4230/lipics.esa.2021.48)</sup> 以及 n 级超图划分器 Mt-KaHyPar，由 Gottesbüren 及其同事于2023年在《ACM算法汇刊》上报告。<sup>[20](https://doi.org/10.1145/3626527)</sup>

## 变体

METIS 实现了多级递归二分（pmetis）和多级 k 路划分（kmetis），当划分数量超过八个时优先使用 kmetis。<sup>[21](http://hdl.handle.net/11299/215346)</sup> Scotch 使用递归多级二分；<sup>[1](https://link.springer.com/rwe/10.1007/978-3-319-63962-8_312-1)</sup> KaHIP 在 Strong、Eco 和 Fast 配置中实现了基于流的方法和局部化局部搜索，并提供了共享内存版本 mt-KaHIP。<sup>[5](https://ae.iti.kit.edu/documents/research/kahip/engineering_multilevel.pdf)</sup><sup> • </sup><sup>[22](https://github.com/KaHIP/mt-KaHIP)</sup> KaHyPar 以最极端的形式实例化多级方法，每一级仅移除一个顶点，并支持直接 k 路和递归二分，以及割网络和连通性目标。<sup>[8](https://dl.acm.org/doi/fullHtml/10.1145/3529090)</sup><sup> • </sup><sup>[23](https://kahypar.org/)</sup>

对于大到无法放入内存的图，流式划分器在单次遍历中为每个到达的顶点分配块：Stanton 和 Kliot 的 LDG 启发式，<sup>[24](https://psycnet.apa.org/doi/10.1145/2339530.2339722)</sup> 以及 FENNEL，其贪心评分 δg(v, S_l) = |N(v) ∩ S_l| − δ_c(|S_l|) 统一了邻居计数和非邻居计数放置启发式。<sup>[7](https://doi.org/10.1145/2556195.2556213)</sup> Sheep 将图归约为消去树以划分超出主内存的图，<sup>[25](https://vldb.org/pvldb/vol8/p1478-margo.pdf)</sup> 而 Cuttana 增加了基于评分的动态缓冲、顶点交换细化和边平衡条件。<sup>[26](https://www.vldb.org/pvldb/vol18/p14-hajidehi.pdf)</sup>

近期工作将该范式推向极端规模和硬件。TeraPart 由 Salwasser 及其同事于2024年在 arXiv 上报告，在单台机器上仅用不到8分钟、约900 GiB 内存便划分了具有一万亿条无向边的合成图，而分布式 xTeraPart 在128台机器上约10分钟内处理了16万亿条边的图。<sup>[27](https://arxiv.org/html/2410.19119)</sup> Jet——GPU 上的多级图划分——由 Gilbert、Madduri、Boman 和 Rajamanickam 于2024年在《SIAM科学计算杂志》上报告，<sup>[28](https://doi.org/10.1137/23m1559129)</sup> GPU 加速的 k 路划分器 G-kway 由 Lee 及其同事于2025年在《ACM电子系统设计自动化汇刊》上报告。<sup>[29](https://doi.org/10.1145/3734522)</sup> 一个 ESA 2025 算法将边稀疏化集成到 KaMinPar 的粗化过程中，并证明了无需输入假设的 \( O(n + m) \) 期望总工作量，相比基线 KaMinPar 实现了高达4倍的实际加速，平均质量损失仅为1%。<sup>[30](https://drops.dagstuhl.de/storage/00lipics/lipics-vol351-esa2025/LIPIcs.ESA.2025.32/LIPIcs.ESA.2025.32.pdf)</sup>

## 应用

在并行计算中，划分将网格或稀疏矩阵的工作分布到各处理器上，以保持处理器间通信量低；通信量是首选的度量指标。<sup>[2](https://ar5iv.labs.arxiv.org/html/1311.3144)</sup> 在超大规模集成电路设计中，多级超图划分在布局阶段对芯片网表进行划分。<sup>[17](https://doi.org/10.1109/92.748202)</sup> 有文献记载的用途还包括社交网络负载均衡、路径规划预计算、超级计算机上的科学模拟，以及图神经网络训练加速。<sup>[3](https://dl.acm.org/doi/fullHtml/10.1145/3571808)</sup> 流式划分加速了分布式分析：Stanton 和 Kliot 的启发式在大规模社交网络上将 Spark 上的 PageRank 加速了18%至39%，<sup>[24](https://psycnet.apa.org/doi/10.1145/2339530.2339722)</sup> 而 PowerGraph 由 Gonzalez 及其同事于2012年报告，将流式划分器集成到其分布式图并行加载器中。<sup>[31](https://doi.org/10.5555/2387880.2387883)</sup>

## 局限与替代方案

局部搜索可能停滞在局部极小值；FM 通过负增益移动和回滚到一轮扫描中所见的最佳状态来缓解这一问题。<sup>[13](https://limsk.ece.gatech.edu/course/ece6133/papers/fm.pdf)</sup> KL 风格的细化在较大实例上相当无效。平衡参数在质量与均匀性之间权衡：允许更多不平衡可能带来割质量更好的划分。顶点上的平衡并不能平衡幂律图上的工作负载：在 Twitter 上的顶点平衡模式下，一个工作节点至少承担其他节点4倍的负载，这就是 Cuttana 强调边平衡的原因；同一来源报告称，长期作为标准的 METIS 无法划分十亿规模的 Twitter 和 Web 图。<sup>[26](https://www.vldb.org/pvldb/vol18/p14-hajidehi.pdf)</sup> 流式方法对流的顺序敏感，随机顺序最差，且通常产生比 METIS 更差的划分，但运行更快；<sup>[25](https://vldb.org/pvldb/vol8/p1478-margo.pdf)</sup> 在万亿边图上，当 \( k = 30000 \) 时，流式划分器 HeiStream 割开的边数是 TeraPart 的3.1倍至14.8倍。<sup>[27](https://arxiv.org/html/2410.19119)</sup>

社区发现共享小割的直觉，因为一个好的社区预期具有较小的割大小，但优化的是不同的准则。模块度 \( Q = (1/2m)\sum_{ij} (A_{ij} - P_{ij}) \cdot \delta(C_{i}, C_{j}) \)，其中在配置零模型下 \( P_{ij} = k_{i} \cdot k_{j} / 2m \)，衡量内部连通性相对于随机基线的偏离，而 Fortunato 和 Barthélemy 证明了存在一个尺度下限，低于该尺度模块度无法识别社区。<sup>[32](https://pdodds.w3.uvm.edu/research/papers/others/2010/fortunato2010a.pdf)</sup> 经验上，激进地优化电导（簇的边界边与内部体积之比）会产生不连通或几乎不连通的簇，这些簇并不对应于直观的社区。<sup>[33](https://ar5iv.labs.arxiv.org/html/1004.3539)</sup>

## References

1. [Graph Partition (Encyclopedia of Big Data Technologies, Schulz & Strash 2018)](https://link.springer.com/rwe/10.1007/978-3-319-63962-8_312-1)
2. [Recent Advances in Graph Partitioning (Buluç, Meyerhenke, Safro, Sanders, Schulz)](https://ar5iv.labs.arxiv.org/html/1311.3144)
3. [More Recent Advances in (Hyper)Graph Partitioning (ACM Computing Surveys, Çatalyürek et al. 2023)](https://dl.acm.org/doi/fullHtml/10.1145/3571808)
4. [B. W. Kernighan, S. Lin (1970). An Efficient Heuristic Procedure for Partitioning Graphs. Bell System Technical Journal.](https://doi.org/10.1002/j.1538-7305.1970.tb01770.x)
5. [Engineering Multilevel Graph Partitioning Algorithms (Sanders & Schulz, ESA'11 / KaFFPa; arXiv:1012.0006 copy merged)](https://ae.iti.kit.edu/documents/research/kahip/engineering_multilevel.pdf)
6. [KaMinPar – Shared-Memory and Distributed-Memory Parallel Graph Partitioning (official repository)](https://github.com/KaHIP/KaMinPar)
7. [FENNEL: streaming graph partitioning for massive scale graphs (Tsourakakis et al., WSDM '14; author PDF and Microsoft Research record merged)](https://doi.org/10.1145/2556195.2556213)
8. [High-Quality Hypergraph Partitioning (KaHyPar, ACM)](https://dl.acm.org/doi/fullHtml/10.1145/3529090)
9. [The k-Partition Problem (UCB technical report, 1978)](https://www2.eecs.berkeley.edu/Pubs/TechRpts/1978/Archive/ERL-m-78-13.pdf)
10. [Konstantin Andreev, Harald Racke (2006). Balanced Graph Partitioning. Theory of Computing Systems.](https://doi.org/10.1007/s00224-006-1350-7)
11. [Geometry, flows, and graph-partitioning algorithms (ARV, Communications of the ACM)](https://people.eecs.berkeley.edu/~vazirani/pubs/arvcacm.pdf)
12. [Graph Partitioning (survey chapter, multilevel methods)](https://twiki.di.uniroma1.it/pub/CI/WebHome/HighPerformanceMultilevel_Graphs.pdf)
13. [A Linear-Time Heuristic for Improving Network Partitions (Fiduccia & Mattheyses, 19th Design Automation Conference, 1982)](https://limsk.ece.gatech.edu/course/ece6133/papers/fm.pdf)
14. [A Fast and High Quality Multilevel Scheme for Partitioning Irregular Graphs (Karypis & Kumar, SIAM J. Sci. Comput., 1998)](https://www.cs.albany.edu/~jhh/courses/readings/karypis.siam98.metis.pdf)
15. [Clustering graph data: the roadmap to spectral techniques (Discover Artificial Intelligence, 2024)](https://link.springer.com/article/10.1007/s44163-024-00102-x)
16. [Tobias Heuer, Peter Sanders, Sebastian Schlag (2019). Network Flow-Based Refinement for Multilevel Hypergraph Partitioning. ACM Journal of Experimental Algorithmics.](https://doi.org/10.1145/3329872)
17. [G. Karypis and colleagues (1999). Multilevel hypergraph partitioning: applications in VLSI domain. IEEE Transactions on Very Large Scale Integration (VLSI) Systems.](https://doi.org/10.1109/92.748202)
18. [Sanders, Peter, Schulz, Christian (2010). Engineering Multilevel Graph Partitioning Algorithms. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1012.0006)
19. [Gottesbüren, Lars and colleagues (2021). Deep Multilevel Graph Partitioning. DROPS (Schloss Dagstuhl – Leibniz Center for Informatics).](https://doi.org/10.4230/lipics.esa.2021.48)
20. [Lars Gottesbüren and colleagues (2023). Scalable High-Quality Hypergraph Partitioning. ACM Transactions on Algorithms.](https://doi.org/10.1145/3626527)
21. [METIS: A Software Package for Partitioning Unstructured Graphs, Partitioning Meshes, and Computing Fill-Reducing Orderings of Sparse Matrices (Karypis & Kumar technical report)](http://hdl.handle.net/11299/215346)
22. [KaHIP/mt-KaHIP – Shared-Memory Parallel Multilevel Partitioning (official repository)](https://github.com/KaHIP/mt-KaHIP)
23. [KaHyPar – Karlsruhe Hypergraph Partitioning (project page)](https://kahypar.org/)
24. [Streaming graph partitioning for large distributed graphs (Stanton & Kliot, KDD '12)](https://psycnet.apa.org/doi/10.1145/2339530.2339722)
25. [Sheep: Scalable Host-tree Embeddings for Efficient Partitioning (PVLDB vol 8)](https://vldb.org/pvldb/vol8/p1478-margo.pdf)
26. [CUTTANA: Scalable Graph Partitioning for Faster Distributed Graph Databases and Analytics (PVLDB vol 18)](https://www.vldb.org/pvldb/vol18/p14-hajidehi.pdf)
27. [Tera-Scale Multilevel Graph Partitioning (TeraPart, IPDPS 2025)](https://arxiv.org/html/2410.19119)
28. [Michael S. Gilbert and colleagues (2024). Jet: Multilevel Graph Partitioning on Graphics Processing Units. SIAM Journal on Scientific Computing.](https://doi.org/10.1137/23m1559129)
29. [Wan Luan Lee and colleagues (2025). G-kway: Multilevel GPU-Accelerated k-way Graph Partitioner using Task Graph Parallelism. ACM Transactions on Design Automation of Electronic Systems.](https://doi.org/10.1145/3734522)
30. [Linear-Time Multilevel Graph Partitioning via Edge Sparsification (ESA 2025, LIPIcs vol. 351)](https://drops.dagstuhl.de/storage/00lipics/lipics-vol351-esa2025/LIPIcs.ESA.2025.32/LIPIcs.ESA.2025.32.pdf)
31. [Joseph E. Gonzalez and colleagues (2012). PowerGraph: distributed graph-parallel computation on natural graphs. .](https://doi.org/10.5555/2387880.2387883)
32. [Community detection in graphs (Physics Reports)](https://pdodds.w3.uvm.edu/research/papers/others/2010/fortunato2010a.pdf)
33. [Empirical Comparison of Algorithms for Network Community Detection](https://ar5iv.labs.arxiv.org/html/1004.3539)

---
*Initially written Sep 29, 2026 · Edited: Oct 15, 2026; Oct 21, 2026; Oct 25, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 逻辑与离散数学 › General discrete mathematics and discrete structures › Graph theory › Computational graph problems and algorithms › NP-hard graph problems and their algorithms

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/graph-partitioning

English original: https://www.edgepedia.org/graph-partitioning
