Set Union if branches have intersections with C#

Hi c# guys, I trying to Set Union only if the branches has Set Intersections.

I started to write a SetUnion with a new HashSet < object > () that work with DataTrees, but I need to find the logic of intersection validation.
Thanks for the help

This is what I expected to get.

union if (9.4 KB)

union if (9.2 KB)

1 Like

thank you @Tao_Lin What would it be like if more than 2 branches share elements?

union if intersect (11.7 KB)

union if intersect (11.1 KB)

1 Like

Thank you @Tao_Lin I definitely need to study your code in depth.