feat: observer-based recording and stable animation for the canonicalizer#217
Closed
GrovyleX wants to merge 1 commit into
Closed
feat: observer-based recording and stable animation for the canonicalizer#217GrovyleX wants to merge 1 commit into
GrovyleX wants to merge 1 commit into
Conversation
…izer Closes QPauLie#199. Wrap the current Canonicalizer with an observer that records each transformation step; render an interactive, jump-free animation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #199. An alternative implementation of the graph-transformation animation (see also #207).
Reintroduces the animation feature by wrapping the current
Canonicalizerwith an observer(as suggested in the issue), so the recorder only watches and never changes the algorithm.
Demo
Smooth on a long leg (algebra
a17,n=10). Positions and distances stay fixed as the graphgrows; a vertex moves only when the algorithm actually restructures its leg:
A-type
4*so(5)and B-typesp(4)worked examples:What's included
helpers/_recording.py):RecordGraph/FrameRecord/FrameGraph/recording_graph, capturing every event (lighting, contraction, attach, p/q, removals,replacements, dependents, leg manipulation).
classifier/observer.py): typedCanonicalizerEventenum +EventManager.The base
Canonicalizeremits guarded notifications and is a no-op when nothing subscribes,so behaviour and all existing tests are unchanged.
RecordingCanonicalizer(classifier/recording_canonicalizer.py): drop-in subclass,mirrors the existing
TrackedCanonicalizeridiom; a recorded run classifies identically toa plain one.
helpers/drawing.py): per-role colours, an interactiveto_jshtmlplayer(play / pause / step / slider), and a stable incremental layout.
classification.rstwith embeddedplayers and a swatch colour legend. Animations are generated at build time by
conf.py, sono media is committed.
docs/generate_animations.pyregenerates them locally.Notes on the review feedback raised so far
position, spacing is constant, long legs fold into rows, and the viewport is frozen. On
a17, n=10(51 frames) only 8 frames have any motion, each a genuine restructure, ending ina clean star.
Canonical graph of type B3: su(1024)..color-legend/.swatchCSS.to_jshtml(default_mode="loop").main(post low-rank-isomorphism);classification.pyis untouched.Testing
tests/test_recording.py: frame invariants, layout stability (growth / relabel / fold),and recorded-vs-plain algebra equality across all
G_LIEtwo-local algebras.ruff,pylint(10/10),mypy src/paulie/application, andsphinx-build -Wall green.