error: Received Orphaned Property Map

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?

thanks,
-sam

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

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)

just do: help(Graph.own_property)