Hylograph.Forces.Link
- Package
- purescript-hylograph-forces
- Repository
- afcondon/purescript-hylograph-forces
The link force: each link is a spring that pulls its two nodes towards a set distance apart.
Ported from d3-force 3.0.0, link.js (ISC, Copyright 2010-2021 Mike
Bostock); see LICENSE.
A link names its nodes by their place in the node array (initialize)
or by an id read off each node (initializeById, which is d3's
force.id(...) and gives d3's error for a link to a node that is not
there).
#strengthFromDegree Source
strengthFromDegree :: forall link. Strength linkd3's default: 1 / min(degree of source, degree of target), so that
links to heavily connected nodes are weaker.
#strengthPerLink Source
strengthPerLink :: forall link. (link -> Number) -> Strength linkA strength asked of each link when the force is initialized.
#defaultConfig Source
defaultConfig :: forall link. Config linkd3's defaults: distance 30, strength from degree, one iteration.
#initialize Source
initialize :: forall row linkRow. Config (Endpoints linkRow) -> Source -> Array (Node row) -> Array (Endpoints linkRow) -> Link rowd3's force.initialize(nodes, random) together with force.links(links),
for links that name their nodes by place in the node array. A link
naming a place outside the array is dropped.
#initializeById Source
initializeById :: forall id row linkRow. Ord id => Show id => (Node row -> id) -> Config (Identified id linkRow) -> Source -> Array (Node row) -> Array (Identified id linkRow) -> Either String (Link row)The same for links that name their nodes by id, as d3's force.id(...)
has it and as Hylograph's links do. A link naming an id that no node has
is d3's error, node not found: <id>.
Re-exports from Hylograph.Forces.Linkage
#Identified Source
type Identified :: Type -> Row Type -> Typetype Identified id row = { source :: id, target :: id | row }
A link, by the ids of its two nodes.
- Modules
- Hylograph.
Forces - Hylograph.
Forces. Center - Hylograph.
Forces. Cohesion - Hylograph.
Forces. Collide - Hylograph.
Forces. Contain - Hylograph.
Forces. Directional - Hylograph.
Forces. Group - Hylograph.
Forces. Link - Hylograph.
Forces. Linkage - Hylograph.
Forces. ManyBody - Hylograph.
Forces. Measure - Hylograph.
Forces. Node - Hylograph.
Forces. Position - Hylograph.
Forces. Quadtree - Hylograph.
Forces. Radial - Hylograph.
Forces. Random - Hylograph.
Forces. RectCollide - Hylograph.
Forces. Snapshot - Hylograph.
Forces. Tick - Hylograph.
Forces. Towards