02assignment_cs582
This algorithm can be split in several steps:
- put all the values(matrix) to a list
- use the function distance to calculate all the distances.
- use the min to choose the samllest and use pop remove these two tuples and append the new value by using the function "position"(which is to get the middle position)
- becasue we knwo that in every level, we only need to cluster two tuples in one loop.
When the global variable is more than 2, it will draw the node again and again until there are only two nodes left. The x axis position is decide by the the order from the data. Thx y axis position is decide by the global variable. And when put all the polygon in the picture, draw the line whose position exisited in another list - alist. The lines show the connections between nodes.
the red polygon is from the data, and the white polygon is combined by two nodes.
From the bio: it could be easier for person to distinguish from each animal from the tree.(Based on the column have the same weight, if not, we could choose weigh different column in different value) Here I assume all the column's weight are same, so we don't need to normalize it.
From the CS: it would be easier to understand the all the code by using different functions.
download the tree of life. and open it with processing (python).