tech-debt: replace Stammbaum DIY layout with a graph-layout dep (dagre) when it stops scaling #361
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
StammbaumTree.sveltecurrently lays the family graph out itself. Thealgorithm is a single-pass heuristic:
max(parent gen) + 1,spouses pulled to share the deeper row, run to fixpoint).
set) with loose spouses attached on the outer edge of their partner. Each
block's parented members are centred under the parents' midpoint, then
blocks are packed left-to-right.
per-child vertical (so all connectors are 90°).
This works well for the canonical Familienarchiv shape — a tree with a few
married-in spouses (PR #360 covers this) — but the architecture has known
limits.
When this becomes painful — switch triggers
Open this issue (or stop deferring it) once any one of these is true:
spousePairsis aMap<string, string>, only one spouse per person istracked; remarriages will be silently dropped).
the same family marrying each other create a cycle the heuristic cannot
position cleanly.
attach as a single node next to their partner; if they have a sibling the
attachment breaks).
appear regularly.
by-side).
Proposed direction
Adopt dagre (~30 kB, layered DAG layout with edge-crossing minimisation).
Wrap it so the input is still our
PersonNodeDTO[] + RelationshipDTO[]andthe output remains the same
{ positions, viewBox }shapeStammbaumTreealready consumes — keeps the SVG render and connector style untouched.
Alternatives evaluated:
d3-hierarchy— tree-only, doesn't model multi-parent (DAG) correctlyfamily-chart— opinionated full component; would replace our SVG layer tooelkjs— more capable layout but ~10× larger bundleAcceptance criteria
per-child vertical, spouse line with midpoint dot, navy/mint via existing
--c-primarytokenStammbaumTree.svelte.test.ts)Out of scope
Open questions
when the heuristic can't handle the shape?
the existing manual SVG render?