Index: branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/Formatters/SymbolicExpressionTreeLatexFormatter.cs
===================================================================
--- branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/Formatters/SymbolicExpressionTreeLatexFormatter.cs	(revision 11015)
+++ branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/Formatters/SymbolicExpressionTreeLatexFormatter.cs	(revision 11016)
@@ -95,5 +95,5 @@
         var coord = nodeCoordinates[node];
         var nodeName = symbolNameMap.ContainsKey(node.Symbol.Name) ? symbolNameMap[node.Symbol.Name] : node.ToString();
-        sb.AppendLine(string.Format(CultureInfo.InvariantCulture, "\\node ({0}) at (\\ws*{1} + {2},\\hs*{3}) {{{4}}};", nodeIds[node], ws * coord.X, offset, -hs * coord.Y, EscapeLatexString(nodeName)));
+        sb.AppendLine(string.Format(CultureInfo.InvariantCulture, "\\node ({0}) at (\\ws*{1} + \\offs,\\hs*{2}) {{{3}}};", nodeIds[node], ws * coord.X, -hs * coord.Y, EscapeLatexString(nodeName)));
       }
 
Index: branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeDistance/BottomUpDistanceCalculator.cs
===================================================================
--- branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeDistance/BottomUpDistanceCalculator.cs	(revision 11015)
+++ branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeDistance/BottomUpDistanceCalculator.cs	(revision 11016)
@@ -40,6 +40,7 @@
       foreach (var l in F.Nodes.Where(x => x.SubtreeCount == 0)) {
         var z = new Vertex { Content = l, Label = Label(l) };
-        z.Weight = Height(l); // might be necessary
-        L[z.Label] = z;
+        //        z.Weight = Height(l); // might be necessary (although not specified in the paper)
+        //        if (!L.ContainsKey(z.Label))
+        L[z.Label] = z; // will overwrite key values, possible bug
         G.AddVertex(z);
       }
@@ -51,5 +52,5 @@
         }
       }
-      do {
+      while (Q.Any()) {
         var v = Q.Dequeue();
         if (v.SubtreeCount == 0) {
@@ -61,6 +62,7 @@
             if (Height(v) != Height(w) || v.SubtreeCount != w.OutDegree || Label(v) != w.Label)
               break;
+
             // sort the lists before comparison, as required when dealing with unordered trees
-            var V = v.Subtrees.OrderBy(Label).Select(s => K[s]);
+            var V = v.Subtrees.Select(s => K[s]).OrderBy(x => x.Label);
             var W = w.OutArcs.Select(x => x.Target).OrderBy(x => x.Label);
             if (V.SequenceEqual(W)) {
@@ -73,4 +75,5 @@
           if (!found) {
             var w = new Vertex { Content = v, Label = Label(v), Weight = Height(v) };
+            G.AddVertex(w);
             K[v] = w;
 
@@ -87,5 +90,5 @@
           } // 47: end if
         } // 48: end if
-      } while (Q.Count != 0);
+      };
       return K;
     }
@@ -168,5 +171,29 @@
 
       public IEnumerable<ISymbolicExpressionTreeNode> Nodes {
-        get { return Item1.IterateNodesPrefix().Concat(Item2.IterateNodesPrefix()); }
+        get {
+          var nodes1 = Item1.Root.IterateNodesBreadth().Reverse();
+          var nodes2 = Item2.Root.IterateNodesBreadth().Reverse();
+
+          return nodes1.Concat(nodes2);
+
+          //          var nodes =
+          //            nodes1.Select(n => new { Node = n, Height = Item1.Root.GetBranchLevel(n) })
+          //              .Concat(nodes2.Select(n => new { Node = n, Height = Item2.Root.GetBranchLevel(n) }))
+          //              .OrderByDescending(x => x.Height)
+          //              .Select(x => x.Node);
+          //
+          //          return nodes;
+          //          //          var list = new List<ISymbolicExpressionTreeNode> { Item1.Root, Item2.Root };
+          //          //          int i = 0;
+          //          //          while (i != list.Count) {
+          //          //            var node = list[i];
+          //          //            if (node.SubtreeCount > 0) {
+          //          //              list.AddRange(node.Subtrees);
+          //          //            }
+          //          //            ++i;
+          //          //          }
+          //          //          list.Reverse(); // return nodes in order of decreasing height
+          //          //          return list;
+        }
       }
 
