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.

a b c d<br />

root<br />

ab<br />

cd<br />

Figure 8.2: Updating the quad tree by propagating changes upward.<br />

8.1 Complexity analysis<br />

For every node in our quad tree we wish maintain information about the minimum<br />

matrix entry in the subtree of that node. That way we can, at any time,<br />

find the minimum entry of the matrix in constant time by looking it up in<br />

the root node. We can keep the tree updated by making leaf nodes propagate<br />

changes upward in the tree, at a price proportional to the height of the tree; for a<br />

balanced quad tree spanning an n×n matrix the height is log 4 (n 2 )=2∗log 4 (n),<br />

so the time spent propagating changes upward through the tree is O(log 4 (n)).<br />

Unfortunately, when we are using the quadtree to support construction of<br />

single linkage clustering trees, we need to update two rows and two columns in<br />

the matrix for each iteration, which would then take time O(n log 4 (n)) if we<br />

needed to propagate values upward through the tree every time, and we can<br />

afford to spend no more than linear time. We can also not afford to update<br />

(re-initialise) the whole tree since that would take time O(n 2 ).<br />

Luckily, it is possible to optimize the update procedure under these specific<br />

circumstances. It turns out that it is possible to update the tree in linear<br />

time when changing precisely exactly one row or column. This is due to the<br />

geometric dependency of the nodes, as illustrated in Figure 8.2. It clearly shows<br />

that the upward propagation of changes introduces redundancy, for example<br />

would changes to entries a and b share almost identical paths toward the root.<br />

By cutting down on this redundancy we can shave off a bit of the running time.<br />

We can ask ourselves how many nodes in the quad tree we need to update, in<br />

total. The answer is that after updating a row of n entries in the matrix we<br />

need to update n/2 entries in the first layer of the quad tree, n/4 entriesinthe<br />

second layer, and so on. This gives us<br />

n + n 2 + n 4<br />

+ ... +1≤ 2n<br />

56

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

Saved successfully!

Ooh no, something went wrong!