d3 / d3-force

Force-directed graph layout using velocity Verlet integration.
https://d3js.org/d3-force
ISC License
1.82k stars 377 forks source link

D3.js - Different gravity for Nodes #157

Closed MadeleineHeuer closed 4 years ago

MadeleineHeuer commented 4 years ago

I need some help with D3.js. I created a network with this examplehttp://bl.ocks.org/GerHobbelt/3071239. I wanted to create a network with groups and a few nodes.The distance between the individual nodes should be small within a group. However, the distance between the groups should be large so that they do not overlap. Maybe it is possible to have different gravities between the nodes?

My example: https://codepen.io/lenichenmadeleine/pen/YzXLypm

Thanks for the answers and help :)

mbostock commented 4 years ago

I’d probably use a custom force for this, like here:

https://observablehq.com/@d3/clustered-bubbles-2