Highlight graph changes per rewrite step in proof view #190#448
Highlight graph changes per rewrite step in proof view #190#448dorakingx wants to merge 9 commits intozxcalc:masterfrom
Conversation
Made-with: Cursor
|
Thanks for the PR, Screen.Recording.2026-02-26.at.17.47.29.mov |
Made-with: Cursor
Made-with: Cursor
|
Thanks for the detailed feedback and the video! It was incredibly helpful.
Note on the temporary layout overlap (Drag-and-Drop): I have attached a new video showing the corrected highlighting behavior across different operations. Could you please take another look when you have time? Screen.Recording.2026-02-28.at.3.32.50.mov |
|
First, we would like the rewrites to highlight the next change in each proof step, rather than the previous. This is because the person doing the proof knows what they've just changed, but looking back at the proof it's helpful to see what was changed between proof steps. Instead of highlighting all edges of spiders involved in the latest rewrite rule, the intended behavior is to only highlighted the subset of those spiders' edges that were changed. For example, for spider fusion, the only edge highlighted should be the edge between the two spiders being fused, not their other edges. Lastly, it should be possible to toggle the highlighting on and off in the GUI settings. |
…dent_edges - Add highlight_match_pairs to Rewrite/AddRewriteStep for MATCH_DOUBLE rules - In move_to_step, when match pairs exist, find fusion edge via incident_edges(v1) instead of g.edges(v1,v2) - Pass match pairs from rewrite_action (tree) and proof_panel (drag-drop) for fuse - Add highlight toggle in settings; update test for next-change semantics Made-with: Cursor
…tices - Add highlight_unfuse_verts to Rewrite and AddRewriteStep for unfuse steps - Unfuse branch: highlight vertices from highlight_unfuse_verts that exist in current graph - When both split vertices exist (viewing after unfuse), highlight edge between them - Avoid coordinate-based path for unfuse so extra vertices at same coords are not highlighted Made-with: Cursor
|
Thanks again for the excellent feedback and the survey! The guidance on forward-looking highlights and precise edge selection was incredibly helpful and greatly improved the feature. I have pushed a new update that fully implements your requested design changes, along with a final fix for the Magic Wand tool. Here is a summary of the latest updates:
I have attached a short video/screenshots demonstrating the refined highlighting across manual operations, drag-and-drop, the Magic Wand, and the new toggle setting in action. Could you please take another look when you have a chance? Let me know if there's anything else you'd like me to adjust! Screen.Recording.2026-02-28.at.10.10.58.mov |
|
Thanks, it looks better. Before we go ahead and review this further, could you please make your PR as minimal as possible and it changes only what's necessary? Currently it has over 800 new lines and I am not sure if all of those are necessary. Such big PRs are hard to review especially since we are reaching the end of the hackathon. |
… comp/remove id; optimize (merge unfuse into highlight_verts, add _edges_between) Made-with: Cursor
|
Thanks for the feedback. I've reduced the PR so it only includes what's needed for the feature. What I changed:
Current size: The branch is now ~455 insertions and ~61 deletions vs If you’d like it even smaller, I can trim further (e.g. fewer comments or a more minimal test). Tell me which parts you’d prefer to see reduced and I’ll adjust. |
|
Thanks, the size looks more reasonable now. Will have a look at it soon |
|
@dorakingx I am still finding it difficult to understand the changes you have made in the code. Can you explain and summarize what you did? And the lint check is failing right now; can you please fix that? |
…nds.py, type ignore setColorScheme in app.py Made-with: Cursor
|
@RazinShaikh Here is the summary. And I fixed the lint check error. Summary of changesWhat this PR doesThis PR adds forward-looking rewrite highlighting in proof mode: when you select a proof step, the graph highlights what will change in the next step (the vertices and edges affected by that rewrite), instead of what changed in the previous one. It also adds a GUI toggle to turn this highlighting on or off, and ensures only the relevant vertices/edges are highlighted (no coordinate drift or unrelated nodes). 1. Highlight behaviour
So the logic is: “when this step was created, we recorded which vertices (and for fuse, which pair) were involved; when we show this step, we highlight those in the current graph.” 2. Where metadata is set
3. GUI toggle
4. Lint fixes (mypy)
Files touched (overview)
|
This PR introduces visual highlighting of nodes and edges that change between consecutive proof steps, making it easier to see what each rewrite did.
Rewrite diff highlighting
GraphDiffbetween that step’s graph and the previous one (ProofStepView.move_to_stepinproof.py).new_verts,changed_vertex_types,changed_phases,changed_vdata,changed_pos) and edges (new_edges,changed_edata,changed_edge_types) are collected and passed to the scene as “highlight sets”.Rendering changes
GraphScenenow maintains sets of highlighted vertices and edges and exposes:set_rewrite_highlight(verts, edges)clear_rewrite_highlight()is_vertex_highlighted(v)/is_edge_highlighted(e)VItem.refreshuses these flags to draw highlighted vertices with a thicker, accent-colored outline (different colors for light/dark mode).EItem.refreshsimilarly draws highlighted edges with a thicker, accent-colored pen while preserving existing styling (e.g. Hadamard dash patterns).Behavior
START) clears all highlighting.You can verify the behavior by opening a proof, applying a few rewrite steps, and moving up and down the step list: only the nodes and edges affected by the selected rewrite should be emphasized.