This block is inspired by this other block and d3 forceCollide. It also uses a segment crossing function posted on this stackoverflow question.
However I think the repositionning of nodes can be improved so if you do that please let me know!
Built with blockbuilder.org
https://d3js.org/d3.v4.min.js