Clustered Network
This clustered network visualization renders the coappearance relationships between characters in Victor Hugo’s *Les Misérables*, using weighted edges to show how often characters appear together in the same chapter. The view groups characters by community structure, displaying individual nodes as small circles and collapsed groups as larger clusters surrounded by translucent convex hulls. Clicking a node expands or collapses its group, while dragging any element moves the entire graph. The code builds the layout with the D3 v2 force layout, computes hull paths via `d3.geom.hull`, and animates transitions on SVG elements.
AI-generated descriptionExperiment …… <a href="http://bl.ocks.org/3071239" title="view this gist via bl.ocks.org">∆</a> <a href="http://bl.ocks.org/GerHobbelt" title="view a list of all my gists at bl.ocks.org">∞</a>
Derived from the D3.js example force_cluster.html
Usage
- Click on node to expand or collapse.
- Click on hull (which shows up when you expanded a group node) to collapse the group.
- Drag node to move entire graph around.
Notes
network()is the one who takes care of (re)generating the nodes and links from the original data, based on thecollapse[]info, i.e. which group(s) should be shown in collapsed form and which shouldn't.only group nodes are expected to a
.sizeattribute (read: your own JSON should use that attribute for any node). Same goes for the fields.group_dataand.link_count: all of these are expected to be generated by thenetwork()call. (.group_datais a reference to the group (x/y/size/link_count) for a node,group_node.link_countcounts the number of links between groups.)you'll very probably have to tweak
.gravity,.charge,.linkDistanceand maybe also.linkStrengthto make your own graphs look good. Compare the final layout of this graph with the ones produced by the v2.9.6 force_cluster.html D3 code: note the generally quite different position of the groups which have only a single link to other groups; that and other differences are all due to the 4 aforementionedforceparameters.
forked from <a href='http://bl.ocks.org/larskotthoff/'>larskotthoff</a>'s block: <a href='http://bl.ocks.org/larskotthoff/4e5dbf8be2c83631a05b'>d3.js: force layout; click to group/bundle nodes</a>