Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Arc.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Arc.cs	(revision 10267)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Arc.cs	(revision 10267)
@@ -0,0 +1,44 @@
+﻿using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.EvolutionaryTracking {
+  /// <summary>
+  /// An arc that can have a weight, a label, and can old additional information in the Data object
+  /// </summary>
+  [StorableClass]
+  public class Arc : Item, IArc {
+    [Storable]
+    private IVertex source;
+    public IVertex Source { get { return source; } set { source = value; } }
+    [Storable]
+    private IVertex target;
+    public IVertex Target { get { return target; } set { target = value; } }
+    [Storable]
+    private string label;
+    public string Label { get { return label; } set { label = value; } }
+    [Storable]
+    private double weight;
+    public double Weight { get { return weight; } set { weight = value; } }
+    [Storable]
+    private object data;
+    public object Data { get { return data; } set { data = value; } }
+
+    [StorableConstructor]
+    public Arc(bool deserializing) : base(deserializing) { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new Arc(this, cloner);
+    }
+    public Arc() { }
+
+    protected Arc(Arc original, Cloner cloner)
+      : base(original, cloner) {
+      Source = original.Source;
+      Target = original.Target;
+      Label = original.Label;
+      Weight = original.Weight;
+      Data = original.Data;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/DirectedGraph.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/DirectedGraph.cs	(revision 10267)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/DirectedGraph.cs	(revision 10267)
@@ -0,0 +1,142 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.EvolutionaryTracking {
+  [Item("", "")]
+  [StorableClass]
+  public class DirectedGraph<TVertex> : Item, IDirectedGraph<TVertex> where TVertex : class,IVertex {
+    [Storable]
+    protected readonly List<TVertex> nodes; // graph will consist of a set of nodes of type T
+    public List<TVertex> Nodes {
+      get { return nodes; }
+    }
+    public DirectedGraph() {
+      nodes = new List<TVertex>();
+    }
+    [StorableConstructor]
+    protected DirectedGraph(bool serializing)
+      : base(serializing) {
+    }
+    protected DirectedGraph(DirectedGraph<TVertex> original, Cloner cloner)
+      : base(original, cloner) {
+      nodes = new List<TVertex>(original.Nodes); // bburlacu: maybe the list should be empty
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new DirectedGraph<TVertex>(this, cloner);
+    }
+    public bool Contains(TVertex t) {
+      return nodes.Contains(t);
+    }
+
+    public virtual bool Any(Func<TVertex, bool> predicate) {
+      return nodes.Any(predicate);
+    }
+    public virtual bool IsEmpty {
+      get { return !nodes.Any(); }
+    }
+
+    public virtual void Clear() {
+      nodes.Clear();
+    }
+
+    public virtual void AddVertex(TVertex vertex) {
+      Nodes.Add(vertex);
+    }
+
+    public virtual void RemoveVertex(TVertex vertex) {
+      nodes.Remove(vertex);
+    }
+    public override Image ItemImage {
+      get { return Common.Resources.VSImageLibrary.Graph; }
+    }
+  }
+
+  [Item("Directed graph", "Generic directed graph base class.")]
+  [StorableClass]
+  public class DirectedGraph<TVertex, TContent> : DirectedGraph<TVertex>, IDirectedGraph<TVertex, TContent>
+    where TVertex : class,IVertex<TContent>
+    where TContent : class,IItem {
+
+    [StorableConstructor]
+    protected DirectedGraph(bool deserializing) : base(deserializing) { }
+
+    [Storable]
+    private readonly Dictionary<TContent, List<TVertex>> contentMap; // reverse mapping of content to the actual vertices
+    public DirectedGraph() {
+      contentMap = new Dictionary<TContent, List<TVertex>>();
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new DirectedGraph<TVertex, TContent>(this, cloner);
+    }
+    protected DirectedGraph(DirectedGraph<TVertex, TContent> original, Cloner cloner)
+      : base(original, cloner) {
+      contentMap = new Dictionary<TContent, List<TVertex>>(original.contentMap);
+    }
+    public bool Contains(TContent content) {
+      return contentMap.ContainsKey(content);
+    }
+    public List<TVertex> this[TContent key] {
+      get {
+        List<TVertex> result = null;
+        contentMap.TryGetValue(key, out result);
+        return result;
+      }
+      //      set {
+      //        contentMap[key] = value;
+      //      }
+    }
+    public override void Clear() {
+      contentMap.Clear();
+      base.Clear();
+    }
+
+    /// <summary>
+    /// Adds a node representing an individual
+    /// </summary>
+    /// <param name="node">The node to add</param>
+    public override void AddVertex(TVertex vertex) {
+      if (contentMap.ContainsKey(vertex.Content)) {
+        contentMap[vertex.Content].Add(vertex);
+      } else {
+        contentMap[vertex.Content] = new List<TVertex> { vertex };
+      }
+      base.AddVertex(vertex);
+    }
+
+    /// <summary>
+    /// Remove a node from the graph along with edges associated with it
+    /// </summary>
+    /// <param name="t">The graph node</param>
+    public override void RemoveVertex(TVertex t) {
+      if (contentMap.ContainsKey(t.Content)) {
+        contentMap[t.Content].Remove(t);
+      }
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Interfaces/IArc.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Interfaces/IArc.cs	(revision 10267)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Interfaces/IArc.cs	(revision 10267)
@@ -0,0 +1,6 @@
+﻿namespace HeuristicLab.EvolutionaryTracking {
+  public interface IArc {
+    IVertex Source { get; set; }
+    IVertex Target { get; set; }
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Interfaces/IDirectedGraph.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Interfaces/IDirectedGraph.cs	(revision 10267)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Interfaces/IDirectedGraph.cs	(revision 10267)
@@ -0,0 +1,42 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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 HeuristicLab.Core;
+
+namespace HeuristicLab.EvolutionaryTracking {
+  public interface IDirectedGraph : IItem { }
+  public interface IDirectedGraph<TVertex> : IDirectedGraph
+    where TVertex : class, IVertex {
+    bool Contains(TVertex vertex);
+    bool Any(Func<TVertex, bool> predicate); // graph contains any nodes matching the given predicate?
+    void Clear(); // clear graph
+    void AddVertex(TVertex vertex);
+    void RemoveVertex(TVertex vertex); // remove node if contained in the graph
+    List<TVertex> Nodes { get; }
+  }
+  public interface IDirectedGraph<TVertex, in TContent> : IDirectedGraph<TVertex>
+    where TVertex : class, IVertex
+    where TContent : class, IItem {
+    bool Contains(TContent content); // graph contains specific node?
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Interfaces/IVertex.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Interfaces/IVertex.cs	(revision 10267)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Interfaces/IVertex.cs	(revision 10267)
@@ -0,0 +1,47 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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 HeuristicLab.Core;
+
+namespace HeuristicLab.EvolutionaryTracking {
+  public interface IVertex : IItem {
+    string Id { get; }
+    List<IArc> InArcs { get; }
+    List<IArc> OutArcs { get; }
+
+    int InDegree { get; }
+    int OutDegree { get; }
+    int Degree { get; }
+
+    string Label { get; set; }
+    double Weight { get; set; }
+
+    void AddForwardArc(IVertex target, double weight = 0.0, object content = null);
+    void AddForwardArc(IArc arc);
+    void AddReverseArc(IVertex target, double weight = 0.0, object content = null);
+    void AddReverseArc(IArc arc);
+  }
+
+  public interface IVertex<T> : IVertex {
+    T Content { get; set; }
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Vertex.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Vertex.cs	(revision 10267)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Vertex.cs	(revision 10267)
@@ -0,0 +1,142 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.EvolutionaryTracking {
+  [StorableClass]
+  public class Vertex : Item, IVertex {
+    [Storable]
+    private string id;
+    public string Id {
+      get { return id; }
+      set { id = value; }
+    }
+    [Storable]
+    private string label;
+    public string Label { get { return label; } set { label = value; } }
+    [Storable]
+    private double weight;
+    public double Weight { get { return weight; } set { weight = value; } }
+    [Storable]
+    private List<IArc> inArcs;
+    public List<IArc> InArcs { get { return inArcs; } protected set { inArcs = value; } }
+    [Storable]
+    private List<IArc> outArcs;
+    public List<IArc> OutArcs { get { return outArcs; } protected set { outArcs = value; } }
+
+    [StorableConstructor]
+    public Vertex(bool deserializing) : base(deserializing) { }
+
+    public Vertex() {
+      id = Guid.NewGuid().ToString();
+    }
+
+    protected Vertex(Vertex original, Cloner cloner)
+      : base(original, cloner) {
+      Id = Guid.NewGuid().ToString();
+      Label = original.Label;
+      InArcs = new List<IArc>(original.InArcs);
+      OutArcs = new List<IArc>(original.OutArcs);
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new Vertex(this, cloner);
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    protected void AfterDeserialization() {
+      if (Id == null) {
+        Id = Guid.NewGuid().ToString();
+      }
+    }
+
+    // this method can be used to add arcs towards targets that are not visible in the graph 
+    // (they do not appear in the nodes Dictionary). It is the programmers responsibility to 
+    // enforce the correct and desired behavior.
+    public void AddForwardArc(IVertex target, double weight = 0.0, object data = null) {
+      var e = new Arc { Source = this, Target = target, Data = data, Weight = weight };
+      if (OutArcs == null) OutArcs = new List<IArc> { e };
+      else OutArcs.Add(e);
+    }
+    public void AddForwardArc(IArc arc) {
+      if (arc.Source == null) { arc.Source = this; }
+      if (arc.Source != this) { throw new Exception("AddForwardArc: Source should be equal to this."); }
+      if (OutArcs == null) { OutArcs = new List<IArc> { arc }; } else { OutArcs.Add(arc); }
+    }
+    public void AddReverseArc(IArc arc) {
+      if (arc.Target == null) { arc.Target = this; }
+      if (arc.Target != this) { throw new Exception("AddReverseArc: Target should be equal to this."); };
+      if (InArcs == null) { InArcs = new List<IArc> { arc }; } else { InArcs.Add(arc); }
+    }
+    public void AddReverseArc(IVertex source, double weight = 0.0, object data = null) {
+      var e = new Arc { Source = source, Target = this, Data = data, Weight = weight };
+      if (InArcs == null) InArcs = new List<IArc> { e };
+      else InArcs.Add(e);
+    }
+
+    public int InDegree { get { return InArcs == null ? 0 : InArcs.Count; } }
+    public int OutDegree { get { return OutArcs == null ? 0 : OutArcs.Count; } }
+    public int Degree { get { return InDegree + OutDegree; } }
+  }
+
+
+  [StorableClass]
+  public class Vertex<T> : Vertex, IVertex<T> where T : class,IItem {
+    [Storable]
+    private T content;
+    public T Content {
+      get { return content; }
+      set {
+        if (value == null)
+          throw new ArgumentException("Node content cannot be null.");
+        content = value;
+      }
+    }
+
+    public Vertex() { }
+
+    [StorableConstructor]
+    protected Vertex(bool deserializing) : base(deserializing) { }
+
+    protected Vertex(Vertex<T> original, Cloner cloner)
+      : base(original, cloner) {
+      Content = original.Content; // not sure if to Clone()
+
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new Vertex<T>(this, cloner);
+    }
+
+    public Vertex(Vertex<T> node) {
+      Id = Guid.NewGuid().ToString();
+      Label = node.Label;
+      Content = node.Content;
+      InArcs = new List<IArc>(node.InArcs);
+      OutArcs = new List<IArc>(node.OutArcs);
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/EvolutionTrackingOperators/EvolutionTrackingAfterCreationOperator.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/EvolutionTrackingOperators/EvolutionTrackingAfterCreationOperator.cs	(revision 10267)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/EvolutionTrackingOperators/EvolutionTrackingAfterCreationOperator.cs	(revision 10267)
@@ -0,0 +1,85 @@
+﻿using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.EvolutionaryTracking {
+  [StorableClass]
+  [Item("EvolutionTrackingAfterCrossoverOperator", "An operator that performs additional operators after crossover")]
+  public sealed class EvolutionTrackingAfterCreationOperator : SingleSuccessorOperator {
+    private const string ResultsParameterName = "Results";
+    private const string PopulationGraphParameterName = "PopulationGraph";
+    private const string GenerationsParameterName = "Generations";
+    private const string CurrentScopeParameterName = "CurrentScope";
+    #region Parameter Properties
+    public ILookupParameter<ResultCollection> ResultsParameter {
+      get { return (ILookupParameter<ResultCollection>)Parameters[ResultsParameterName]; }
+    }
+    private ScopeParameter CurrentScopeParameter {
+      get { return (ScopeParameter)Parameters[CurrentScopeParameterName]; }
+    }
+    public LookupParameter<IntValue> GenerationsParameter {
+      get { return (LookupParameter<IntValue>)Parameters[GenerationsParameterName]; }
+    }
+    public ILookupParameter<ItemArray<IItem>> ParentsParameter {
+      get { return (ScopeTreeLookupParameter<IItem>)Parameters["Parents"]; }
+    }
+    public ILookupParameter<IItem> ChildParameter {
+      get { return (ILookupParameter<IItem>)Parameters["Child"]; }
+    }
+    #endregion
+    #region Properties
+    public IScope CurrentScope {
+      get { return CurrentScopeParameter.ActualValue; }
+    }
+    public ResultCollection Results {
+      get { return ResultsParameter.ActualValue; }
+    }
+
+    public IntValue Generations {
+      get { return GenerationsParameter.ActualValue; }
+    }
+    private GenealogyGraph<IGenealogyGraphNode> GenealogyGraph {
+      get {
+        IResult result;
+        if (!Results.ContainsKey(PopulationGraphParameterName)) {
+          result = new Result(PopulationGraphParameterName, new GenealogyGraph<IGenealogyGraphNode>());
+          Results.Add(result);
+        } else {
+          result = Results[PopulationGraphParameterName];
+        }
+        var graph = (GenealogyGraph<IGenealogyGraphNode>)result.Value;
+        return graph;
+      }
+    }
+    #endregion
+    public EvolutionTrackingAfterCreationOperator() {
+      Parameters.Add(new LookupParameter<ResultCollection>(ResultsParameterName, "The results collection."));
+      Parameters.Add(new ScopeParameter(CurrentScopeParameterName, "The current scope from which sub-scopes should be selected."));
+      Parameters.Add(new LookupParameter<IntValue>(GenerationsParameterName, "The number of elapsed generations."));
+      Parameters.Add(new ScopeTreeLookupParameter<IItem>("Parents", "The parent individuals which should be crossed."));
+      Parameters.Add(new LookupParameter<IItem>("Child", "The child individual resulting from the crossover."));
+    }
+    private EvolutionTrackingAfterCreationOperator(EvolutionTrackingAfterCreationOperator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new EvolutionTrackingAfterCreationOperator(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      var individuals = CurrentScope.SubScopes.Select(s => s.Variables.First().Value).ToList();
+      foreach (var ind in individuals) {
+        var graphNode = new GenealogyGraphNode {
+          Rank = 0
+        };
+        GenealogyGraph.AddVertex(graphNode);
+      }
+      return base.Apply();
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/EvolutionTrackingOperators/EvolutionTrackingAfterCrossoverOperator.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/EvolutionTrackingOperators/EvolutionTrackingAfterCrossoverOperator.cs	(revision 10267)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/EvolutionTrackingOperators/EvolutionTrackingAfterCrossoverOperator.cs	(revision 10267)
@@ -0,0 +1,79 @@
+﻿using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.EvolutionaryTracking {
+  [StorableClass]
+  [Item("EvolutionTrackingAfterCrossoverOperator", "An operator that performs additional operators after crossover")]
+  public sealed class EvolutionTrackingAfterCrossoverOperator : SingleSuccessorOperator {
+    private const string ResultsParameterName = "Results";
+    private const string PopulationGraphParameterName = "PopulationGraph";
+    private const string GenerationsParameterName = "Generations";
+    private const string CurrentScopeParameterName = "CurrentScope";
+    #region Parameter Properties
+    public ILookupParameter<ResultCollection> ResultsParameter {
+      get { return (ILookupParameter<ResultCollection>)Parameters[ResultsParameterName]; }
+    }
+    private ScopeParameter CurrentScopeParameter {
+      get { return (ScopeParameter)Parameters[CurrentScopeParameterName]; }
+    }
+    public LookupParameter<IntValue> GenerationsParameter {
+      get { return (LookupParameter<IntValue>)Parameters[GenerationsParameterName]; }
+    }
+    public ILookupParameter<ItemArray<IItem>> ParentsParameter {
+      get { return (ScopeTreeLookupParameter<IItem>)Parameters["Parents"]; }
+    }
+    public ILookupParameter<IItem> ChildParameter {
+      get { return (ILookupParameter<IItem>)Parameters["Child"]; }
+    }
+    #endregion
+    #region Properties
+    public IScope CurrentScope {
+      get { return CurrentScopeParameter.ActualValue; }
+    }
+    public ResultCollection Results {
+      get { return ResultsParameter.ActualValue; }
+    }
+
+    public IntValue Generations {
+      get { return GenerationsParameter.ActualValue; }
+    }
+    private GenealogyGraph<IGenealogyGraphNode> GenealogyGraph {
+      get {
+        IResult result;
+        if (!Results.ContainsKey(PopulationGraphParameterName)) {
+          result = new Result(PopulationGraphParameterName, new GenealogyGraph<IGenealogyGraphNode>());
+          Results.Add(result);
+        } else {
+          result = Results[PopulationGraphParameterName];
+        }
+        var graph = (GenealogyGraph<IGenealogyGraphNode>)result.Value;
+        return graph;
+      }
+    }
+    #endregion
+    public EvolutionTrackingAfterCrossoverOperator() {
+      Parameters.Add(new LookupParameter<ResultCollection>(ResultsParameterName, "The results collection."));
+      Parameters.Add(new ScopeParameter(CurrentScopeParameterName, "The current scope from which sub-scopes should be selected."));
+      Parameters.Add(new LookupParameter<IntValue>(GenerationsParameterName, "The number of elapsed generations."));
+      Parameters.Add(new ScopeTreeLookupParameter<IItem>("Parents", "The parent individuals which should be crossed."));
+      Parameters.Add(new LookupParameter<IItem>("Child", "The child individual resulting from the crossover."));
+    }
+    private EvolutionTrackingAfterCrossoverOperator(EvolutionTrackingAfterCrossoverOperator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new EvolutionTrackingAfterCrossoverOperator(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      var child = ChildParameter.ActualValue;
+      var parents = ParentsParameter.ActualValue;
+      return base.Apply();
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/EvolutionTrackingOperators/EvolutionTrackingOperator.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/EvolutionTrackingOperators/EvolutionTrackingOperator.cs	(revision 10267)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/EvolutionTrackingOperators/EvolutionTrackingOperator.cs	(revision 10267)
@@ -0,0 +1,19 @@
+﻿
+using HeuristicLab.Common;
+using HeuristicLab.Operators;
+
+namespace HeuristicLab.EvolutionaryTracking.EvolutionTrackingOperators {
+  public class EvolutionTrackingOperator : SingleSuccessorOperator {
+    // evolution tracking-related parameters
+    private const string ResultsParameterName = "Results";
+    private const string PopulationGraphParameterName = "PopulationGraph";
+    private const string GenerationsParameterName = "Generations";
+
+    protected EvolutionTrackingOperator(EvolutionTrackingOperator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new EvolutionTrackingOperator(this, cloner);
+    }
+  }
+}
Index: anches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/FPGraph.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/FPGraph.cs	(revision 10266)
+++ 	(revision )
@@ -1,62 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2012 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.Linq;
-using HeuristicLab.Core;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-
-namespace HeuristicLab.EvolutionaryTracking {
-  [Item("Symbol graph", "A graph used to store the relationship between symbols in a population of individuals")]
-  [StorableClass]
-  public class FPGraph : GenericGraph<SymbolNode> {
-    [Storable]
-    public Dictionary<int, List<SymbolNode>> Levels { get { return levels; } }
-    private Dictionary<int, List<SymbolNode>> levels = new Dictionary<int, List<SymbolNode>>();
-
-    public void AddNode(SymbolNode node, int level) {
-      if (levels.ContainsKey(level)) {
-        SymbolNode match = levels[level].Find(n => n.Label.Equals(node.Label));
-        if (match == null) {
-          levels[level].Add(node);
-        }
-      } else {
-        levels[level] = new List<SymbolNode> { node };
-      }
-      base.AddNode(node);
-    }
-
-    public bool ContainsKey(string key, int level) {
-      return levels.ContainsKey(level) && levels[level].Select(n => n.Label).Contains(key);
-    }
-
-    public SymbolNode GetNode(string key, int level) {
-      SymbolNode node = null;
-      if (levels.ContainsKey(level))
-        node = levels[level].Find(n => n.Label.Equals(key));
-      return node;
-    }
-
-    void AddArc(SymbolNode source, SymbolNode target, double weight, object data = null) {
-      source.AddForwardArc(target, weight, data);
-    }
-  }
-}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraph.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraph.cs	(revision 10267)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraph.cs	(revision 10267)
@@ -0,0 +1,44 @@
+﻿
+using System;
+using System.Collections.Generic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.EvolutionaryTracking {
+  [StorableClass]
+  [Item("GenealogyGraph", "A class representing a genealogy graph")]
+  public class GenealogyGraph : GenealogyGraph<IGenealogyGraphNode> {
+  }
+
+  [StorableClass]
+  [Item("GenealogyGraph", "A class representing a genealogy graph (of a population of individuals) without storing any content for vertices")]
+  public class GenealogyGraph<TVertex> : DirectedGraph<TVertex>, IGenealogyGraph<TVertex> where TVertex : class,IGenealogyGraphNode {
+    [Storable]
+    private Dictionary<double, LinkedList<TVertex>> ranks; // use a linked list for fast insertion/removal
+
+    public Dictionary<double, LinkedList<TVertex>> Ranks {
+      get { return ranks; }
+      set { ranks = value; }
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new GenealogyGraph<TVertex>(this, cloner);
+    }
+    protected GenealogyGraph(GenealogyGraph<TVertex> original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    [StorableConstructor]
+    protected GenealogyGraph(bool deserializing) : base(deserializing) { }
+
+    public GenealogyGraph() {
+      Ranks = new Dictionary<double, LinkedList<TVertex>>();
+    }
+
+    public event EventHandler GraphUpdated;
+    private void OnGraphUpdated(object sender, EventArgs args) {
+      var updated = GraphUpdated;
+      if (updated != null) updated(sender, args);
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraphArc.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraphArc.cs	(revision 10267)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraphArc.cs	(revision 10267)
@@ -0,0 +1,23 @@
+﻿
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.EvolutionaryTracking {
+  [StorableClass]
+  [Item("GenealogyGraphArc", "A graph arc connecting two GenealogyGraphNodes and holding some data.")]
+  public class GenealogyGraphArc<T> : Arc, IGenealogyGraphArc where T : class,IItem {
+    [StorableConstructor]
+    protected GenealogyGraphArc(bool deserializing) : base(deserializing) { }
+    protected GenealogyGraphArc(GenealogyGraphArc<T> original, Cloner cloner)
+      : base(original, cloner) {
+      Data = (T)original.Data.Clone();
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new GenealogyGraphArc<T>(this, cloner);
+    }
+    public new IGenealogyGraphNode Source { get; set; }
+    public new IGenealogyGraphNode Target { get; set; }
+    public new T Data { get; set; }
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraphNode.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraphNode.cs	(revision 10267)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraphNode.cs	(revision 10267)
@@ -0,0 +1,98 @@
+﻿
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.EvolutionaryTracking {
+  [StorableClass]
+  [Item("GenealogGraphNode", "A class representing a node in the GenealogyGraph")]
+  public class GenealogyGraphNode : Vertex, IGenealogyGraphNode {
+    [StorableConstructor]
+    protected GenealogyGraphNode(bool deserializing) : base(deserializing) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new GenealogyGraphNode(this, cloner);
+    }
+    protected GenealogyGraphNode(GenealogyGraphNode original, Cloner cloner)
+      : base(original, cloner) {
+    }
+
+    public GenealogyGraphNode() { }
+
+    public new List<IGenealogyGraphArc> InArcs {
+      get {
+        return base.InArcs.Cast<IGenealogyGraphArc>().ToList();
+      }
+    }
+    public new List<IGenealogyGraphArc> OutArcs {
+      get {
+        return base.OutArcs.Cast<IGenealogyGraphArc>().ToList();
+      }
+    }
+    public IEnumerable<IGenealogyGraphNode> Ancestors() {
+      // for performance, we use a hashset for lookup and a list for iteration
+      var nodes = new HashSet<IGenealogyGraphNode> { this };
+      var list = new List<IGenealogyGraphNode> { this };
+      int i = 0;
+      while (i != list.Count) {
+        if (list[i].InArcs != null) {
+          foreach (var e in list[i].InArcs) {
+            if (nodes.Contains(e.Source)) continue;
+            nodes.Add(e.Source);
+            list.Add(e.Source);
+          }
+        }
+        ++i;
+      }
+      return list;
+    }
+    /// <summary>
+    /// Performs a downward-breath-traversal of the genealogy graph using the nodes OutArcs
+    /// </summary>
+    /// <returns>All the descendants of the current node</returns>
+    public IEnumerable<IGenealogyGraphNode> Descendants() {
+      var nodes = new HashSet<IGenealogyGraphNode> { this };
+      var list = new List<IGenealogyGraphNode> { this };
+      int i = 0;
+      while (i != list.Count) {
+        if (list[i].OutArcs != null) {
+          foreach (var e in list[i].OutArcs) {
+            if (nodes.Contains(e.Target)) continue;
+            nodes.Add(e.Target);
+            list.Add(e.Target);
+          }
+        }
+        ++i;
+      }
+      return list;
+    }
+    [Storable]
+    private double rank;
+    public double Rank {
+      get { return rank; }
+      set { rank = value; }
+    }
+    [Storable]
+    private double quality;
+    public double Quality {
+      get { return quality; }
+      set { quality = value; }
+    }
+    [Storable]
+    private bool isElite;
+    public bool IsElite {
+      get { return isElite; }
+      set { isElite = value; }
+    }
+    public int CompareTo(IGenealogyGraphNode other) {
+      return Quality.CompareTo(other.Quality);
+    }
+  }
+
+  [StorableClass]
+  [Item("GenealogyGraphNode", "A genealogy graph node which also has a Content")]
+  public class GenealogyGraphNode<T> : GenealogyGraphNode, IGenealogyGraphNode<T> {
+    public T Content { get; set; }
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/Interfaces/IGenealogyGraph.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/Interfaces/IGenealogyGraph.cs	(revision 10267)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/Interfaces/IGenealogyGraph.cs	(revision 10267)
@@ -0,0 +1,10 @@
+﻿using System.Collections.Generic;
+
+namespace HeuristicLab.EvolutionaryTracking {
+  public interface IGenealogyGraph<TVertex> : IDirectedGraph<TVertex> where TVertex : class, IGenealogyGraphNode {
+    Dictionary<double, LinkedList<TVertex>> Ranks { get; set; }
+  }
+
+  public interface IGenealogyGraph : IGenealogyGraph<IGenealogyGraphNode> {
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/Interfaces/IGenealogyGraphArc.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/Interfaces/IGenealogyGraphArc.cs	(revision 10267)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/Interfaces/IGenealogyGraphArc.cs	(revision 10267)
@@ -0,0 +1,7 @@
+﻿namespace HeuristicLab.EvolutionaryTracking {
+  public interface IGenealogyGraphArc : IArc {
+    new IGenealogyGraphNode Source { get; set; }
+    new IGenealogyGraphNode Target { get; set; }
+    object Data { get; set; }
+  }
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/Interfaces/IGenealogyGraphNode.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/Interfaces/IGenealogyGraphNode.cs	(revision 10267)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/Interfaces/IGenealogyGraphNode.cs	(revision 10267)
@@ -0,0 +1,19 @@
+﻿using System;
+using System.Collections.Generic;
+
+namespace HeuristicLab.EvolutionaryTracking {
+  public interface IGenealogyGraphNode : IVertex, IComparable<IGenealogyGraphNode> {
+    IEnumerable<IGenealogyGraphNode> Ancestors();
+    IEnumerable<IGenealogyGraphNode> Descendants();
+
+    new List<IGenealogyGraphArc> InArcs { get; }
+    new List<IGenealogyGraphArc> OutArcs { get; }
+
+    double Rank { get; set; }
+    double Quality { get; set; }
+    bool IsElite { get; set; }
+  }
+
+  public interface IGenealogyGraphNode<T> : IGenealogyGraphNode, IVertex<T> { }
+
+}
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/HeuristicLab.EvolutionTracking-3.4.csproj
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/HeuristicLab.EvolutionTracking-3.4.csproj	(revision 10266)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/HeuristicLab.EvolutionTracking-3.4.csproj	(revision 10267)
@@ -9,6 +9,6 @@
     <OutputType>Library</OutputType>
     <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>HeuristicLab.EvolutionaryTracking</RootNamespace>
-    <AssemblyName>HeuristicLab.EvolutionaryTracking-3.4</AssemblyName>
+    <RootNamespace>HeuristicLab.EvolutionTracking</RootNamespace>
+    <AssemblyName>HeuristicLab.EvolutionTracking-3.4</AssemblyName>
     <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
Index: anches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/LineageExplorer.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/LineageExplorer.cs	(revision 10266)
+++ 	(revision )
@@ -1,31 +1,0 @@
-﻿using System;
-using System.Collections.Generic;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-
-namespace HeuristicLab.EvolutionaryTracking {
-  [StorableClass]
-  public class LineageExplorer : Item {
-    [Storable]
-    private ISymbolicExpressionTreeGenealogyGraph genealogyGraph;
-    public ISymbolicExpressionTreeGenealogyGraph GenealogyGraph { get { return genealogyGraph; } set { genealogyGraph = value; } }
-    [Storable]
-    private IList<Tuple<ISymbolicExpressionTree, double>> trees;
-    public IList<Tuple<ISymbolicExpressionTree, double>> Trees { get { return trees; } set { trees = value; } }
-    [Storable]
-    private int generations;
-    public int Generations { get { return generations; } set { generations = value; } }
-
-    private LineageExplorer(bool deserializing) : base(deserializing) { }
-    private LineageExplorer(LineageExplorer original, Cloner cloner)
-      : base(original, cloner) {
-      genealogyGraph = original.genealogyGraph;
-      trees = original.trees;
-      generations = original.generations;
-    }
-    public LineageExplorer() { }
-    public override IDeepCloneable Clone(Cloner cloner) { return new LineageExplorer(this, cloner); }
-  }
-}
Index: anches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/SymbolGraph.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/SymbolGraph.cs	(revision 10266)
+++ 	(revision )
@@ -1,76 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2012 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.Linq;
-using HeuristicLab.Core;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-
-namespace HeuristicLab.EvolutionaryTracking {
-  [Item("Symbol graph", "A graph used to store the relationship between symbols in a population of individuals")]
-  [StorableClass]
-  public class SymbolGraph : GenericGraph<SymbolNode> {
-    [Storable]
-    private Dictionary<string, SymbolNode> nodes = new Dictionary<string, SymbolNode>();
-
-    public override void AddNode(SymbolNode node) {
-      if (nodes.ContainsKey(node.Label)) return; // node already present? do nothing
-      nodes[node.Label] = node;
-      base.AddNode(node);
-    }
-
-    public bool ContainsKey(string key) {
-      return nodes.ContainsKey(key);
-    }
-
-    public SymbolNode GetNode(string key) {
-      SymbolNode node;
-      nodes.TryGetValue(key, out node);
-      return node;
-    }
-
-    void AddArc(SymbolNode source, SymbolNode target, double weight, object data = null) {
-      source.AddForwardArc(target, weight, data);
-    }
-  }
-
-  [StorableClass]
-  public class SymbolNode : Vertex {
-    public ISymbol Symbol { get; set; }
-    public Dictionary<int, int> Positions { get; set; }
-    public double AverageArity { get; set; }
-
-    public new List<SymbolArc> InEdges {
-      get { return base.InEdges == null ? null : base.InEdges.Cast<SymbolArc>().ToList(); }
-    }
-
-    public new List<SymbolArc> OutEdges {
-      get { return base.OutEdges == null ? null : base.OutEdges.Cast<SymbolArc>().ToList(); }
-    }
-  }
-
-  public class SymbolArc : IEdge {
-    public IVertex Source { get; set; }
-    public IVertex Target { get; set; }
-    public double Weight { get; set; }
-  }
-}
