Changeset 11925 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymbolicDataAnalysisGenealogyGraphView.cs
- Timestamp:
- 02/05/15 19:35:34 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymbolicDataAnalysisGenealogyGraphView.cs
r11881 r11925 85 85 // that will include just the individual and its ancestors 86 86 var graph = new GenealogyGraph<ISymbolicExpressionTree>(); 87 var ancestors = new[] { graphNode }.Concat(graphNode.Ancestors); 88 var cloned = ancestors.ToDictionary(x => x, x => cloner.Clone(x)); 89 graph.AddVertices(cloned.Values); 90 foreach (var arc in cloned.Keys.SelectMany(x => x.InArcs)) { 91 graph.AddArc(cloner.Clone(arc)); 92 } 87 var ancestors = new[] { graphNode }.Concat(graphNode.Ancestors).ToList(); 88 graph.AddVertices(ancestors.Select(cloner.Clone)); 89 graph.AddArcs(ancestors.SelectMany(x => x.InArcs).Select(cloner.Clone)); 93 90 MainFormManager.MainForm.ShowContent(graph); 94 91 } … … 185 182 private void navigateRightButton_Click(object sender, EventArgs e) { 186 183 var graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)genealogyGraphChart.SelectedGraphNode; 187 var inArcs = (List<IArc>)((IVertex)graphNode).InArcs;184 var inArcs = graphNode.InArcs.ToList(); 188 185 if (inArcs.Count > 0) { 189 186 var data = inArcs.Last().Data; … … 205 202 for (int i = 1; i < inArcs.Count; ++i) { 206 203 td = (TraceData)inArcs[i].Data; 207 var f2 = ((I SymbolicExpressionTree)inArcs[i].Source.Data).NodeAt(td.SubtreeIndex);204 var f2 = ((IGenealogyGraphNode<ISymbolicExpressionTree>)inArcs[i].Source).Data.NodeAt(td.SubtreeIndex); 208 205 // if the subtrees are the same we have found a match 209 206 // note: this is not necessarily 100% correct if in the trace graph we have identical fragments on different arcs … … 218 215 } 219 216 } 220 221 217 public class SymbolicDataAnalysisGenealogyGraphViewDesignable : GenealogyGraphView<ISymbolicExpressionTree> { } 218 219 internal static class Util { 220 internal static ISymbolicExpressionTreeNode NodeAt(this ISymbolicExpressionTree tree, int position) { 221 return NodeAt(tree.Root, position); 222 } 223 internal static ISymbolicExpressionTreeNode NodeAt(this ISymbolicExpressionTreeNode root, int position) { 224 return root.IterateNodesPrefix().ElementAt(position); 225 } 226 } 222 227 }
Note: See TracChangeset
for help on using the changeset viewer.