Index: /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/AxisType.cs
===================================================================
--- /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/AxisType.cs	(revision 12535)
+++ /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/AxisType.cs	(revision 12536)
@@ -21,6 +21,4 @@
 
 using System;
-using System.Collections.Generic;
-using System.Text;
 
 namespace HeuristicLab.Visualization {
Index: /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/ChartMode.cs
===================================================================
--- /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/ChartMode.cs	(revision 12535)
+++ /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/ChartMode.cs	(revision 12536)
@@ -20,8 +20,4 @@
 #endregion
 
-using System;
-using System.Collections.Generic;
-using System.Text;
-
 namespace HeuristicLab.Visualization {
   public enum ChartMode {
Index: /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/HeuristicLab.Visualization-3.3.csproj
===================================================================
--- /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/HeuristicLab.Visualization-3.3.csproj	(revision 12535)
+++ /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/HeuristicLab.Visualization-3.3.csproj	(revision 12536)
@@ -123,4 +123,10 @@
     <Compile Include="ChartMode.cs" />
     <Compile Include="AxisType.cs" />
+    <Compile Include="Trees\LayoutEngines\BoxesLayoutEngine.cs" />
+    <Compile Include="Trees\LayoutEngines\ILayoutEngine.cs" />
+    <Compile Include="Trees\LayoutEngines\LayoutNode.cs" />
+    <Compile Include="Trees\LayoutEngines\ReingoldTilfordLayoutEngine.cs" />
+    <Compile Include="Trees\VisualTreeNode.cs" />
+    <Compile Include="Trees\VisualTreeNodeConnection.cs" />
     <None Include="Plugin.cs.frame" />
     <Compile Include="Plugin.cs" />
Index: /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Interfaces/IChart.cs
===================================================================
--- /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Interfaces/IChart.cs	(revision 12535)
+++ /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Interfaces/IChart.cs	(revision 12536)
@@ -22,5 +22,4 @@
 using System;
 using System.Collections.Generic;
-using System.Text;
 using System.Drawing;
 using System.Windows.Forms;
Index: /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Primitives/Line.cs
===================================================================
--- /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Primitives/Line.cs	(revision 12535)
+++ /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Primitives/Line.cs	(revision 12536)
@@ -21,9 +21,5 @@
 
 using System;
-using System.Collections.Generic;
-using System.Text;
 using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Windows.Forms;
 
 namespace HeuristicLab.Visualization {
Index: /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Primitives/Rectangle.cs
===================================================================
--- /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Primitives/Rectangle.cs	(revision 12535)
+++ /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Primitives/Rectangle.cs	(revision 12536)
@@ -20,7 +20,4 @@
 #endregion
 
-using System;
-using System.Collections.Generic;
-using System.Text;
 using System.Drawing;
 
Index: /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Structs/SizeD.cs
===================================================================
--- /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Structs/SizeD.cs	(revision 12535)
+++ /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Structs/SizeD.cs	(revision 12536)
@@ -21,6 +21,4 @@
 
 using System;
-using System.Collections.Generic;
-using System.Text;
 using System.Drawing;
 
Index: /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Trees/LayoutEngines/BoxesLayoutEngine.cs
===================================================================
--- /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Trees/LayoutEngines/BoxesLayoutEngine.cs	(revision 12536)
+++ /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Trees/LayoutEngines/BoxesLayoutEngine.cs	(revision 12536)
@@ -0,0 +1,117 @@
+﻿#region License Information
+
+/* HeuristicLab
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
+  public class BoxesLayoutEngine<T> : ILayoutEngine<T> where T : class {
+    public int NodeWidth { get; set; }
+    public int NodeHeight { get; set; }
+    public int HorizontalSpacing { get; set; }
+    public int VerticalSpacing { get; set; }
+
+    private readonly Func<T, IEnumerable<T>> GetChildren;
+    private readonly Func<T, int> GetLength;
+    private readonly Func<T, int> GetDepth;
+
+    public BoxesLayoutEngine(Func<T, IEnumerable<T>> GetChildren, Func<T, int> GetLength, Func<T, int> GetDepth) {
+      if (GetChildren == null) throw new ArgumentNullException("GetChildren");
+      if (GetLength == null) throw new ArgumentNullException("GetLength");
+      if (GetDepth == null) throw new ArgumentNullException("GetDepth");
+
+      this.GetChildren = GetChildren;
+      this.GetLength = GetLength;
+      this.GetDepth = GetDepth;
+    }
+
+
+    public IEnumerable<VisualTreeNode<T>> CalculateLayout(T root, float width, float height) {
+      var nodeMap = new Dictionary<T, VisualTreeNode<T>>();
+      CreateVisualNodes(root, nodeMap);
+      RecursiveLayout(nodeMap, nodeMap[root], 0, 0, (int)Math.Round(width), (int)Math.Round(height) / GetDepth(root));
+      return nodeMap.Values;
+    }
+
+    private void CreateVisualNodes(T root, Dictionary<T, VisualTreeNode<T>> map) {
+      var node = new VisualTreeNode<T>(root) {
+        PreferredWidth = NodeWidth,
+        PreferredHeight = NodeHeight
+      };
+
+      map.Add(root, node);
+      var children = GetChildren(root).ToList();
+      if (children.Any()) {
+        foreach (var child in children) {
+          CreateVisualNodes(child, map);
+        }
+      }
+    }
+
+    private void RecursiveLayout(Dictionary<T, VisualTreeNode<T>> nodeMap, VisualTreeNode<T> visualTreeNode, int x, int y, int width, int height) {
+      float center_x = x + width / 2;
+      float center_y = y + height / 2;
+      int actualWidth = width - HorizontalSpacing;
+      int actualHeight = height - VerticalSpacing;
+
+      //calculate size of node
+      if (actualWidth >= visualTreeNode.PreferredWidth && actualHeight >= visualTreeNode.PreferredHeight) {
+        visualTreeNode.Width = visualTreeNode.PreferredWidth;
+        visualTreeNode.Height = visualTreeNode.PreferredHeight;
+        visualTreeNode.X = (int)center_x - visualTreeNode.Width / 2;
+        visualTreeNode.Y = (int)center_y - visualTreeNode.Height / 2;
+      }
+        //width too small to draw in desired sized
+      else if (actualWidth < visualTreeNode.PreferredWidth && actualHeight >= visualTreeNode.PreferredHeight) {
+        visualTreeNode.Width = actualWidth;
+        visualTreeNode.Height = visualTreeNode.PreferredHeight;
+        visualTreeNode.X = x;
+        visualTreeNode.Y = (int)center_y - visualTreeNode.Height / 2;
+      }
+        //height too small to draw in desired sized
+      else if (actualWidth >= visualTreeNode.PreferredWidth && actualHeight < visualTreeNode.PreferredHeight) {
+        visualTreeNode.Width = visualTreeNode.PreferredWidth;
+        visualTreeNode.Height = actualHeight;
+        visualTreeNode.X = (int)center_x - visualTreeNode.Width / 2;
+        visualTreeNode.Y = y;
+      }
+        //width and height too small to draw in desired size
+      else {
+        visualTreeNode.Width = actualWidth;
+        visualTreeNode.Height = actualHeight;
+        visualTreeNode.X = x;
+        visualTreeNode.Y = y;
+      }
+      //calculate areas for the subtrees according to their tree size 
+      var node = visualTreeNode.Content;
+      var children = GetChildren(node).ToList();
+      int[] xBoundaries = new int[children.Count + 1];
+      xBoundaries[0] = x;
+      for (int i = 0; i < children.Count; i++) {
+        xBoundaries[i + 1] = (int)(xBoundaries[i] + (width * (double)GetLength(children[i])) / (GetLength(node) - 1));
+        RecursiveLayout(nodeMap, nodeMap[children[i]], xBoundaries[i], y + height, xBoundaries[i + 1] - xBoundaries[i], height);
+      }
+    }
+  }
+}
Index: /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Trees/LayoutEngines/ILayoutEngine.cs
===================================================================
--- /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Trees/LayoutEngines/ILayoutEngine.cs	(revision 12536)
+++ /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Trees/LayoutEngines/ILayoutEngine.cs	(revision 12536)
@@ -0,0 +1,35 @@
+﻿#region License Information
+
+/* HeuristicLab
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#endregion
+
+using System.Collections.Generic;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
+  interface ILayoutEngine<T> where T : class {
+    int NodeWidth { get; set; }
+    int NodeHeight { get; set; }
+    int HorizontalSpacing { get; set; }
+    int VerticalSpacing { get; set; }
+
+    IEnumerable<VisualTreeNode<T>> CalculateLayout(T root, float width, float height);
+  }
+}
Index: /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Trees/LayoutEngines/LayoutNode.cs
===================================================================
--- /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Trees/LayoutEngines/LayoutNode.cs	(revision 12536)
+++ /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Trees/LayoutEngines/LayoutNode.cs	(revision 12536)
@@ -0,0 +1,108 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
+  internal class LayoutNode<T> : object where T : class {
+    public float Width { get; set; }
+    public float Height { get; set; }
+
+    public LayoutNode<T> NextLeft {
+      get {
+        return Children == null ? Thread : Children.First();
+      }
+    }
+    public LayoutNode<T> NextRight {
+      get {
+        return Children == null ? Thread : Children.Last();
+      }
+    }
+    public LayoutNode<T> LeftSibling {
+      get {
+        if (Parent == null) return null;
+        return Number == 0 ? null : Parent.Children[Number - 1];
+      }
+    }
+    public LayoutNode<T> LeftmostSibling {
+      get {
+        if (Parent == null) return null;
+        return Number == 0 ? null : Parent.Children[0];
+      }
+    }
+
+    public LayoutNode<T> Thread { get; set; }
+    public LayoutNode<T> Ancestor { get; set; }
+    public LayoutNode<T> Parent { get; set; }
+    public List<LayoutNode<T>> Children { get; set; }
+    public float Mod { get; set; }
+    public float Prelim { get; set; }
+    public float Change { get; set; }
+    public float Shift { get; set; }
+    public int Number { get; set; }
+    public int Level { get; set; }
+    public float X { get; set; }
+    public float Y { get; set; }
+
+    public bool IsLeaf {
+      get { return Children == null || Children.Count == 0; }
+    }
+
+    private T content;
+    public T Content {
+      get { return content; }
+      set {
+        if (value == null)
+          throw new ArgumentNullException("LayoutNode: Content cannot be null.");
+        content = value;
+      }
+    }
+    /// <summary>
+    /// Translate the position of the layout node according to the given offsets
+    /// </summary>
+    /// <param name="dx"></param>
+    /// <param name="dy"></param>
+    public void Translate(float dx, float dy) {
+      X += dx;
+      Y += dy;
+    }
+
+    public void ResetCoordinates() {
+      X = 0;
+      Y = 0;
+    }
+
+    /// <summary>
+    /// Reset layout-related parameters
+    /// </summary>
+    public void Reset() {
+      Ancestor = this;
+      Thread = null;
+      Change = 0;
+      Shift = 0;
+      Prelim = 0;
+      Mod = 0;
+      ResetCoordinates();
+    }
+  }
+}
Index: /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Trees/LayoutEngines/ReingoldTilfordLayoutEngine.cs
===================================================================
--- /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Trees/LayoutEngines/ReingoldTilfordLayoutEngine.cs	(revision 12536)
+++ /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Trees/LayoutEngines/ReingoldTilfordLayoutEngine.cs	(revision 12536)
@@ -0,0 +1,273 @@
+﻿
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
+  public class ReingoldTilfordLayoutEngine<T> : ILayoutEngine<T> where T : class {
+    public int NodeWidth { get; set; }
+    public int NodeHeight { get; set; }
+    private int minHorizontalSpacing = 5;
+    public int HorizontalSpacing {
+      get { return minHorizontalSpacing; }
+      set { minHorizontalSpacing = value; }
+    }
+
+    private int minVerticalSpacing = 5;
+    public int VerticalSpacing {
+      get { return minVerticalSpacing; }
+      set { minVerticalSpacing = value; }
+    }
+
+    private readonly Func<T, IEnumerable<T>> GetChildren;
+
+    public ReingoldTilfordLayoutEngine(Func<T, IEnumerable<T>> GetChildren) {
+      this.GetChildren = GetChildren;
+    }
+
+    public IEnumerable<VisualTreeNode<T>> CalculateLayout(T root) {
+      return CalculateLayout(root, 0, 0);
+    }
+
+    public IEnumerable<VisualTreeNode<T>> CalculateLayout(T root, float width, float height) {
+      Dictionary<T, LayoutNode<T>> layoutNodeMap = new Dictionary<T, LayoutNode<T>>();
+      var layoutRoot = new LayoutNode<T> { Content = root, Width = NodeWidth, Height = NodeHeight, };
+      layoutRoot.Ancestor = layoutRoot;
+      Expand(layoutRoot, layoutNodeMap);
+
+      FirstWalk(layoutRoot);
+      SecondWalk(layoutRoot, -layoutRoot.Prelim);
+      NormalizeCoordinates(layoutNodeMap.Values);
+      if (height != 0 && width != 0) {
+        FitToBounds(width, height, layoutNodeMap.Values);
+        Center(width, height, layoutNodeMap.Values);
+      }
+
+      return layoutNodeMap.Values.Select(x => new VisualTreeNode<T>(x.Content) {
+        Width = (int)Math.Round(x.Width),
+        Height = (int)Math.Round(x.Height),
+        X = (int)Math.Round(x.X),
+        Y = (int)Math.Round(x.Y)
+      });
+    }
+
+    private void Expand(LayoutNode<T> lRoot, Dictionary<T, LayoutNode<T>> map) {
+      map.Add(lRoot.Content, lRoot);
+      var children = GetChildren(lRoot.Content).ToList();
+      if (!children.Any()) return;
+      lRoot.Children = new List<LayoutNode<T>>(children.Count);
+      for (int i = 0; i < children.Count; ++i) {
+        var node = new LayoutNode<T> {
+          Content = children[i],
+          Number = i,
+          Parent = lRoot,
+          Level = lRoot.Level + 1,
+          Width = NodeWidth,
+          Height = NodeHeight
+        };
+        node.Ancestor = node;
+        lRoot.Children.Add(node);
+        Expand(node, map);
+      }
+    }
+
+
+    /// <summary>
+    /// Transform LayoutNode coordinates so that all coordinates are positive and start from (0,0)
+    /// </summary>
+    private static void NormalizeCoordinates(IEnumerable<LayoutNode<T>> nodes) {
+      float xmin = 0, ymin = 0;
+      foreach (var node in nodes) {
+        if (xmin > node.X) xmin = node.X;
+        if (ymin > node.Y) ymin = node.Y;
+      }
+      foreach (var node in nodes) {
+        node.X -= xmin;
+        node.Y -= ymin;
+      }
+    }
+
+    private void Center(float width, float height, IEnumerable<LayoutNode<T>> nodes) {
+      // center layout on screen
+      var bounds = Bounds(nodes);
+      float dx = 0, dy = 0;
+      if (width > bounds.Width) { dx = (width - bounds.Width) / 2f; }
+      if (height > bounds.Height) { dy = (height - bounds.Height) / 2f; }
+      foreach (var node in nodes) { node.Translate(dx, dy); }
+    }
+
+    private void FitToBounds(float width, float height, IEnumerable<LayoutNode<T>> nodes) {
+      var bounds = Bounds(nodes);
+      var myWidth = bounds.Width;
+      var myHeight = bounds.Height;
+
+      if (myWidth <= width && myHeight <= height) return; // no need to fit since we are within bounds
+
+      var layers = nodes.GroupBy(node => node.Level, node => node).ToList();
+
+      if (myWidth > width) {
+        // need to scale horizontally
+        float x = width / myWidth;
+        foreach (var node in layers.SelectMany(g => g)) {
+          node.X *= x;
+          node.Width *= x;
+        }
+        float spacing = minHorizontalSpacing * x;
+        foreach (var layer in layers) {
+          var nodesLayer = layer.ToList();
+          float minWidth = float.MaxValue;
+          for (int i = 0; i < nodesLayer.Count - 1; ++i) { minWidth = Math.Min(minWidth, nodesLayer[i + 1].X - nodesLayer[i].X); }
+          float w = Math.Min(NodeWidth, minWidth - spacing);
+          foreach (var node in nodesLayer) {
+            node.X += (node.Width - w) / 2f;
+            node.Width = w;
+            //this is a simple solution to ensure that the leftmost and rightmost nodes are not drawn partially offscreen due to scaling and offset
+            //this should work well enough 99.9% of the time with no noticeable visual difference
+            if (node.X < 0) {
+              node.Width += node.X;
+              node.X = 0;
+            } else if (node.X + node.Width > width) {
+              node.Width = width - node.X;
+            }
+          }
+        }
+      }
+      if (myHeight > height) {
+        // need to scale vertically
+        float x = height / myHeight;
+        foreach (var node in layers.SelectMany(g => g)) {
+          node.Y *= x;
+          node.Height *= x;
+        }
+      }
+    }
+
+
+    /// <summary>
+    /// Returns the bounding box for this layout. When the layout is normalized, the rectangle should be [0,0,xmin,xmax].
+    /// </summary>
+    /// <returns></returns>
+    private RectangleF Bounds(IEnumerable<LayoutNode<T>> nodes) {
+      float xmin = 0, xmax = 0, ymin = 0, ymax = 0;
+      foreach (LayoutNode<T> node in nodes) {
+        float x = node.X, y = node.Y;
+        if (xmin > x) xmin = x;
+        if (xmax < x) xmax = x;
+        if (ymin > y) ymin = y;
+        if (ymax < y) ymax = y;
+      }
+      return new RectangleF(xmin, ymin, xmax + minHorizontalSpacing + NodeWidth, ymax + minVerticalSpacing + NodeHeight);
+    }
+
+    #region methods specific to the reingold-tilford layout algorithm
+    private void FirstWalk(LayoutNode<T> v) {
+      LayoutNode<T> w;
+      if (v.IsLeaf) {
+        w = v.LeftSibling;
+        if (w != null) {
+          v.Prelim = w.Prelim + minHorizontalSpacing + NodeWidth;
+        }
+      } else {
+        var defaultAncestor = v.Children[0]; // leftmost child
+
+        foreach (var child in v.Children) {
+          FirstWalk(child);
+          Apportion(child, ref defaultAncestor);
+        }
+        ExecuteShifts(v);
+        var leftmost = v.Children.First();
+        var rightmost = v.Children.Last();
+        float midPoint = (leftmost.Prelim + rightmost.Prelim) / 2;
+        w = v.LeftSibling;
+        if (w != null) {
+          v.Prelim = w.Prelim + minHorizontalSpacing + NodeWidth;
+          v.Mod = v.Prelim - midPoint;
+        } else {
+          v.Prelim = midPoint;
+        }
+      }
+    }
+
+    private void SecondWalk(LayoutNode<T> v, float m) {
+      v.X = v.Prelim + m;
+      v.Y = v.Level * (minVerticalSpacing + NodeHeight);
+      if (v.IsLeaf) return;
+      foreach (var child in v.Children) {
+        SecondWalk(child, m + v.Mod);
+      }
+    }
+
+    private void Apportion(LayoutNode<T> v, ref LayoutNode<T> defaultAncestor) {
+      var w = v.LeftSibling;
+      if (w == null) return;
+      LayoutNode<T> vip = v;
+      LayoutNode<T> vop = v;
+      LayoutNode<T> vim = w;
+      LayoutNode<T> vom = vip.LeftmostSibling;
+
+      float sip = vip.Mod;
+      float sop = vop.Mod;
+      float sim = vim.Mod;
+      float som = vom.Mod;
+
+      while (vim.NextRight != null && vip.NextLeft != null) {
+        vim = vim.NextRight;
+        vip = vip.NextLeft;
+        vom = vom.NextLeft;
+        vop = vop.NextRight;
+        vop.Ancestor = v;
+        float shift = (vim.Prelim + sim) - (vip.Prelim + sip) + minHorizontalSpacing + NodeWidth;
+        if (shift > 0) {
+          var ancestor = Ancestor(vim, v) ?? defaultAncestor;
+          MoveSubtree(ancestor, v, shift);
+          sip += shift;
+          sop += shift;
+        }
+        sim += vim.Mod;
+        sip += vip.Mod;
+        som += vom.Mod;
+        sop += vop.Mod;
+      }
+      if (vim.NextRight != null && vop.NextRight == null) {
+        vop.Thread = vim.NextRight;
+        vop.Mod += (sim - sop);
+      }
+      if (vip.NextLeft != null && vom.NextLeft == null) {
+        vom.Thread = vip.NextLeft;
+        vom.Mod += (sip - som);
+        defaultAncestor = v;
+      }
+    }
+
+    private void MoveSubtree(LayoutNode<T> wm, LayoutNode<T> wp, float shift) {
+      int subtrees = wp.Number - wm.Number; // TODO: Investigate possible bug (if the value ever happens to be zero) - happens when the tree is actually a graph (but that's outside the use case of this algorithm which only works with trees)
+      if (subtrees == 0) throw new Exception("MoveSubtree failed: check if object is really a tree (no cycles)");
+      wp.Change -= shift / subtrees;
+      wp.Shift += shift;
+      wm.Change += shift / subtrees;
+      wp.Prelim += shift;
+      wp.Mod += shift;
+    }
+
+    private void ExecuteShifts(LayoutNode<T> v) {
+      if (v.IsLeaf) return;
+      float shift = 0;
+      float change = 0;
+      for (int i = v.Children.Count - 1; i >= 0; --i) {
+        var w = v.Children[i];
+        w.Prelim += shift;
+        w.Mod += shift;
+        change += w.Change;
+        shift += (w.Shift + change);
+      }
+    }
+
+    private LayoutNode<T> Ancestor(LayoutNode<T> u, LayoutNode<T> v) {
+      var ancestor = u.Ancestor;
+      if (ancestor == null) return null;
+      return ancestor.Parent == v.Parent ? ancestor : null;
+    }
+    #endregion
+  }
+}
Index: /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Trees/VisualTreeNode.cs
===================================================================
--- /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Trees/VisualTreeNode.cs	(revision 12536)
+++ /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Trees/VisualTreeNode.cs	(revision 12536)
@@ -0,0 +1,129 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Drawing;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
+  public class VisualTreeNode<T> where T : class {
+    private static readonly Color defaultLineColor = Color.Black;
+    private static readonly Color defaultTextColor = Color.Black;
+    private static readonly Color defaultFillColor = Color.White;
+    private const int defaultPreferredWidth = 70;
+    private const int defaultPreferredHeight = 46;
+
+    public VisualTreeNode(T content) :
+      this(content, defaultLineColor) {
+    }
+
+    public VisualTreeNode(T content, Color lineColor) :
+      this(content, lineColor, defaultTextColor) {
+    }
+
+    public VisualTreeNode(T content, Color lineColor, Color textColor) :
+      this(content, lineColor, textColor, defaultFillColor) {
+    }
+
+    public VisualTreeNode(T content, Color lineColor, Color textColor, Color fillColor) :
+      this(content, lineColor, textColor, fillColor, defaultPreferredWidth, defaultPreferredHeight) {
+    }
+
+    public VisualTreeNode(T content, Color lineColor, Color textColor, Color fillColor, int width, int height) {
+      this.content = content;
+      this.lineColor = lineColor;
+      this.textColor = textColor;
+      this.fillColor = fillColor;
+      this.preferredWidth = width;
+      this.preferredHeight = height;
+      this.ToolTip = content.ToString();
+    }
+
+    #region members for internal use only
+    private int x;
+    public int X {
+      get { return x; }
+      internal set { this.x = value; }
+    }
+
+    private int y;
+    public int Y {
+      get { return y; }
+      internal set { this.y = value; }
+    }
+
+    private int width;
+    public int Width {
+      get { return this.width; }
+      internal set { this.width = value; }
+    }
+
+    private int height;
+    public int Height {
+      get { return this.height; }
+      internal set { this.height = value; }
+    }
+    #endregion
+
+    private T content;
+    public T Content {
+      get { return this.content; }
+      set {
+        content = value;
+        ToolTip = Content.ToString();
+      }
+    }
+
+    private int preferredWidth;
+    public int PreferredWidth {
+      get { return this.preferredWidth; }
+      set { this.preferredWidth = value; }
+    }
+
+    private int preferredHeight;
+    public int PreferredHeight {
+      get { return this.preferredHeight; }
+      set { this.preferredHeight = value; }
+    }
+
+    private Color lineColor;
+    public Color LineColor {
+      get { return this.lineColor; }
+      set { this.lineColor = value; }
+    }
+
+    private Color textColor;
+    public Color TextColor {
+      get { return this.textColor; }
+      set { this.textColor = value; }
+    }
+
+    private Color fillColor;
+    public Color FillColor {
+      get { return this.fillColor; }
+      set { this.fillColor = value; }
+    }
+
+    private string toolTip;
+    public string ToolTip {
+      get { return toolTip; }
+      set { toolTip = value; }
+    }
+  }
+}
Index: /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Trees/VisualTreeNodeConnection.cs
===================================================================
--- /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Trees/VisualTreeNodeConnection.cs	(revision 12536)
+++ /branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Trees/VisualTreeNodeConnection.cs	(revision 12536)
@@ -0,0 +1,48 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Drawing;
+using System.Drawing.Drawing2D;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
+  public class VisualTreeNodeConnection {
+    private static readonly Color defaultLineColor = Color.Black;
+    private static readonly DashStyle defaultDashStyle = DashStyle.Solid;
+
+    private Color lineColor;
+    public Color LineColor {
+      get { return lineColor; }
+      set { lineColor = value; }
+    }
+
+    private DashStyle dashStyle;
+    public DashStyle DashStyle {
+      get { return dashStyle; }
+      set { dashStyle = value; }
+    }
+
+    public VisualTreeNodeConnection()
+      : base() {
+      lineColor = defaultLineColor;
+      dashStyle = defaultDashStyle;
+    }
+  }
+}
