Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraph.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraph.cs	(revision 11458)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraph.cs	(revision 11459)
@@ -22,5 +22,8 @@
 using System;
 using System.Collections.Generic;
+using System.Drawing;
+using System.IO;
 using System.Linq;
+using System.Text;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -31,11 +34,6 @@
   [Item("GenealogyGraph", "A class representing a genealogy graph")]
   public class GenealogyGraph : DirectedGraph, IGenealogyGraph {
-    [Storable]
-    private readonly Dictionary<object, IGenealogyGraphNode> contentMap;
-
-    [Storable]
-    private readonly Dictionary<string, IGenealogyGraphNode> idMap;
-
-    [Storable]
+    private Dictionary<object, IGenealogyGraphNode> contentMap;
+    private Dictionary<string, IGenealogyGraphNode> idMap;
     protected Dictionary<double, List<IGenealogyGraphNode>> ranks;
 
@@ -59,4 +57,21 @@
     protected GenealogyGraph(bool deserializing)
       : base(deserializing) {
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      contentMap = new Dictionary<object, IGenealogyGraphNode>();
+      idMap = new Dictionary<string, IGenealogyGraphNode>();
+      ranks = new Dictionary<double, List<IGenealogyGraphNode>>();
+
+      foreach (var v in Vertices) {
+        contentMap[v.Data] = v;
+        idMap[v.Id] = v;
+        if (ranks.ContainsKey(v.Rank)) {
+          ranks[v.Rank].Add(v);
+        } else {
+          ranks[v.Rank] = new List<IGenealogyGraphNode> { v };
+        }
+      }
     }
 
@@ -130,7 +145,27 @@
       ranks.Clear();
     }
+
+    public void ExportDot(string path) {
+      var sb = new StringBuilder();
+      sb.AppendLine("graph fragmentgraph {");
+      foreach (var v in Vertices) {
+        sb.AppendLine("\"" + v.Id + "\"[shape=circle, style = filled, width = " + v.Degree / 2.0 + ", label = " + v.Rank + ", fillcolor = \"" + ColorTranslator.ToHtml(GetColor(v)) + "\"]");
+      }
+      foreach (var a in Arcs.Select(x => (IGenealogyGraphArc)x)) {
+        sb.AppendLine("\"" + a.Source.Id + "\" -- \"" + a.Target.Id + "\"");
+      }
+
+      sb.AppendLine("}");
+      File.WriteAllText(path, sb.ToString());
+    }
+
+    private Color GetColor(IGenealogyGraphNode node) {
+      var colorIndex = (int)Math.Round(node.Quality * ColorGradient.Colors.Count);
+      if (colorIndex >= ColorGradient.Colors.Count) return ColorGradient.Colors.Last();
+      return ColorGradient.Colors[colorIndex];
+    }
   }
 
-  [Item("GenealogyGraph", "A specialization of the genealogy graph with T as content for vertices")]
+  [Item("GenealogyGraph", "A genealogy graph in which the vertex data is of type T")]
   [StorableClass]
   public class GenealogyGraph<T> : GenealogyGraph, IGenealogyGraph<T> where T : class, IItem {
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraphNode.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraphNode.cs	(revision 11458)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraphNode.cs	(revision 11459)
@@ -52,9 +52,9 @@
 
     public new IEnumerable<IGenealogyGraphArc> InArcs {
-      get { return base.InArcs.Cast<IGenealogyGraphArc>(); }
+      get { return base.InArcs.Select(x => (IGenealogyGraphArc)x); }
     }
 
     public new IEnumerable<IGenealogyGraphArc> OutArcs {
-      get { return base.OutArcs.Cast<IGenealogyGraphArc>(); }
+      get { return base.OutArcs.Select(x => (IGenealogyGraphArc)x); }
     }
 
@@ -148,14 +148,14 @@
     }
     public new IEnumerable<IGenealogyGraphNode<T>> Parents {
-      get { return base.Parents.Cast<IGenealogyGraphNode<T>>(); }
+      get { return base.Parents.Select(x => (IGenealogyGraphNode<T>)x); }
     }
     public new IEnumerable<IGenealogyGraphNode<T>> Children {
-      get { return base.Children.Cast<IGenealogyGraphNode<T>>(); }
+      get { return base.Children.Select(x => (IGenealogyGraphNode<T>)x); }
     }
     public new IEnumerable<IGenealogyGraphNode<T>> Ancestors {
-      get { return base.Ancestors.Cast<IGenealogyGraphNode<T>>(); }
+      get { return base.Ancestors.Select(x => (IGenealogyGraphNode<T>)x); }
     }
     public new IEnumerable<IGenealogyGraphNode<T>> Descendants {
-      get { return base.Descendants.Cast<IGenealogyGraphNode<T>>(); }
+      get { return base.Descendants.Select(x => (IGenealogyGraphNode<T>)x); }
     }
   }
