You can use the binary paths to create a jagged tree of nodes. This is normally frowned upon as “poor form”, but the advantage is that you can use path depth to ascertain valence and parent/child relationships easily.
For example, the ancestor nodes of the leaf {0;0;1;0;0} are {0;0;1;0}, {0;0;1}, {0;0}, and {0} and using Tree Item with these paths quickly delivers the nodes for the polyline of that branch.
I don’t see a problem with using jagged trees if the portion of the script using the jagged tree is purely generative, i.e. not taking in data of unknown structure from somewhere else. You just have to be cognisant of what you’re doing. But for those who like to complain, at least the point and polyline geometry has been flattened to global indices.