Validate and Flatten a Relationship Matrix for Lookup
Source:R/calculate_adjacency_score.R
prep_relationship.RdValidates relationship and packs it into a flat numeric vector plus
row/column level vectors that adjacency_score_vec() can index into in
constant time per cell. speed() calls this once before the SA loop so
the per-iteration cost stays in the lookup itself. Direct callers of
calculate_adjacency_score() must wrap their matrix with this function
before passing - the score functions consume the prepped form only.