Changeset 11969 for branches/HeuristicLab.EvolutionTracking
- Timestamp:
- 02/07/15 02:52:06 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraph.cs
r11925 r11969 38 38 39 39 private readonly Comparison<IArc<IDeepCloneable>> compareArcs = (a, b) => { 40 if (a.Data == b.Data) 40 var da = a.Data; 41 var db = b.Data; 42 43 if ((da == null && db == null) || (da != null && db != null)) 41 44 return 0; 42 if (a.Data == null) 45 46 if (da == null) 43 47 return -1; 48 44 49 return 1; 45 50 }; … … 55 60 : base(original, cloner) { 56 61 RebuildDictionaries(); 57 58 foreach (var arcs in Vertices.Select(v => v.InArcs.ToList())) { arcs.Sort(compareArcs); } 62 // sort arcs so that in the case of crossover (child vertex with two parents) 63 // the arc which holds the fragment information is always last 64 foreach (var arcList in base.Vertices.Select(v => (List<IArc>)v.InArcs)) { 65 arcList.Sort((a, b) => compareArcs((IGenealogyGraphArc)a, (IGenealogyGraphArc)b)); 66 } 59 67 } 60 68 public override IDeepCloneable Clone(Cloner cloner) { … … 69 77 private void AfterDeserialization() { 70 78 RebuildDictionaries(); 71 foreach (var arcs in Vertices.Select(v => v.InArcs.ToList())) { arcs.Sort(compareArcs); } 79 foreach (var arcList in base.Vertices.Select(v => (List<IArc>)v.InArcs)) { 80 arcList.Sort((a, b) => compareArcs((IGenealogyGraphArc)a, (IGenealogyGraphArc)b)); 81 } 72 82 } 73 83 public GenealogyGraph() {
Note: See TracChangeset
for help on using the changeset viewer.