computing the quartet distance between general trees
computing the quartet distance between general trees
computing the quartet distance between general trees
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
7.2. IMPLEMENTATION 49tween <strong>the</strong> number of inner nodes and <strong>the</strong>ir degree might be more or less important. Thesame relation made <strong>the</strong> case analysis difficult.Based on <strong>the</strong>se observations my assumption is that <strong>trees</strong> with a large number of highdegreeinternal nodes will pose <strong>the</strong> worst challenge; here <strong>the</strong> implementation will sufferfrom increasing cost of <strong>the</strong> matrix multiplication while <strong>the</strong> overhead on o<strong>the</strong>r calculationswill influence <strong>the</strong> time consumption as well. As described in Sec. 3.1, sqrt<strong>trees</strong> are intended to have this property. For bin <strong>trees</strong> however, with a large numberof small-degree inner nodes, <strong>the</strong> cost of matrix multiplication per node pair will nevergrow. Therefore <strong>the</strong> result will probably be that this cost can be disregarded and that <strong>the</strong>algorithm will behave as a quadratic function, even though <strong>the</strong>re might be a large overheaddue to <strong>the</strong> many node pairs being processed. The star <strong>trees</strong> have one node of muchhigher degree which could result in a very small overhead but a much faster growth.Result The performance of <strong>the</strong> prototypes applied to <strong>the</strong> five types of test <strong>trees</strong> is shownin Fig. 7.7 and 7.8. The result is quite surprising and <strong>the</strong> first thing that catches <strong>the</strong> eye, is<strong>the</strong> relatively slow growth of <strong>the</strong> time usage. For <strong>the</strong> Python implementation <strong>the</strong> runningtimes seem to underlie a more or less quadratic development, with <strong>the</strong> star tree being <strong>the</strong>worst challenge, resulting in a slightly steeper slope, however, far from cubic. The plotof <strong>the</strong> C++ implementation displays <strong>the</strong> same tendency, <strong>the</strong> development being closeto quadratic. It is, however, even more clear that <strong>the</strong> implementation is suffering frommatrix multiplication costs when dealing with star <strong>trees</strong> and to some extent also <strong>the</strong> wc<strong>trees</strong>.The conclusion is, as assumed, that <strong>the</strong> algorithm responds differently to <strong>trees</strong>, dependingon <strong>the</strong>ir internal structure. For smaller input <strong>trees</strong>, <strong>the</strong> algorithm easily dealswith <strong>the</strong> ones that have a small number of internal nodes, whereas a complex internalstructure with a large number of internal nodes results in a large overhead. When <strong>the</strong>input size is increased <strong>the</strong> overhead is neutralized and <strong>the</strong> more dominant characteristicseems to be <strong>the</strong> maximum degree of <strong>the</strong> internal nodes. Large degrees result in large matrixmultiplications and <strong>the</strong> consequence is a faster growth in <strong>the</strong> development of timeusage.These experiments have been repeated five times each, once again with <strong>the</strong> exceptionof some of <strong>the</strong> larger Python experiments. Especially <strong>the</strong> large experiments on bin,ran and wc <strong>trees</strong> are slow and have not been repeated.7.2.2 Introducing a library for matrix multiplicationHaving gained <strong>the</strong> first experience with <strong>the</strong> algorithm, I will now introduce a better methodfor matrix multiplication and attempt to improve <strong>the</strong> algorithm in accordance to <strong>the</strong> <strong>the</strong>-