Generate RG with flexible degree 

With while loop for degree bound.