Hi,
I hope this is not a bother, but I think there's a slight misalignment between the text and the example in:
https://activitysim.github.io/sharrow/walkthrough/one-dim.html#data-trees-and-flows
The tree defined here is not a tree in the mathematical sense. It has cycle(s), when showing at least the edges by label. The text above the example indicates that "all sharrow.DataTree objects are trees in the mathematical sense". The text says:
"Then, it’s time to prepare our data...This is a tree in the mathematical sense..."
Here's a cycle in the example just below that text: Tour[PERID] -> Person[PERID], then Person[household_id] -> hh[HHID], then HH[TAZ] -> dot_skims[dtaz], then ANTIDirectionOF[(dot_skims[time_period] -> tour['out_time_period']).
Ultimately, this class is defined based on networkx.MultiDiGraph, describing it as a tree in the "mathematical sense" doesn't really make much sense to me. Happy to be corrected.