Collapse at a perticular node in network diagram



I am building a network diagram which has 6 to 7 level deep hierarchy. I want to show the user 4 level deep hierarchy by default and let the user select the 4th level to see further hierarchy. I am using visnetwork library and used the visoptions to set the collapse which works great to collapse and uncollapse nodes. I wish I could pass in a parameter at each node level letting the visnetwork know that I want to show this node in a collapse way or uncollapse way. Anyway one else trying to do this kind visualization ? Any thoughts? suggestion.


Do you have an example of what you're trying to show? I'm having trouble visualizing what you want to do.

Also, it could be helpful here to post a reprex of your code and what you have so far