build/modelscript.umd.js
function S(a, b, alpha, beta, gamma) {
                if (a === undefined || b === undefined) {
                    return 0;
                }
                else {
                    var C = (alpha*Math.min(a.sum, b.sum)/Math.max(a.sum, b.sum)+ (1-alpha)*Math.exp(-gamma*Math.abs(a.center - b.center)));
                }
                return beta*C + (1-beta)*(S(a.left, b.left, alpha, beta, gamma)+S(a.right, b.right, alpha, beta, gamma));
            }
function S(a, b, alpha, beta, gamma) {
                if (a === undefined || b === undefined) {
                    return 0;
                }
                else {
                    var C = (alpha*Math.min(a.sum, b.sum)/Math.max(a.sum, b.sum)+ (1-alpha)*Math.exp(-gamma*Math.abs(a.center - b.center)));
                }
                return beta*C + (1-beta)*(S(a.left, b.left, alpha, beta, gamma)+S(a.right, b.right, alpha, beta, gamma));
            }
function S ( a , b , alpha , beta , gamma ) { if ( a === undefined || b === undefined ) { return 0 ; } else { var C = ( alpha * Math . min ( a . sum , b . sum ) / Math . max ( a . sum , b . sum ) + ( 1 - alpha ) * Math . exp ( - gamma * Math . abs ( a . center - b . center ) ) ) ; } return beta * C + ( 1 - beta ) * ( S ( a . left , b . left , alpha , beta , gamma ) + S ( a . right , b . right , alpha , beta , gamma ) ) ; }
Similarity between two nodes
@param {{sum: number, center: number, left: {json}, right: {json}}} a - tree A node
@param {{sum: number, center: number, left: {json}, right: {json}}} b - tree B node
@param {number} alpha - weights the relative importance of intensity vs. shift match
@param {number} beta - weights the relative importance of node matching and children matching
@param {number} gamma - controls the attenuation of the effect of chemical shift differences
@returns {number} similarity measure between tree nodes
Similarity between two nodes