Documentation of Graph Class - Clarification on Note on relative Runtime

The Documentation for Graph.iter_all_neighbors (etc.) states that:

This mode of iteration is more efficient than using out_neighbors(), as descriptor objects are not created.

I just realized (when writing this post) that this refers to the Vertex method out_neighbors() and not to the Graph method get_out_neighbors(). So this may be on me for only skimming the documentation and not thinking it through.

Anyway, I found it to be much slower than get_out_neighbors() (when using Cython) because the iteration is handled in python rather than python only handing over numpy arrays between C-level code. Since the note said ‘faster than XY’ I assumed that it would be the fastest way to do it, which is not the case.

It may be helpful to add a reference to get_all_neighbors, saying that this is even faster when using C-level code. In my example, on the Netzschleuder escorts dastaset, the difference is between 2.5s and 0.033s, so quite significant IMO.
minimal_example.ipynb (2.6 KB)

Even though this wasn’t relevant for me, adding the opposite notice to the methods of Vertex would also be useful for many users.

I’d be happy to create a merge request if you agree that this would be an improvement to the documentation.

As you already noticed Graph.get_out_neighbors() and Vertex.iter_out_neighbors() are different functions, and the documentation does not refer to the former, only the latter.

The difference between these modes of iteration are already described in detail in the documentation: Quick start guide — graph-tool 2.80 documentation