Distribution algorithm for node selection