new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

D3 · all subjects

d3-force/many-body

8 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

d3.forceManyBody configuration

Force many-body configuration methods: manyBody.strength (set force strength), manyBody.theta (set Barnes-Hut approximation accuracy), manyBody.distanceMin (limit force when nodes are close), manyBody.distanceMax (limit force when nodes are far).

forceManyBody() constructor

Creates a new many-body force with default parameters. Example usage: const manyBody = d3.forceManyBody().strength(-100);

Many-body force applies globally to all nodes

The many-body force applies mutually amongst all nodes in the simulation. Unlike the link force which only affects two linked nodes, the charge force is global: every node affects every other node, even if they are on disconnected subgraphs.

Many-body force uses Barnes-Hut approximation

The many-body force implementation uses a quadtree and the Barnes-Hut approximation to greatly improve performance. The accuracy can be customized using the theta parameter.

manyBody.strength() method and accessor

Sets or gets the strength accessor. If strength is specified, sets the strength accessor to the specified number or function, re-evaluates the strength accessor for each node, and returns this force. A positive value causes nodes to attract each other (gravity), while a negative value causes nodes to repel each other (electrostatic charge). The strength accessor is invoked for each node in the simulation, being passed the node and its zero-based index. The default strength accessor is: function strength() { return -30; }

manyBody.theta() method for Barnes-Hut criterion

Sets or gets the Barnes-Hut approximation criterion. Defaults to 0.9. The theta parameter determines the accuracy of the approximation: if the ratio w / l of the width w of the quadtree cell to the distance l from the node to the cell's center of mass is less than theta, all nodes in the given cell are treated as a single node rather than individually. The force computation is O(n log n) per application where n is the number of nodes.

manyBody.distanceMin() method

Sets or gets the minimum distance between nodes over which this force is considered. Defaults to 1. A minimum distance establishes an upper bound on the strength of the force between two nearby nodes, avoiding instability. In particular, it avoids an infinitely-strong force if two nodes are exactly coincident; in this case, the direction of the force is random.

manyBody.distanceMax() method

Sets or gets the maximum distance between nodes over which this force is considered. Defaults to infinity. Specifying a finite maximum distance improves performance and produces a more localized layout.

Give your agent this brain