Generators return adjacency matrices directly and attach only compact truth metadata. This keeps sparse output useful without attaching a dense probability matrix.
A <- generate_sbm(
n = 200,
K = 3,
alpha = 0.5,
beta = 0.08,
representation = "dense",
seed = 1,
ncores = 1
)
parameters <- get_generator_parameters(A)
table(parameters$g_true)##
## 1 2 3
## 66 56 78
Sparse output is the default where a generator supports it.
netOP re-exports the Matrix-aware mean(),
sum(), diag(), rowMeans(),
rowSums(), colMeans(), and
colSums() generics, so common summaries work after loading
netOP without separately attaching Matrix. Choose
representation = "dense" only when downstream software
requires an ordinary dense matrix.
## n <= 200; using engine = 'base'.
## [1] 200 3
clustering <- spectral_cluster(
A,
K = 3,
spectral_engine = "base",
cluster_engine = "kmeans"
)
table(clustering$g_hat)##
## 1 2 3
## 66 56 78
The public model-selection APIs begin with the network and candidate set. Examples use one worker and small deterministic inputs; production analyses can increase repetition counts and choose partial eigensolvers.
selection <- netcrop_blockmodel(
A,
K_candidates = 1:5,
num_subnetworks = 2,
overlap_size = 50,
nrep = 1,
losses = "sse",
ncores = 1,
seed = 2,
verbose = FALSE,
sbm_est_options = list(spectral_cluster = list(spectral_engine = "base")),
dcbm_est_options = list(spectral_cluster = list(spectral_engine = "base"))
)
selection$best_model_overallSetting seed makes randomized stages reproducible. The
examples use ncores = 1 because that is portable across
operating systems and keeps the vignette deterministic. For larger
analyses, supported routines can use more workers; consult each
function’s seed documentation for its parallel
reproducibility contract.
NETCROP is also available for RDPG and latent-space dimensions and
spectral regularization. The self-contained ECV and NCV wrappers provide
alternative block-model stability selectors; see
?ecv_stability_blockmodel and
?ncv_stability_blockmodel for disclosures, algorithm
restrictions, and citations.
See the choosing-a-method article for a side-by-side
guide to NETCROP, ECV, NCV, DKEST, and SONNET.