Changeset 11212 for branches/HeuristicLab.BottomUpTreeDistance
- Timestamp:
- 07/22/14 01:54:47 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BottomUpTreeDistance/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeDistance/BottomUpTreeDistanceCalculator.cs
r11211 r11212 128 128 for (int i = vertices.Count - 1; i >= 0; --i) { 129 129 var w = vertices[i]; 130 // removed requirement for heights to be equal since a compacted dag should not care about heights 131 // this ensures correct behavior when isomorphic subtrees are placed at different depths. 132 // furthermore, if the nodes have the same labels and the same subtrees then that should be sufficient, 133 // since in the bottom-up approach we are guaranteed that no differences would occur on the lower levels 134 if (v.SubtreeCount != w.OutDegree || label != w.Label) 130 if (Height(v) != Height(w) || v.SubtreeCount != w.OutDegree || label != w.Label) 135 131 continue; 136 132 … … 192 188 193 189 private static int Height(IVertex v) { 194 return Height((ISymbolicExpressionTreeNode)v.Content);190 return ((ISymbolicExpressionTreeNode)v.Content).GetDepth(); 195 191 } 196 192 197 193 private static int Height(ISymbolicExpressionTreeNode n) { 198 var p = n; 199 while (p.Parent != null) 200 p = p.Parent; 201 return p.GetBranchLevel(n); 194 return n.GetDepth(); 202 195 } 203 196
Note: See TracChangeset
for help on using the changeset viewer.