Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Get all nodes/edges as numpy array #2

Open
cmalinmayor opened this issue Sep 19, 2024 · 2 comments
Open

Feature: Get all nodes/edges as numpy array #2

cmalinmayor opened this issue Sep 19, 2024 · 2 comments

Comments

@cmalinmayor
Copy link

No description provided.

@funkey
Copy link
Member

funkey commented Sep 24, 2024

For context, at the moment, Graph.{nodes,{in_,out_,}edges} return generators. Those are slow convenience methods for cases where users do not want to allocate a lot of memory. I am not sure if this use case is common, though.

One option is to always return numpy arrays. That can be a footgun if someone asks for all nodes/edges with data, as this will basically make a copy of everything stored in the graph. Maybe acceptable.

The alternative is to provide separate functions for numpy array access. That'll clutter the interface.

I think I am leaning towards the first option. Opinions?

@cmalinmayor
Copy link
Author

I like the default being returning numpy arrays. We can add a generator (for individual nodes or "pages" of nodes) if we find that it is necessary, but I think the numpy array is how we want people to interact with the spatial graph and should be the default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants