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.

44 CHAPTER 7. SUB-CUBIC TIME ALGORITHM7.1.4 How to count butterflies in constant timeSec. 7.1.1, 7.1.2 and 7.1.3 gave an intuitive explanation of <strong>the</strong> algorithm. This sectionwill clarify that <strong>the</strong> number of butterflies, shared and different, associated with a pair ofdirected edges, can in fact be calculated in constant time, given <strong>the</strong> right preprocessinginformation. All preprocessing arrays and tables are listed in Appendix A. These will bereferenced here and <strong>the</strong> most important table, calculation of which is posing a threat to<strong>the</strong> overall complexity of <strong>the</strong> algorithm, will be explained in detail below.The article explains how <strong>the</strong> expression in Eq. (7.3), used to calculate <strong>the</strong> number ofshared directed butterflies associated with a pair of internal nodes, can be translated into<strong>the</strong> following constant time computable expression:( )1 I [i , j ] (M ′ − R ′ [i ] −C ′ [j ] + I ′ [i , j ]+2 2(I [i , j ] − R[i ] −C [j ])(M − R[i ] −C [j ] + I [i , j ])+R ′′ [i ] − I [i , j ](C [j ] − I [i , j ])+C ′′ [j ] − I [i , j ](R[i ] − I [i , j ]) ) (7.8)And fur<strong>the</strong>rmore how <strong>the</strong> expression in Eq. (7.7), used to calculate <strong>the</strong> number ofdifferent directed butterflies associated with a pair of internal nodes, is translated intoone of <strong>the</strong> succeeding two expressions.I [i , j ]((M − R[i ] −C [j ] + I [i , j ])(R[i ] − I [i , j ])(C [j ] − I [i , j ])+(R[i ] − I [i , j ])(I [i , j ](R[i ] − I [i , j ]) −C ′′ [j ])+(C [j ] − I [i , j ])(I [i , j ](C [j ] − I [i , j ]) − R ′′ [i ])+I 1 ′′′′′[i , j ] − I [i , j ]I 1 [i ,i ] − I [i , j ](C ′′′ [j ] − I [i , j ] 2 ) ) (7.9)I [i , j ]((M − R[i ] −C [j ] + I [i , j ])(R[i ] − I [i , j ])(C [j ] − I [i , j ])+(R[i ] − I [i , j ])(I [i , j ](R[i ] − I [i , j ]) −C ′′ [j ])+(C [j ] − I [i , j ])(I [i , j ](C [j ] − I [i , j ]) − R ′′ [i ])+I 2 ′′′′′[i , j ] − I [i , j ]I 2 [j, j ] − I [i , j ](R′′′ [i ] − I [i , j ] 2 ) ) (7.10)This requires some explanation. The respective translations into <strong>the</strong>se constant timecomputable expressions are very cumbersome and not essential to this <strong>the</strong>sis and I willmerely refer to <strong>the</strong> appendix of <strong>the</strong> original article by Mailund et al. [14] for details onthis process.

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

Saved successfully!

Ooh no, something went wrong!