The "TreeExpanderButton", which changes the Node.isTreeExpanded property, really only works with tree structures. When you want to hide/show the "downstream" nodes from a given node, using the "TreeExpanderButton" might not do what you like, especially when there are cycles in the graph structure.

Instead, this sample implements a "Button" with custom behavior to modify the visibility of each Node. If this behavior is still not quite right for your app, you can adapt the behavior implemented in the `collapseFrom` and `expandFrom` functions to use different criteria for when to stop recursion.