Scaling AlphaPhi algorithm, making it work with non-consecutive id's.