Changeset 15757 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraphNode.cs
- Timestamp:
- 02/12/18 16:12:51 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraphNode.cs
r11925 r15757 77 77 // for performance, we use a hashset for lookup and a list for iteration 78 78 var nodes = new HashSet<IGenealogyGraphNode>(Parents); 79 var list = new List<IGenealogyGraphNode>( Parents);79 var list = new List<IGenealogyGraphNode>(nodes); 80 80 int i = 0; 81 81 while (i != list.Count) { 82 foreach (var e in list[i].InArcs) { 83 if (nodes.Contains(e.Source)) continue; 84 nodes.Add(e.Source); 85 list.Add(e.Source); 82 foreach (var arc in list[i].InArcs) { 83 if (nodes.Add(arc.Source)) 84 list.Add(arc.Source); 86 85 } 87 86 ++i; … … 94 93 get { 95 94 var nodes = new HashSet<IGenealogyGraphNode>(Children); 96 var list = new List<IGenealogyGraphNode>( Children);95 var list = new List<IGenealogyGraphNode>(nodes); 97 96 int i = 0; 98 97 while (i != list.Count) { 99 98 foreach (var e in list[i].OutArcs) { 100 if (nodes.Contains(e.Target)) continue; 101 nodes.Add(e.Target); 102 list.Add(e.Target); 99 if (nodes.Add(e.Target)) 100 list.Add(e.Target); 103 101 } 104 102 ++i;
Note: See TracChangeset
for help on using the changeset viewer.