This paper studies the minimum-width drawing problem for trees with sized vertices, proves that the problem is NP-complete, and proposes an exact MILP solution and a fast simulated annealing heuristic. Experiments verify that both methods can effectively reduce the width of tree layouts.
Tree layout is a classic research problem in information visualization. In many practical scenarios, vertices cannot be abstracted as geometric points and must instead be represented as rectangles with specified width and height. When the order of each vertex's children is fixed in advance, existing research has proposed multiple polynomial-time algorithms that produce tree layouts satisfying various drawing conventions. However, in many practical scenarios, the ordering of siblings carries no semantic information, and reasonably optimizing that order can significantly reduce the total width of the final layout.
Currently published related work does not simultaneously cover three core settings: a tidy layered drawing convention, vertices with custom sizes, and free choice of sibling ordering. This insufficiently studied combination is exactly the object of this paper's research. The layout model uses real-valued coordinates, consistent with the previously discussed orderless layered drawing convention.
The paper gives a rigorous formal definition of minimum-width drawing of trees with reordering (MWD): given a rooted tree T=(V,E,w,h) with custom width and height parameters, the goal is to find an ordering π* of siblings such that the total drawing width W_π*(T) of the tree under that ordering equals the minimum achievable total width W*(T). You can use the accompanying diagram to intuitively understand the core layout parameters involved in this definition and the basic rule of centered placement of parents.
The paper first establishes the NP-completeness of the MWD problem, and the result holds even in the setting of binary trees where all vertex widths are unit values. The proof first confirms the problem is in NP: given a sibling ordering as a verification certificate, one can check in polynomial time whether the layout width of the given tree is at most a specified threshold; specifically, the van der Ploeg algorithm computes the tidy layered layout for the given ordering in O(n) time, completing the verification.
The exact MILP-based solution has a clear scalability boundary: once the number of vertices of the tree to be processed exceeds 100, solving efficiency drops sharply and larger instances cannot be supported.
Based on the NP-completeness result, for larger tree instances the paper designs a simulated annealing heuristic that searches directly over the space of all possible sibling orderings. Each time a candidate ordering is generated, the van der Ploeg algorithm is called to compute in O(n) time the minimum-width tidy layout for that ordering, yielding the candidate's objective value. The combinatorial nature of MWD makes simulated annealing a highly suitable solution method: its search space is purely combinatorial, each internal node corresponds to an ordering of its children, generating a local move requires only swapping two siblings at extremely low cost, and the objective function can be evaluated exactly and quickly by existing algorithms without any additional approximate estimation overhead.
Empirical results for both the exact MILP solution and the simulated annealing heuristic show that tree shape dominates the effect on layout width optimization, exerting a stronger influence than the tree's maximum degree parameter. With the maximum degree cap fixed, deeper trees consistently achieve better layout width improvements than shallow trees, whereas adjusting only the maximum degree cap for a fixed tree shape changes the median improvement by only about 5 percentage points. You can use the accompanying visualizations to directly examine the per-instance median runtime distributions of the three methods at different node counts, and the trend of the proportion of MILP runs terminating within the time limit as node count grows under different child-count constraints.
The heuristic and exact methods are not competitors but complement each other. The simulated annealing heuristic outputs layouts in well under 1 second on all tested instances, fitting the needs of interactive tools. The exact MILP-based method, while too slow for interactive scenarios, can reliably output provably optimal results on instances with roughly up to 100 vertices, and serves as a ground-truth reference, providing a verifiable optimal benchmark for future research on heuristics for the MWD problem—an especially crucial role for evaluating NP-hard problems. Readers can use the tree layouts produced by the different solving strategies to directly compare the width differences among the three.
MWD's optimization objective is to unconditionally minimize the drawing width, but layout readability does not grow monotonically with compactness. Blank space serves to separate subtrees and guide the eye; compressing the layout to the theoretical lower bound of total width may instead make adjacent subtrees visually indistinguishable. MWD should therefore be understood as one end of the layout-optimization spectrum. In practical applications, introducing a small blank-space budget or adding a proximity penalty for adjacent subtrees, at only a tiny cost in total width, can produce tree visualizations with much stronger readability.