This project is basically the ported version of https://github.com/cjrd/directed-graph-creator to d3 version 5.7. You can find the blocks here: https://bl.ocks.org/cjrd/6863459
To be honest, I think you are way better off using http://js.cytoscape.org/ which as a graph model behind it.