Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

README.md

curve.chain_ranks (procNode)

Follow each element's link until a root, by pointer jumping: the root each element reaches and how many links it took. A root links to itself.

Each round of the jump kernel in rank mode doubles the reach of every link, so rounds rounds resolve chains of up to 2^rounds links. rank is the distance to the root. curve.grow ranks chains of nodes and the tree of chains with it. The mode reads no pairs and counts no changes, so the bindings it leaves unread take runs of their own (core.scratch).

Built from: op.device.kernel (jump), core.scratch, g:fold.

Inputs

  • parent (Column<Int>). For each element, the element it links to; a root names itself.
  • rounds (Float). Default 1. At least 1. How many doubling rounds run; a chain of up to 2^rounds links reaches its root.

Outputs

  • root: an Int column: the root each element reaches.
  • rank: an Int column: how many links each element is from its root.

Example

local parent = g.core.column({ values = { 0, 0, 1, 2 } })
local ranks = g.curve.chain_ranks({ parent = parent, rounds = 2 })

The chain 3 to 2 to 1 to 0: ranks.root holds 0, 0, 0, 0 and ranks.rank holds 0, 1, 2, 3.