build_multiscale_connectivity_matrix: Build a multiscale H3 connectivity matrix

View source: R/multiscale_connect_matrix.R

build_multiscale_connectivity_matrixR Documentation

Build a multiscale H3 connectivity matrix

Description

Construct a symmetric sparse connectivity matrix linking each finer H3 planning unit to its parent at the next coarser resolution. This is typically used as the data input to add_multiscale_connectivity_penalties().

Usage

build_multiscale_connectivity_matrix(maps, symmetric = TRUE)

Arguments

maps

A list as returned by build_h3_maps(), containing at least h3_vec, res_vec, res_levels, and row_idx_by_h3.

symmetric

Logical; if TRUE (default), the matrix is symmetrised so that each parent–child link appears in both directions.

Value

A Matrix::dgCMatrix connectivity matrix of size ⁠n_pu × n_pu⁠.

Examples

# Minimal 2-resolution parent-child example
h3_child  <- "8a2a1072b59ffff"
h3_parent <- "872a1072bffffff"

maps <- build_h3_maps(
  s_or_h3 = c(h3_parent, h3_child),
  res_vec = c(7L, 8L)
)

conn <- build_multiscale_connectivity_matrix(maps)
conn


MultiscaleSCP documentation built on March 30, 2026, 5:08 p.m.