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-hierarchy/cluster

6 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.cluster configuration

Cluster layout configuration methods: cluster.size (set layout size), cluster.nodeSize (set node size), cluster.separation (set separation between leaves).

cluster() creates a new cluster layout

cluster() creates a new cluster layout with default settings. The cluster layout produces dendrograms: node-link diagrams that place leaf nodes of the tree at the same depth.

cluster(root) lays out hierarchy and assigns node coordinates

cluster(root) lays out the specified root hierarchy, assigning the following properties on root and its descendants: node.x (the x-coordinate of the node) and node.y (the y-coordinate of the node). The coordinates x and y represent an arbitrary coordinate system; for example, you can treat x as an angle and y as a radius to produce a radial layout.

cluster.nodeSize(size) sets or gets node size

cluster.nodeSize(size) sets the cluster layout's node size to the specified two-element array of numbers [width, height] and returns the cluster layout, or if size is not specified, returns the current node size, which defaults to null. A node size of null indicates that a layout size will be used instead. When a node size is specified, the root node is always positioned at ⟨0, 0⟩.

cluster.separation(separation) sets or gets separation accessor

cluster.separation(separation) sets the separation accessor to the specified function and returns the cluster layout, or if separation is not specified, returns the current separation accessor. The default separation function is: function separation(a, b) { return a.parent == b.parent ? 1 : 2; }. The separation accessor is used to separate neighboring leaves and is passed two leaves a and b, and must return the desired separation.

Cluster layout example with dendrogram

Example of a cluster layout applied to hierarchical data: const gods = ["Chaos/Gaia/Mountains", "Chaos/Gaia/Pontus", "Chaos/Gaia/Uranus", "Chaos/Eros", "Chaos/Erebus", "Chaos/Tartarus"]; This produces a dendrogram where leaf nodes are at the same depth.

Give your agent this brain