Sorry for the late reply, but there was a problem with the mailing list.
I can't figure out the precise meaning of 'proportional' to, and would
like to know where/how it enters into the the actual formulae for
stochastic blocks. I have tried playing with various limits, and of course
tried scaling the 'probability' to account for graph size. For example,
there does not appear to be a limit where all edges are within blocks,
though surely this should be possible(assuming the number of edges fits
within the blocks)? Any help would be greatly appreciated.
Proportional means exactly that: The probability will be what you give, up
to an overall constant, which is unimportant since the total number of edges
is always fixed.
To force the edges to always be inside the groups, you should set the
probability to zero, whenever r != s.
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.