Making sure that number of paths in a data tree is always the same

Hello,

I have a theoretical question:
I encountered a problem with data trees i need your help with. I will use an example:
Let’s say I have different files containing some information and that i have a data tree structured like this:
{Street_number; Building_number; Flat_number} (room_names)

All the simplify functions (and trim trees used) support that schema. Let’s imagine that at the end of the script you use ‘Trim Tree’ to get all the rooms in given building:
{Street_number; Building_number}(room_names)

Most files would work fine, but then, in some files you would get ONLY single-family houses that DO NOT have a flat number as it is unnecessary - no branch is created. Than the tree would be structured like this:
{Street_number; Building_number} (room_names)

If you would use ‘Trim Tree’ here, you would get all the rooms on a given street, and that is not what I want:
{Street_number} (room_names)

So, in this case - the result and data structure would depend on your input. Do you guys have any methods on how to keep data structure always the same in such cases?

Looking forward to hearing from you!

I would use a path mapper with two entries, one to take care of your flat building structure with the trimming, and one for the single homes where you won’t trim.

Same path mapper setup, different data trees as input.

flats_vs_singlehomes.gh (14.8 KB)

That kind of stuff is typically addressed in real life via some Class of a custom type where suitable Properties contain any info (in this case street info, building info etc etc) you want. Then you just perform any LINQ query (simple or nested) imaginable. That’s (more or less) how RDBMS deta mining works (well … kinda).

But if you are not familiar with coding all the above are chinese.

Anyway, notify if by accident you want a simple demo case in C#.