13.07.2015 Views

computing the quartet distance between general trees

computing the quartet distance between general trees

computing the quartet distance between general trees

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

70 APPENDIX A. PREPROCESSING FOR THE SUB-CUBIC ALGORITHMAnd two more arrays:R ′′ [i ] =C ′ ∑d v[j ] = I ′ [i , j ]M ′ =∑d vj =1i=1∑d v d v ′∑i=1 j =1I ′ [i , j ]I [i , j ](C [j ] − I [i , j ])(A.6)(A.7)(A.8)C ′′ ∑d v[j ] = I [i , j ](R[i ] − I [i , j ])(A.9)i=1Only one of <strong>the</strong> two following arrays will need calculation, depending on which of <strong>the</strong>two expressions for counting different butterflies is used, Eq. (7.9) or Eq. (7.10):R ′′′ [i ] =∑d vj =1I [i , j ] 2C ′′′ ∑d v[j ] = I [i , j ] 2With <strong>the</strong> approach taken in <strong>the</strong> article [14], <strong>the</strong> following table needs calculation.i=1(A.10)(A.11)I ′′′ [i , j ] =∑d vd v ′∑k=1,k≠i l=1,l≠jI [i ,l]I [k, j ]I [k,l]However, if calculated naively, <strong>the</strong> sub-cubic time bound promised will be broken. Thesolution is instead to calculate ei<strong>the</strong>r I1 ′′ = I I T and <strong>the</strong>n I1 ′′′ = I ′′ I , which is basically1dI 1 ′′v ′[i ,k] = ∑j =1I [i , j ]I [k, j ](A.12)I 1 ′′′d v[i , j ] = ∑k=1I [k, j ]I 1 ′′ [i ,k], (A.13)or o<strong>the</strong>rwise calculate I2 ′′ = I T I and <strong>the</strong>n I2 ′′′ = I I ′′ , which is basically2I 2 ′′d v[j,l] = ∑i=1I [i , j ]I [i ,l](A.14)dI 2 ′′′v ′[i , j ] = ∑I [i ,l]I 2 ′′ [l,k]. (A.15)l=1The choice is essential to <strong>the</strong> algorithm and is explained in fur<strong>the</strong>r detail in Sec. 7.1.4.1.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!