This is a preliminary version of a later part of my How to Create Good Network Data Visualization workshop that I'll be having at ForwardJS.
It uses the jLouvain lib to calculate the modularity of the network, and then uses those modules as their own graph in a separate mini-map of the network.
The position of the module node is based on the average of the position of its constituent nodes, with all singletons collapsed into one node.
Drag the regular nodes and watch the minimap follow them. Hover over the module nodes in the mini-map to see the corresponding member nodes.
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js