ComGPT: Detecting Local Community Structure with Large Language Models
Abstract
Large Language Models (LLMs), like GPT, 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 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 M from the detected community's neighbors, and subsequently employs LLMs to choose the node to join the detected community from these selected potential nodes. To address the above issues faced by LLMs, we improve graph encoding method, called Incident, by incorporating community knowledge to improve LLMs's understanding of community-related graph information. Additionally, we design the NSG (Node Selection Guide) prompt to enhance LLMs' understanding of community characteristics. Experimental results demonstrate that ComGPT outperforms the comparison methods, thereby confirming the effectiveness of the improved graph encoding method and prompts.
- Publication:
-
arXiv e-prints
- Pub Date:
- August 2024
- DOI:
- 10.48550/arXiv.2408.06658
- arXiv:
- arXiv:2408.06658
- Bibcode:
- 2024arXiv240806658N
- Keywords:
-
- Computer Science - Social and Information Networks