Changeset 7795
- Timestamp:
- 05/11/12 14:25:57 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Interfaces/ISymbolicExpressionTree.cs
r7259 r7795 29 29 int Depth { get; } 30 30 31 IEnumerable<ISymbolicExpressionTreeNode> IterateNodesBreadth(); 31 32 IEnumerable<ISymbolicExpressionTreeNode> IterateNodesPrefix(); 32 33 IEnumerable<ISymbolicExpressionTreeNode> IterateNodesPostfix(); -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Interfaces/ISymbolicExpressionTreeNode.cs
r7507 r7795 34 34 int GetBranchLevel(ISymbolicExpressionTreeNode child); 35 35 36 IEnumerable<ISymbolicExpressionTreeNode> IterateNodesBreadth(); 36 37 IEnumerable<ISymbolicExpressionTreeNode> IterateNodesPostfix(); 37 38 IEnumerable<ISymbolicExpressionTreeNode> IterateNodesPrefix(); -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTree.cs
r7259 r7795 75 75 } 76 76 77 public IEnumerable<ISymbolicExpressionTreeNode> IterateNodesBreadth() { 78 if (root == null) 79 return new SymbolicExpressionTreeNode[0]; 80 return root.IterateNodesBreadth(); 81 } 82 77 83 public IEnumerable<ISymbolicExpressionTreeNode> IterateNodesPrefix() { 78 84 if (root == null) -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTreeNode.cs
r7654 r7795 174 174 } 175 175 176 public IEnumerable<ISymbolicExpressionTreeNode> IterateNodesBreadth() { 177 var list = new List<ISymbolicExpressionTreeNode>() { this }; 178 int i = 0; 179 while (i != list.Count) { 180 for (int j = 0; j != list[i].SubtreeCount; ++j) 181 list.Add(list[i].GetSubtree(j)); 182 ++i; 183 } 184 return list; 185 } 186 176 187 public IEnumerable<ISymbolicExpressionTreeNode> IterateNodesPrefix() { 177 188 List<ISymbolicExpressionTreeNode> list = new List<ISymbolicExpressionTreeNode>();
Note: See TracChangeset
for help on using the changeset viewer.