I don't mean an indexed tree, I mean an arbitrary hierarchal structure such as what might be used to represent filesystem in memory.
To this point I've been using ego-tree (a Vec and using indexes into the vec to represent links) to represent my tree. Now I also want fast cloning to create versions of the tree with structural sharing.
Does such a thing already exist?
If not any suggestions on how to best to implement?
I'm actually working on my own version of ego-tree, but backed by an im::vector::Vector right now. This seems to be working well enough... but I'm not sure that approach is the best way to do things.
In my naive idea of how immutable data-structures work I think tree shaped data should be the easiest structure to implement. Using im::vector::Vector as a backing store for tree data for the purpose of immutability seems like it might be doing a lot of unnecessary work? (representing a tree in a vector that's represented by a tree behind the scenes?)
As I continue to work in my im::vector::Vector backed tree implementation I though I should ask and see if there's already a immutable tree out there before I reinvent things badly.
Here's the performance that I'm seeing comparing a Vec backed tree to an immutable Vector backed tree: