code wiki / (root) / nx_kfloor_lib.nx

nx_kfloor_lib.nx

buildroot/runtime/nx_kfloor_lib.nx

6154 B142 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_kfloor_lib.nx -- HIERARCHICAL k-ANONYMITY RELEASE WITH COMPLEMENTARY SUPPRESSION (shared lib, 2026-08-24). THE ONE OWNER of the question "which nodes of an aggregate tree may be published under a floor k". Admitted as a LIBRARY, not a verb of one organ, because every multi-organisation feedback surface on the estate (surveys, connect polls, the community pulse) faces the same two defects and today solves only the first, per organ: 1. a level with fewer than k contributors is withheld (nx_survey_serve already does this, per survey); 2. a PUBLISHED parent minus its PUBLISHED children exposes the withheld remainder -- if that remainder has fewer than k contributors the floor at the child was defeated by subtraction. Nobody on the estate handled (2); the lib exists so nobody has to remember it. Model: Sweeney, k-anonymity, IJUFKS 10(5) 2002 -- a release is k-anonymous when every released group is indistinguishable from at least k-1 others. Here a "group" is the set of contributors behind one published number; the complementary rule keeps every DERIVABLE group at k as well. DATA MODEL (parallel arrays, caller-owned, n nodes): own[i] contributors recorded directly at node i (an organisation's own ballots; 0 for a locality) parent[i] index of the parent node, or KFL_NOPARENT for a root; a forest is allowed tot[i] OUT: own[i] plus every descendant's own (kfl_totals) state[i] OUT: KFL_PUB, KFL_WITHHELD_K (under the floor) or KFL_WITHHELD_COMP (complementary) Every function returns a count or a NAMED negative; nothing here prints, allocates beyond scratch, or reads a file. Pure integer. No sampling: every node is visited every call. license_tier: ORIGINAL

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_kfloor_lib.nx nx_communitypulse.nx

imports: nx_syscalls.nx

imported by: nx_communitypulse.nx

structs

none

consts

25const KFL_NOPARENT: i64 = 0 - 1
26const KFL_WITHHELD_K: i64 = 0
27const KFL_PUB: i64 = 1
28const KFL_WITHHELD_COMP: i64 = 2
29const KFL_ERR_K: i64 = 0 - 1 // k < 1 is not a floor
30const KFL_ERR_TREE: i64 = 0 - 2 // a parent index out of range, or a cycle (walk longer than n)
31const KFL_ERR_N: i64 = 0 - 3 // n < 1: a release over nothing is not a release

functions

35func kfl_totals(own: *i64, parent: *i64, n: i64, tot: *i64) -> i64
called by 1: kfl_release
61func kfl_floor(tot: *i64, n: i64, k: i64, state: *i64) -> i64
called by 1: kfl_release
75func kfl_residual(tot: *i64, parent: *i64, n: i64, state: *i64, i: i64) -> i64
90func kfl_complement_suppress(tot: *i64, parent: *i64, n: i64, k: i64, state: *i64) -> i64
118func kfl_release(own: *i64, parent: *i64, n: i64, k: i64, tot: *i64, state: *i64) -> i64
129func kfl_partition(state: *i64, n: i64, out3: *i64) -> i64