here is a working example
```
import graph_tool.all as gt
import multiprocessing as mp
g = gt.collection.data["celegansneural"]
pool = mp.Pool(5)
def fit_sbm(i):
state = gt.minimize_blockmodel_dl(g)
b = state.get_blocks()
print(i)
return(b)
blocks = pool.map(fit_sbm, range(5))
pool.close
#print(blocks)
#b0 = blocks[0]
#print(b0)
b0 = blocks[0]
g.vertex_properties["membership"] = b0
```
i wasn't aware of the own_property() function and can't find it in the
graph-tool documentation (other than seeing it being used in examples involving
visualization). whatever it does, it seems to work, and the modified code below
seems to work
```
import graph_tool.all as gt
import multiprocessing as mp
g = gt.collection.data["celegansneural"]
pool = mp.Pool(5)
def fit_sbm(i):
state = gt.minimize_blockmodel_dl(g)
b = state.get_blocks()
print(i)
return(b)
blocks = pool.map(fit_sbm, range(5))
pool.close
#print(blocks)
#b0 = blocks[0]
#print(b0)
b0 = blocks[0]
g.vertex_properties["membership"] = g.own_property(b0)
```
_______________________________________________
graph-tool mailing list -- [email protected]
To unsubscribe send an email to [email protected]