On 01.10.2016 10:13, Tzu-Chi Yen wrote:
Dear Tiago,
I tried, g, bm = gt.random_graph( 1000, lambda: np.random.poisson(10), model="blockmodel-traditional", vertex_corr = corr, directed = False, block_membership=lambda: random.randint(1, 10) )
where corr is, def corr(a, b): if a == b: return 1. else: return 0.
The edges are not forced to stay within the blocks, when I checked with, gt.graph_draw(g, vertex_fill_color=bm, edge_color="black")
Am I missing something?
If parallel edges and self-loops are not allowed (as is the default), the algorithm implemented is an edge-switching Markov-Chain that needs time to equilibrate (this is mentioned in the documentation). Try adding "niter=100" to random_graph(), and your groups will mostly likely separate. Alternatively, you can make "parallel_edges=True" and "self_loops=True", and the same thing will happen much faster. Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>