Skip to content

Improve graph layout: crossing-aware row packing#79

Merged
danipen merged 8 commits into
mainfrom
improve-graph-layout
Jul 4, 2026
Merged

Improve graph layout: crossing-aware row packing#79
danipen merged 8 commits into
mainfrom
improve-graph-layout

Conversation

@danipen

@danipen danipen commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

Overhauls the Graph tab's layout algorithm to produce a more compact, readable branch graph with fewer crossing lines.

  • New crossing-aware row packing (packing.ts): packs each chain onto a row while minimizing vertical-line crossings, then runs a bounded improvement pass (nested-pair swaps + greedy lifts) that reclaims wasted vertical space. Each accepted move strictly shrinks (crossings, total row distance) lexicographically, so the pass converges.
  • More compact layout: tightens row assignment so the graph occupies less vertical space.
  • Branch labels factored into packing: chains reserve room for their branch labels so labels no longer collide with adjacent lines.
  • Keeps layout logic pure and fully unit-tested (layout.test.ts, packing.test.ts).

Testing

  • bun run lint — clean
  • bun run typecheck — clean
  • bun test — 809 pass, 4 skip, 0 fail

@danipen danipen merged commit 2215cbf into main Jul 4, 2026
9 checks passed
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.

1 participant