Removed edges in EdgePropertyMap

Hi Tiago, hi all,

When an edge is removed from a graph, it still occupies a place in the
graphs EdgePropertyMap, leading to the following being |False|:

edge_prop.a.shape[0] == graph.num_edges()|

Is there a way to circumvent this?

Best,

Guillaume

attachment.html (2.36 KB)

If you use a recent version from git, this can be obtained by getting
the filtered array, with the .fa attribute:

    edge_prop.fa.shape[0] == graph.num_edges()

Best,
Tiago

Hi,

I‘m relying on the deb package, so I’ll have to wait for next release.
Meanwhile, here is a workaround for any one interested:

def _get_valid_mask(graph):

     '''Mask over valid edges '''
     valid = graph.new_edge_property('bool')
     valid.a[:] =0
     for edgein graph.edges():
         valid[edge] =1
     return valid

valid = _get_valid_mask(graph)
graph.set_edge_filter(valid)

edge_prop.fa.shape[0] == graph.num_edges()|

Thanks for the fast answer,

Best,

Guillaume

attachment.html (6.22 KB)