Changeset 11502
- Timestamp:
- 10/26/14 22:07:40 (10 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraph.cs
r11475 r11502 45 45 protected GenealogyGraph(GenealogyGraph original, Cloner cloner) 46 46 : base(original, cloner) { 47 Ranks = new Dictionary<double, List<IGenealogyGraphNode>>(original.Ranks); 48 contentMap = new Dictionary<object, IGenealogyGraphNode>(original.contentMap); 49 idMap = new Dictionary<string, IGenealogyGraphNode>(original.idMap); 47 RebuildDictionaries(); 50 48 } 51 49 … … 61 59 [StorableHook(HookType.AfterDeserialization)] 62 60 private void AfterDeserialization() { 63 contentMap = new Dictionary<object, IGenealogyGraphNode>(); 64 idMap = new Dictionary<string, IGenealogyGraphNode>(); 65 ranks = new Dictionary<double, List<IGenealogyGraphNode>>(); 66 67 foreach (var v in Vertices) { 68 contentMap[v.Data] = v; 69 idMap[v.Id] = v; 70 if (ranks.ContainsKey(v.Rank)) { 71 ranks[v.Rank].Add(v); 72 } else { 73 ranks[v.Rank] = new List<IGenealogyGraphNode> { v }; 74 } 75 } 61 RebuildDictionaries(); 76 62 } 77 63 … … 151 137 } 152 138 139 private void RebuildDictionaries() { 140 contentMap = new Dictionary<object, IGenealogyGraphNode>(); 141 idMap = new Dictionary<string, IGenealogyGraphNode>(); 142 ranks = new Dictionary<double, List<IGenealogyGraphNode>>(); 143 144 foreach (var v in Vertices) { 145 contentMap[v.Data] = v; 146 idMap[v.Id] = v; 147 if (ranks.ContainsKey(v.Rank)) { 148 ranks[v.Rank].Add(v); 149 } else { 150 ranks[v.Rank] = new List<IGenealogyGraphNode> { v }; 151 } 152 } 153 } 154 153 155 public void ExportDot(string path) { 154 156 var sb = new StringBuilder(); … … 157 159 sb.AppendLine("\"" + v.Id + "\"[shape=circle, style = filled, width = " + v.Degree / 2.0 + ", label = " + v.Rank + ", fillcolor = \"" + ColorTranslator.ToHtml(GetColor(v)) + "\"]"); 158 160 } 159 foreach (var a in Arcs .Select(x => (IGenealogyGraphArc)x)) {161 foreach (var a in Arcs) { 160 162 sb.AppendLine("\"" + a.Source.Id + "\" -- \"" + a.Target.Id + "\""); 161 163 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraphArc.cs
r11233 r11502 55 55 [StorableConstructor] 56 56 protected GenealogyGraphArc(bool deserializing) : base(deserializing) { } 57 protected GenealogyGraphArc(GenealogyGraphArc <T>original, Cloner cloner)57 protected GenealogyGraphArc(GenealogyGraphArc original, Cloner cloner) 58 58 : base(original, cloner) { 59 Data = original.Data;60 59 } 61 60
Note: See TracChangeset
for help on using the changeset viewer.