# [graph-tool] random_graph stochastic block model produces unreasonably interconnected blocks

Tiago de Paula Peixoto tiago at skewed.de
Thu Oct 27 17:18:59 CEST 2016

```On 25.10.2016 17:42, G. B. wrote:
> Sure thing-- here's the example I was describing. Again, assuming my
> calculations in the previous message are correct (i.e. I'm understanding the
> documentation correctly), I should expect, on average, about 5 or so edges
> reaching from one block to the other block, with about 6-8 edges in the
> total network connecting minority block members to each other (and 235-237
> edges in the total network connecting majority block members to each other).
> Instead, the minority block features a higher-than-expected connectivity,
> and all of the members of the minority block appear central in the overall
> network.
>
> Thanks in advance for any help.
>
>
>
> N = 100
> P = .15
>
> def blockMaker(v):
> 		if v<N*P:
> 			return 1
> 		else:
> 			return 0
>
> def corr(a,b):
> 		if a==b:
> 			return 20
> 		else:
> 			return 1
>
> g, sT = random_graph(N, lambda: poisson(5), directed=False,
> 						model="blockmodel-traditional",
> 						block_membership= blockMaker,
> 						vertex_corr=corr,n_iter=100,persist=True)
>
> graph_draw(g, vertex_fill_color=sT, edge_color="black", output="figure.pdf")

As it stands, the documentation for model="blockmodel-traditional" is
imprecise. It should state that the value returned by corr(a,b) should be
proportional to the probability of an edge existing between the two groups,
not two nodes that belong to the two groups. In other words, the  expected
total number of edges  between groups a and b will be proportional to
corr(a, b). To get what you want, you need to multiply your probability by
the product of the sizes, corr2(a, b) = corr(a, b) * n_a * n_b.

Best,
Tiago

--
Tiago de Paula Peixoto <tiago at skewed.de>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <https://lists.skewed.de/pipermail/graph-tool/attachments/20161027/fe0ecb5e/attachment.asc>
```

More information about the graph-tool mailing list