🤖 AI Summary
In community detection, most graph neural network (GNN) approaches lack precise control over the number of output clusters: they neither automatically infer the optimal count nor reliably adhere to a user-specified target. This paper introduces the first GNN framework supporting explicit cardinality constraints on clustering—enabling differentiable soft or hard upper/lower bounds on the number of communities. Users may specify either an exact cluster count or a feasible range, with constraints strictly enforced during training. The method integrates a differentiable clustering module with a constrained optimization mechanism, jointly preserving structural awareness and cluster-count controllability. Extensive experiments demonstrate that the framework maintains competitive clustering quality while consistently producing community partitions satisfying the prescribed cardinality constraints—thereby significantly enhancing the practicality and reliability of GNNs for controllable community detection.
📝 Abstract
In community detection, many methods require the user to specify the number of clusters in advance since an exhaustive search over all possible values is computationally infeasible. While some classical algorithms can infer this number directly from the data, this is typically not the case for graph neural networks (GNNs): even when a desired number of clusters is specified, standard GNN-based methods often fail to return the exact number due to the way they are designed. In this work, we address this limitation by introducing a flexible and principled way to control the number of communities discovered by GNNs. Rather than assuming the true number of clusters is known, we propose a framework that allows the user to specify a plausible range and enforce these bounds during training. However, if the user wants an exact number of clusters, it may also be specified and reliably returned.