Hi Guys

I am trying to remove edges from my graph.

I first copy my graph:

gCopy = g.copy()

pCopy = gCopy.new_edge_property("double")

then I go through the edges in the original graph to check for a particular property:

for j, e in enumerate(g.edges():

src = e.source()

tgt = e.target()

When a certain value for the property map of the original graph is found I use:

if p[e] > value:

print pCopy.a

gCopy.remove_edge(e)

print pCopy.a

When I look at pCopy.a I see that the array does not shorten and that 0 values remain.

These values do not show up when I use:

for e in gCopy.edges():

print pCopy[e]

I can still find these values, however, when I use

for e in g.edges():

print pCopy[e]

I want to use this array in the max flow algorithm and it complains:

res = gt.edmonds_karp_max_flow(gCopy, src, tgt, pCopy)

res.a = pCopy.a - res.a

ValueError: operands could not be broadcast together with shapes (17,) (32,)

Is there any way I can remove the zero values from pCopy.a?

Thanks!

Best,

Alex

I am trying to remove edges from my graph.

I first copy my graph:

gCopy = g.copy()

pCopy = gCopy.new_edge_property("double")

then I go through the edges in the original graph to check for a particular property:

for j, e in enumerate(g.edges():

src = e.source()

tgt = e.target()

When a certain value for the property map of the original graph is found I use:

if p[e] > value:

print pCopy.a

gCopy.remove_edge(e)

print pCopy.a

When I look at pCopy.a I see that the array does not shorten and that 0 values remain.

These values do not show up when I use:

for e in gCopy.edges():

print pCopy[e]

I can still find these values, however, when I use

for e in g.edges():

print pCopy[e]

I want to use this array in the max flow algorithm and it complains:

res = gt.edmonds_karp_max_flow(gCopy, src, tgt, pCopy)

res.a = pCopy.a - res.a

ValueError: operands could not be broadcast together with shapes (17,) (32,)

Is there any way I can remove the zero values from pCopy.a?

Thanks!

Best,

Alex