Collapsible Force Layout
This interactive visualization displays the hierarchical structure of the Flare dataset using a force-directed layout, with collapsible internal nodes. In the default view, only the top-level "flare" node and its immediate children are visible. Clicking an internal node toggles the visibility of its descendant nodes, with collapsed packages rendered in blue, expanded packages in light blue, and leaf nodes in orange. The code uses d3.layout.force for the physics simulation, d3.layout.tree for computing parent-child links, and SVG elements for rendering nodes and links.
AI-generated descriptionThis example demonstrates how to create a force layout of a hierarchy whose internal nodes are collapsible. Leaf nodes are shown in orange, while internal nodes (packages) are shown in blue. Clicking on an internal node (without dragging) causes that node to expand or collapse, toggling the visibility of its descendant nodes.
forked from <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/1093130'>Collapsible Force Layout</a>