Aha - yeah. Sorry, using arrays works, but not lists. (important to know,
though)


On 30 September 2013 19:11, Tiago de Paula Peixoto <[email protected]> wrote:

> On 09/30/2013 07:09 PM, Rene Pfitzner wrote:
> > 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.
>
> 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)
>
>
> Cheers,
> Tiago
>
> --
> Tiago de Paula Peixoto <[email protected]>
>
>


-- 
René Pfitzner, Dipl. Phys.
Scientific assistant / Doctoral candidate

ETH Zürich
Chair of Systems Design

+41-44-63-28478
[email protected]
http://www.sg.ethz.ch/people/prene
_______________________________________________
graph-tool mailing list
[email protected]
http://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to