Subsets of property map values - iterating over vertices

Thanks Tiago!

Let me just point out that the part

  mask.a = g.degree_property_map("out").a > 4

will (if you are using python 2.x) not give you what you most likely would
like to have, namely a list of boolean values containing the results of the
element wise comparisons of elements g.degree_property_map("out").a[i]>4.
Instead, for some strange reason, you'll simply get the *value* True back,
writing True to all elements in mask.a ... instead, it seems to me, the
only (fastest) way to do it is to use map

  mask.a = map(lambda(x): x > 4, g.degree_property_map("out").a)

.... so be careful.


attachment.html (3.53 KB)

Are you sure?

I get the following with python 2 and numpy 1.7.1:

    In [4]: arange(10)
    Out[4]: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

    In [5]: arange(10) > 2
    Out[5]: array([False, False, False, True, True, True, True, True, True, True], dtype=bool)