pyt-team / TopoNetX

Computing on Topological Domains
https://pyt-team.github.io/toponetx/
MIT License
175 stars 32 forks source link

Inconsistencies in iterating over different complex types #266

Closed ffl096 closed 11 months ago

ffl096 commented 11 months ago

Iterating over complexes is inconsistent across different complex types:

We should make this consistent across all implementations and add a definition to the Complex ABC. I would suggest for the __iter__ method to iterate over all atoms in a complex. Any thoughts?

ninamiolane commented 11 months ago

Thanks for spotting this! I agree to iterate only over the nodes, great idea.

sanity check: Is it what networkx does?

ffl096 commented 11 months ago

NetworkX iterates over the nodes.

I think there is a need for both: Iterating over the nodes and over all faces in the complex. The normal __iter__ method could iterate over the nodes and a dedicated iter_atoms over all faces in the complex. This would be akin to NetworkX's iterating over G (or G.nodes) and over G.edges.