Formalizing community detection and detecting hubs