Adjustable Link Strength
This example displays a force-directed graph of character relationships from *Les Misérables*, rendered as nodes and links on a Canvas. A slider control adjusts the link strength parameter of the simulation, and the graph dynamically repositions to reflect the new force balance. The visualization uses D3 v4’s `d3.forceSimulation` with `d3.forceLink`, `d3.forceManyBody`, and `d3.forceCenter`, and on each slider input it updates the link strength and restarts the simulation with `simulation.alpha(1).restart()`. The network data comes from the included `miserables.json` file.
AI-generated descriptionThis example demonstrates how to modify the parameters of a force-directed graph. After modifying the desired parameter (here link.strength), you should reheat the simulation using simulation.alpha and simulation.restart. Alternatively, you can prevent the simulation from cooling by setting simulation.alphaDecay to 0, or by setting simulation.alphaTarget to a positive value.
forked from <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/aba1a8d1a484f5c5f294eebd353842da'>Adjustable Link Strength</a>