pub fn to_graph_data(sheet: &Sheet, labels: &Labels) -> GraphDataExpand description
Serializes sheet and labels into a GraphData snapshot for D3.
Constraint links: when a relationship has a cached plan (sheet.selected_method returns
Some) its links are directed (inputs → relationship → outputs, LinkData::directed
true). Otherwise all cells adjacent to that relationship are emitted as undirected
source→relationship edges (directed false) — this is decided per relationship, so one
relationship having a plan never marks another relationship’s links as directed.
Conditional nodes: for each conditional, emits one Conditional node, one always-directed
Constraint link from the match cell to the conditional node, and one Control link per
relationship in each branch/default. When a branch (or the default) holds more than one
relationship, its control links route through an intermediate Branch junction node
(conditional → branch → relationship) instead of a direct edge, so the branch’s relationships visually group
together; branches with 0 or 1 relationships keep a direct edge. Control links carry
branch_index and branch_active for rendering, shared identically across both hops of a
junction-routed branch.
- Complexity: O(c + r + e + cond·b·k) where c = cells, r = relationships, e = adjacency pairs, cond = conditionals, b = branches per conditional, k = keys per branch.