Skip to contents

LCDA-GRASP: fixed-parameter variant.

Usage

lcda_grasp(
  g,
  alpha_c = 0.1,
  alpha_s = 0.3,
  variant = 1,
  B = 50,
  centrality = "eigen",
  similarity = "hpi",
  verbose = FALSE,
  seed = NA_integer_
)

Arguments

g

an igraph object (undirected, simple).

alpha_c, alpha_s

RCL parameters.

variant

1 or 2.

B

number of GRASP iterations.

centrality, similarity

metric names.

verbose

logical; show a cli progress bar and a final summary.

seed

integer RNG seed, or `NA` to leave the RNG untouched.

Value

an object of class `lcda_grasp_result`: best partition, Q/H traces, the parameters used, the wall-clock `elapsed` time in seconds, and the (simplified) input `graph`, so that [lcda_metrics()] and [plot()] can be called on the result alone.

Details

Weighted graphs: a numeric `weight` edge attribute is honoured by the modularity objective and the local search, but the construction (similarity and centrality) and the NCE leader score remain *structural* (unweighted).

See also

[lcda_metrics()] for the paper's metric surface computed from a result, and [plot.lcda_grasp_result()] for the community-and-leader map.

Examples

g <- igraph::make_graph("Zachary")
res <- lcda_grasp(g, B = 20, seed = 1)
res$best$Q
#> [1] 0.4020381
res$best$leaders
#> [1] 34  1  6
res$elapsed                       # wall-clock seconds
#> [1] 0.082