On 01.10.2016 10:13, Tzu-Chi Yen wrote:
g, bm = gt.random_graph(
vertex_corr = corr,
directed = False,
block_membership=lambda: random.randint(1, 10)
where corr is,
def corr(a, b):
if a == b:
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.
Tiago de Paula Peixoto <tiago(a)skewed.de>