Calculate Log Spanning Tree Compactness

comp_log_st(plans, shp, counties = NULL, adj)

Arguments

plans

A redist_plans object or plans_matrix where each row indicates a district assignment and each column is a plan.

shp

A redist_map object, tibble, or data frame with an sf geometry column.

counties

column name in shp containing counties

adj

Zero-indexed adjacency list. Not required if a redist_map is supplied for shp.

Value

A numeric vector. Can be shaped into a district-by-plan matrix.

References

Cory McCartan and Kosuke Imai. 2020. Sequential Monte Carlo for Sampling Balanced and Compact Redistricting Plans.

Examples

data(nh)
data(nh_m)
# For a single plan:
comp_log_st(plans = nh$r_2020, shp = nh, counties = county, adj = nh$adj)
#> [1] -Inf -Inf

# Or many plans:
comp_log_st(plans = nh_m[, 3:5], shp = nh, counties = county, adj = nh$adj)
#> [1] 387.2177 387.2177     -Inf     -Inf     -Inf     -Inf