-
Notifications
You must be signed in to change notification settings - Fork 274
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
Node.update appears broken #1339
Comments
Sorry for the late reply I was on a vacation. I marked it as a bug though it is not really a bug but rather a very weird behavior. I am planning to give this operation a better semantics, which will not be that surprising. The update operation works correctly with the labeled graphs, created with
The pair of functions As a result, in Graphlib we have equality between labels and nodes. Even in the labeled graph both labels and nodes are represented with the same type. The
So what the update operation currently does is that assuming that When we have an unlabeled graph, saying
So the I understand that this all sounds weird and wtfs/minute rate is very high but this is indeed the intended and specified semantics. I understand, that what you really want is to change node Besides, if what you want is actually to update the label, then you should use the labeled graph. |
I appreciate your consideration. Your reply here reminds me of an SO answer (/rant 😉) of yours I remember from a while ago, https://stackoverflow.com/a/47679557/11809 It sounds like My workaround at the moment (which is perfectly fine, even from a perf perspective) is to fold through all of the existing node's inputs and outputs and replace them with edges to the replacement node. I suppose I'm operating with the same mindset as ocamlgraph's "original sin", and in this particular case it'd be simpler / more efficient to swap a label; but I'm disinclined to have synthetic/semantically void node identifiers (ints I suppose), and the labelled graph API comes with additional awkwardness. |
That's a good answer, unfortunately, I forgot about it)) After a lot of consideration, I ended up on #1340. The
Yes, but we don't have such a signature, neither does OCamlgraph. |
Example:
This prints:
I would expect:
The text was updated successfully, but these errors were encountered: