Community detection in dense random networks