Am 04.10.21 um 10:29 schrieb sam.gyetvay@gmail.com:
hi,
i received this error while trying to assign a vertex property map to a graph, and i'm not sure how to get around it.
context: i am running minimize_blockmodel_dl() many times in parallel using microprocessing. because my graph is large, i don't want it to save multiple copies of the graph. so i am trying to only keep the block id each time. however, when i try to do this, i get the above error
here's a somewhat simplified example:
``` import graph_tool.all as gt import multiprocessing as mp
pool = mp.Pool(5)
def fit_sbm(): state = gt.minimize_blockmodel_dl(g) b = state.get_blocks() return b
blocks = pool.map(fit_sbm, range(5))
pool.close
b0 = blocks[0] membership = g.new_vertex_property("int") membership = b0 g.vertex_properties["membership"] = b0 ```
could you explain why this error comes up, and also if possible suggest an alternative way to proceed?
The code you provided does not run. Could you please provide a minimal _working_ example that shows the problem? Additionally, you seem confused about how variable assignment works in Python, since the first line does nothing in: membership = g.new_vertex_property("int") membership = b0 And these two lines are also irrelevant to what follows, since you never use the variable "membership" again. Presumably, you wanted to do something like: g.vp["membership"] = g.own_property(blocks[0]) But I can only guess. Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>