There isn’t a perfect solution. But you can try this: Extending Dynamic Ports Link Routing Overlapping Issue
Hmmm, you might also want to increase the space around the nodes so that the AvoidsNodes
routing doesn’t route links so close to the nodes. Set { avoidableMargin: 20 }
on your node template(s).