Inconsistencies in `__getitem__` implementation across complex types
ffl096 opened this issue · 1 comments
ffl096 commented
Similar to #266, the __getitem__
method is not implemented consistently across different complex types:
- For simplicial complexes,
SC[simplex]
returns the user-defined attributes associated with that simplex. - For cell complexes,
CC[cell]
returns the neighbours of that cell. - For coloured hypergraphs (and combinatorial complexes),
CHG[node]
returns the attributes of that node, but it does not work for hyperedges. - For path complexes,
PC[path]
returns the attributes associated with that path.
ffl096 commented
For context, NetworkX works as follows:
G[node]
gives a view of all neighbouring nodes.G[edge]
is invalid.G[node][neighbour]
gives access to the edge attributes of the edge betweennode
andneighbour
.G.nodes[node]
andG.edges[edge]
gives access to the attributes ofnode
andedge
, respectively.
That being said, I am not sure we want to mirror that API exactly. For example, SC[node][neighbour]
is ill-defined, as there can be multiple connections between two nodes and it is not clear what attributes to return.