hkb_editor.gui.widgets.graph_layout
¶
GraphLayout
dataclass
¶
compute_layout
¶
compute_layout(graph: DiGraph, nodemap: dict[str, Node]) -> dict[str, tuple[float, float]]
Return {node_id: (x, y)} for all visible nodes.
HorizontalGraphLayout
dataclass
¶
Bases: GraphLayout
compute_layout
¶
compute_layout(graph: DiGraph, nodemap: dict[str, Node]) -> dict[str, tuple[float, float]]
Place nodes left-to-right by column, top-to-bottom within each column.
Column is derived from the deepest visible parent's column + 1, so multi-parent nodes land in the correct column for the branch that revealed them rather than using a pre-assigned shortest-path depth.
next_y[col] tracks the next free y-coordinate per column so siblings from different parents never overlap.