simple label propagation implementation