Skip to end of metadata
Go to start of metadata

Mr. Tree Layout Algorithm

This project is all about developing a tree layout algorithm. We pity the fool who doesn't use Mr. Tree Layout!

The general information to get you started:

Project Team
  • Sven Oliver Reimers (sor)
  • Sven Gundlach (sgu)
Project Goals

The following are the main goals for this project:

  • Develop a good, robust tree-based layout algorithm that can be published and shipped as part of our KLay library.
  • Supply useful documentation, both on this page (project-centric) as well as on a new page in the KIELER Wiki (user-centric).
Plug-in Namede.cau.cs.kieler.klay.tree
RepositoryKIELER Pragmatics

Page Contents


Mr. Tree is a layout algorithm for trees. It uses the algorithm from A Node-Positioning Algorithm for General Trees, John Q.Walker II to layout trees. To do this it uses four phases plus a pre-processing to build a corresponding data structure. The first phase "treeifying" transforms the given graph into a tree if necessary. To do this, edges which destroy the tree property will be removed and stored, so that they can be reinserted during a post processing. In the second phase "orderNodes" the nodes of each level are separated into leaves and inner nodes. Inner nodes are arranged into the middle of the level and then whitespace in the level is filled with leaves. The third phase "NodePlacer" uses the algorithm first mentioned from John Q.Walker II to compute the actual position of the nodes. The last phase routeEdges sets the positions for the edges corresponding to the positions of the nodes.

Each phase uses intermediate processors for small computations on the graph. The corresponding processors are defined in each phase. Some are defined multiple times, but they are invoked only once between phases.


Currently only the node weighting for the node order can be changed by  the user through the option: Weighting of Nodes

The possibilities for "Weighting of Nodes" are:

  • DESCENDANTS: The weighting of a node is the number of nodes in the subtree starting at the corresponding node.
  • FAN: The weighting of a node is the maximal number of nodes in the same level of the subtree starting at the corresponding node.


Related publications:


Mr.Tree is a layout algorithm that lays out a graph in a tree layout. It contains the following features:

  • Support for graphs with cycles or other graphs that are hardly trees
  • Support of aesthetic rules as described in Wetherell and Shannon 
  • Support of whitespace reduction

Some other features that can be thought of being implemented in the future:

  • Support for node and edge labels
  • Support for different weighting option
  • Support for different edge routings
  • Different kinds of tree layouts (top-down tree, left-to-right tree, radial tree...)



  • No labels

1 Comment

  1. Unknown User (cds)

    Good work documenting the TGraph! However, you don't have to keep the documentation inside info boxes. I just used them when creating this page to set my recommendations apart from the actual text you would be writing. (smile)