This is the code for Chapter 6, Figure 8 from D3.js in Action showing how to create a force-directed network using d3.layout.force() as well as SVG markers for arrowheads.
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js
https://d3js.org/queue.v1.min.js