---
title: Size-Bounded Community Search
url: https://www.emergentmind.com/topics/size-bounded-community-search
type: topic
---

# Size-Bounded Community Search

Size-bounded community search studies community identification under explicit cardinality constraints rather than relying on indirect control of scale. In the query-centric formulations, the task is to return a subgraph that contains a designated query node and satisfies a prescribed size condition while optimizing a cohesiveness criterion; in related partition-based work, the task is to optimize a global objective while requiring every community in a partition to lie within user-specified size bounds. Recent arXiv work formalizes this theme in heterogeneous information networks (HINs), attributed graphs, and modularity-based graph partitioning, and collectively shows that size bounds are not a cosmetic post-processing rule but a primary modeling constraint that changes both the optimization problem and the algorithmic design [2508.14356] [2402.17242] [2605.25248].

## 1. Scope and formal problem statements

Two query-centric formulations are explicit. In HINs, the size-bounded community search problem takes as input an HIN \(H\), a symmetric meta-path \(P\), a query node \(q\) of the target type, and a size bound \(s\in\mathbb N^+\), and returns a subgraph \(G_P'=(V^*,E^*)\) with \(|V^*|=s\) and \(q\in V^*\) such that \(E^*\) induces a triangle-connected \((k^*,P)\)-truss of maximum possible \(k^*\). In attributed graphs, the size-bounded extension of CS-AG takes an attributed graph \(G=(V,E,A)\), a query node \(q\in V\), integers \(k>0\), \(l>1\), \(h\ge l\), and the attribute distance \(f(u,q)\), and asks for a connected \(k\)-core \(H\subseteq G\) containing \(q\) with \(l \le |V_H| \le h\) that minimizes the \(q\)-centric attribute distance
$$
\delta(H) = \frac{1}{|V_H|-1}\sum_{u\in V_H\setminus\{q\}} f(u,q).
$$
A related but distinct global formulation is the size-constrained maximum-modularity problem, where a partition \(P=\{C_1,\dots,C_q\}\) of an undirected, unweighted graph must satisfy \(s \le |C| \le S\) for every community \(C\) and optimize modularity over the family of feasible partitions [2508.14356] [2402.17242] [2605.25248].

| Setting | Feasibility condition | Optimization target |
|---|---|---|
| HIN community search | \(|V^*|=s\), \(q\in V^*\), triangle-connected \((k,P)\)-truss | Maximum possible \(k^*\) |
| Attributed-graph community search | \(q\in V_H\), connected \(k\)-core, \(l \le |V_H| \le h\) | Minimize \(\delta(H)\) |
| Modularity-based partitioning | Every community satisfies \(s \le |C| \le S\) | Maximize \(Q(G,P)\) |

This terminology matters. The HIN and attributed-graph problems are community search problems because they are anchored at a query node \(q\). The modularity formulation is a size-constrained community detection problem over an entire partition. A plausible implication is that the literature uses closely related constraint machinery in settings with materially different output semantics: one community around a query versus a full partition of the graph.

## 2. Cohesiveness models and objective functions

In HINs, the search space is built from a meta-path-derived homogeneous graph. A HIN is a directed graph \(H=(V,E)\) with a node-type mapping \(\phi:V\to\mathcal A\) and an edge-type mapping \(\psi:E\to\mathcal R\). A meta-path \(P\) of length \(l\) is a sequence \(A_1 \xrightarrow{R_1} A_2 \xrightarrow{R_2}\cdots \xrightarrow{R_l}A_{l+1}\), and the work assumes symmetric \(P\). Collecting all \(P\)-pairs over nodes of a chosen target type yields a homogeneous, undirected graph \(G_P=(V_P,E_P)\). Cohesiveness is then defined through a refined \((k,P)\)-truss model: a triangle is a triplet \((u,v,w)\) such that each pair is a \(P\)-pair in \(G_P\); the support of an edge is the number of triangles containing it; a \((k,P)\)-truss is a maximum edge-set \(S\) in \(G_P\) such that every \((u,v)\in S\) has support at least \(k-2\); and triangle connectivity requires that every pair of triangles in \(S\) be connected through a sequence of adjacent triangles [2508.14356].

In attributed graphs, the structural constraint is a connected \(k\)-core and the quality criterion is explicitly query-centric. The extension to size-bounded CS leaves the attribute-distance and confidence-interval machinery unchanged and only inserts size checks into the exact and approximate procedures. The central objective remains minimization of \(\delta(H)\), which averages \(f(u,q)\) over nodes in the returned community other than the query node. The paper states that the metric considers both textual and numerical attributes and emphasizes correlation with the query node \(q\) [2402.17242].

In modularity-based partitioning, the graph is \(G=(V,E)\) with \(|V|=n\), \(|E|=m\), adjacency matrix \(A=[a_{ij}]\), degree \(d_i=\sum_j a_{ij}\), and resolution parameter \(\gamma>0\). The modularity objective is
$$
Q(G,P) = \frac{1}{2m}\sum_{i,j\in V}\Bigl(a_{ij}-\gamma\frac{d_i d_j}{2m}\Bigr)\delta(i,j),
$$
where \(\delta(i,j)=1\) if \(i\) and \(j\) are in the same community and \(0\) otherwise. With modularity matrix \(B=[b_{ij}]\), \(b_{ij}=a_{ij}-\gamma \frac{d_i d_j}{2m}\), this can be written as
$$
Q(G,P)=\tfrac{1}{2m}\sum_{i<j}2\,b_{ij}\,\delta(i,j)+\tfrac{1}{2m}\sum_i b_{ii}.
$$
To impose size constraints, the heuristic replaces \(Q\) by a penalized objective
$$
Q_\lambda(P)=Q(G,P)-\lambda\,\Phi(P),
$$
where \(\Phi(P)=\sum_{C\in P}\phi(n_C)\) and
$$
\phi(n_C)=
\begin{cases}
\sqrt{s-n_C}, & n_C<s,\\
\sqrt{n_C-S}, & n_C>S,\\
0, & s\le n_C\le S.
\end{cases}
$$
The square-root form is stated to be sub-additive, which encourages coalescence of marginally violating clusters during local moves [2605.25248].

## 3. Computational hardness and exact formulations

For HINs, the decision version of size-bounded community search is NP-complete via reduction from CLIQUE. Given a graph \(G=(V,E)\), the reduction constructs a two-type HIN in which each original edge \((u,v)\) maps to a new node \(w_e\) plus edges \((u,w_e)\) and \((v,w_e)\) under the meta-path \(P=(T_1,T_2,T_1)\). The proof shows that a clique of size \(m\) in the original graph corresponds to an \((m+1)\)-clique, and hence an \((m+1)\)-truss of trussness \(m+1\), containing a special query node \(q\) [2508.14356].

For attributed graphs, the size-bounded version remains NP-hard because it subsumes the unconstrained CS-AG problem. The paper does not give a new reduction in the size-bounded section; instead, it observes that setting \(h=|V|\) recovers the unconstrained case, so the hardness result carries over directly [2402.17242].

In modularity optimization, the exact baseline is formulated as a \(0\)–\(1\) integer linear program for the variant with at most \(k\) communities. Binary variables \(x_{i,c}\) encode assignment of node \(i\) to community index \(c\), and binary variables \(f_{i,j}\) encode whether nodes \(i\) and \(j\) share a community. The objective maximizes
$$
\frac{1}{2m}\Bigl(\sum_{i<j}2\,b_{ij}\,f_{i,j}+\sum_i b_{ii}\Bigr),
$$
subject to assignment constraints \(\sum_c x_{i,c}=1\), sign-sensitive consistency constraints over \(B^+=\{(i,j):b_{ij}\ge 0\}\) and \(B^-=\{(i,j):b_{ij}<0\}\), and size bounds \(\sum_i x_{i,c}\le S\) together with \(\sum_i x_{i,c}\ge s\cdot x_{i,c}\) to enforce either emptiness or size at least \(s\). The implementation uses Gurobi 10.x with default MIP tolerances, allowing a \(0.1\%\) optimality gap on larger graphs and exact solve on \(n\le 60\) [2605.25248].

## 4. Algorithmic strategies

The HIN work develops a branch-and-bound framework, kcBB, that enumerates size-\(s\) node sets containing \(q\). Direct enumeration over \(\binom{n}{s-1}\) candidates is tightened by lexicographic generation of size-\(s\) subsets, upper bounds on achievable trussness from a partial state \((C,R)\), dominance-based branching, candidate reductions, and early termination. The node-based and edge-based upper bounds both run in \(O(|E(G_P[C\cup R])|^{1.5})\) by triangle enumeration. Dominance is defined in edge and triangle forms, and the total search order sorts \(R\) by nondecreasing distance to \(q\), tie-broken by nonincreasing node trussness. Candidate reductions remove nodes with trussness at most the current best \(k^*\), nodes not \((k^*+1)\)-triangle-connected to \(C\), and nodes whose distance enforces too large a minimum truss increase. A heuristic lower bound is obtained from meta-path “stars”: each \(P\)-star is a clique in \(G_P\), and seeds containing \(q\) are either truncated to size \(s\) or greedily merged and then pruned. Two exact algorithms are built on top of this framework: node-set enumeration (NSG), whose worst-case time complexity is \(O\bigl(|N(q,G_P)|\binom{|V(G_P)|}{s-2}|E(G_P)|^{1.5}\bigr)\), and edge-set enumeration (ESG), whose search tree depth is at most \(\frac{(s-1)(s-2)}2\) and whose stated worst-case complexity is \(O\bigl(|N(q,G_P)|\binom{|E(G_P)|}{\tfrac{(s-1)(s-2)}2}|E(G_P)|^{1.5}\bigr)\) [2508.14356].

For attributed graphs, the exact enumeration algorithm is extended by adding size checks: if a candidate subcore is too large, recursion stops; if it is already too small, recursion also stops because the process only deletes nodes; and the current best is updated only when \(l \le |V_{H_k^i}| \le h\). The three pruning strategies—duplicate-state, unnecessary, and unpromising by lower bound—carry over unchanged. The approximate method modifies the sampling-estimation framework in three places: the Hoeffding-based minimum sample-neighborhood size replaces the term \(k+1\) by \(l\), requiring
$$
|G_q| \ge \frac{2}{\epsilon^2}\ln\bigl(l\cdot (n-l)/\beta\bigr)+1;
$$
the greedy enumeration ignores candidates with size \(>h\) and stops the peel-off chain if the size would drop below \(l\); and early termination is allowed once a feasible \(H^\star\) is found with bootstrap-computed confidence-interval half-width \(\epsilon\) satisfying
$$
\epsilon \le \delta(H^\star)\cdot e/(1+e).
$$
The paper characterizes the approximation output by a confidence interval rather than only by a loose approximation ratio [2402.17242].

For modularity-based partitioning, the principal heuristic is constrained Leiden. It begins with \(\lambda=0\), runs standard Leiden, and, if the resulting partition violates any \(s\le |C|\le S\) constraint, sets \(\lambda\leftarrow \max(10^{-4},\lambda)\times 2\) and re-runs Leiden seeded from the previous partition until a feasible partition is found. During local moves and refinement, moving node \(i\) from community \(A\) to \(B\) is evaluated by
$$
\Delta Q_\lambda = \Delta Q_{\mathrm{mod}} - \lambda(\Delta \phi_A+\Delta \phi_B),
$$
and the move is accepted if \(\Delta Q_\lambda>0\). Each Leiden run is \(O(m\log n)\) on sparse graphs, and the worst-case number of penalty doublings is \(O(\log(\lambda^*))\), yielding total cost \(\lesssim O(m\log n\cdot \log(\Phi_{\max}/10^{-4}))\) [2605.25248].

## 5. Empirical behavior across graph settings

The modularity study compares UL (Unconstrained Leiden), CL (Constrained Leiden), and CIP (Constrained IP). On planted-partition benchmarks with \(n\in\{64,128,256\}\), average degree \(k\in\{5,8,10\}\), two equal-size communities, mixing \(\mu\in[0.1,0.5]\), and size bounds \([n/2-10\%,\, n/2+10\%]\), the reported metrics are Adjusted Mutual Information (AMI), achieved standard \(Q\), and community size distributions. UL often achieves higher \(Q\) but violates size bounds and yields low AMI below the detectability limit \((\mu\le 0.4)\). CL and CIP both satisfy size bounds, and CL’s AMI tracks CIP closely, within \(0\)–\(2\%\). On a ring of \(50\) cliques of size \(5\), UL retrieves the planted partition only for \(\gamma\in[5,40]\), whereas CL retrieves it at \(\gamma=1\) with \([s,S]=[2,8]\). On the Budapest brain connectome with \(n=1015\), UL yields four trivial clusters, while neuroscience atlases suggest relative community-size ranges \([6/246 \dots 34/246]\) or \([12/200 \dots 46/200]\); averaging gives \(s=43\), \(S=187\), and CL at \(\gamma=1\) returns \(6\) clusters closely matching known functional systems. In runtime terms, UL and CL scale to millions of edges in seconds, whereas CIP scales to \(n\le 60\) before memory/time blowup [2605.25248].

The HIN study evaluates on Amazon, DBLP, DoubanMovie, Aminer, and Freebase, with schema sizes ranging from \(|\mathcal A|=4\)–\(8\), \(|\mathcal R|=4\)–\(36\), and \(10\)–\(100\) meaningful symmetric meta-paths per dataset. It uses \(100\) queries per dataset with random \(P\) and query node \(q\), and size bound \(s\in\{9,12,15,18,21\}\). The baselines are SC-BRB and ST-Exa; the proposed methods are SCSHEV\(^+\) and SCSHEP\(^+\). Quality is measured by \(P\)-pair density, \(\frac{|E^*|}{|V^*|}\), and average PathSim similarity over all node pairs in the community. The reported outcome is that SCSHEV\(^+\) yields the highest densities and similarities across all datasets and sizes, often returns a clique when \(s\) is small on DBLP, Aminer, and Freebase, and is also the fastest; SCSHEP\(^+\) is slower but outperforms the baselines. On Freebase, with up to \(1.4\) billion \(G_P\)-edges, NSG with the stated optimizations still solves most queries within minutes [2508.14356].

The attributed-graph study reports size-bounded experiments on DBLP and GitHub with \(k=4\), \(l=10\), and upper bound \(h\) varying from \(10\) to \(50\), averaged over \(200\) random queries. On DBLP, response time decreases from approximately \(120\) ms at \(h=10\) to approximately \(60\) ms at \(h=50\), while relative error decreases from approximately \(1.8\%\) to approximately \(0.9\%\). On GitHub, response time decreases from approximately \(250\) ms to approximately \(120\) ms, and relative error from approximately \(1.9\%\) to approximately \(1.0\%\). In every case, the absolute relative error remains below the user-specified \(2\%\) bound, and runtime falls as the maximum size bound grows because the greedy peel needs fewer steps [2402.17242].

## 6. Interpretation, implementation, and recurrent misconceptions

A recurrent misconception in modularity-based practice is that tuning the resolution parameter \(\gamma\) is an adequate surrogate for explicit size control. The size-constrained modularity study rejects that equivalence on several grounds. Changing \(\gamma\) shifts the average community size—smaller \(\gamma\) produces fewer larger clusters and larger \(\gamma\) produces more smaller clusters—but does not force every community size to lie in \([s,S]\). The paper also states that resolution changes cannot directly reduce the variance \(\mathrm{Var}(|C|)\) once \(\gamma\) is fixed, whereas the size-constrained approach simultaneously controls the minimum and maximum community size and hence the variation. The ring-of-cliques example is used as a concrete counterexample to the idea that a resolution sweep can reliably enforce individual size bounds [2605.25248].

Implementation details reflect the same distinction between explicit constraints and indirect tuning. Constrained Leiden is available in `leidenalg v0.10+` for Python and `libleidenalg` for C++, and passing `min_community_size` and `max_community_size` activates the penalty-based move evaluation and progressive \(\lambda\) schedule; an `init_membership` argument can be used to speed repeated runs. In the HIN and attributed-graph settings, by contrast, size bounds are embedded directly in the search logic through candidate generation, pruning, or termination conditions rather than through a global penalty on partition quality [2605.25248] [2508.14356] [2402.17242].

Across these lines of work, size-boundedness serves different operational roles. In HINs, the motivation is that “a size constraint is often imposed due to limited resources.” In modularity-based detection, the motivation is that domain experts may have prior expectations about the size of communities. In attributed graphs, the size-bounded extension is treated as a direct modification of CS-AG with unchanged attribute-distance machinery. This suggests that size-bounded community search is best understood not as a single algorithmic recipe but as a family of constrained optimization problems whose common feature is explicit cardinality control, while the structural model—triangle-connected \((k,P)\)-truss, connected \(k\)-core, or modularity-defined partition—determines the relevant objective, hardness, and feasible algorithmic strategy.

Source: https://www.emergentmind.com/topics/size-bounded-community-search