Build an adjacency matrix that mixes L neighbors inside a local radius
r with K neighbors outside that radius. Far neighbors receive a
mild penalty so they can contribute without dominating.
Arguments
- coord_mat
Numeric matrix of coordinates (rows = points).
- L
Number of local neighbors (within
r) to keep for each point.- K
Number of far neighbors (outside
r) to keep for each point.- r
Radius defining the local ball.
- weight_mode
Weighting scheme name (e.g., "heat"); forwarded to internal helper get_neighbor_fun.
- sigma
Bandwidth for the heat/normalized kernels; default
r/2.- far_penalty
Either
"lambda"(constant multiplier) or"exp"(decay with distance beyondr).- lambda
Constant multiplier for far neighbors when
far_penalty = "lambda".- tau
Scale of exponential decay when
far_penalty = "exp".- nnk_buffer
Extra candidates requested from the NN search to ensure enough far neighbors are available.
- include_diagonal
Logical; keep self-loops.
- symmetric
Logical; if TRUE, symmetrize by averaging
Aandt(A).- normalized
Logical; if TRUE, row-normalize the matrix (stochastic).