One-for-All Community Search on Unseen Graphs
Abstract
Community search is a fundamental graph-based retrieval problem that aims to identify a query-dependent subgraph whose nodes exhibit strong internal connectivity. While recent learning-based methods improve retrieval effectiveness via graph representation learning, they follow a ''one-use-one-train'' paradigm that requires retraining or fine-tuning for each target graph, leading to high data dependency, high training costs, and limited generalization. To handle this, we propose OFA-CS, a ''one-for-all'' community search framework trained once on source datasets and directly deployed to arbitrary unseen graphs without retraining or fine-tuning, while preserving strong performance. Specifically, we introduce a Spectral-Aware Feature Alignment module to unify feature dimensionality and align cross-domain semantics in a community-aware manner. We further develop a Graph Diffusion Tokenized Transformer that constructs hybrid token sequences from local and global structural contexts for Transformer encoding, and applies diffusion-based refinement to mitigate distribution shifts on unseen graphs. With the unified representations, communities are efficiently retrieved via a modularity-driven search procedure. Extensive experiments on diverse real-world graphs demonstrate that OFA-CS achieves strong cross-domain generalization and competitive retrieval effectiveness against state-of-the-art methods, without requiring target-domain supervision.