optimizing community detection