I'm trying to figure out how to make / use Trees in Mathematica. I've made my own very rough tree in Draw.io, but I'd like a more systematic / automatic way of doing it in Mathematica.
But I'm not sure how, or whether Mathematica currently supports the end-product I want to create.
My idea is basically to dynamically create an interactive Collatz tree, preferably in a very specific visual / functional way.
The Collatz conjecture uses two rules:
If an integer is 'even': divide by 2. If an integer is 'odd': multiply it by 3 and then add 1. [Thus making an even integer.]
The conjecture is that any number subjected repeatedly to those rules will eventually lead to 1 and/or the 1 --> 4 --> 2 --> 1 loop.
My thinking is to do the reverse, and create an expandable/collapsible Collatz Tree from the bottom up, starting at 1.
"Trunks" would be vertical series starting at an odd number [1, or the bottom of a "Branch"], and then proceeding upward by multiplying that odd number by ascending powers of 2, essentially to infinity.
"Branches" would be a line to the right at any number where a 3x+1 function would produce that number [or, in reverse, that number minus one, then divided by 3, results in an integer].
The result of each "Branch" [an odd number] would be the start of a new vertical "Trunk."
My notion is to have "branches" be 'collapsible.'
So, you'd basically start with just the vertical "powers of 2" Trunk, and then specific numbers would have a control to expand/collapse a new Branch at that number. Not all numbers have branches as not all numbers would result in an integer as a result of subtracting 1 and then dividing by 3. [Basically works out to every 2nd even number having a Branch.]
I'm just not sure how to go about creating such a tree in Mathematica. Generally, or with collapsible Branches.
How, in general, do you create a Tree, or Graph, or Flow Chart, or whatever, based on the two Collatz rules? [If x is Even, do '1'; if x is Odd do '2'?]
Does Mathematica support 'Collapsible/Expandable' controls in graphs / trees / demonstration projects?
Does Mathematica support kind of formatting how the "Tree" or "Flow Chart" or whatever gets built? Can you specify that like the "odd number times powers of 2" Trunk should be arranged vertically, while the Branches [((x-1)/3) {if the result is an integer}] should be a horizontal node, which then connects to the bottom [odd number] of another vertical Trunk?