-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add support for serde #28
Comments
The only problem that I see with this now is how we can maintain determinism across serialization. Currently, if edges have the default weight, they are sorted lexicographically based on their My question is the following: Would we also serialize I know this isn't important in most cases but there are those cases in distributed systems where you must maintain determinism, and a thing like this can potentially break a whole system silently. |
My prototyped approach does serialise the If |
I was thinking of adding a trait bound on Vertices for Another problem with serialization is that VertexIds are deterministically generated by incrementing a local nonce. So if you serialize a graph on machine |
Ok. I hadn't looked at how Perhaps we can leave this open for a while and mark it as an enhancement for 0.5? |
We can go that route as well since it would be simpler and with less complexity for users. However, this would require changing the implementation to generate universally unique ids in order to avoid collisions. So yeah, I'm good with it, we can do it this way. |
One other thing to consider... serde and "no-std" is not straightforward: https://serde.rs/no-std.html I imagine that anyone using serde and graphlib would want std as well, but, just in case, we'd need to specify something like:
for no-std configurations. |
Yes, and also with the alloc feature since we are already using the alloc crate. This enables back all of the functionality of serde so it should work well with |
I'd like to be able to serialise/deserialise my graphs.
I've taken a look at it and the work to add naive support is fairly trivial. Enabling hash brown serialize/deserialize support, adding serde support to the lib and specifying some derives is pretty much all that's required.
If we want to implement it as a feature for (similar to the existing "dot" feature), I think that would also be fairly straightforward.
This would then tie in the library to a long term serialisation format that exposes details about implementation and that might not be desirable. It might be better to have a discussion about the implications of this before going ahead and adding support. One solution could be to provide an implementation that checks for incompatibilities (perhaps version based) and fails if incompatible. That would be more work than just using the derive macros.
What do you think?
The text was updated successfully, but these errors were encountered: