Quoting Tiago de Paula Peixoto (2016-09-21 17:45:32)
On 21.09.2016 14:53, Patrick Totzke wrote:
Is there a better way to filter my graphs than writing a custom `GraphView` subclass for it?
You can just use the set_edge/vertex_filter() methods of Graph.et
Yes, but as far as I understand one cannot add multiple vertex-filters right? I mean in order to solve my problem recursively on subgraphs, I can of course set a filter and then recur. But then "setting a filter" would amount to amending an already existing one...
You can just keep several copies of the mask, and compose them by hand:
old_mask = g.get_vertex_filter()[0] mask = old_mask.copy() for v in sub_graph_vertices: mask[v] = False g.set_vertex_filter(mask) # now g does no longer contains those vertices
It is easy to do this recursively, and it amounts to what is actually done with GraphView, although it is less elegant.
Cool, thanks for this and also for the detailed pointers re parallelisation! Best wishes, Patrick