In terms of wanting to weld things together, the spacedock works the same way as the drydock, in that there are lots of options as to where to place things.
In terms of figuring out what things will stick together after the dock is turned off, the connectivity rules are pretty simple.
1) Start with the most core component on the ship (first is hull 3, hull 3 strut, hull 2, hull 2 strut, hull 1, hull 1 strut, then clamps, and regular components last.) Explosive bolts aren't core at all, so if they are the only things left, they do not form a ship and instead just vaporize.
That selected component is considered part of the ship and "sticks".
2) All components part of the ship are checked to see if there are any other components which will accept a connector hex being offered.
Any components that do accept the connection, become part of the ship too. Goto 2
3) If you have just disabled a dock or had a critical component destroyed, then there will come a point where there are some components which are still not part of the ship, but don't accept any connections from components on the ship.
All of these leftover components are moved to a new design grid (attributes such as saved accel and velocity are copied), and the process repeats from step 1.
Once fragmentation is complete, the final set of ships then shares energy to make them all have the same % energy.