Flexible Spectral Methods for Community Detection in Networks