I am trying to generate a stochastic block model but with the degree-sequence preserved. I am fine even if the degree-distribution is preserved instead of the exact sequence. I tried the following:
def prob(a, b): if a == b : return 0.999 else: return 0.001