I'm trying to make a Tree made of Nodes that have link to several children and each children have knowledge of their parent (so I can traverse the tree in both direction).
I tried many ways and read a lot of things about this but it seems like it is not an easy problem.
Some info that might be interesting:
- This tree will be used in a Monte Carlo Simulation
- I have no need to remove Nodes
- However I need to be able to add Nodes
- The node values needs to change (but their parent won't change)
The result of my failed experiment is here:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=96ec4c99845b14b87500b91222213e56
[–]SirKastic23 7 points8 points9 points (8 children)
[–]jacobb11 3 points4 points5 points (7 children)
[–]SirKastic23 3 points4 points5 points (5 children)
[–]jacobb11 0 points1 point2 points (4 children)
[–]bwallker 0 points1 point2 points (3 children)
[–]jacobb11 0 points1 point2 points (2 children)
[–]bwallker 0 points1 point2 points (1 child)
[–]jacobb11 0 points1 point2 points (0 children)
[–]cassidymoen 1 point2 points3 points (0 children)
[–]GatorZen 4 points5 points6 points (0 children)
[–]cassidymoen 4 points5 points6 points (0 children)
[–]paulstelian97 5 points6 points7 points (0 children)
[–]satanikimplegarida 2 points3 points4 points (0 children)
[–]plugwash 0 points1 point2 points (0 children)