Social network topology can shape collective cognition and group behavior. Different social network topologies can facilitate various forms of collective cognition, leading to diverse collective cognition and group function. We analyzed the characteristics of contract networks and compared the performance of community structure discovery algorithms in social networks, using modularity as the assessment index. By examining the speed and effectiveness of these algorithms, we found that the Louvain algorithm and Girvan–Newman algorithm are suitable for discovering the network structure of sparse social networks. Experimental results have shown that the Louvain algorithm outperforms the Girvan–Newman algorithm on sparse networks across multiple scales. Finally, we learned a close relationship between collective cognition and community structure in contract networks, particularly influenced by the central nodes within these communities.