Collapsible D3 force directed graph with non-tree data
问题 I have a D3 force directed graph using non-tree data and ID associations vs index. I cannot seem to find an example of this structure of data in a collapsible force layout. Basically, when you click a node, the data for that node should collapse/expand like this example: http://bl.ocks.org/mbostock/1062288. The last answer to this questions got close but is linking nodes by index rather than id: How to create d3.js Collapsible force layout with non tree data? Here is a fiddle of my code https