Custom the "collapse node"

I have a problem that I want to solve…
I have relationship map:

I want to custom the “collapse node” to when the ( - ) button of “Test bug bbg” is clicked, the links that were connected to “Test pj” and “manifest.php” are removed but not removing node (But node “Test doc 2” is still removed).

I have no idea what relationships are actually present in your example, but it certainly seems as if what you are asking for is not implemented by any predefined behavior in GoJS.

So you will need to implement that “Button” click behavior yourself. Within a transaction traverse the graph starting at the button’s Node, obj.part, and set visible of each Node and Link the way that you want.