Hypothesis Testing for Automated Community Detection in Networks