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

remove_simplex_ids() raises error when removing all simplices from a SC #580

Closed
thomasrobiglio opened this issue Sep 6, 2024 · 0 comments · Fixed by #581
Closed

remove_simplex_ids() raises error when removing all simplices from a SC #580

thomasrobiglio opened this issue Sep 6, 2024 · 0 comments · Fixed by #581
Labels
bug Something isn't working

Comments

@thomasrobiglio
Copy link
Collaborator

thomasrobiglio commented Sep 6, 2024

Originally noted in #578. I am working on fixing it.

>>> tetra = xgi.SimplicialComplex([[1,2,3,4]])
>>> bunch = tetra.edges.filterby("order", 0, "gt")
>>> tetra.remove_simplex_ids_from(bunch)
Traceback (most recent call last):
  File "/Users/thomasrobiglio/GitHub/xgi/xgi/utils/utilities.py", line 40, in __getitem__
    return dict.__getitem__(self, item)
KeyError: 4

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/thomasrobiglio/GitHub/xgi/xgi/core/simplicialcomplex.py", line 749, in remove_simplex_id
    supfaces_ids = self._supfaces_id(self._edge[id])
  File "/Users/thomasrobiglio/GitHub/xgi/xgi/utils/utilities.py", line 42, in __getitem__
    raise IDNotFound(f"ID {item} not found") from e
xgi.exception.IDNotFound: 'ID 4 not found'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/thomasrobiglio/GitHub/xgi/xgi/core/simplicialcomplex.py", line 779, in remove_simplex_ids_from
    self.remove_simplex_id(id)
  File "/Users/thomasrobiglio/GitHub/xgi/xgi/core/simplicialcomplex.py", line 757, in remove_simplex_id
    raise XGIError(f"Simplex {id} is not in the Simplicialcomplex") from e
xgi.exception.XGIError: Simplex 4 is not in the Simplicialcomplex

quoting @maximelucas:

I think it fails when trying to remove edge 4: frozenset({1, 2, 3}) which does not exist anymore already because it already removed 2: frozenset({1, 2}), and in doing so had to remove 4: frozenset({1, 2, 3}) already to ensure downward closure.

@thomasrobiglio thomasrobiglio added the bug Something isn't working label Sep 6, 2024
thomasrobiglio added a commit to thomasrobiglio/xgi that referenced this issue Sep 6, 2024
@thomasrobiglio thomasrobiglio linked a pull request Sep 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant