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 support for the interactive visualizer #426

Merged

Conversation

saulshanabrook
Copy link
Member

@saulshanabrook saulshanabrook commented Sep 20, 2024

This PR adds the ability to try the new interactive visualizer in the web editor. I still kept the original graphviz visualizer as default, while this while let you switch between them:

new.mov

The new visualizer includes the following features compared to the existing editor:

  • Hopefully, better performance when laying out and rendering many nodes
  • The ability to focus on a single sub-graph, by clicking on a node and filtering to its descendants
  • highlights the connected components to an edge/node on click (could add an on-hover option as well)
  • incremental layout based on the existing positions, which the layout engine will take into account
  • preserving colors of nodes across multiple consecutive renders, so they will stay consistent
  • better edge routing and layout performed by eclipse layout kernel
  • design closer to the examples at the egg homepage, courtesy of react flow and tailwind css

Moreover, it can serve as a base to build future interactive features that would be helpful.

@saulshanabrook saulshanabrook requested a review from a team as a code owner September 20, 2024 01:16
@saulshanabrook saulshanabrook requested review from mwillsey and removed request for a team September 20, 2024 01:16
@saulshanabrook
Copy link
Member Author

saulshanabrook commented Oct 12, 2024

I have updated this PR to support transitioning between multiple e-graphs, the last thing I wanted to add before calling the visualizer good for now!

Untitled2.mov

If anyone could try this locally and make sure it works, then we can get this in. Thanks!

Copy link
Collaborator

@yihozhang yihozhang left a comment

Choose a reason for hiding this comment

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

This looks awesome!! Thank you for making the visualizer better!

web-demo/Cargo.toml Outdated Show resolved Hide resolved
@saulshanabrook saulshanabrook merged commit 43de12f into egraphs-good:main Oct 16, 2024
3 checks passed
@saulshanabrook saulshanabrook deleted the interactive-visualizer branch October 16, 2024 00:58
@yihozhang
Copy link
Collaborator

This PR seems to make some unintended style changes to the entire web demo (font, font size, alignments, button styles, etc).

Before:

image

After:

image

@saulshanabrook
Copy link
Member Author

Yes, it does! I thought they mainly were fine, except it's just not great when the buttons wrap. That's based on your screen size and the addition of the extra toggle.

I think the changes are from using tailwindcss to style the visualizer and it pulls in some "pre-flight" styles:

Built on top of modern-normalize, Preflight is a set of base styles for Tailwind projects that are designed to smooth over cross-browser inconsistencies and make it easier for you to work within the constraints of your design system.

@yihozhang
Copy link
Collaborator

@saulshanabrook I see! Thanks for the explanation. Some differences I noticed

  1. Font size increases a bit in general
  2. The font weight used in the code editor is lighter
  3. Spacing between lines in the code editor is wider
  4. The buttons and dropdown menus are less recognizable (e.g., no background, no border)
  5. The button wraps at the end (although this goes away if I further zoom out).

1 and 2 seem fine, I'm not sure about 3 (the original spacing looks slightly more natural), and I think we should fix 4 and 5. What do you think?

saulshanabrook added a commit to egraphs-good/egraph-visualizer that referenced this pull request Oct 17, 2024
@saulshanabrook
Copy link
Member Author

Thanks @yihozhang!

I published a new version that limited the preflight styles to just my component (using this) and I think it fixed it?

Screenshot 2024-10-16 at 9 09 36 PM

For reference I had to purge the JS cache of these two URLs after publishing to load the new one:

https://cdn.jsdelivr.net/npm/egraph-visualizer@2/dist/style.css
https://cdn.jsdelivr.net/npm/egraph-visualizer@2/+esm

@yihozhang
Copy link
Collaborator

Yes, thank you!! @saulshanabrook

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.

3 participants