Skip to contents

Node optimization for any connection layout – undirected, undirected with self-connections, or ordered: every connection counts toward each code it connects, a self-connection (a column whose two codes are the same) toward its code self_weight times; each unit's weights are then L1-normalised and the nodes solved by least squares against the points. With an undirected key it matches lws_lsq_positions(); with an ordered key, directed_node_positions() at the same self_weight.

Usage

node_positions_by_key(
  line_weights,
  points,
  numDims,
  key,
  codes,
  self_weight = 2
)

Arguments

line_weights

Numeric matrix (units x connections)

points

Numeric matrix of rotated points (units x dims)

numDims

Number of dimensions

key

Adjacency key: a 2 x n_connections matrix of code names, one column per connection (e.g. set$rotation$adjacency.key)

codes

Character vector of codes; node order

self_weight

Weight of a self-connection in its code's node weight (2 = row + column sum, as ordered models; 1 = once)

Value

List with nodes, centroids, weights, points