Guten Tag!

I read in another thread about how someone wanted to do reverse lookup in property maps. My project is similar, and I'm looking to use the vertex/edge filters for achieving this. I don't quite understand exactly the best way to use them though.

Let's say I have a vertex property called 'color'. I have red, green, and blue vertices. If I want to mask the graph so as to only consider red vertices,

colors = g.vertex_properties['color'].get_array()
filter = numpy.ndarray( colors.size, dtype=bool )
filter = [ x == "red" for x in colors ]

g.set_vertex_filter( filter )

Is this correct and the most efficient way to do this? I'm actually working on a very large dataset with comparisons that aren't as trivial.

And just for clarification, does this mask out edges attached to green and blue vertices so that algorithms won't even see that they exist? For instance, pagerank won't consider these edges when performing the random walk. Also, let's say that I apply an edge filter instead, the resulting graph will still contain all the vertices, even if they're not connected to anything.

Thanks,

--
Derek