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
On 02/21/2014 12:58 PM, Guillaume Gay wrote:
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?
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 -- Tiago de Paula Peixoto <tiago@skewed.de>
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 Le 21/02/2014 13:18, Tiago de Paula Peixoto a écrit :
On 02/21/2014 12:58 PM, Guillaume Gay wrote:
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? 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
_______________________________________________ graph-tool mailing list graph-tool@skewed.de http://lists.skewed.de/mailman/listinfo/graph-tool
participants (2)
-
Guillaume Gay -
Tiago de Paula Peixoto