function computeDistance(p1, p2) {
        let dist = 1; //prevent it from becoming 0
        for(let key in p1._transitions) {
            const p1count = p1._transitions[key];
            const p2count = p2._transitions[key];
            if(!p2count) dist += p1count;
            else dist += Math.abs(p1count - p2count); 
        }
        //find keys missing in p1
        for(let key in p2._transitions) {
            const p1count = p1._transitions[key];
            const p2count = p2._transitions[key];
            if(!p1count) dist += p2count;
        }
        return dist;
    }
//create adjacency matrix between all graph with each cell representing distances between each graph. 
create adjacency matrix between all graph with each cell representing distances between each graph.
create adjacency matrix between all graph with each cell representing distances between each graph .
function computeDistance(p1, p2) {
        let dist = 1; 
        for(let key in p1._transitions) {
            const p1count = p1._transitions[key];
            const p2count = p2._transitions[key];
            if(!p2count) dist += p1count;
            else dist += Math.abs(p1count - p2count); 
        }
        for(let key in p2._transitions) {
            const p1count = p1._transitions[key];
            const p2count = p2._transitions[key];
            if(!p1count) dist += p2count;
        }
        return dist;
    }
function computeDistance ( p1 , p2 ) { let dist = 1 ; for ( let key in p1 . _transitions ) { const p1count = p1 . _transitions [ key ] ; const p2count = p2 . _transitions [ key ] ; if ( ! p2count ) dist += p1count ; else dist += Math . abs ( p1count - p2count ) ; } for ( let key in p2 . _transitions ) { const p1count = p1 . _transitions [ key ] ; const p2count = p2 . _transitions [ key ] ; if ( ! p1count ) dist += p2count ; } return dist ; }
create adjacency matrix between all graph with each cell representing distances between each graph.
create adjacency matrix between all graph with each cell representing distances between each graph .
//prevent it from becoming 0 //find keys missing in p1