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.

interface EdgeIterator<br />

{<br />

boolean hasNext();<br />

}<br />

Edge next();<br />

Figure 6.5: The interface for the EdgeIterator class<br />

6.2 Operations on the tree datastructure<br />

The tree datastructure maintains a compatible set of splits. And the operations<br />

we are interested in supporting are the following:<br />

• Insert(σ)<br />

Of course, we need to be able to insert splits into our set of splits<br />

• Delete(σ)<br />

And we need to be able to remove splits from the set<br />

• Incompatible(σ)<br />

And finally we need to be able to determine if a split is compatible with<br />

any split in our compatible set of splits, and if there is one, to extract it.<br />

The following sections describe in detail how these operations have been<br />

implemented. In order to support the operations on the tree data structure<br />

needed in the refined <strong>Buneman</strong> algorithm, we must be able to search through<br />

the tree, and find both nodes and edges.<br />

For the insert operation we will need to locate a node with the property that<br />

for a split σ = U|V the node seperates U and V in the sense that we can group<br />

its subtrees in two, where one group only contains elements from U, andthe<br />

other group only contains elements from V . This node can then be expanded<br />

into two connected nodes, one for each subtree group.<br />

For the delete operation we need to be able to find the edge e that seperates U<br />

and V , meaning that the node on one of the edge is root in a subtree containing<br />

only elements from U, and the node on the other end is root in a subtree<br />

containiing only elements from V .<br />

For the incompatible operation we need to be able to find en edge e which<br />

is incompatible with another edge e ′ . We will use Definition 3 to decide the<br />

question of incompatibility.<br />

6.2.1 Insert<br />

Assume we have an unrooted tree T , and that we have selected some random<br />

node w root as starting point for traversal. The task is to insert a split σ = U|V<br />

which is compatible with all other splits represented by T . This amounts to<br />

46

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

Saved successfully!

Ooh no, something went wrong!