Index: branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/TraceCalculator.cs
===================================================================
--- branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/TraceCalculator.cs	(revision 11638)
+++ branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/TraceCalculator.cs	(revision 11751)
@@ -34,6 +34,6 @@
   [StorableClass]
   public class TraceCalculator : Item {
-    private readonly IGenealogyGraph<ISymbolicExpressionTree> traceGraph;
-    private readonly Dictionary<IGenealogyGraphNode<ISymbolicExpressionTree>, Tuple<int, int>> traceMap;
+    private IGenealogyGraph<ISymbolicExpressionTree> traceGraph;
+    private Dictionary<IGenealogyGraphNode<ISymbolicExpressionTree>, Tuple<int, int>> traceMap;
 
     public IGenealogyGraph<ISymbolicExpressionTree> TraceGraph { get { return traceGraph; } }
@@ -58,8 +58,15 @@
     }
 
+    public IGenealogyGraph<ISymbolicExpressionTree> PartialTrace(IGenealogyGraphNode<ISymbolicExpressionTree> node,
+      int subtreeIndex, ISymbolicExpressionTreeNode subtree) {
+      traceGraph = new GenealogyGraph<ISymbolicExpressionTree>();
+      traceMap = new Dictionary<IGenealogyGraphNode<ISymbolicExpressionTree>, Tuple<int, int>>();
+      return null;
+    }
+
     public IGenealogyGraph<ISymbolicExpressionTree> Trace(IGenealogyGraphNode<ISymbolicExpressionTree> node, int subtreeIndex) {
-      traceGraph.Clear();
-      traceMap.Clear();
-      Trace(node, subtreeIndex, null);
+      traceGraph = new GenealogyGraph<ISymbolicExpressionTree>();
+      traceMap = new Dictionary<IGenealogyGraphNode<ISymbolicExpressionTree>, Tuple<int, int>>();
+      TraceRecursive(node, subtreeIndex);
       return traceGraph;
     }
@@ -82,9 +89,12 @@
     /// - lastFi is the subtree index in the previous trace node
     /// </summary>
-    /// <param name="g">The current node in the genealogy graph</param>
-    /// <param name="si">The index of the traced subtree</param>
+    /// <param name="node">The current node in the genealogy graph</param>
+    /// <param name="subtreeIndex">The index of the traced subtree</param>
     /// <param name="last">The last added node in the trace graph</param>
-    private void Trace(IGenealogyGraphNode<ISymbolicExpressionTree> g, int si, IGenealogyGraphNode<ISymbolicExpressionTree> last = null) {
+    private void TraceRecursive(IGenealogyGraphNode<ISymbolicExpressionTree> node, int subtreeIndex, IGenealogyGraphNode<ISymbolicExpressionTree> last = null) {
+      var g = node;
+      int si = subtreeIndex;
       while (g.Parents.Any()) {
+        Debug.Assert(si < g.Data.Length);
         var parents = g.Parents.ToList();
         var fragment = (IFragment<ISymbolicExpressionTreeNode>)g.InArcs.Last().Data;
@@ -124,6 +134,6 @@
               // subtree contains fragment => branching point in the fragment graph
               var n = GetTraceNode(g, si, fi);
-              Trace(parents[0], si, n);
-              Trace(parents[1], fragment.Index2, n);
+              TraceRecursive(parents[0], si, n);
+              TraceRecursive(parents[1], fragment.Index2, n);
               break;
             } else {
@@ -144,5 +154,5 @@
             var n = GetTraceNode(g, si, fi);
             int i = si < fi ? si : fi;
-            Trace(parents[0], i, n);
+            TraceRecursive(parents[0], i, n);
             break;
           } else {
@@ -207,8 +217,8 @@
   internal static class Util {
     // shallow node copy (does not clone the data or the arcs)
+    #region some helper methods for shortening the tracing code
     public static IGenealogyGraphNode<ISymbolicExpressionTree> Copy(this IGenealogyGraphNode<ISymbolicExpressionTree> node) {
       return new GenealogyGraphNode<ISymbolicExpressionTree>(node.Data) { Rank = node.Rank, Quality = node.Quality };
     }
-    #region some helper methods for shortening the tracing code
     public static ISymbolicExpressionTreeNode NodeAt(this ISymbolicExpressionTree tree, int index) {
       return NodeAt(tree.Root, index);
