I want to experiment with an alternative family force functions for force-directed graph layouts.
For each node n_i
, I can define a "force function" f_i
such that
f_i ( n_i )
is identically zero; andf_i ( n_j )
, where n_i != n_j
, is the force on node n_i
that is due to some other node n_j
.The net force on node n_i
should then be the vector sum of the forces f_i ( n_j )
, where n_j
ranges over all other nodes1.
Is there some way to tell d3.js to use these custom force functions in the layout algorithm?
[The documentation for d3.js's force-directed layout describes various ways in which its built-in force function can be tweaked, but I have not been able to find a way to specify an entirely different force function altogether, i.e. a force function that cannot be achieved by tweaking the parameters of the built-in force function.]
1IOW, no other/additional forces should act on node n_i
besides those computed from its force function f_i
.
To achieve this, you'll need to create your own custom layout. There's no tutorial for this that I'm aware of, but the source code for the existing force layout should be a good starting point as, by the sound of it, the structure of your custom layout would be very similar to that.