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

other bug in add_simplices_from when specifying ids #244

Closed
maximelucas opened this issue Dec 7, 2022 · 1 comment
Closed

other bug in add_simplices_from when specifying ids #244

maximelucas opened this issue Dec 7, 2022 · 1 comment

Comments

@maximelucas
Copy link
Collaborator

Running

edges = [({0, 1, 2}, 1), ({1, 2}, 0), ({2, 3, 4}, 2)]
S = xgi.SimplicialComplex()
S.add_simplices_from(edges)

we get

# -> UserWarning: uid 2 already exists, cannot add simplex {2, 3, 4}.
S._edge
# -> {1: frozenset({0, 1, 2}),
#     2: frozenset({0, 1}),
#     3: frozenset({0, 2}),
#     4: frozenset({1, 2})}

which is wrong for two reasons:

  1. {2, 3, 4} should've been added but was not because its ID was taken by subfaces of {0, 1, 2}
  2. {1, 2} was assigned ID 4 even though the input specified 0

Both these issues can be solved by making add_simplices_from first add all input simplices and then add all their subfaces, rather than adding each input simplex and their subfaces immediately.

@maximelucas
Copy link
Collaborator Author

fixed in #247

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

1 participant