Community detection using a potential-based label propagation algorithm