public static double distance(TreeBiPartitionInfo t1, TreeBiPartitionInfo t2, DistanceNorm norm) {
        double d = 0.0;
        for( BiPartiotionInfo k : t2.all.values() ) {
            k.has = false;
        }
        double din = 0;
        double dout = 0;

        for( Map.Entry<FixedBitSet, BiPartiotionInfo> k : t1.all.entrySet() ) {
            final BiPartiotionInfo info = t2.all.get(k.getKey());
            final double b1 = t1.t.getLength(k.getValue().n);
            double dif;
            if( info != null ) {

                final double b2 = t2.t.getLength(info.n);
                info.has = true;

                dif = Math.abs(b1 - b2);
            } else {
                dif = b1;
            }
            if( norm == DistanceNorm.NORM1 ) {
                //d += dif;
                din += dif;
            } else {
                //d += dif * dif;
                din += dif * dif;
            }
        }

        for( BiPartiotionInfo info : t2.all.values() ) {
            if( !info.has ) {
                final double dif = t2.t.getLength(info.n);
                if( norm == DistanceNorm.NORM1 ) {
                    //d += dif;
                    dout += dif;
                } else {
                    //d += dif * dif;
                    dout += dif * dif;
                }
            }
        }
        d = din + dout;
        return ( norm == DistanceNorm.NORM1 ) ? d : Math.sqrt(d);
    }