# 社区搜索

社区搜索是一种图挖掘方法：给定一个图和一个或多个查询节点，返回一个包含这些节点的连通且稠密的子图。它直接回答诸如“哪些研究者围绕某位作者形成了核心合作关系”这类问题，而不是先对整个图进行划分。

它与全局社区发现有三点不同。社区搜索依赖于查询，答案随输入节点的变化而变化，而社区发现是在一个全局标准下找出所有社区。其凝聚性标准是用户指定的参数（如k），而非单一固定的目标。此外，它面向在线求值而设计，查询可通过预计算索引在毫秒级内得到回答，并能适应动态图；而完整的发现划分通常计算代价高昂，且图一旦变化就必须重做。<sup>[1](https://ar5iv.labs.arxiv.org/html/1904.12539)</sup>

| 关键事实 | 详情 |
|---|---|
| 输入/输出 | 一个图G加上查询节点；输出为包含查询节点的连通、凝聚子图<sup>[2](https://users.ics.aalto.fi/gionis/cocktail.pdf)</sup> |
| 常见凝聚性模型 | k-核、k-桁架、k-团、最稠密子图、模块度、GNN得分<sup>[1](https://ar5iv.labs.arxiv.org/html/1904.12539)</sup><sup> • </sup><sup>[3](https://dbgroup.cs.tsinghua.edu.cn/jnwang/papers/vldb2025-ICS.pdf)</sup> |
| 预处理代价 | 核分解O(m+n)；桁架计算\( O(m^{1.5}) \)时间、O(m+n)空间<sup>[1](https://ar5iv.labs.arxiv.org/html/1904.12539)</sup> |
| 查询求值 | 使用ShellStruct进行\( O(|H_{V}|) \)的索引查找，或在线剥离/扩展<sup>[1](https://ar5iv.labs.arxiv.org/html/1904.12539)</sup> |
| 难度 | 规模受限变体和最近社区变体是NP难的<sup>[2](https://users.ics.aalto.fi/gionis/cocktail.pdf)</sup><sup> • </sup><sup>[4](http://www.vldb.org/pvldb/vol9/p276-huang.pdf)</sup> |
| 报告的质量提升 | 相较先前最优方法，F1分别提升20.6%（CSFormer）、22%（GICS）、10.18%（ALICE）<sup>[5](https://dl.acm.org/doi/abs/10.1145/3626772.3657771)</sup><sup> • </sup><sup>[3](https://dbgroup.cs.tsinghua.edu.cn/jnwang/papers/vldb2025-ICS.pdf)</sup><sup> • </sup><sup>[6](https://arxiv.org/html/2403.18874)</sup> |

## 工作原理

社区搜索模型固定一种凝聚性度量，求包含查询节点的最佳连通子图。k-核是每个顶点在子图内的度至少为k的最大子图。k-桁架是每条边至少位于\( k-2 \)个三角形中的最大子图；它比k-核更具凝聚性，因为每条边的两个端点必须共享\( k-2 \)个共同邻居，而在k-核中它们可能一个都不共享。按凝聚性排序，k-核 ⪯ k-桁架 ⪯ k-团，而计算效率则按相反顺序递减。<sup>[1](https://ar5iv.labs.arxiv.org/html/1904.12539)</sup><sup> • </sup><sup>[7](https://arxiv.org/html/2402.17242)</sup>

最初的表述最大化返回子图的最小度而非平均度，因为平均度对“搭便车者”敏感——那些附着在查询节点上、无关但稠密的子图会产生不直观的解。<sup>[2](https://users.ics.aalto.fi/gionis/cocktail.pdf)</sup>他们的Greedy算法是Charikar为最稠密子图近似所分析的剥离方案的一个变体，能在距离约束下计算最小度的最优解，并可推广到任意单调函数和单调约束。<sup>[2](https://users.ics.aalto.fi/gionis/cocktail.pdf)</sup>

## 实现方式

实践者通常运行三个阶段。

**预处理与索引。** 全图的k-[核分解](https://www.edgepedia.org/zh/core-decomposition)需要O(m+n)时间和空间，计算所有\( k \geq 3 \)的k-桁架需要\( O(m^{1.5}) \)时间。<sup>[1](https://ar5iv.labs.arxiv.org/html/1904.12539)</sup>对于基于核的搜索，ShellStruct索引以\( O(n) \)空间将所有连通的k-核组织成一棵\( k_{\max} \)层的树，构建时间为\( O(n \cdot k_{\max} + m) \)，因此查询可通过最近公共祖先结构在最优的\( O(|H_{V}|) \)时间内得到回答；后来的索引将构建时间改进为O(m·α(n))，其中α为反[阿克曼函数](https://www.edgepedia.org/zh/ackermann-function)。<sup>[1](https://ar5iv.labs.arxiv.org/html/1904.12539)</sup>对于基于桁架的搜索，TCP-Index为每个节点u在其邻居上构建一个加权诱导图并存储最大生成森林，从而能快速检索包含查询节点的k-桁架；一个代表性的桁架索引需要O(ρ·m)时间和O(m)空间，其中ρ为荫度，上界为\( \min\{d_{\max}, \sqrt{m}\} \)。<sup>[8](https://export.arxiv.org/pdf/2210.17403v5.pdf)</sup><sup> • </sup><sup>[4](http://www.vldb.org/pvldb/vol9/p276-huang.pdf)</sup>

**查询求值。** 在没有索引的情况下，k-核搜索有两类在线方法：全局剥离，从整个图中迭代地移除度最小的顶点；局部扩展，从查询节点向外生长，可返回更小的社区。<sup>[1](https://ar5iv.labs.arxiv.org/html/1904.12539)</sup>Barbieri等人的GS算法处理多个查询顶点，产生最优的最小度社区，无需参数，运行时间为O(m × α(n))。<sup>[9](https://link.springer.com/article/10.1007/s10618-015-0422-1)</sup>

**后处理。** 剥离方法可能返回过大、凝聚性弱的结果，因此需要施加规模界限、直径约束或剪枝步骤；SIGMOD 2014的k-桁架模型支持以社区规模的线性代价进行搜索，并能处理带有频繁顶点和边插入删除的动态图。<sup>[10](https://lijunchang.github.io/pdf/scs-tr.pdf)</sup><sup> • </sup><sup>[11](https://psycnet.apa.org/doi/10.1145/2588555.2610495)</sup>

## 起源

社区搜索问题是社区发现的一个查询依赖变体：给定图G和一组查询节点，找出一个包含查询节点且稠密连通的子图。<sup>[2](https://users.ics.aalto.fi/gionis/cocktail.pdf)</sup>“社区搜索问题”一词被形式化为寻找一个包含所有查询顶点、最大化最小度的连通子图。<sup>[9](https://link.springer.com/article/10.1007/s10618-015-0422-1)</sup>该问题建立在早期查询驱动的子图工作之上，特别是Tong和Faloutsos（2006）通过随机游走连接查询节点的中心子图，以及植根于Seidman 1983年关于网络结构与最小度研究的最小度凝聚性概念。<sup>[12](https://doi.org/10.1016/0378-8733%2883%2990028-x)</sup>与全局发现的分野源于查询依赖的目标：不是对图做一次划分，而是每个查询在用户选择的参数下产生自己的社区。<sup>[1](https://ar5iv.labs.arxiv.org/html/1904.12539)</sup>

## 变体

**基于桁架。** Huang等人的k-桁架社区模型定义包含单个查询节点的极大k-桁架，其中每条边与其他边三角形连通；当查询节点的边不三角形连通时，它可能找不到任何社区。<sup>[4](http://www.vldb.org/pvldb/vol9/p276-huang.pdf)</sup>Huang等人的最近桁架社区（CTC）模型找出包含查询节点、k最大且直径最小的连通k-桁架；该问题是NP难的，且难以在因子\( (2-\varepsilon) \)内近似，他们的贪心框架达到2-近似。<sup>[4](http://www.vldb.org/pvldb/vol9/p276-huang.pdf)</sup>

**规模受限。** 要求顶点数在ℓ到h之间同时最大化最小度是NP难的；早期的启发式方法GreedyD和GreedyF不提供最优性保证，而分支-归约-定界算法SC-BRB将返回的最小度平均提高到GreedyF的2.41倍。<sup>[10](https://lijunchang.github.io/pdf/scs-tr.pdf)</sup>

**属性与空间。** ACQ搜索属性图（Fang等人，2016），<sup>[13](https://doi.org/10.14778/2994509.2994538)</sup>ATC增加了属性驱动的桁架搜索（Huang和Lakshmanan，2017）。<sup>[14](https://doi.org/10.14778/3099622.3099626)</sup>Fang等人（2017）研究了大规模空间图上的空间感知社区搜索。<sup>[15](https://doi.org/10.14778/3055330.3055337)</sup>CS-AG在k-核模型上定义了对文本和数值属性的搜索，采用无索引的采样算法并带有\( 1-\alpha \)置信保证。<sup>[7](https://arxiv.org/html/2402.17242)</sup>

**其他图类型。** 有向图使用(k,l)-核，要求入度至少为k、出度至少为l。<sup>[1](https://ar5iv.labs.arxiv.org/html/1904.12539)</sup>DMCS引入了密度模块度函数，首次将模块度用于社区搜索，NMI准确率比基线最高提升8.5倍。<sup>[16](https://dl.acm.org/doi/10.1145/3514221.3526137)</sup>近期研究涵盖关键词图、加权图、异构图、多层图和动态图。<sup>[3](https://dbgroup.cs.tsinghua.edu.cn/jnwang/papers/vldb2025-ICS.pdf)</sup>

**神经方法。** QD-GNN是首个用于社区搜索的查询驱动GNN，它及其属性扩展AQD-GNN均由Jiang等人（2021）提出；<sup>[17](https://doi.org/10.48550/arxiv.2104.03583)</sup>ALICE在十亿规模上进行神经属性搜索（Wang等人，2023）；<sup>[18](https://doi.org/10.1145/3626738)</sup>CS-TGN扩展到时序图（Hashemi、Behrouz和Hajidehi，2023）。<sup>[19](https://doi.org/10.48550/arxiv.2303.08964)</sup>

## 应用

已记录的应用包括在线推荐，例如用喜爱的电影查询IMDb以找到相关社区；专家发现，例如从DBLP社区组织研讨会；以及生物数据分析。<sup>[20](https://www.vldb.org/pvldb/vol18/p2941-gou.pdf)</sup>

## 局限与替代方案

**搭便车者。** 平均度目标容许附着在查询节点上的无关稠密子图，大多数早期研究未解决该问题；CTC定义通过最小化直径来避免它。<sup>[2](https://users.ics.aalto.fi/gionis/cocktail.pdf)</sup><sup> • </sup><sup>[4](http://www.vldb.org/pvldb/vol9/p276-huang.pdf)</sup>

**输出过大。** 具有最大最小度的极大子图可通过迭代剥离最小度顶点在线性时间内计算，但结果可能极大，这促使了规模约束的出现。<sup>[10](https://lijunchang.github.io/pdf/scs-tr.pdf)</sup>GS之前所有基于最小度的方法也需要访问输入图的大部分区域，并输出大而不真正凝聚的社区。<sup>[9](https://link.springer.com/article/10.1007/s10618-015-0422-1)</sup>

**模型僵化。** 没有任何单一固定模型——无论是k-核、k-桁架、准团还是基于学习的方法——能在所有数据集上找到精确的社区答案或契合每个用户的意图；GICS框架以交互方式解决这一问题，让用户在轮次中增删顶点并自动调参，F1分数提升22%，且能在一秒内响应。<sup>[3](https://dbgroup.cs.tsinghua.edu.cn/jnwang/papers/vldb2025-ICS.pdf)</sup>非学习的属性方法还受限于僵化的k-核/k-桁架超参数约束，以及将每个属性独立处理。<sup>[6](https://arxiv.org/html/2403.18874)</sup>

ALICE在包括一个十亿规模图在内的11个数据集上平均将F1提升10.18%。<sup>[6](https://arxiv.org/html/2403.18874)</sup>

## References

1. [A Survey of Community Search Over Big Graphs](https://ar5iv.labs.arxiv.org/html/1904.12539)
2. [The Community-search Problem and How to Plan a Successful Cocktail Party](https://users.ics.aalto.fi/gionis/cocktail.pdf)
3. [A Flexible Framework for Query-oriented Interactive Community Search (GICS-framework, PVLDB 2025)](https://dbgroup.cs.tsinghua.edu.cn/jnwang/papers/vldb2025-ICS.pdf)
4. [Approximate Closest Community Search in Networks (PVLDB 2015)](http://www.vldb.org/pvldb/vol9/p276-huang.pdf)
5. [Scalable Community Search over Large-scale Graphs based on Graph Transformer (CSFormer, SIGIR 2024)](https://dl.acm.org/doi/abs/10.1145/3626772.3657771)
6. [Neural Attributed Community Search at Billion Scale (ALICE)](https://arxiv.org/html/2403.18874)
7. [Scalable Community Search with Accuracy Guarantee on Attributed Graphs (CS-AG)](https://arxiv.org/html/2402.17242)
8. [Community Key-members Search (CKS) over large graphs](https://export.arxiv.org/pdf/2210.17403v5.pdf)
9. [Efficient and effective community search (Barbieri, Bonchi, Galimberti, Gullo, Data Mining and Knowledge Discovery 2015)](https://link.springer.com/article/10.1007/s10618-015-0422-1)
10. [Efficient Size-Bounded Community Search over Large Networks (SC-BRB)](https://lijunchang.github.io/pdf/scs-tr.pdf)
11. [Querying k-truss community in large and dynamic graphs (SIGMOD 2014)](https://psycnet.apa.org/doi/10.1145/2588555.2610495)
12. [Network structure and minimum degree (Social Networks, 1983)](https://doi.org/10.1016/0378-8733%2883%2990028-x)
13. [Yixiang Fang and colleagues (2016). Effective community search for large attributed graphs. Proceedings of the VLDB Endowment.](https://doi.org/10.14778/2994509.2994538)
14. [Xin Huang, Laks V. S. Lakshmanan (2017). Attribute-driven community search. Proceedings of the VLDB Endowment.](https://doi.org/10.14778/3099622.3099626)
15. [Yixiang Fang and colleagues (2017). Effective community search over large spatial graphs. Proceedings of the VLDB Endowment.](https://doi.org/10.14778/3055330.3055337)
16. [DMCS: Density Modularity based Community Search (SIGMOD 2022)](https://dl.acm.org/doi/10.1145/3514221.3526137)
17. [Jiang, Yuli and colleagues (2021). Query Driven-Graph Neural Networks for Community Search: From Non-Attributed, Attributed, to Interactive Attributed. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2104.03583)
18. [Jianwei Wang and colleagues (2023). Neural Attributed Community Search at Billion Scale. Proceedings of the ACM on Management of Data.](https://doi.org/10.1145/3626738)
19. [Hashemi, Farnoosh, Behrouz, Ali, Hajidehi, Milad Rezaei (2023). CS-TGN: Community Search via Temporal Graph Neural Networks. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2303.08964)
20. [A Comprehensive Survey and Experimental Study of Learning-based Community Search (PVLDB Vol. 18, 2025)](https://www.vldb.org/pvldb/vol18/p2941-gou.pdf)

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

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Algorithms and computational methods › Graph and network algorithms › Network analysis and centrality

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/community-search

English original: https://www.edgepedia.org/community-search
