Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeTile.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeTile.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeTile.cs	(revision 10650)
@@ -41,7 +41,12 @@
 
     public ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode> LayoutEngine { get; set; }
-    public SymbolicExpressionTreeTile(IChart chart) : base(chart) { }
+    private Dictionary<IPrimitive, ISymbolicExpressionTreeNode> primitiveMap;
+
+    public SymbolicExpressionTreeTile(IChart chart)
+      : base(chart) {
+      primitiveMap = new Dictionary<IPrimitive, ISymbolicExpressionTreeNode>();
+    }
     public SymbolicExpressionTreeTile(IChart chart, ISymbolicExpressionTree tree)
-      : base(chart) {
+      : this(chart) {
       SymbolicExpressionTree = tree;
       PreferredNodeWidth = 80;
@@ -50,11 +55,10 @@
     private void GeneratePrimitives(double preferredNodeWidth, double preferredNodeHeight) {
       Clear();
-      LayoutEngine.Initialize(SymbolicExpressionTree.Root, node => node.Subtrees);
-      LayoutEngine.CalculateLayout();
+      ISymbolicExpressionTreeNode root = SymbolicExpressionTree.Root;
+      if (root.Symbol is ProgramRootSymbol && root.SubtreeCount == 1) { root = root.GetSubtree(0); }
+      var visualNodes = LayoutEngine.CalculateLayout(root);
 
-      var primitivesMap = new Dictionary<ISymbolicExpressionTreeNode, IPrimitive>(); // both Ellipse and Rectangle are derived from the RectangularPrimitiveBase
       var font = new Font(FontFamily.GenericSansSerif, 10, GraphicsUnit.Pixel);
 
-      var visualNodes = LayoutEngine.GetVisualNodes().ToList();
       var visualNodeMap = visualNodes.ToDictionary(x => x.Content, x => x);
 
@@ -71,5 +75,4 @@
 
         this.Add(rectangularPrimitive);
-        primitivesMap.Add(node, rectangularPrimitive);
       }
 
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Interfaces/ISymbolicExpressionTreeNodeComparer.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Interfaces/ISymbolicExpressionTreeNodeComparer.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Interfaces/ISymbolicExpressionTreeNodeComparer.cs	(revision 10650)
@@ -2,6 +2,4 @@
 
 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
-  public interface ISymbolicExpressionTreeNodeComparer : IComparer<ISymbolicExpressionTreeNode> {
-
-  }
+  public interface ISymbolicExpressionTreeNodeComparer : IComparer<ISymbolicExpressionTreeNode> { }
 }
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphChart.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphChart.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphChart.cs	(revision 10650)
@@ -1,3 +1,24 @@
-﻿using System;
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2014 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.Drawing;
@@ -26,4 +47,6 @@
     }
 
+    public IGenealogyGraphNode SelectedGraphNode { get; private set; }
+
     private void Clear() {
       if (nodeMap == null)
@@ -41,7 +64,13 @@
     private Dictionary<Tuple<VisualGenealogyGraphNode, VisualGenealogyGraphNode>, VisualGenealogyGraphArc> arcMap;
 
+    #region chart modes
     public bool SimpleLineages { get; set; }
     public bool LockGenealogy { get; set; }
+    public bool TraceFragments { get; set; }
+    #endregion
+
     private Visualization.Rectangle TargetRectangle { get; set; }
+    private bool DrawInProgress { get; set; } // do not try to update the chart while the drawing is not finished
+    private VisualGenealogyGraphNode SelectedVisualNode { get; set; }
 
     private VisualGenealogyGraphNode GetMappedNode(IGenealogyGraphNode node) {
@@ -62,16 +91,10 @@
       return arc;
     }
-    private bool DrawInProgress { get; set; } // do not try to update the chart while the drawing is not finished
-    private VisualGenealogyGraphNode SelectedVisualNode { get; set; }
-
-    public event MouseEventHandler GenealogyGraphNodeClicked;
-    private void OnGenealogyGraphNodeClicked(object sender, MouseEventArgs e) {
-      var clicked = GenealogyGraphNodeClicked;
-      if (clicked != null) clicked(sender, e);
-    }
+
     public GenealogyGraphChart()
       : base() {
       InitializeComponent();
     }
+
     protected virtual void DrawGraph(double xIncrement, double yIncrement, double diameter) {
       Chart.UpdateEnabled = false;
@@ -127,4 +150,12 @@
       DrawInProgress = false;
     }
+
+    public event MouseEventHandler GenealogyGraphNodeClicked;
+    private void OnGenealogyGraphNodeClicked(object sender, MouseEventArgs e) {
+      var clicked = GenealogyGraphNodeClicked;
+      if (clicked != null) clicked(sender, e);
+    }
+
+    #region event handlers
     protected override void pictureBox_MouseMove(object sender, MouseEventArgs e) {
       if (!DrawInProgress) {
@@ -160,4 +191,5 @@
       SelectedVisualNode = visualNodes[0] as VisualGenealogyGraphNode;
       if (SelectedVisualNode == null) return;
+      SelectedGraphNode = SelectedVisualNode.Data;
 
       if (!LockGenealogy) {
@@ -188,4 +220,6 @@
       base.pictureBox_MouseUp(sender, e);
     }
+    #endregion
+
     private void DrawLineage(VisualGenealogyGraphNode node, Func<VisualGenealogyGraphNode, IEnumerable<VisualGenealogyGraphArc>> arcSelector, Func<VisualGenealogyGraphArc, VisualGenealogyGraphNode> nodeSelector) {
       if (node.Brush != null) return;
@@ -205,4 +239,5 @@
       }
     }
+
     void MarkSelectedNode() {
       var center = SelectedVisualNode.Center;
@@ -219,4 +254,5 @@
       }
     }
+
     private static VisualGenealogyGraphArc AddArc(IChart chart, VisualGenealogyGraphNode source, VisualGenealogyGraphNode target, Pen pen, Brush brush = null) {
       var arc = new VisualGenealogyGraphArc(chart, source, target, pen) { Brush = brush };
@@ -227,4 +263,5 @@
       return arc;
     }
+
     public virtual void ClearPrimitives() {
       foreach (var primitive in Chart.Group.Primitives) {
@@ -236,13 +273,16 @@
       }
     }
+
     public void HighlightNodes(IEnumerable<IGenealogyGraphNode> nodes) {
       Chart.UpdateEnabled = false;
       ClearPrimitives();
       foreach (var node in nodes) {
-        GetMappedNode(node).Brush = new SolidBrush(node.GetColor());
+        var graphNode = GetMappedNode(node);
+        graphNode.Brush = new SolidBrush(node.GetColor());
       }
       Chart.UpdateEnabled = true;
       Chart.EnforceUpdate();
     }
+
     public void HighlightAll() {
       Chart.UpdateEnabled = false;
@@ -261,4 +301,5 @@
     }
   }
