Dear all, I do not understand the behavior of the following code (this is not a minimal example, I tried to reproduce the problem on a minimal example but I could not...). I do not get why, when I purge the vertices and edges after filtering, the properties of the vertices are not consistent. Thanks for your help, Flavien. _graph = gt.Graph(_originalGraph)
_bus = _graph.new_vertex_property('bool') _bus.a = True _trainVertices = [_v for _v in _graph.vertices() if _name[_v][:3] == 'stn']
for _v in _trainVertices : _bus[_v] = False
print 'original graph #', _graph print 'train number # ', len([_v for _v in _graph.vertices() if _name[_v][:3] == 'stn']), '\n'
_graph.set_vertex_filter(_bus) print 'filtered graph #', _graph print 'train number #', len([_v for _v in _graph.vertices() if _name[_v][:3] == 'stn']), '\n'
_graph.purge_vertices() _graph.purge_edges() print 'purged graph #', _graph print 'train number #', len([_v for _v in _graph.vertices() if _name[_v][:3] == 'stn']), '\n'
original graph # <Graph object, directed, with 2775 vertices and 9341 edges at 0x313be50>
train number # 112
filtered graph # <Graph object, directed, with 2663 vertices and 6307 edges, edges filtered by (<PropertyMap object with key type 'Edge' and value type 'bool', for Graph 0x313be50, at 0x2a3c750>, False), vertices filtered by (<PropertyMap object with key type 'Vertex' and value type 'bool', for Graph 0x313be50, at 0x2d62610>, False) at 0x313be50> train number # 0
purged graph # <Graph object, directed, with 2663 vertices and 6307 edges, edges filtered by (<PropertyMap object with key type 'Edge' and value type 'bool', for Graph 0x313be50, at 0x313bc50>, False), vertices filtered by (<PropertyMap object with key type 'Vertex' and value type 'bool', for Graph 0x313be50, at 0x313bb90>, False) at 0x313be50> train number # 109