Second, a series of iterations is performed aimed at merging the clusters (lines 5-11).
at each iteration the algorithm analyzes each vertex v in random order and assigns it to the majority class among those associated with its neighbors.