Index: trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/LayoutEngines/ReingoldTilfordLayoutEngine.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/LayoutEngines/ReingoldTilfordLayoutEngine.cs	(revision 10526)
+++ trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/LayoutEngines/ReingoldTilfordLayoutEngine.cs	(revision 10531)
@@ -72,4 +72,8 @@
         Y = (int)Math.Round(x.Y)
       });
+    }
+
+    public IEnumerable<LayoutNode<T>> GetLayoutNodes() {
+      return nodeMap.Values;
     }
 
Index: trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeChart.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeChart.cs	(revision 10526)
+++ trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeChart.cs	(revision 10531)
@@ -50,6 +50,5 @@
       this.backgroundColor = Color.White;
       this.textFont = new Font(FontFamily.GenericSansSerif, 12);
-      //      layoutEngine = new ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode> {
-      layoutEngine = new BoxesLayoutEngine<ISymbolicExpressionTreeNode> {
+      layoutEngine = new ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode> {
         NodeWidth = preferredNodeWidth,
         NodeHeight = preferredNodeHeight,
@@ -107,4 +106,6 @@
         tree = value;
         if (tree != null) {
+          //the layout engine needs to be initialized here so that the visualNodes and the visualLines dictionaries are populated 
+          InitializeLayout();
           Repaint();
         }
@@ -235,4 +236,5 @@
 
     private void SymbolicExpressionTreeChart_MouseMove(object sender, MouseEventArgs e) {
+
       VisualTreeNode<ISymbolicExpressionTreeNode> visualTreeNode = FindVisualSymbolicExpressionTreeNodeAt(e.X, e.Y);
       if (draggedSymbolicExpressionTree != null &&
@@ -260,16 +262,10 @@
     #endregion
 
-    #region methods for painting the symbolic expression tree
-    private void DrawFunctionTree(ISymbolicExpressionTree symbExprTree, Graphics graphics, int preferredWidth, int preferredHeight, int minHDistance, int minVDistance) {
-      var root = symbExprTree.Root;
-      var actualRoot = root.SubtreeCount == 1 ? root.GetSubtree(0) : root;
-      layoutEngine.NodeWidth = preferredWidth;
-      layoutEngine.NodeHeight = preferredHeight;
-      layoutEngine.HorizontalSpacing = minHDistance;
-      layoutEngine.VerticalSpacing = minVDistance;
+    private void InitializeLayout() {
+      var actualRoot = tree.Root.SubtreeCount == 1 ? tree.Root.GetSubtree(0) : tree.Root;
       layoutEngine.Initialize(actualRoot, n => n.Subtrees, n => n.GetLength(), n => n.GetDepth());
-      layoutEngine.CalculateLayout(Width, Height);
-
+      layoutEngine.CalculateLayout(this.Width, this.Height);
       var visualNodes = layoutEngine.GetVisualNodes().ToList();
+      //populate the visual nodes and visual connections dictionaries
       visualTreeNodes = visualNodes.ToDictionary(x => x.Content, x => x);
       visualLines = new Dictionary<Tuple<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>, VisualTreeNodeConnection>();
@@ -279,5 +275,17 @@
         }
       }
-      // draw nodes and connections
+    }
+
+    #region methods for painting the symbolic expression tree
+    private void DrawFunctionTree(ISymbolicExpressionTree symbExprTree, Graphics graphics, int preferredWidth, int preferredHeight, int minHDistance, int minVDistance) {
+      //we assume here that the layout has already been initialized when the symbolic expression tree was changed
+      //recalculate layout according to new node widths and spacing
+      layoutEngine.NodeWidth = preferredWidth;
+      layoutEngine.NodeHeight = preferredHeight;
+      layoutEngine.HorizontalSpacing = minHDistance;
+      layoutEngine.VerticalSpacing = minVDistance;
+      layoutEngine.CalculateLayout(Width, Height);
+      var visualNodes = visualTreeNodes.Values;
+      //draw nodes and connections
       foreach (var visualNode in visualNodes) {
         DrawTreeNode(visualNode);
@@ -375,4 +383,5 @@
         VerticalSpacing = minVerticalDistance
       };
+      InitializeLayout();
       Repaint();
     }
@@ -385,4 +394,5 @@
         VerticalSpacing = minVerticalDistance
       };
+      InitializeLayout();
       Repaint();
     }
