Hi All, I hope everyone’s staying healthy and safe in these crazy times.
I have a script which writes data to a 3-level nested tree {a,b,c}
I’m trying to find the number of unique path numbers in each “dimension,” a b and c.
[edited to add - I’m writing this in C#]
Imagine this as the addresses in a 3 dimensional grid. Say a
is 3, b
is 4, and c
is 5. I would have lists
{0,0,0}
{0,0,1}
.
.
{0,1,0}
{0,1,1}
.
.
{0,1,4}
{0,2,0}
.
.
on to
{2,3,4}
{2,3,4}
So as you can guess, I don’t want a count of paths with that dimension (as that would just be 60 (3x4x5) for all three), I want those values to return 3,4, and 5. Or, it could be thought of as the largest value for any given branch of a path.
I tried Branches[n].Count
and Paths[n].Length
(where n is the integer of the number of the path) and it just returns a value of 3…
Basically, what I’m trying to do is test for a condition so that on every path with a {3,n,n}, {n,4,n},
or {n,n,5}
in it something happens.
It seems like both count and length would also return the product of 3x4x5, as each of the (3) indices of the paths at {a, , }
repeats (4x5) times. So I would need to find the max number in each dimension, or the size of the set of each unique dimension a, b,
or c
of the path.
As for a code sample that would help facilitate this, there’s nothing I could add that would help, as I’m generating these trees in a different component and trying to bring them in to this component and operate over them. If I were doing this test in the component where the trees are generated this would be easy, but I’m trying to split different functions to different components.
Thanks in advance for any advice!