Skip to main content
100%

Clustered Network

✓ Published0🌍 Public
GGerHobbelt
Last edited Sep 18, 2012
Created on Jul 8, 2012

This example shows a clustered network of character co-occurrences from Victor Hugo's Les Miserables, where nodes represent characters and edges represent shared chapters. Users can click on group nodes to expand or collapse clusters, revealing individual characters or hiding them within hulls. The visualization uses d3.layout.force for physics-based layout with adjustable gravity, charge, and link distance parameters, while d3.svg.line with cardinal interpolation draws the convex hulls around collapsed groups. The data is loaded from a JSON file containing 77 nodes and 254 weighted links, with group assignments derived from community structure analysis.

AI-generated description

Experiment …… <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 the expand[] info, i.e. which group(s) should be shown in expanded form and which shouldn't.

  • only group nodes are expected to a .size attribute (read: your own JSON should use that attribute for any node). Same goes for the fields .group_data and .link_count: all of these are expected to be generated by the network() call. (.group_data is a reference to the group (x/y/size/link_count) for a node, group_node.link_count counts the number of links between groups.)

  • you'll very probably have to tweak .gravity, .charge, .linkDistance and maybe also .linkStrength to 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 aforementioned force parameters.

Similar vizzes