+
   internal static class Util {
     public static Color GetColor(this IGenealogyGraphNode node) {
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/VisualGenealogyGraphTextLabel.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/VisualGenealogyGraphTextLabel.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/VisualGenealogyGraphTextLabel.cs	(revision 10650)
@@ -5,9 +5,9 @@
 namespace HeuristicLab.EvolutionTracking.Views {
   public class VisualGenealogyGraphTextLabel : Rectangle {
-    private string text;
-    public string Text { get { return text; } set { text = value; } }
-
-    private Font font;
-    public Font Font { get { return font; } set { font = value; } }
+    //    private string text;
+    //    public string Text { get { return text; } set { text = value; } }
+    //
+    //    private Font font;
+    //    public Font Font { get { return font; } set { font = value; } }
 
     private Brush fontBrush;
@@ -32,6 +32,6 @@
 
       float fontSize = s.Height;
-      font = new Font(font.Name, fontSize, Font.Style, GraphicsUnit.Pixel);
-      graphics.DrawString(text, font, fontBrush, p.X, p.Y);
+      var font = new Font(Font.Name, fontSize, Font.Style, GraphicsUnit.Pixel);
+      graphics.DrawString(Text, font, fontBrush, p.X, p.Y);
     }
 
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Analyzers/GenealogyAnalyzer.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Analyzers/GenealogyAnalyzer.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Analyzers/GenealogyAnalyzer.cs	(revision 10650)
@@ -93,14 +93,14 @@
       get { return GenerationsParameter.ActualValue; }
     }
-    public IGenealogyGraph GenealogyGraph {
+    public IGenealogyGraph<T> GenealogyGraph {
       get {
         IResult result;
         if (!Results.ContainsKey(PopulationGraphParameterName)) {
-          result = new Result(PopulationGraphParameterName, new GenealogyGraph());
+          result = new Result(PopulationGraphParameterName, new GenealogyGraph<T>());
           Results.Add(result);
         } else {
           result = Results[PopulationGraphParameterName];
         }
-        var graph = (IGenealogyGraph)result.Value;
+        var graph = (IGenealogyGraph<T>)result.Value;
         return graph;
       }
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Interfaces/IVertex.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Interfaces/IVertex.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Interfaces/IVertex.cs	(revision 10650)
@@ -45,5 +45,5 @@
 
   public interface IVertex<T> : IVertex
-  where T : class,IItem {
+  where T : class {
     new T Content { get; set; }
   }
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Fragment.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Fragment.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Fragment.cs	(revision 10650)
@@ -8,8 +8,8 @@
   public class Fragment : Item, IFragment {
     [Storable]
-    public int NewPos { get; set; }
+    public int Index { get; set; }
 
     [Storable]
-    public int OldPos { get; set; }
+    public int OldIndex { get; set; }
 
     [Storable]
@@ -23,6 +23,6 @@
       : base(original, cloner) {
       Root = original.Root;
-      NewPos = original.NewPos;
-      OldPos = original.OldPos;
+      Index = original.Index;
+      OldIndex = original.OldIndex;
     }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraph.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraph.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraph.cs	(revision 10650)
@@ -80,6 +80,6 @@
   public class GenealogyGraph<T> : DirectedGraph, IGenealogyGraph<T> where T : class, IItem {
     [Storable]
-    private Dictionary<double, LinkedList<IGenealogyGraphNode<T>>> ranks;
-    public Dictionary<double, LinkedList<IGenealogyGraphNode<T>>> Ranks {
+    private Dictionary<double, LinkedList<IGenealogyGraphNode>> ranks;
+    public Dictionary<double, LinkedList<IGenealogyGraphNode>> Ranks {
       get { return ranks; }
       set { ranks = value; }
@@ -94,10 +94,10 @@
     protected GenealogyGraph(bool deserializing) : base(deserializing) { }
     public GenealogyGraph() {
-      Ranks = new Dictionary<double, LinkedList<IGenealogyGraphNode<T>>>();
+      Ranks = new Dictionary<double, LinkedList<IGenealogyGraphNode>>();
     }
     public override void AddVertex(IVertex vertex) {
       var node = (IGenealogyGraphNode<T>)vertex;
       if (!Ranks.ContainsKey(node.Rank))
-        Ranks[node.Rank] = new LinkedList<IGenealogyGraphNode<T>>();
+        Ranks[node.Rank] = new LinkedList<IGenealogyGraphNode>();
       Ranks[node.Rank].AddLast(node);
       base.AddVertex(vertex);
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/Interfaces/IGenealogyGraph.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/Interfaces/IGenealogyGraph.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/Interfaces/IGenealogyGraph.cs	(revision 10650)
@@ -25,10 +25,7 @@
 namespace HeuristicLab.EvolutionTracking {
   public interface IGenealogyGraph : IDirectedGraph {
-    Dictionary<double, LinkedList<IGenealogyGraphNode>> Ranks { get; set; }
+    Dictionary<double, LinkedList<IGenealogyGraphNode>> Ranks { get; }
   }
 
-  public interface IGenealogyGraph<T> : IDirectedGraph
-    where T : class,IItem {
-    Dictionary<double, LinkedList<IGenealogyGraphNode<T>>> Ranks { get; set; }
-  }
+  public interface IGenealogyGraph<T> : IGenealogyGraph where T : class,IItem { }
 }
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/Interfaces/IGenealogyGraphNode.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/Interfaces/IGenealogyGraphNode.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/Interfaces/IGenealogyGraphNode.cs	(revision 10650)
@@ -36,4 +36,4 @@
   }
 
-  public interface IGenealogyGraphNode<T> : IGenealogyGraphNode, IVertex<T> where T : class,IItem { }
+  public interface IGenealogyGraphNode<T> : IGenealogyGraphNode, IVertex<T> where T : class { }
 }
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Interfaces/IFragment.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Interfaces/IFragment.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Interfaces/IFragment.cs	(revision 10650)
@@ -25,6 +25,6 @@
   public interface IFragment : IItem {
     object Root { get; set; }
-    int NewPos { get; set; }
-    int OldPos { get; set; }
+    int Index { get; set; }
+    int OldIndex { get; set; }
   }
 
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/AfterCrossoverOperator.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/AfterCrossoverOperator.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/AfterCrossoverOperator.cs	(revision 10650)
@@ -28,5 +28,5 @@
   [StorableClass]
   [Item("AfterCrossoverOperator", "A generic operator that can record genealogical relationships between crossover parents and children.")]
-  public class AfterCrossoverOperator<T> : EvolutionTrackingOperator, ICrossoverOperator<T> where T : class,IItem {
+  public class AfterCrossoverOperator<T> : EvolutionTrackingOperator<T>, ICrossoverOperator<T> where T : class,IItem {
     private const string DefaultParentsParameterName = "Parents";
     private const string DefaultChildParameterName = "Child";
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/AfterManipulatorOperator.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/AfterManipulatorOperator.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/AfterManipulatorOperator.cs	(revision 10650)
@@ -28,5 +28,5 @@
   [StorableClass]
   [Item("AfterCrossoverOperator", "Performs an action after the crossover operator is applied.")]
-  public class AfterManipulatorOperator<T> : EvolutionTrackingOperator, IManipulatorOperator<T> where T : class,IItem {
+  public class AfterManipulatorOperator<T> : EvolutionTrackingOperator<T>, IManipulatorOperator<T> where T : class,IItem {
 
     private const string ChildParameterName = "Child";
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/AfterSolutionCreatorOperator.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/AfterSolutionCreatorOperator.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/AfterSolutionCreatorOperator.cs	(revision 10650)
@@ -27,5 +27,5 @@
   [StorableClass]
   [Item("AfterSolutionCreatorOperator", "An operator that runs after the solution creator and performs additional actions.")]
-  public class AfterSolutionCreatorOperator<T> : EvolutionTrackingOperator
+  public class AfterSolutionCreatorOperator<T> : EvolutionTrackingOperator<T>
     where T : class,IItem {
 
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/BeforeCrossoverOperator.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/BeforeCrossoverOperator.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/BeforeCrossoverOperator.cs	(revision 10650)
@@ -31,5 +31,5 @@
   [StorableClass]
   [Item("AfterCrossoverOperator", "A generic operator that can record genealogical relationships between crossover parents and children.")]
-  public class BeforeCrossoverOperator<T> : EvolutionTrackingOperator, ICrossoverOperator<T> where T : class,IItem {
+  public class BeforeCrossoverOperator<T> : EvolutionTrackingOperator<T>, ICrossoverOperator<T> where T : class,IItem {
     private const string defaultParentsParameterName = "Parents";
     private const string defaultChildParameterName = "Child";
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/BeforeManipulatorOperator.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/BeforeManipulatorOperator.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/BeforeManipulatorOperator.cs	(revision 10650)
@@ -29,5 +29,5 @@
   [StorableClass]
   [Item("AfterCrossoverOperator", "Performs an action after the crossover operator is applied.")]
-  public class BeforeManipulatorOperator<T> : EvolutionTrackingOperator, IManipulatorOperator<T> where T : class,IItem {
+  public class BeforeManipulatorOperator<T> : EvolutionTrackingOperator<T>, IManipulatorOperator<T> where T : class,IItem {
 
     private const string ChildParameterName = "Child";
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/EvolutionTrackingOperator.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/EvolutionTrackingOperator.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/EvolutionTrackingOperator.cs	(revision 10650)
@@ -28,5 +28,5 @@
 
 namespace HeuristicLab.EvolutionTracking {
-  public class EvolutionTrackingOperator : SingleSuccessorOperator {
+  public class EvolutionTrackingOperator<T> : SingleSuccessorOperator where T : class,IItem {
     // evolution tracking-related parameters
     private const string resultsParameterName = "Results";
@@ -46,14 +46,14 @@
       get { return GenerationsParameter.ActualValue; }
     }
-    public IGenealogyGraph GenealogyGraph {
+    public IGenealogyGraph<T> GenealogyGraph {
       get {
         IResult result;
         if (!Results.ContainsKey(populationGraphParameterName)) {
-          result = new Result(populationGraphParameterName, new GenealogyGraph());
+          result = new Result(populationGraphParameterName, new GenealogyGraph<T>());
           Results.Add(result);
         } else {
           result = Results[populationGraphParameterName];
         }
-        var graph = (GenealogyGraph)result.Value;
+        var graph = (GenealogyGraph<T>)result.Value;
         return graph;
       }
@@ -63,9 +63,9 @@
       Parameters.Add(new LookupParameter<ResultCollection>(resultsParameterName));
     }
-    protected EvolutionTrackingOperator(EvolutionTrackingOperator original, Cloner cloner)
+    protected EvolutionTrackingOperator(EvolutionTrackingOperator<T> original, Cloner cloner)
       : base(original, cloner) {
     }
     public override IDeepCloneable Clone(Cloner cloner) {
-      return new EvolutionTrackingOperator(this, cloner);
+      return new EvolutionTrackingOperator<T>(this, cloner);
     }
   }
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 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj	(revision 10650)
@@ -219,4 +219,16 @@
       <DependentUpon>SlidingWindowDataView.cs</DependentUpon>
     </Compile>
+    <Compile Include="SymboldDataAnalysisGenealogyView.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="SymboldDataAnalysisGenealogyView.Designer.cs">
+      <DependentUpon>SymboldDataAnalysisGenealogyView.cs</DependentUpon>
+    </Compile>
+    <Compile Include="SymbolicDataAnalysisExpressionGenealogyGraphChart.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="SymbolicDataAnalysisExpressionGenealogyGraphChart.Designer.cs">
+      <DependentUpon>SymbolicDataAnalysisExpressionGenealogyGraphChart.cs</DependentUpon>
+    </Compile>
     <Compile Include="SymbolicDataAnalysisExpressionLineageExplorerChart.cs">
       <SubType>UserControl</SubType>
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.Designer.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.Designer.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.Designer.cs	(revision 10650)
@@ -19,4 +19,5 @@
  */
 #endregion
+
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
@@ -137,12 +138,16 @@
       // 
       // btnOptimizeConstants
-      // 
-      this.btnOptimizeConstants.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+      //       
+      this.btnOptimizeConstants.AutoSize = true;
       this.btnOptimizeConstants.Enabled = false;
-      this.btnOptimizeConstants.Location = new System.Drawing.Point(104, 3);
+      //      this.btnOptimizeConstants.Image = HeuristicLab.Common.Resources.VSImageLibrary.Performance;
+      this.btnOptimizeConstants.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter;
+      this.btnOptimizeConstants.Location = new System.Drawing.Point(105, 3);
       this.btnOptimizeConstants.Name = "btnOptimizeConstants";
-      this.btnOptimizeConstants.Size = new System.Drawing.Size(97, 23);
+      this.btnOptimizeConstants.Size = new System.Drawing.Size(80, 24);
       this.btnOptimizeConstants.TabIndex = 2;
       this.btnOptimizeConstants.Text = "Optimize";
+      this.btnOptimizeConstants.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+      this.btnOptimizeConstants.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
       this.btnOptimizeConstants.UseVisualStyleBackColor = true;
       this.btnOptimizeConstants.Click += new System.EventHandler(this.btnOptimizeConstants_Click);
@@ -150,9 +155,15 @@
       // btnSimplify
       // 
+      this.btnSimplify.AutoSize = true;
+      this.btnSimplify.Enabled = true;
+      //      this.btnSimplify.Image = HeuristicLab.Common.Resources.VSImageLibrary.FormulaEvaluator;
+      this.btnSimplify.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter;
       this.btnSimplify.Location = new System.Drawing.Point(3, 3);
       this.btnSimplify.Name = "btnSimplify";
-      this.btnSimplify.Size = new System.Drawing.Size(95, 23);
+      this.btnSimplify.Size = new System.Drawing.Size(80, 24);
       this.btnSimplify.TabIndex = 1;
       this.btnSimplify.Text = "Simplify";
+      this.btnSimplify.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+      this.btnSimplify.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
       this.btnSimplify.UseVisualStyleBackColor = true;
       this.btnSimplify.Click += new System.EventHandler(this.btnSimplify_Click);
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs	(revision 10650)
@@ -52,4 +52,5 @@
       Content.ModelChanged += Content_Changed;
       Content.ProblemDataChanged += Content_Changed;
+      treeChart.Repainted += treeChart_Repainted;
     }
     protected override void DeregisterContentEvents() {
@@ -57,4 +58,5 @@
       Content.ModelChanged -= Content_Changed;
       Content.ProblemDataChanged -= Content_Changed;
+      treeChart.Repainted -= treeChart_Repainted;
     }
 
@@ -68,4 +70,9 @@
       UpdateView();
       viewHost.Content = this.Content;
+    }
+
+    private void treeChart_Repainted(object sender, EventArgs e) {
+      if (nodeImpacts != null && nodeImpacts.Count > 0)
+        PaintNodeImpacts();
     }
 
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.cs	(revision 10650)
@@ -32,6 +32,6 @@
 
   internal sealed partial class InteractiveSymbolicExpressionTreeChart : SymbolicExpressionTreeChart {
-    private ISymbolicExpressionTreeNode tempNode; // node in clipboard (to be cut/copy/pasted etc)
-    private VisualTreeNode<ISymbolicExpressionTreeNode> currSelected; // currently selected node
+    private ISymbolicExpressionTreeNode tempNode; //node in clipboard (to be cut/copy/pasted etc)
+    private VisualTreeNode<ISymbolicExpressionTreeNode> currSelected; //currently selected node
     private enum EditOp { NoOp, CopySubtree, CutSubtree }
     private EditOp lastOp = EditOp.NoOp;
@@ -218,5 +218,5 @@
             if (tempNode.IterateNodesBreadth().Contains(node))
               throw new ArgumentException();// cannot cut/paste a node into itself
-            ModifyTree(Tree, tempNode.Parent, tempNode, null); //remove node from its original parent 	 	 
+            ModifyTree(Tree, tempNode.Parent, tempNode, null); //remove node from its original parent
             ModifyTree(Tree, node, null, tempNode); //insert it as a child to the new parent 
             break;
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Plugin.cs.frame
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Plugin.cs.frame	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Plugin.cs.frame	(revision 10650)
@@ -32,4 +32,5 @@
   [PluginDependency("HeuristicLab.Collections", "3.3")]
   [PluginDependency("HeuristicLab.Common", "3.3")]
+  [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
   [PluginDependency("HeuristicLab.Core", "3.3")]
   [PluginDependency("HeuristicLab.Core.Views", "3.3")]
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymboldDataAnalysisGenealogyView.Designer.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymboldDataAnalysisGenealogyView.Designer.cs	(revision 10650)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymboldDataAnalysisGenealogyView.Designer.cs	(revision 10650)
@@ -0,0 +1,167 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2014 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
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
+  partial class SymboldDataAnalysisGenealogyView {
+    /// <summary> 
+    /// Required designer variable.
+    /// </summary>
+    private System.ComponentModel.IContainer components = null;
+
+    /// <summary> 
+    /// Clean up any resources being used.
+    /// </summary>
+    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+    protected override void Dispose(bool disposing) {
+      if (disposing && (components != null)) {
+        components.Dispose();
+      }
+      base.Dispose(disposing);
+    }
+
+    #region Component Designer generated code
+
+    /// <summary> 
+    /// Required method for Designer support - do not modify 
+    /// the contents of this method with the code editor.
+    /// </summary>
+    private void InitializeComponent() {
+      this.components = new System.ComponentModel.Container();
+      this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+      this.genealogyGraphChart = new HeuristicLab.Problems.DataAnalysis.Symbolic.Views.SymbolicDataAnalysisExpressionGenealogyGraphChart();
+      this.symbolicExpressionTreeChart = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart();
+      this.trace_checkBox = new System.Windows.Forms.CheckBox();
+      this.lockGraph_checkBox = new System.Windows.Forms.CheckBox();
+      this.simpleLineages_checkBox = new System.Windows.Forms.CheckBox();
+      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
+      this.splitContainer1.Panel1.SuspendLayout();
+      this.splitContainer1.Panel2.SuspendLayout();
+      this.splitContainer1.SuspendLayout();
+      this.SuspendLayout();
+      // 
+      // splitContainer1
+      // 
+      this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Bottom;
+      this.splitContainer1.Location = new System.Drawing.Point(0, 33);
+      this.splitContainer1.Name = "splitContainer1";
+      // 
+      // splitContainer1.Panel1
+      // 
+      this.splitContainer1.Panel1.Controls.Add(this.genealogyGraphChart);
+      // 
+      // splitContainer1.Panel2
+      // 
+      this.splitContainer1.Panel2.Controls.Add(this.symbolicExpressionTreeChart);
+      this.splitContainer1.Size = new System.Drawing.Size(1247, 722);
+      this.splitContainer1.SplitterDistance = 607;
+      this.splitContainer1.TabIndex = 0;
+      // 
+      // genealogyGraphChart
+      // 
+      this.genealogyGraphChart.BackColor = System.Drawing.SystemColors.Control;
+      this.genealogyGraphChart.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.genealogyGraphChart.GenealogyGraph = null;
+      this.genealogyGraphChart.Location = new System.Drawing.Point(0, 0);
+      this.genealogyGraphChart.LockGenealogy = false;
+      this.genealogyGraphChart.Name = "genealogyGraphChart";
+      this.genealogyGraphChart.ScaleOnResize = true;
+      this.genealogyGraphChart.SimpleLineages = false;
+      this.genealogyGraphChart.Size = new System.Drawing.Size(607, 722);
+      this.genealogyGraphChart.TabIndex = 0;
+      this.genealogyGraphChart.TraceFragments = false;
+      // 
+      // symbolicExpressionTreeChart
+      // 
+      this.symbolicExpressionTreeChart.BackgroundColor = System.Drawing.Color.White;
+      this.symbolicExpressionTreeChart.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.symbolicExpressionTreeChart.LineColor = System.Drawing.Color.Black;
+      this.symbolicExpressionTreeChart.Location = new System.Drawing.Point(0, 0);
+      this.symbolicExpressionTreeChart.Name = "symbolicExpressionTreeChart";
+      this.symbolicExpressionTreeChart.Size = new System.Drawing.Size(636, 722);
+      this.symbolicExpressionTreeChart.Spacing = 5;
+      this.symbolicExpressionTreeChart.SuspendRepaint = false;
+      this.symbolicExpressionTreeChart.TabIndex = 0;
+      this.symbolicExpressionTreeChart.TextFont = new System.Drawing.Font("Microsoft Sans Serif", 12F);
+      this.symbolicExpressionTreeChart.Tree = null;
+      // 
+      // trace_checkBox
+      // 
+      this.trace_checkBox.AutoSize = true;
+      this.trace_checkBox.Location = new System.Drawing.Point(611, 10);
+      this.trace_checkBox.Name = "trace_checkBox";
+      this.trace_checkBox.Size = new System.Drawing.Size(54, 17);
+      this.trace_checkBox.TabIndex = 1;
+      this.trace_checkBox.Text = "Trace";
+      this.trace_checkBox.UseVisualStyleBackColor = true;
+      this.trace_checkBox.CheckedChanged += new System.EventHandler(this.trace_checkBox_CheckedChanged);
+      // 
+      // lockGraph_checkBox
+      // 
+      this.lockGraph_checkBox.AutoSize = true;
+      this.lockGraph_checkBox.Location = new System.Drawing.Point(4, 10);
+      this.lockGraph_checkBox.Name = "lockGraph_checkBox";
+      this.lockGraph_checkBox.Size = new System.Drawing.Size(82, 17);
+      this.lockGraph_checkBox.TabIndex = 2;
+      this.lockGraph_checkBox.Text = "Lock Graph";
+      this.lockGraph_checkBox.UseVisualStyleBackColor = true;
+      this.lockGraph_checkBox.CheckedChanged += new System.EventHandler(this.lockGraph_checkBox_CheckedChanged);
+      // 
+      // simpleLineages_checkBox
+      // 
+      this.simpleLineages_checkBox.AutoSize = true;
+      this.simpleLineages_checkBox.Location = new System.Drawing.Point(91, 10);
+      this.simpleLineages_checkBox.Name = "simpleLineages_checkBox";
+      this.simpleLineages_checkBox.Size = new System.Drawing.Size(103, 17);
+      this.simpleLineages_checkBox.TabIndex = 3;
+      this.simpleLineages_checkBox.Text = "Simple Lineages";
+      this.simpleLineages_checkBox.UseVisualStyleBackColor = true;
+      this.simpleLineages_checkBox.CheckedChanged += new System.EventHandler(this.simpleLineages_checkBox_CheckedChanged);
+      // 
+      // SymboldDataAnalysisGenealogyView
+      // 
+      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.Controls.Add(this.simpleLineages_checkBox);
+      this.Controls.Add(this.lockGraph_checkBox);
+      this.Controls.Add(this.trace_checkBox);
+      this.Controls.Add(this.splitContainer1);
+      this.Name = "SymboldDataAnalysisGenealogyView";
+      this.Size = new System.Drawing.Size(1247, 755);
+      this.splitContainer1.Panel1.ResumeLayout(false);
+      this.splitContainer1.Panel2.ResumeLayout(false);
+      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
+      this.splitContainer1.ResumeLayout(false);
+      this.ResumeLayout(false);
+      this.PerformLayout();
+
+    }
+
+    #endregion
+
+    private System.Windows.Forms.SplitContainer splitContainer1;
+    private SymbolicDataAnalysisExpressionGenealogyGraphChart genealogyGraphChart;
+    private Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart symbolicExpressionTreeChart;
+    private System.Windows.Forms.CheckBox trace_checkBox;
+    private System.Windows.Forms.CheckBox lockGraph_checkBox;
+    private System.Windows.Forms.CheckBox simpleLineages_checkBox;
+
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymboldDataAnalysisGenealogyView.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymboldDataAnalysisGenealogyView.cs	(revision 10650)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymboldDataAnalysisGenealogyView.cs	(revision 10650)
@@ -0,0 +1,241 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2014 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;
+using System.Drawing;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.Core.Views;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views;
+using HeuristicLab.EvolutionTracking;
+using HeuristicLab.EvolutionTracking.Views;
+using HeuristicLab.MainForm;
+
+using FragmentGraph = HeuristicLab.EvolutionTracking.IGenealogyGraph<HeuristicLab.EvolutionTracking.IFragment<HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ISymbolicExpressionTreeNode>>;
+
+
+using FragmentNode = HeuristicLab.EvolutionTracking.GenealogyGraphNode<HeuristicLab.EvolutionTracking.IFragment<HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ISymbolicExpressionTreeNode>>;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
+  [View("SymboldDataAnalysisGenealogyView")]
+  [Content(typeof(IGenealogyGraph<ISymbolicExpressionTree>), IsDefaultView = true)]
+  public partial class SymboldDataAnalysisGenealogyView : ItemView {
+    private readonly ISymbolicExpressionTreeNodeSimilarityComparer comparer;
+
+    public SymboldDataAnalysisGenealogyView() {
+      InitializeComponent();
+
+      comparer = new SymbolicExpressionTreeNodeSimilarityComparer();
+    }
+
+    public new IGenealogyGraph<ISymbolicExpressionTree> Content {
+      get { return (IGenealogyGraph<ISymbolicExpressionTree>)base.Content; }
+      set { base.Content = value; }
+    }
+
+    #region event handlers
+
+    protected override void OnContentChanged() {
+      base.OnContentChanged();
+      if (Content != null) {
+        genealogyGraphChart.GenealogyGraph = Content;
+      }
+    }
+
+    #endregion
+
+    protected override void RegisterContentEvents() {
+      genealogyGraphChart.GenealogyGraphNodeClicked += graphChart_GenealogyGraphNodeClicked;
+      symbolicExpressionTreeChart.SymbolicExpressionTreeNodeClicked += treeChart_SymbolicExpressionNodeClicked;
+      base.RegisterContentEvents();
+    }
+
+    protected override void DeregisterContentEvents() {
+      base.DeregisterContentEvents();
+      genealogyGraphChart.GenealogyGraphNodeClicked -= graphChart_GenealogyGraphNodeClicked;
+      symbolicExpressionTreeChart.SymbolicExpressionTreeNodeClicked -= treeChart_SymbolicExpressionNodeClicked;
+    }
+
+    public void graphChart_GenealogyGraphNodeClicked(object sender, MouseEventArgs args) {
+      var visualNode = (VisualGenealogyGraphNode)sender;
+      var graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)visualNode.Data;
+      var tree = graphNode.Content;
+      symbolicExpressionTreeChart.Tree = tree;
+    }
+
+    public void treeChart_SymbolicExpressionNodeClicked(object sender, MouseEventArgs args) {
+      var visualNode = (VisualTreeNode<ISymbolicExpressionTreeNode>)sender;
+      var subtree = visualNode.Content;
+
+      // highlight the selected subtree inside the displayed tree on the right hand side
+      treeChart_ClearColors();
+      treeChart_HighlightSubtree(subtree);
+
+      bool trace = genealogyGraphChart.TraceFragments; // check whether the mode is 'trace' or 'match'
+
+      if (trace) {
+        // perform fragment tracing
+        var fragmentGraph = TraceSubtree(subtree);
+
+        // find all the genealogy graph nodes that contain the building blocks which formed the currently selected subtree
+        // this should maybe be limited to nodes of the ancestry (can be very computationally expensive)
+        var vertices = from x in fragmentGraph.Nodes
+                       let fragmentNode = (FragmentNode)x
+                       let fragment = fragmentNode.Content
+                       from y in Content.Nodes
+                       let graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)y
+                       let tree = graphNode.Content
+                       where tree.Root.ContainsSubtree(fragment.Root, comparer)
+                       select graphNode;
+
+        graphChart_highlightMatchingVertices(vertices);
+      } else {
+        // perform matching like before
+        var trees = Content.Nodes.Select(x => (ISymbolicExpressionTree)x.Content);
+        var matchingTrees = trees.Where(x => x.Root.ContainsSubtree(subtree, comparer));
+
+        var matchingVertices = matchingTrees.SelectMany(x => Content[x]).Cast<IGenealogyGraphNode<ISymbolicExpressionTree>>();
+        graphChart_highlightMatchingVertices(matchingVertices);
+      }
+    }
+
+    private void graphChart_highlightMatchingVertices(IEnumerable<IGenealogyGraphNode> vertices) {
+      genealogyGraphChart.Chart.UpdateEnabled = false;
+      genealogyGraphChart.ClearPrimitives();
+      genealogyGraphChart.HighlightNodes(vertices);
+      genealogyGraphChart.Chart.UpdateEnabled = true;
+      genealogyGraphChart.Chart.EnforceUpdate();
+    }
+
+    private void treeChart_ClearColors() {
+      foreach (var node in symbolicExpressionTreeChart.Tree.IterateNodesPrefix()) {
+        var visualNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node);
+        if (visualNode != null) {
+          visualNode.LineColor = Color.Black;
+          visualNode.FillColor = Color.Transparent;
+        }
+      }
+      symbolicExpressionTreeChart.RepaintNodes();
+    }
+
+    private void treeChart_HighlightSubtree(ISymbolicExpressionTreeNode subtree) {
+      foreach (var s in subtree.IterateNodesPrefix()) {
+        var visualNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(s);
+        visualNode.LineColor = Color.RoyalBlue;
+        visualNode.FillColor = Color.LightBlue;
+
+        foreach (var c in s.Subtrees) {
+          var visualArc = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNodeConnection(s, c);
+          visualArc.LineColor = Color.RoyalBlue;
+        }
+      }
+      symbolicExpressionTreeChart.RepaintNodes();
+    }
+
+    #region events for configuring the behavior of the genealogy chart (trace/match, simple lineages, etc)
+    private void trace_checkBox_CheckedChanged(object sender, System.EventArgs e) {
+      genealogyGraphChart.TraceFragments = trace_checkBox.Checked;
+    }
+
+    private void simpleLineages_checkBox_CheckedChanged(object sender, System.EventArgs e) {
+      genealogyGraphChart.SimpleLineages = simpleLineages_checkBox.Checked;
+    }
+
+    private void lockGraph_checkBox_CheckedChanged(object sender, System.EventArgs e) {
+      genealogyGraphChart.LockGenealogy = lockGraph_checkBox.Checked;
+    }
+    #endregion
+
+    #region fragment tracing
+    private FragmentGraph TraceSubtree(ISymbolicExpressionTreeNode subtree) {
+      var graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)genealogyGraphChart.SelectedGraphNode;
+      var graph = new GenealogyGraph<IFragment<ISymbolicExpressionTreeNode>>();
+      Trace(graphNode, subtree, graph);
+      return graph;
+    }
+
+    private void Trace(IGenealogyGraphNode<ISymbolicExpressionTree> graphNode, ISymbolicExpressionTreeNode subtree, FragmentGraph fragmentGraph, FragmentNode fragmentNode = null) {
+      // add the subtree as a vertex in the fragment graph
+      var fn = new FragmentNode { Content = new Fragment<ISymbolicExpressionTreeNode> { Root = subtree }, Rank = graphNode.Rank };
+      fragmentGraph.AddVertex(fn);
+
+      // maybe we reached the end of the genealogy
+      if (graphNode.InArcs == null) return;
+
+      // the subtree must belong to the currently displayed tree which in turn must belong to the currently selected graph node
+      var tree = graphNode.Content;
+      var index = tree.IterateNodesPrefix().ToList().IndexOf(subtree);
+      var length = subtree.GetLength();
+
+      var fragment = (IFragment<ISymbolicExpressionTreeNode>)graphNode.InArcs.Last().Data;
+      var fragmentLength = fragment.Root.GetLength();
+
+      if (fragment.Index <= index && index < fragment.Index + fragmentLength) {
+        // the selected subtree is contained by the fragment
+        var fn1 = new FragmentNode { Content = fragment };
+        if (fragmentNode != null) {
+          AddChild(fragmentNode, fn1);
+        }
+        fragmentGraph.AddVertex(fn1);
+        graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)graphNode.InArcs.Last().Source;
+        subtree = graphNode.Content.IterateNodesPrefix().ToList()[fragment.OldIndex];
+        Trace(graphNode, subtree, fragmentGraph, fn1);
+      } else if (fragment.Index > index && fragment.Index < index + length) {
+        // the selected subtree contains the fragment
+        // first trace the fragment, then trace the subtree
+        graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)graphNode.InArcs.Last().Source;
+        subtree = graphNode.Content.IterateNodesPrefix().ToList()[fragment.OldIndex];
+
+        var fn0 = new FragmentNode { Content = new Fragment<ISymbolicExpressionTreeNode> { Root = subtree } };
+        var fn1 = new FragmentNode { Content = fragment };
+
+        if (fragmentNode != null) {
+          AddChild(fragmentNode, fn0);
+          AddChild(fragmentNode, fn1);
+        }
+        fragmentGraph.AddVertex(fn0);
+        fragmentGraph.AddVertex(fn1);
+
+        var graphNode0 = (IGenealogyGraphNode<ISymbolicExpressionTree>)graphNode.InArcs[0].Source;
+        var subtree0 = graphNode0.Content.IterateNodesPrefix().ToList()[index];
+        Trace(graphNode0, subtree0, fragmentGraph, fn0);
+
+        var graphNode1 = (IGenealogyGraphNode<ISymbolicExpressionTree>)graphNode.InArcs.Last().Source;
+        var subtree1 = graphNode1.Content.IterateNodesPrefix().ToList()[fragment.OldIndex];
+        Trace(graphNode1, subtree1, fragmentGraph, fn1);
+      } else {
+        // the fragment is not contained by the selected subtree, so we go one level up
+        graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)graphNode.InArcs[0].Source;
+        subtree = graphNode.Content.IterateNodesPrefix().ToList()[index];
+        fragmentGraph.Clear(); // restart the trace one level up
+        Trace(graphNode, subtree, fragmentGraph);
+      }
+    }
+
+    private void AddChild(FragmentNode parent, FragmentNode child) {
+      child.Rank = parent.Rank - 1;
+      parent.AddForwardArc(child);
+      child.AddReverseArc(parent);
+    }
+    #endregion
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisExpressionGenealogyGraphChart.Designer.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisExpressionGenealogyGraphChart.Designer.cs	(revision 10650)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisExpressionGenealogyGraphChart.Designer.cs	(revision 10650)
@@ -0,0 +1,32 @@
+﻿namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
+  partial class SymbolicDataAnalysisExpressionGenealogyGraphChart {
+    /// <summary> 
+    /// Required designer variable.
+    /// </summary>
+    private System.ComponentModel.IContainer components = null;
+
+    /// <summary> 
+    /// Clean up any resources being used.
+    /// </summary>
+    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+    protected override void Dispose(bool disposing) {
+      if (disposing && (components != null)) {
+        components.Dispose();
+      }
+      base.Dispose(disposing);
+    }
+
+    #region Component Designer generated code
+
+    /// <summary> 
+    /// Required method for Designer support - do not modify 
+    /// the contents of this method with the code editor.
+    /// </summary>
+    private void InitializeComponent() {
+      components = new System.ComponentModel.Container();
+      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+    }
+
+    #endregion
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisExpressionGenealogyGraphChart.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisExpressionGenealogyGraphChart.cs	(revision 10650)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisExpressionGenealogyGraphChart.cs	(revision 10650)
@@ -0,0 +1,38 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2014 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 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.EvolutionTracking;
+using HeuristicLab.EvolutionTracking.Views;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
+  public partial class SymbolicDataAnalysisExpressionGenealogyGraphChart : GenealogyGraphChart {
+    public SymbolicDataAnalysisExpressionGenealogyGraphChart() {
+      InitializeComponent();
+    }
+
+    public new IGenealogyGraph<ISymbolicExpressionTree> GenealogyGraph {
+      get { return (IGenealogyGraph<ISymbolicExpressionTree>)base.GenealogyGraph; }
+      set { base.GenealogyGraph = value; }
+    }
+    // add event handlers here for processing events coming from the tree chart
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisExpressionLineageExplorerChart.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisExpressionLineageExplorerChart.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisExpressionLineageExplorerChart.cs	(revision 10650)
@@ -1,4 +1,5 @@
 ﻿using System.Collections.Generic;
 using System.Drawing;
+using System.Windows.Forms;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views;
 using HeuristicLab.Visualization;
@@ -59,4 +60,21 @@
       }
     }
+
+    protected override void pictureBox_MouseUp(object sender, MouseEventArgs e) {
+      base.pictureBox_MouseUp(sender, e);
+      // get the selected primitive and update it's graphics
+      var point = new Point(e.X, e.Y);
+
+      var selectedPrimitives = Chart.GetAllPrimitives(point);
+      // first primitive in the list should be the tile, the second one should be the actual primitive representing a tree node
+      var tile = (SymbolicExpressionTreeTile)selectedPrimitives[0];
+      var selectedPrimitive = (RectangularPrimitiveBase)selectedPrimitives[1];
+      var tree = tile.SymbolicExpressionTree; // use the tree to get the genealogy graph node and the fragments used for tracing building blocks
+
+      var pen = new Pen(Color.Blue);
+      using (var g = Graphics.FromImage(pictureBox.Image)) {
+        g.DrawRectangle(pen, (float)selectedPrimitive.LowerLeft.X, (float)selectedPrimitive.LowerLeft.Y, (float)selectedPrimitive.Size.Width, (float)selectedPrimitive.Size.Height);
+      }
+    }
   }
 }
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisExpressionLineageExplorerView.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisExpressionLineageExplorerView.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisExpressionLineageExplorerView.cs	(revision 10650)
@@ -30,5 +30,5 @@
     public SymbolicDataAnalysisExpressionLineageExplorerView() {
       InitializeComponent();
-      symbolicExpressionTreeNodeLayoutEngine = new ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode> {
+      symbolicExpressionTreeNodeLayoutEngine = new ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode>(node => node.Subtrees) {
         HorizontalSpacing = MinHorizontalSpacing,
         VerticalSpacing = MinVerticalSpacing,
@@ -36,4 +36,5 @@
         NodeHeight = PreferredNodeHeight
       };
+
       treeMap = new Dictionary<TreeNode, ISymbolicExpressionTree>();
       double width = lineageExplorerChart.PreferredSize.Width;
@@ -43,5 +44,4 @@
       }
     }
-
 
     #region events
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj	(revision 10650)
@@ -189,4 +189,10 @@
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Matching\SymbolicExpressionTreeCanonicalSorter.cs" />
+    <Compile Include="Matching\SymbolicExpressionTreeEqualityComparer.cs" />
+    <Compile Include="Matching\SymbolicExpressionTreeMatching.cs" />
+    <Compile Include="Matching\SymbolicExpressionTreeMaxCommonSequenceCalculator.cs" />
+    <Compile Include="Matching\SymbolicExpressionTreeNodeComparer.cs" />
+    <Compile Include="Matching\SymbolicExpressionTreeNodeSimilarityComparer.cs" />
     <Compile Include="SlidingWindow\GenerationalSlidingWindowAnalyzer.cs" />
     <Compile Include="SlidingWindow\OffspringSelectionSlidingWindowAnalyzer.cs" />
@@ -198,5 +204,4 @@
     <Compile Include="SymbolGraph\SymbolGraph.cs" />
     <Compile Include="SymbolicDataAnalysisExpressionPruningOperator.cs" />
-    <Compile Include="SymbolicDataAnalysisExpressionTreeMatching.cs" />
     <Compile Include="SymbolicDataAnalysisExpressionTreeSimilarityCalculator.cs" />
     <Compile Include="SymbolicDataAnalysisSolutionPruningOptimizer.cs" />
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Matching/SymbolicExpressionTreeCanonicalSorter.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Matching/SymbolicExpressionTreeCanonicalSorter.cs	(revision 10650)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Matching/SymbolicExpressionTreeCanonicalSorter.cs	(revision 10650)
@@ -0,0 +1,30 @@
+﻿
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  public class SymbolicExpressionTreeCanonicalSorter {
+    private readonly HashSet<Type> nonSymmetricSymbols = new HashSet<Type> { typeof(Subtraction), typeof(Division) };
+
+    public void SortSubtrees(ISymbolicExpressionTree tree) {
+      SortSubtrees(tree.Root);
+    }
+
+    public void SortSubtrees(ISymbolicExpressionTreeNode node) {
+      if (node.SubtreeCount == 0) return;
+      var subtrees = node.Subtrees as List<ISymbolicExpressionTreeNode> ?? node.Subtrees.ToList();
+      if (IsSymmetric(node.Symbol)) {
+        var comparer = new SymbolicExpressionTreeNodeComparer();
+        subtrees.Sort(comparer);
+      }
+      foreach (var s in subtrees)
+        SortSubtrees(s);
+    }
+
+    private bool IsSymmetric(ISymbol s) {
+      return !nonSymmetricSymbols.Contains(s.GetType());
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Matching/SymbolicExpressionTreeEqualityComparer.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Matching/SymbolicExpressionTreeEqualityComparer.cs	(revision 10650)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Matching/SymbolicExpressionTreeEqualityComparer.cs	(revision 10650)
@@ -0,0 +1,19 @@
+﻿using System;
+using System.Collections.Generic;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  public class SymbolicExpressionTreeEqualityComparer : IEqualityComparer<ISymbolicExpressionTree> {
+    public SymbolicExpressionTreeNodeSimilarityComparer SimilarityComparer { get; set; }
+
+    public bool Equals(ISymbolicExpressionTree a, ISymbolicExpressionTree b) {
+      if (SimilarityComparer == null) throw new Exception("SimilarityComparer needs to be initialized first.");
+      return a.Length == b.Length &&
+             SymbolicExpressionTreeMatching.Match(a.Root, b.Root, SimilarityComparer) == Math.Min(a.Length, b.Length);
+    }
+
+    public int GetHashCode(ISymbolicExpressionTree tree) {
+      return (tree.Length << 8) % 12345;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Matching/SymbolicExpressionTreeMatching.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Matching/SymbolicExpressionTreeMatching.cs	(revision 10650)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Matching/SymbolicExpressionTreeMatching.cs	(revision 10650)
@@ -0,0 +1,48 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+//using HeuristicLab.EvolutionTracking;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  public static class SymbolicExpressionTreeMatching {
+    public static bool ContainsSubtree(this ISymbolicExpressionTreeNode root, ISymbolicExpressionTreeNode subtree, ISymbolicExpressionTreeNodeSimilarityComparer comparer) {
+      return FindMatches(root, subtree, comparer).Any();
+    }
+    public static IEnumerable<ISymbolicExpressionTreeNode> FindMatches(ISymbolicExpressionTree tree, ISymbolicExpressionTreeNode subtree, ISymbolicExpressionTreeNodeSimilarityComparer comparer) {
+      return FindMatches(tree.Root, subtree, comparer);
+    }
+
+    public static IEnumerable<ISymbolicExpressionTreeNode> FindMatches(ISymbolicExpressionTreeNode root, ISymbolicExpressionTreeNode subtree, ISymbolicExpressionTreeNodeSimilarityComparer comp) {
+      var fragmentLength = subtree.GetLength();
+      // below, we use ">=" for Match(n, subtree, comp) >= fragmentLength because in case of relaxed conditions, 
+      // we can have multiple matches of the same node
+
+      return root.IterateNodesBreadth().Where(n => n.GetLength() >= fragmentLength && Match(n, subtree, comp) == fragmentLength);
+    }
+
+    ///<summary>
+    /// Finds the longest common subsequence in quadratic time and linear space
+    /// Variant of:
+    /// D. S. Hirschberg. A linear space algorithm for or computing maximal common subsequences. 1975.
+    /// http://dl.acm.org/citation.cfm?id=360861
+    /// </summary>
+    /// <returns>Number of pairs that were matched</returns>
+    public static int Match(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b, ISymbolicExpressionTreeNodeSimilarityComparer comp) {
+      if (!comp.Equals(a, b)) return 0;
+      int m = a.SubtreeCount;
+      int n = b.SubtreeCount;
+      if (m == 0 || n == 0) return 1;
+      var matrix = new int[m + 1, n + 1];
+      for (int i = 1; i <= m; ++i) {
+        var ai = a.GetSubtree(i - 1);
+        for (int j = 1; j <= n; ++j) {
+          var bj = b.GetSubtree(j - 1);
+          int match = Match(ai, bj, comp);
+          matrix[i, j] = Math.Max(Math.Max(matrix[i, j - 1], matrix[i - 1, j]), matrix[i - 1, j - 1] + match);
+        }
+      }
+      return matrix[m, n] + 1;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Matching/SymbolicExpressionTreeMaxCommonSequenceCalculator.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Matching/SymbolicExpressionTreeMaxCommonSequenceCalculator.cs	(revision 10650)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Matching/SymbolicExpressionTreeMaxCommonSequenceCalculator.cs	(revision 10650)
@@ -0,0 +1,59 @@
+﻿using System;
+using System.Collections.Generic;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Matching {
+  public class MaxCommonSequenceCalculator<T, U>
+    where T : class
+    where U : IEqualityComparer<T> {
+
+    public U Comparer { get; set; }
+    private int[,] matrix;
+    private List<T> sequence;
+
+    /// <summary>
+    /// Calculate the maximal common subsequence between arrays a and b and return it
+    /// </summary>
+    /// <param name="a"></param>
+    /// <param name="b"></param>
+    /// <returns></returns>
+    public IEnumerable<T> Calculate(T[] a, T[] b) {
+      int m = a.Length;
+      int n = b.Length;
+
+      if (m == 0 || n == 0) return null;
+      sequence = new List<T>();
+      matrix = new int[m + 1, n + 1];
+
+      for (int i = 0; i <= m; ++i) {
+        for (int j = 0; j <= n; ++j) {
+          if (i == 0 || j == 0) {
+            matrix[i, j] = 0;
+          } else if (Comparer.Equals(a[i - 1], b[j - 1])) {
+            matrix[i, j] = matrix[i - 1, j - 1] + 1;
+          } else {
+            matrix[i, j] = Math.Max(matrix[i - 1, j], matrix[i, j - 1]);
+          }
+        }
+      }
+      recon(a, b, n, m);
+      return sequence;
+    }
+
+    private void recon(T[] a, T[] b, int i, int j) {
+      while (true) {
+        if (i == 0 || j == 0) return;
+        if (Comparer.Equals(a[i - 1], b[j - 1])) {
+          recon(a, b, i - 1, j - 1);
+          sequence.Add(a[i - 1]);
+        } else if (matrix[i - 1, j] > matrix[i, j - 1]) {
+          i = i - 1;
+          continue;
+        } else {
+          j = j - 1;
+          continue;
+        }
+        break;
+      }
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Matching/SymbolicExpressionTreeNodeComparer.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Matching/SymbolicExpressionTreeNodeComparer.cs	(revision 10650)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Matching/SymbolicExpressionTreeNodeComparer.cs	(revision 10650)
@@ -0,0 +1,33 @@
+﻿using System;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  // this comparer considers that a < b if the type of a is "greater" than the type of b, for example:
+  // - A function node is "greater" than a terminal node
+  // - A variable terminal is "greater" than a constant terminal
+  // - used for bringing subtrees to a "canonical" form when the operation allows reordering of arguments
+  public class SymbolicExpressionTreeNodeComparer : ISymbolicExpressionTreeNodeComparer {
+    public int Compare(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
+      if (!(a is SymbolicExpressionTreeTerminalNode)) {
+        return b is SymbolicExpressionTreeTerminalNode
+          ? -1
+          : string.Compare(a.Symbol.Name, b.Symbol.Name, StringComparison.Ordinal);
+      }
+      if (!(b is SymbolicExpressionTreeTerminalNode)) return 1;
+      // at this point we know a and b are terminal nodes
+      var va = a as VariableTreeNode;
+      if (va != null) {
+        if (b is ConstantTreeNode) return -1;
+        var vb = (VariableTreeNode)b;
+        return (va.VariableName.Equals(vb.VariableName)
+          ? va.Weight.CompareTo(vb.Weight)
+          : string.Compare(va.VariableName, vb.VariableName, StringComparison.Ordinal));
+      }
+      // at this point we know for sure that a is a constant tree node
+      if (b is VariableTreeNode) return 1;
+      var ca = (ConstantTreeNode)a;
+      var cb = (ConstantTreeNode)b;
+      return ca.Value.CompareTo(cb.Value);
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Matching/SymbolicExpressionTreeNodeSimilarityComparer.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Matching/SymbolicExpressionTreeNodeSimilarityComparer.cs	(revision 10650)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Matching/SymbolicExpressionTreeNodeSimilarityComparer.cs	(revision 10650)
@@ -0,0 +1,76 @@
+﻿using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [Item("SymbolicExpressionTreeNodeSimilarityComparer", "A comparison operator that checks node equality based on different similarity measures.")]
+  [StorableClass]
+  public class SymbolicExpressionTreeNodeSimilarityComparer : Item, ISymbolicExpressionTreeNodeSimilarityComparer {
+    [StorableConstructor]
+    private SymbolicExpressionTreeNodeSimilarityComparer(bool deserializing) : base(deserializing) { }
+    private SymbolicExpressionTreeNodeSimilarityComparer(SymbolicExpressionTreeNodeSimilarityComparer original, Cloner cloner)
+      : base(original, cloner) {
+      matchConstantValues = original.matchConstantValues;
+      matchVariableNames = original.matchVariableNames;
+      matchVariableWeights = original.matchVariableWeights;
+    }
+    public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicExpressionTreeNodeSimilarityComparer(this, cloner); }
+
+    // more flexible matching criteria 
+    [Storable]
+    private bool matchConstantValues;
+    public bool MatchConstantValues {
+      get { return matchConstantValues; }
+      set { matchConstantValues = value; }
+    }
+
+    [Storable]
+    private bool matchVariableNames;
+    public bool MatchVariableNames {
+      get { return matchVariableNames; }
+      set { matchVariableNames = value; }
+    }
+
+    [Storable]
+    private bool matchVariableWeights;
+    public bool MatchVariableWeights {
+      get { return matchVariableWeights; }
+      set { matchVariableWeights = value; }
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+    }
+
+    public SymbolicExpressionTreeNodeSimilarityComparer() {
+      matchConstantValues = true;
+      matchVariableNames = true;
+      matchVariableWeights = true;
+    }
+
+    public int GetHashCode(ISymbolicExpressionTreeNode n) {
+      return n.ToString().ToLower().GetHashCode();
+    }
+
+    public bool Equals(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
+      if (!(a is SymbolicExpressionTreeTerminalNode))
+        // if a and b are non terminal nodes, check equality of symbol names
+        return !(b is SymbolicExpressionTreeTerminalNode) && a.Symbol.Name.Equals(b.Symbol.Name);
+      var va = a as VariableTreeNode;
+      if (va != null) {
+        var vb = b as VariableTreeNode;
+        if (vb == null) return false;
+
+        return (!MatchVariableNames || va.VariableName.Equals(vb.VariableName)) && (!MatchVariableWeights || va.Weight.Equals(vb.Weight));
+      }
+      var ca = a as ConstantTreeNode;
+      if (ca != null) {
+        var cb = b as ConstantTreeNode;
+        if (cb == null) return false;
+        return (!MatchConstantValues || ca.Value.Equals(cb.Value));
+      }
+      return false;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimilarityCalculator.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimilarityCalculator.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimilarityCalculator.cs	(revision 10650)
@@ -84,5 +84,5 @@
       Parameters.Add(new ValueParameter<ISymbolicExpressionTree>(CurrentSymbolicExpressionTreeParameterName, ""));
       Parameters.Add(new LookupParameter<BoolValue>(MatchVariablesParameterName, "Specify if the symbolic expression tree comparer should match variable names."));
-      Parameters.Add(new LookupParameter<BoolValue>(MatchVariableWeightsParameterName, "Specify if the symbolic expression tree comparer should match variable weights."));
+      Parameters.Add(new LookupParameter<BoolValue>(MatchVariableWeightsParameterName, "Specify if the symbolic expression tree comparer should match variable weghts."));
       Parameters.Add(new LookupParameter<BoolValue>(MatchConstantValuesParameterName, "Specify if the symbolic expression tree comparer should match constant values."));
       Parameters.Add(new LookupParameter<DoubleValue>(SimilarityValuesParmeterName, ""));
@@ -113,12 +113,17 @@
     }
 
-    public static double CalculateSimilarity(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b,
-      SymbolicExpressionTreeNodeSimilarityComparer comp) {
-      return 2.0 * SymbolicExpressionTreeMatching.Match(a, b, comp) / (a.GetLength() + b.GetLength());
+    public static double CalculateSimilarity(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b, SymbolicExpressionTreeNodeSimilarityComparer comparer) {
+      return 2.0 * SymbolicExpressionTreeMatching.Match(a, b, comparer) / (a.GetLength() + b.GetLength());
     }
 
-    public static double MaxCommonSubtreeSimilarity(ISymbolicExpressionTree a, ISymbolicExpressionTree b,
-      SymbolicExpressionTreeNodeSimilarityComparer comparer) {
-      double max = 0;
+    /// <summary>
+    /// Try to match each pair of nodes from trees a and b and return a similarity value based on the maximum number of matched node pairs.
+    /// </summary>
+    /// <param name="a"></param>
+    /// <param name="b"></param>
+    /// <param name="comparer"></param>
+    /// <returns>A similarity value computed as 2.0 * MaxNumberOfMatchedPairs / (Sum of both tree sizes)</returns>
+    public static double MaxCommonSubtreeSimilarity(ISymbolicExpressionTree a, ISymbolicExpressionTree b, SymbolicExpressionTreeNodeSimilarityComparer comparer) {
+      int max = 0;
       var rootA = a.Root.GetSubtree(0).GetSubtree(0);
       var rootB = b.Root.GetSubtree(0).GetSubtree(0);
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterCrossoverOperator.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterCrossoverOperator.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterCrossoverOperator.cs	(revision 10650)
@@ -21,5 +21,5 @@
         fragment = new Fragment<ISymbolicExpressionTreeNode> {
           Root = childNodes[i],
-          NewPos = i
+          Index = i
         };
       }
@@ -28,5 +28,5 @@
       for (int i = 0; i < nodes1.Count; ++i) {
         if (nodes1[i] != fragment.Root) continue;
-        fragment.OldPos = i;
+        fragment.OldIndex = i;
       }
 
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterManipulatorOperator.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterManipulatorOperator.cs	(revision 10649)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterManipulatorOperator.cs	(revision 10650)
@@ -28,5 +28,5 @@
         fragment = new Fragment<ISymbolicExpressionTreeNode> {
           Root = nodesAfter[i],
-          NewPos = i
+          Index = i
         };
       }
