ComGPT: Detecting Local Community Structure with Large Language Models
Li Ni, Haowen Shen, Lin Mu, Yiwen Zhang, Wenjian Luo
TL;DR
The paper tackles local community detection, a task hindered by seed-dependence, diffusion, and free-rider effects in seed-expansion methods. It introduces ComGPT, a GPT-guided approach that leverages a graph-knowledge encoding (ComIncident) and specialized Node Selection Guide prompts (NSG) to inform node additions, while also enabling node supplementation via LLM reasoning. Through empirical evaluation on five real networks, ComGPT demonstrates competitive or superior performance to established baselines, with ablation and prompt-design studies validating the importance of the LLM component, graph encoding, and prompts. The work highlights the potential of integrating LLMs with domain-specific graph reasoning for scalable local community detection, while also discussing runtime and scalability considerations for real-world deployments.
Abstract
Large Language Models (LLMs), like GPT-3.5-turbo, have demonstrated the ability to understand graph structures and have achieved excellent performance in various graph reasoning tasks, such as node classification. Despite their strong abilities in graph reasoning tasks, they lack specific domain knowledge and have a weaker understanding of community-related graph information, which hinders their capabilities in the community detection task. Moreover, local community detection algorithms based on seed expansion, referred to as seed expansion algorithms, often face several shortcomings, including the seed-dependent problem, community diffusion, and free rider effect. To use LLMs to overcome the above shortcomings, we explore a GPT-guided seed expansion algorithm named ComGPT. ComGPT iteratively selects potential nodes by local modularity from the detected community's neighbors, and subsequently employs LLMs to choose the node from these selected potential nodes to join the detected community. To improve LLMs' understanding of community-related graph information, we propose ComIncident, a graph encoding method that incorporates community knowledge and is designed for the community detection task. Additionally, we design the Node Selection Guide (NSG) prompt to enhance LLMs' understanding of community characteristics. Experimental results demonstrate that ComGPT outperforms the baselines, thereby confirming the effectiveness of the ComIncident and the NSG prompt.
