Updating specific edge properties

I am probably just missing something, but I want to update a specific edge property within a graph, for example increasing the weight once it has been visited by a random walk. I thought I would just be able to update the edge property value but this doesn’t work in the way I expected. I’ve included a minimal example here:

g = gt.Graph([(0,1,10)],eprops = [('weight','double')])
print(g.ep['weight'][0,1])
g.ep['weight'][0,1] = 999
print(g.ep['weight'][0,1])

What am I missing??

Thanks,

Nik

This is actually a bug! It has been fixed in the newest 2.58 version.

In the meantime, if you can’t upgrade, you can work around this by indexing via edge descriptors

g = gt.Graph([(0,1,10)],eprops = [('weight','double')])
print(g.ep['weight'][g.edge(0,1)])
g.ep['weight'][g.edge(0,1)] = 999
print(g.ep['weight'][g.edge(0,1)])

ah great, I can update! Thank you!