Algorithms for detection of communities on graphs