Implementation of the Label Propagation (LP) algorithm