  In this paper we introduce an estimator for the number of communities in the
Stochastic Block Model (SBM), based on the maximization of a penalized version
of the so-called Krichevsky-Trofimov mixture distribution. We prove its
eventual almost sure convergence to the underlying number of communities,
without assuming a known upper bound on that quantity. Our results apply to
both the dense and the sparse regimes. To our knowledge this is the first
consistency result for the estimation of the number of communities in the SBM
in the unbounded case, that is when the number of communities is allowed to
grow with the same size.
