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

Add serialization support #171

Merged
merged 6 commits into from
Jul 19, 2023
Merged

Conversation

saulshanabrook
Copy link
Member

This PR adds serialization support to the egraph-serialize format.

It pulls some ideas and code from the viz pr (#147) around requirements for the serialization format.

I also started using the insta library for snapshot testing, to verify that certain examples are serialized properly. So far, I just tried to manually look over them to make sure they seem sensible.

Once the viz work is redone on top of this, it will also be easier to quickly verify the results.

The choice of how to determine the node IDs is not the most straightforward one, but conforms to certain properties that were useful for the graphviz work, which would use these directly (since in graphviz you can't actually point to a cluster, you have to point to nodes).

Link to some relevant convo on zulip around how to serialize.

Comment on lines +61 to +67
/// Return the inner values and sorts.
/// Only eq_container_sort need to implement this method,
fn inner_values(&self, value: &Value) -> Vec<(&ArcSort, Value)> {
let _ = value;
vec![]
}

Copy link
Member Author

@saulshanabrook saulshanabrook Jul 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this so that we can properly handle e-classes inside of collections. If we just use extract (what I tried previously) then it will only give us a particular e-node from a collection, instead of referencing the full e-class. So instead provide a native way to traverse the inner values.

@mwillsey
Copy link
Member

While there are definitely some benefits to snapshot testing, I'm not ready to commit to it with this PR. Can you please back it out for now?

Otherwise the PR looks great!

@saulshanabrook
Copy link
Member Author

Thanks! Sure, I just removed the tests.

@mwillsey mwillsey merged commit c65d3d6 into egraphs-good:main Jul 19, 2023
@saulshanabrook saulshanabrook deleted the export branch July 19, 2023 21:52
@saulshanabrook saulshanabrook mentioned this pull request Jul 21, 2023
24 tasks
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

Successfully merging this pull request may close these issues.

2 participants