Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/09/12 09:56:56 (12 years ago)
Author:
bburlacu
Message:

#1772: Moved tree matching functionality in separate class, implemented new tree fragments analyzer. Fixed bug in GetCutIndex method.

Location:
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphChart.cs

    r7779 r7785  
    177177          foreach (var node in ancestors.SelectMany(n => _visualNodeMap[n])) {
    178178            node.Brush = new SolidBrush(node.ToColor());
    179             if (node.IncomingArcs != null && node == _visualNodeMap[node.Data].First())
     179            if (node.IncomingArcs != null && node == _visualNodeMap[node.Data].First()) {
    180180              foreach (var arc in node.IncomingArcs) {
    181181                if (arc.Source.Data == node.Data) continue;
     
    183183                var end = new Point((int)arc.End.X, (int)arc.End.Y);
    184184                arc.Pen.Brush = new LinearGradientBrush(start, end, arc.Source.ToColor(), arc.Target.ToColor());
    185                 if (node.Data.CutpointIndex == -1) { // if the cut index wasn't computed yet
     185                if (node.Data.CutpointIndex == -1) {
     186                  // if the cut index wasn't computed yet
    186187                  var parent = arc.Source.Data.Data as ISymbolicExpressionTree;
    187188                  var child = node.Data.Data as ISymbolicExpressionTree;
     
    189190                }
    190191              }
     192            }
    191193          }
    192194          // highlight the descendants
     
    208210        Chart.UpdateEnabled = true;
    209211        Chart.EnforceUpdate();
    210         if (_selectedGenealogyGraphNode != null) /* emit clicked event */ OnGenealogyGraphNodeClicked(_selectedGenealogyGraphNode, e);
     212        if (_selectedGenealogyGraphNode != null)
     213          /* emit clicked event */
     214          OnGenealogyGraphNodeClicked(_selectedGenealogyGraphNode, e);
    211215      }
    212216    }
     
    238242      var e1 = parent.IterateNodesPostfix().GetEnumerator();
    239243      var e2 = child.IterateNodesPostfix().GetEnumerator();
    240       int pos = -1;
    241       var comparer = new SymbolicExpressionTreeGenealogyGraph.SymbolicExpressionTreeNodeComparer(0);
     244      int pos = 0;
     245      var comparer = new SymbolicExpressionTreeNodeComparer((int)SymbolicExpressionTreeMatching.SimilarityLevel.Exact);
    242246      while (e1.MoveNext() && e2.MoveNext() && comparer.Equals(e1.Current, e2.Current)) ++pos;
     247      if (pos == 0) return -1;
     248      if (pos == child.Length) return 0;
    243249      return pos;
     250      //return pos == 0 ? -1 : pos;
    244251    }
    245252  }
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphView.cs

    r7779 r7785  
    9494        var nodes = symbolicExpressionTreeChart.Tree.IterateNodesPostfix().ToArray();
    9595        var fragments = _selectedVisualSymbolicExpressionTreeNode.SymbolicExpressionTreeNode.IterateNodesPostfix().ToArray();
    96         int index = SymbolicExpressionTreeGenealogyGraph.FindMatch(nodes, fragments, similarityModeSelector.SelectedIndex);
     96        int index = SymbolicExpressionTreeMatching.FindMatch(nodes, fragments, similarityModeSelector.SelectedIndex);
    9797        if (index != -1) {
    9898          _selectedVisualSymbolicExpressionTreeNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(nodes[index + fragments.Count() - 1]);
     
    143143      genealogyGraphChart.ClearAllNodes(); // clear node colors
    144144      // color each graph node according to the degree to which it matches the selected tree fragment
    145       foreach (var i in Enum.GetValues(typeof(SymbolicExpressionTreeGenealogyGraph.SimilarityLevel)).Cast<int>().Reverse()) {
     145      foreach (var i in Enum.GetValues(typeof(SymbolicExpressionTreeMatching.SimilarityLevel)).Cast<int>().Reverse()) {
    146146        var owners = genealogyGraphChart.Graph.TraceFragment(treeNode, i).ToList();
    147147        if (owners.Any()) genealogyGraphChart.HighlightNodes(owners, colors[i]); // highlight matching individuals from the genealogy
Note: See TracChangeset for help on using the changeset viewer.