Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/HeuristicLab.EvolutionTracking.Views-3.4.csproj
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/HeuristicLab.EvolutionTracking.Views-3.4.csproj	(revision 11164)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/HeuristicLab.EvolutionTracking.Views-3.4.csproj	(revision 11165)
@@ -97,7 +97,5 @@
       <DependentUpon>FrequentFragmentsDialog.cs</DependentUpon>
     </Compile>
-    <Compile Include="GenealogyGraphChart.cs">
-      <SubType>UserControl</SubType>
-    </Compile>
+    <Compile Include="GenealogyGraphChart.cs" />
     <Compile Include="GenealogyGraphChart.Designer.cs">
       <DependentUpon>GenealogyGraphChart.cs</DependentUpon>
@@ -105,7 +103,5 @@
     <Compile Include="Plugin.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="GenealogyGraphView.cs">
-      <SubType>UserControl</SubType>
-    </Compile>
+    <Compile Include="GenealogyGraphView.cs" />
     <Compile Include="GenealogyGraphView.Designer.cs">
       <DependentUpon>GenealogyGraphView.cs</DependentUpon>
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj	(revision 11164)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj	(revision 11165)
@@ -279,7 +279,5 @@
       <DependentUpon>SymboldDataAnalysisGenealogyView.cs</DependentUpon>
     </Compile>
-    <Compile Include="Tracking\SymbolicDataAnalysisExpressionGenealogyGraphChart.cs">
-      <SubType>UserControl</SubType>
-    </Compile>
+    <Compile Include="Tracking\SymbolicDataAnalysisExpressionGenealogyGraphChart.cs" />
     <Compile Include="Tracking\SymbolicDataAnalysisExpressionGenealogyGraphChart.Designer.cs">
       <DependentUpon>SymbolicDataAnalysisExpressionGenealogyGraphChart.cs</DependentUpon>
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 11164)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeDistance/BottomUpDistanceCalculator.cs	(revision 11165)
@@ -26,4 +26,5 @@
 using System.Linq;
 using System.Text;
+using System.Text.RegularExpressions;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views;
@@ -36,4 +37,10 @@
   /// </summary>
   public static class BottomUpDistanceCalculator {
+    /// <summary>
+    /// Creates a compact representation of the two trees as a directed acyclic graph
+    /// </summary>
+    /// <param name="t1">The first tree</param>
+    /// <param name="t2">The second tree</param>
+    /// <returns>The compacted DAG representing the two trees</returns>
     private static Dictionary<ISymbolicExpressionTreeNode, IVertex> Compact(ISymbolicExpressionTree t1, ISymbolicExpressionTree t2) {
       var G = new DirectedGraph();
@@ -79,4 +86,10 @@
             if (V.SequenceEqual(W)) {
               K[v] = w;
+              //              // merge vertices
+              //              foreach (var a in K[v].InArcs) {
+              //                a.Target = w;
+              //              }
+              //              G.RemoveVertex(K[v]);
+
               found = true;
               break;
@@ -148,4 +161,15 @@
       var K = Compact(t1, t2);
       var M = Mapping(t1, t2, K);
+
+      var keys = M.Keys.ToList();
+      for (int j = 0; j < keys.Count; ++j) {
+        var key = keys[j];
+        var value = M[key];
+        if (key.Parent != null && value.Parent != null && !M.ContainsKey(key.Parent) && Label(key.Parent).Equals(Label(value.Parent))) {
+          M.Add(key.Parent, value.Parent);
+          keys.Add(key.Parent);
+        }
+      }
+
       int d = t1.Length - M.Count;
       int s = M.Count(x => !Label(x.Key).Equals(Label(x.Value)));
@@ -185,6 +209,26 @@
 
       public IEnumerable<ISymbolicExpressionTreeNode> Nodes {
-        get { return Item1.Root.IterateNodesPostfix().Concat(Item2.Root.IterateNodesPostfix()); }
-      }
+        get {
+          var r1 = Item1.Root;
+          var r2 = Item2.Root;
+
+          var virtualRootSymbol = new StartSymbol();
+          var virtualRootNode = virtualRootSymbol.CreateTreeNode();
+          virtualRootNode.AddSubtree(r1);
+          virtualRootNode.AddSubtree(r2);
+
+          var nodes = virtualRootNode.IterateNodesPostfix().ToList();
+
+          virtualRootNode.RemoveSubtree(0);
+          virtualRootNode.RemoveSubtree(0);
+
+          for (int i = 0; i < nodes.Count - 1; ++i) { yield return nodes[i]; }
+        }
+      }
+    }
+
+    public static string RemoveFirstLines(string text, int linesCount) {
+      var lines = Regex.Split(text, "\r\n|\r|\n").Skip(linesCount);
+      return string.Join(Environment.NewLine, lines.ToArray());
     }
 
@@ -198,4 +242,7 @@
       var m2 = formatter.Format(t2, out s2, 20);
 
+      // skip first 6 lines of s2
+      s2 = RemoveFirstLines(s2, 6);
+
       sb.Append(s1);
       sb.Append(s2);
