pyt-team/TopoNetX

Cell View __contains__ issues with homotopic cells and non-ordered Iterables

devendragovil opened this issue · 0 comments

What

  1. The contains method of Cell View Class doesn't check for homotopic cells and hence throws incorrect results when checking membership for a homotopic cell.
  2. Non-ordered Iterables like Sets when converted to tuples (as presently done) will result in ordered tuples, leading to various issues

How to Reproduce

import toponetx as tnx
CX = tnx.CellComplex()
CX._insert_cell((1, 2, 3, 4), color="red")
CX._insert_cell((1, 2, 3, 4), color="green")
CX._insert_cell((1, 2, 3, 4), shape="square")
CX._insert_cell((2, 3, 4, 5))
CV = CX._cells
print(CV.__contains__((1,2,3,4)),"---", CV.__contains__((2,3,4,1)))
set_1 = {1, 2, 3, 4}
set_2 = {2, 1, 3, 4}
print(CV.__contains__(set_1),"---", CV.__contains__(set_2))

The above would print

True --- False
True --- True