Hello Tiago,
I am trying to generate a stochastic block model but with the degree-sequence preserved. I am fine even if the degree-distribution is preserved instead of the exact sequence. I tried the following:
def prob(a, b): if a == b : return 0.999 else: return 0.001
g, bm = gt.random_graph(N, lambda: 1 + np.random.poisson(5), model = "blockmodel-degree", directed = False, block_membership=np.random.randint(0, b, N), edge_probs = prob)
However, this generates an ER graph. What can I do to retain the block-structure?
Thank you
I forgot to mention that 'b' in np.random.randint(0, b, N) is the number of blocks.
Thank you
On Wed, Sep 27, 2017 at 8:27 AM, Snehal Shekatkar <snehalshekatkar@gmail.com
wrote:
Hello Tiago,
I am trying to generate a stochastic block model but with the degree-sequence preserved. I am fine even if the degree-distribution is preserved instead of the exact sequence. I tried the following:
def prob(a, b): if a == b : return 0.999 else: return 0.001
g, bm = gt.random_graph(N, lambda: 1 + np.random.poisson(5), model = "blockmodel-degree", directed = False, block_membership=np.random.randint(0, b, N), edge_probs = prob)
However, this generates an ER graph. What can I do to retain the block-structure?
Thank you
Snehal M. Shekatkar Pune India
On 27.09.2017 03:57, Snehal Shekatkar wrote:
Hello Tiago,
I am trying to generate a stochastic block model but with the degree-sequence preserved. I am fine even if the degree-distribution is preserved instead of the exact sequence. I tried the following:
def prob(a, b): if a == b : return 0.999 else: return 0.001
g, bm = gt.random_graph(N, lambda: 1 + np.random.poisson(5), model = "blockmodel-degree", directed = False, block_membership=np.random.randint(0, b, N), edge_probs = prob)
However, this generates an ER graph. What can I do to retain the block-structure?
I believe this is a bug with the alias method used. Try with the option "alias=False", and don't forget to use a large value of "n_iter".
I'll provide a fix in git soon.
Best, Tiago
That worked! Thanks a lot.
Snehal
On Mon, Oct 2, 2017 at 9:54 PM, Tiago de Paula Peixoto tiago@skewed.de wrote:
On 27.09.2017 03:57, Snehal Shekatkar wrote:
Hello Tiago,
I am trying to generate a stochastic block model but with the degree-sequence preserved. I am fine even if the degree-distribution is preserved instead of the exact sequence. I tried the following:
def prob(a, b): if a == b : return 0.999 else: return 0.001
g, bm = gt.random_graph(N, lambda: 1 + np.random.poisson(5), model = "blockmodel-degree", directed = False, block_membership=np.random.
randint(0,
b, N), edge_probs = prob)
However, this generates an ER graph. What can I do to retain the block-structure?
I believe this is a bug with the alias method used. Try with the option "alias=False", and don't forget to use a large value of "n_iter".
I'll provide a fix in git soon.
Best, Tiago
-- Tiago de Paula Peixoto tiago@skewed.de
graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool