Introduction
Network analysis frequently requires two fundamental tasks: node embedding (mapping nodes to low-dimensional vectors) and community detection (identifying clusters of related nodes). While traditional sequence-based methods like DeepWalk effectively capture local topology, they often fail to preserve distinct community structures, resulting in overlapping clusters in the embedding space. GEMSEC (Graph Embedding with Self Clustering) addresses this by learning node representations and community clusters simultaneously within a unified framework.
Methodology
GEMSEC extends the skip-gram architecture by integrating a multi-component loss function designed to align embeddings with community structures. The objective function comprises three primary elements:
- Embedding Cost: A standard skip-gram objective that minimizes the negative log-likelihood of node neighborhoods, preserving the graph's local topology.
- Clustering Cost: A $k$-means-inspired term that minimizes the distance between each node and its assigned cluster center ($\mu_c$). This explicitly pulls nodes toward community centroids.
- Smoothness Regularization: Based on neighborhood overlap (Jaccard similarity), this term encourages nodes with shared neighbors to be positioned closer together, effectively sharpening community boundaries.
To ensure stability, the model employs an annealing strategy, gradually increasing the weight of the clustering cost during training. The optimization is performed using mini-batch gradient descent with negative sampling, maintaining linear scalability relative to the number of nodes.
Datasets and Evaluation
The performance of GEMSEC was evaluated on several large-scale social network datasets:
- Facebook Page Networks: Mutual "likes" between verified pages across categories such as Politicians, Athletes, and Companies.
- Deezer User Networks: Friendship networks from three countries, utilized for downstream genre preference prediction.
- Zachary’s Karate Club: A classic benchmark used for qualitative visualization of community separation.
Results and Discussion
GEMSEC demonstrates significant improvements over state-of-the-art baselines, including DeepWalk, node2vec, and LINE.
Quantitative Performance
On the Facebook datasets, GEMSEC consistently achieved higher modularity scores, showing a 3.4% improvement in the "Athletes" network over the best baseline. In recommendation tasks using the Deezer dataset, GEMSEC variants outperformed competing methods in F1-score by 3.03% to 4.95%, indicating that joint learning produces more informative features for downstream tasks.
Qualitative Visualization
Visual analysis of the Karate Club graph highlights the impact of the clustering cost. Unlike the "fuzzy" boundaries produced by DeepWalk, GEMSEC generates tightly packed, well-separated clusters.
Conclusion
GEMSEC bridges the gap between graph embeddings and community detection by treating them as synergistic tasks. By incorporating social-network-specific priors and a clustering objective, it produces high-quality, community-aware representations. Future work may address the current limitations of fixed cluster counts and the assumption of non-overlapping communities.
Summary updated