pub fn layout_tree<T>(
treeize: &Treeize<T>,
config: LayoutConfig,
has_output: impl FnMut(NodeId) -> bool,
has_input: impl FnMut(NodeId) -> bool,
node_sizes: Option<&HashMap<NodeId, Vec2>>,
) -> HashMap<NodeId, Pos2>Expand description
Performs hierarchical layout on a tree-like graph.
This function arranges nodes in a top-to-bottom tree structure using a compact contour-based layout algorithm (similar to ELK Mr.Tree). Nodes are organized into levels based on their distance from root nodes.
§Arguments
treeize- The tree graph to layoutconfig- Layout configuration parametershas_output- Function to check if a node has output pinshas_input- Function to check if a node has input pinsnode_sizes- Optional map from node ID to node size (width, height). If provided, the layout will consider actual node sizes to avoid overlaps.
§Returns
A map from node ID to its calculated position (top-left corner).
§Panics
This function does not panic, but may produce unexpected layouts if the graph contains cycles or if node sizes are invalid.