22.01.2015 Views

Refined Buneman Trees

Refined Buneman Trees

Refined Buneman Trees

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 13<br />

The Reference<br />

Implementation<br />

For testing purposes the author has implemented a package reference, which<br />

in a simple and transparent (and hopelessly inefficient) manner calculates the<br />

refined <strong>Buneman</strong> tree.<br />

The reference implementation is intended to provide a basis for comparison<br />

against the implementation of the [BFÖ+ 03] algorithm. To justify that the<br />

latter has been implemented correctly, we argue first that our reference implementation<br />

is correct, and thereafter we demonstrate that on the same input,<br />

the two implementations agree completely. These two arguments together form<br />

a basis for concluding that the [BFÖ+ 03] algorithm has been implemented correctly.<br />

13.1 A simple refined <strong>Buneman</strong> tree algorithm<br />

Algorithm 11 is a very simple algorithm that calculates the refined <strong>Buneman</strong><br />

tree. It has been adapted directly from the definition of the refined <strong>Buneman</strong><br />

tree.<br />

Line 1 initialises a set S to be the empty set. In line 2, we iterate over all<br />

possible splits in σ(X), avoiding duplicates by interpreting splits as bitvectors,<br />

and counting (using bit-flipping) through exactly half the possible splits. For<br />

each split σ we in line 3 initialise a set of quartets Q to the empty set. In line 4<br />

we iterate over all possible quartets in q(σ) and add them to Q in line 5. In line<br />

7wesortQ in increasing order so that in line 8 we can sum over the n − 3least<br />

scoring quartets to find the refined <strong>Buneman</strong> index. In lines 9–10 we report the<br />

splits with positive refined <strong>Buneman</strong> index.<br />

The complexity of this algorithm is quite horrible: first we iterate over O(2 n )<br />

splits, and for each split we iterate over O(n 4 )quartets. Thealgorithm therefore<br />

performs in time O(2 n n 4 ).<br />

74

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

Saved successfully!

Ooh no, something went wrong!