code: private double computeSimilarity(IContextMapping<INode> mapping) {
          MatchedTreeNodeComparator mntc = new MatchedTreeNodeComparator(mapping);
          TreeEditDistance tde = new TreeEditDistance(mapping.getSourceContext(), mapping.getTargetContext(), mntc, new WorstCaseDistanceConversion());
  
          tde.calculate();
          double ed = tde.getTreeEditDistance();
  
          return 1 - (ed / Math.max(mapping.getSourceContext().getNodesList().size(), mapping.getTargetContext().getNodesList().size()));
      }
docs: Computes the similarity score according to the definition provided in
  Approximate structure-preserving semantic matching.
  By
  Giunchiglia, Fausto and McNeill, Fiona and Yatskevich, Mikalai and
  Pane, Juan and Besana, Paolo and Shvaiko, Pavel (2008)
  <a href="http://eprints.biblio.unitn.it/archive/00001459/">http://eprints.biblio.unitn.it/archive/00001459/</a>.
  
  @param mapping mapping
  @return similarity score