what type of crate handles multi-dimensional data well?
like, I am building a TUI, and I made a Node type with a left, right, up and down feilds
but i also have parents and children
I have to do, alot of assigments
any crate that can make this much easier? like lets say i want to put some peice of data next to another peice of data, it will update all other relevant peices of data to include it under the left feild, or right feild, and parents and children, rather than a dozen manual assignemtns
Example of this:
It really depends how crazy you want to go with this...
For once a regular hypergraph with your four directiin as custom node type would do the trick. I just finished updating my UltraGraph crate with a more efficient CSM/CSR implementation that's super fast. It's not yet released since the PR was just merged yesterday.
Then, if you need native support for 4 dimensional or non euclidean context data, well, the upcoming 0.8 release of my DeepCausality project got you covered to the nth degree and beyond. Again, not yet released because I'm still working on closing the last open issue, but the draft of the upcoming release is already available on the beta project page.
That looks unique! There is no native way to do four-way nodes, which is a shame because there will be alot of boilerplate regarding, lets say I want to add a node between a node and a node left of it, automatically changing the left and right references of the nodes to share the new node. But it might make things easier, but whats the difference between this and something like petgraph? or is it just more performant.
I wrote the new CSM implementation of UltraGraph because, on average, it's about 300x times faster than the previous implementation that used petgraph. Meanwhile, I have removed petgraph entirely. The benchmark results are in the PR:
feat(ultragraph): re-implementation of the ultragraph by marvin-hansen · Pull Request #249 · deepcausality-rs/deep_causality · GitHub
You may want to look into the generic time index mentioned in the DeepCausality blog post because it solved the relative time index problem in temporal hypergraphs. That is, how do you know which node is current? It's hard because the answer is scale dependent meaning for a different time scale the temporal distance that determines the difference between current and past depends on the actual time scale.
If you adapt the temporal traits to your four way spatial problem you get a relative spatial index which then gives you a fairly straightforward way of adding the nodes the way you describe it. there are two ways you can go about:
-
establish a priori global coordinate frame of reference and place your nodes relative to said coordinates. That way, your index is a bit more complicated because you have to juggle the projection into the coordinates.
-
Use an earth center analogy for root. This "establishes" that the root node with index zero is the center. Full stop. By definition, N/S/W/E nodes of distance one are exactly one hop away from root so your relative spatial index becomes quite trivial. You just updated "current left" index with the relative position of the left node relative to root. I think it's easy to design.
Quick updated, I released the new 0.8 version. Its now on crates.io
https://crates.io/crates/ultragraph