-
Notifications
You must be signed in to change notification settings - Fork 33
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
Fix #224 uid counter initialisation #225
Conversation
Thanks. I find this solution a bit convoluted. Since the edge uid is meant to be internal, it doesn't really matter what ids we associate to edges, right? Why not do something like this? class Hypergraph:
def __init__(self, incoming_data, ...):
...
self._edge_uid = count(start=len(incoming_data))
... Or something like this? In this way we know we will never generate uids that clash with whatever is in |
Good point, that's simpler. We just need to use it |
I think we need to have the same count while we make the copy. After we make the copy, I wouldn't really care that whether they are the same. |
Yea but I guess I would hope that if I add an edge to the original and to the copy, they get the same id by default. No? |
Actually now that I think of it they might clash with this. Because if you pass a dictionary where you specify the ids, you might add just two edges but give them ids 100 and 999. |
Looking back into this. One aspect that is not covered at all: when adding edges and specifying their IDs, we don't check if these IDs exist, in any methods, potentially replacing existing edges. In those cases, what should we do: 1) throw an error/warning "this edge could not be added because this ID already exists", or 2) change the ID to one that does not exist and add the edge anyway (potentially with a warning)? In case of numeric IDs, they might not be super meaningful (but also might be) and so adding anyway might be okay. But in case of more descriptive IDs for example strings, then updating might not be great. I think I'd go for throwing an error/warning and not adding, letting the user deal with this manually. |
I think it works now. Also, if we're okay, I'll implement the same for simplicial complexes, and update the note in the docstring of |
The tests for tutorials 3.11 pass but all others tutorial tests get cancelled, any idea why? Also, after merging main I had to deal with potential tuple IDs. I know we all agreed but I'm wondering now if allowing tuple IDs might not be so great. |
No idea what happened to the tests but I just re-ran them manually and all passed so 🤷 |
Yeah, let's merge. I have an idea of how to fix this as well! |
add_edges_from
andadd_simplices_from
H.copy()
so that it does not throw an error for string IDs