Auto layout for hierarchical diagrams