  Identifying communities in networks is a fundamental and challenging problem
of practical importance in many fields of science. Current methods either
ignore the heterogeneous distribution of nodal degrees or assume prior
knowledge of the number of communities. Here we propose an efficient hypothesis
test for community detection based on quantifying dissimilarities between
graphs. Given a random graph, the null hypothesis is that it is of
degree-corrected Erd\"{o}s-R\'{e}nyi type. We compare the dissimilarity between
them by a measure incorporating the vertex distance distribution, the
clustering coefficient distribution, and the alpha-centrality distribution,
which is used for our hypothesis test. We design a two-stage bipartitioning
algorithm to uncover the number of communities and the corresponding structure
simultaneously. Experiments on synthetic and real networks show that our method
outperforms state-of-the-art ones.
