Fastest way to iterate through edges

Hi all,

I haven't been on the list very long but I see this question keeps coming
up. I just thought I put some numbers out so people know. Graph tool is
super fast at doing the c++ stuff it does, and super convenient for picking
through the data on a python level also, but it doesn't make python fast.

So, here are some examples of working with a mask in Python. Notice that
numpy is not fast just because it is numpy. I chose an Nx3 array because
numpy masking is extra slow with shapes other than Nx1.

attachment.html (3.23 KB)

Could you try those examples again with the newest version in git? I've
made some changes which should make the loops slightly faster.

However nothing is going to beat iterating through a list of edges,
since using the Graph.edges() iterator will include all the time
necessary for the creation of the edge descriptors.

Best,
Tiago

Sorry,

I don't want to ignore you but I don't think I'll get around to upgrading
any time soon. Should be easy enough for anyone to check for themselves
though.

Glad it's getting better though. The edge iterator isn't near as bad slow
as generating some other objects I've been working with (gdal.OGRGeometry
for instance).

Thanks,
  Elliot

attachment.html (1.97 KB)