Documentation
¶
Overview ¶
Package forcelayout places the notes of a graph and their tags, as d3-force did in the browser: a repulsion between every node (Barnes-Hut), springs along the edges, collisions on a small graph, a pull to the center. Deterministic: the same graph gives the same map.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Signature ¶
Signature is a fingerprint of the notes, their tags and links (FNV-1a): a saved layout serves as is only for the same graph.
func Simulate ¶
Simulate places the notes and their tags, in the simulation's units: see Edges for the springs. The pull to the center weakens as the graph grows (1/√ of its nodes), or a big one shrinks into a ball. seed: a layout saved before; the nodes it lacks start next to a neighbor it has, and the whole only settles a little. Without one, a graph past sampleLimit notes is seeded from a sample of its notes: see fromSample.
Types ¶
type Edge ¶
Edge is a spring: a note to one of its tags, or a [[link]].
func Edges ¶
Edges gives the springs of the graph, a note to each of its tags (notes in order, their tags in order), then the [[links]].
- A tag pulls by how rare it is among the n notes, log(n / its notes) / log(n): a tag on half of them says little. Shared among the tags of the note, so a note with many tags is not pulled harder than one with a single tag.
- Its notes sit at √(its notes) collide radii: the room a disk of them needs, so a big tag spreads instead of piling up.
- A [[link]] is a choice, not a vote: short and strong, weakened only on a note with many of them.