3 ms·
That tree format (using parentheses) is also known as Newick format >> https://en.wikipedia.org/wiki/Newick_format https://en.wikipedia.org/wiki/Newick_format
by itronitron 2y ago
That tree format (using parentheses) is also known as Newick format >> https://en.wikipedia.org/wiki/Newick_format https://en.wikipedia.org/wiki/Newick_format
But you can also simply store the tree structure as a single array of ints (or longs) ... each node in the tree corresponds to a unique index position, and the value at that position is the index position of the node's parent (or it's own position if it's a top level node) ... good stuff.