Minimal mode: SGD stress layout with constraint-graph straightening - #230
Open
hadley wants to merge 1 commit into
Open
Minimal mode: SGD stress layout with constraint-graph straightening#230hadley wants to merge 1 commit into
hadley wants to merge 1 commit into
Conversation
…ening Minimal mode draws each table as its name only, one wire per relationship. Its layout is a full stress model solved by stochastic gradient descent (Zheng, Pawar & Goodman, IEEE TVCG 2019, arXiv:1710.04626): all-pairs shortest-path ideal distances weighted 1/d^2, box-extent-inflated so the stress term itself keeps tables apart, with the s_gd2 annealing schedule over several deterministic restarts scored on wire crossings. Once the solver settles, a constraint-graph pass straightens and aligns: wires are labelled by compass direction, horizontal/vertical wires become centre-equality constraints, non-overlap becomes separation arcs in a per-axis DAG, and longest path assigns coordinates (TSM-style compaction; the coordinate half of Shape-Metrics, arXiv:2508.19416, without the SAT search). A wire whose constraint would stack its tables keeps its diagonal. Wires anchor to the nearest pair of compass points on the two boxes, so aligned tables get exactly straight horizontal or vertical wires. The minimal/regular mode persists in the per-dictionary layout record in localStorage.
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.
Experimental solution to #214.
Adds a minimal mode to the rendered dictionary page (toggle in the diagram toolbar, persisted per dictionary in localStorage): each table draws as its name only, one wire per relationship, laid out by a full stress model rather than dagre.
Layout pipeline (minimal mode)
Wire anchoring
Minimal-mode wires anchor to the nearest pair of compass points (3×3 grid: corners + edge midpoints) on the two boxes — aligned boxes get facing edge midpoints, so straight wires draw exactly straight. The layout's crossing scoring mirrors the same anchor choice.
Notes
BOX_GAPconstant feeds the solver, the hill-climb's overlap test, and the separation pass, so they don't re-move each other's placements.tidydiscards the saved arrangement but preserves the mode.\0escape (git treats the file as text again), dead acyclicity merge check replaced with the correct arc-between-groups infeasibility test (verified on the triangle repro), latent union-find revert corruption eliminated by checking feasibility before mutatingparent.