I am applying multiple layouts to a GoJS diagram using the context menu.
When applying ForceDirectedLayout and expanding a group node, overlapping occurs with the group node. In some cases, non-child nodes appear inside the boundary of the group node.
Question:
How can I achieve the desired behavior with ForceDirectedLayout—ensuring that group nodes do not overlap with other nodes and that only child nodes are contained within the group boundaries?
In general there is no way to guarantee that any ForceDirectedLayout’s results will avoid any node overlaps. That’s because if there are a lot of nodes densely connected by links, there might not be enough room to allow every node to be moved far enough apart to avoid any overlaps.
Or consider: Radial & ForceDirected Layout That doesn’t have any groups, but you can toggle the size of each node as if it were a group. That sample has the links connecting with the expanding/collapsing nodes.