Data structure for unrooted trees
        Posted  
        
            by Esmond
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Esmond
        
        
        
        Published on 2010-04-02T15:05:57Z
        Indexed on 
            2010/04/02
            15:13 UTC
        
        
        Read the original article
        Hit count: 252
        
java
I'm having problems figuring out how to build an unrooted tree with weighted edges and what data structure to store such a tree. An example of an unrooted tree would be like the one here: http://www.bio.davidson.edu/courses/GENOMICS/seq/unrooted.gif
The problem i am having is the leaves would only have 1 link to the internal nodes and the internal nodes would have 3 links(the internal nodes would have 2 children and a link to another internal node). Do i have to distinguish between the 2 different kinds of nodes or can i have one class having the function of both types of nodes?
© Stack Overflow or respective owner