feat(stammbaum): bloodline-contiguous tidy-tree layout (replace per-generation packer) (#724) #725

Merged
marcel merged 24 commits from feat/issue-724-tidy-tree-layout into main 2026-06-04 14:55:12 +02:00
Showing only changes of commit 44cad849bb - Show all commits

View File

@@ -97,3 +97,22 @@ describe('tidyTree — contour nesting', () => {
);
});
});
describe('tidyTree — multi-root packing', () => {
it('packs multiple roots left-to-right with no overlap', () => {
// A real Stammbaum is a forest of ~50 roots, not a single tree — this is
// the dominant compactness win. Three roots of differing shapes.
const r1 = node('r1', [leaf('r1a'), leaf('r1b')]);
const r2 = leaf('r2');
const r3 = node('r3', [leaf('r3a')]);
const roots = [r1, r2, r3];
const x = layoutForest(roots, GAP);
expectNoOverlap(x, roots, GAP);
// Roots keep input order left-to-right.
expect(x.get('r1')!).toBeLessThan(x.get('r2')!);
expect(x.get('r2')!).toBeLessThan(x.get('r3')!);
// Forest is normalised so the leftmost edge is at 0.
expect(Math.min(...x.values())).toBe(0);
});
});