This is a d3.js tree diagram that incldes an interactive element as used as an example in the book D3 Tips and Tricks.
Any parent node can be clicked on to collapse the portion of the tree below it, on itself. Conversly, it can be clicked on again to regrow.
It is derived from the Mike Bostock Collapsible tree example but it is a slightly cut down version.
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js