Dear all, I am trying to generate a stochastic block model in the graph_tool. Specifically, I am trying to construct a network with exactly 2 blocks such that the probabilities inside the groups are higher than that of the between the groups (assortative structure) but the probabilities inside the groups are not identical for two groups (say 0.9 for the first group and 0.6 for the second group). The extreme case of this would be to make the probability between the groups equal to zero which should give me two isolated modules. My code given below however fails to generate these two models. Can somebody kindly explain me my mistake? import numpy as np import graph_tool.all as gt N = 1000 ave_deg = 10 block = np.random.randint(1, 3, N) def f(): ave_deg = 5 return np.random.poisson(ave_deg) def corr(a, b): if a == 1 and b == 1: return 0.6 elif a == 2 and b == 2 : return 0.9 else: return 0. G, bm = gt.random_graph(N, deg_sampler = f, directed = False, model = "blockmodel-traditional", block_membership = block, vertex_corr = corr) largest_comp = gt.Graph(gt.GraphView(G, vfilt = gt.label_largest_component(G)), prune = True) gt.graph_draw(G) Thank you Snehal -- Snehal Madhukar Shekatkar Pune India