Changeset 8234
- Timestamp:
- 07/05/12 15:21:07 (12 years ago)
- Location:
- branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior/3.3/Analyzers/BestIndividualQualityAnalyzer.cs
r8230 r8234 119 119 stringMatrix[i, 1] = element.Value; 120 120 } 121 stringMatrix.ColumnNames = new[] { "Schema", "Occurence in hierarchy" };121 stringMatrix.ColumnNames = new[] { "Schema", "Occurences in hierarchy" }; 122 122 123 123 Results.Add(new Result(SchemaQualityMatrixParameterName, stringMatrix)); -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior/3.3/GenealogyGraph.cs
r8161 r8234 54 54 } 55 55 56 pr ivateGenealogyGraph(GenealogyGraph<T> original, Cloner cloner)56 protected GenealogyGraph(GenealogyGraph<T> original, Cloner cloner) 57 57 : base(original, cloner) { 58 58 _nodes = new Dictionary<T, GenealogyGraphNode>(original._nodes); … … 207 207 /// <returns>All the ancestors of the current node</returns> 208 208 public IEnumerable<GenealogyGraphNode> Ancestors() { 209 // for performance, we use a hashset for lookup and a list for iteration 209 210 var nodes = new HashSet<GenealogyGraphNode> { this }; 211 var list = new List<GenealogyGraphNode> { this }; 210 212 int i = 0; 211 while (i != nodes.Count) { 212 if (nodes.ElementAt(i).InEdges != null) { 213 foreach (var p in nodes.ElementAt(i).InEdges.Select(e => e.Target)) { 214 nodes.Add(p); 215 yield return p; 213 while (i != list.Count) { 214 if (list[i].InEdges != null) { 215 foreach (var e in list[i].InEdges) { 216 if (nodes.Contains(e.Target)) continue; 217 nodes.Add(e.Target); 218 list.Add(e.Target); 216 219 } 217 220 } 218 221 ++i; 219 222 } 223 return list; 220 224 } 221 225 … … 226 230 public IEnumerable<GenealogyGraphNode> Descendants() { 227 231 var nodes = new HashSet<GenealogyGraphNode> { this }; 232 var list = new List<GenealogyGraphNode> { this }; 228 233 int i = 0; 229 while (i != nodes.Count) { 230 if (nodes.ElementAt(i).OutEdges != null) { 231 foreach (var p in nodes.ElementAt(i).OutEdges.Select(e => e.Target)) { 232 nodes.Add(p); 233 yield return p; 234 while (i != list.Count) { 235 if (list[i].OutEdges != null) { 236 foreach (var e in list[i].OutEdges) { 237 if (nodes.Contains(e.Target)) continue; 238 nodes.Add(e.Target); 239 list.Add(e.Target); 234 240 } 235 241 } 236 242 ++i; 237 243 } 244 return list; 238 245 } 239 246
Note: See TracChangeset
for help on using the changeset viewer.