Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
d690ad3
refactor: Rename normalization flags to `normalized` (#2788)
claude Aug 17, 2026
e6c206e
Merge branch 'claude/issue-2788-subagents-faw1t1-3' into claude/issue…
schochastics Oct 15, 2026
404b0db
chore: Regenerate migration blocks after merging the base branch
schochastics Oct 15, 2026
9712425
Merge branch 'claude/issue-2788-subagents-faw1t1-3' into claude/issue…
schochastics Dec 2, 2026
e5f2c44
Merge branch 'claude/issue-2788-subagents-faw1t1-3' into claude/issue…
schochastics Dec 2, 2026
9b75754
Merge branch 'claude/issue-2788-subagents-faw1t1-3' into claude/issue…
schochastics Dec 2, 2026
4739a75
Merge branch 'claude/issue-2788-subagents-faw1t1-3' into claude/issue…
schochastics Dec 2, 2026
82385e6
Merge branch 'claude/issue-2788-subagents-faw1t1-3' into claude/issue…
schochastics Dec 3, 2026
f0221db
chore: Auto-update from GitHub Actions
schochastics Dec 3, 2026
a29cb73
Merge branch 'claude/issue-2788-subagents-faw1t1-3' into claude/issue…
schochastics Dec 3, 2026
72f4f69
Merge branch 'claude/issue-2788-subagents-faw1t1-3' into claude/issue…
schochastics Dec 3, 2026
49776b8
Merge branch 'claude/issue-2788-subagents-faw1t1-3' into claude/issue…
schochastics Dec 3, 2026
0c23afd
Merge branch 'claude/issue-2788-subagents-faw1t1-3' into claude/issue…
schochastics Dec 3, 2026
7643105
Merge branch 'claude/issue-2788-subagents-faw1t1-3' into claude/issue…
schochastics Dec 3, 2026
b34cf16
Merge branch 'claude/issue-2788-subagents-faw1t1-3' into claude/issue…
schochastics Dec 3, 2026
2ddf33c
Merge remote-tracking branch 'origin/claude/issue-2788-subagents-faw1…
schochastics Dec 3, 2026
f9fe5a4
Merge remote-tracking branch 'origin/claude/issue-2788-subagents-faw1…
schochastics Dec 3, 2026
2034c65
Merge remote-tracking branch 'origin/claude/issue-2788-subagents-faw1…
schochastics Dec 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 38 additions & 14 deletions R/centrality.R
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ edge.betweenness <- function(
#' `bonpow()` was renamed to [power_centrality()] to create a more
#' consistent API.
#' @inheritParams power_centrality
#' @param rescale `r lifecycle::badge("deprecated")` Use `normalized` in
#' [power_centrality()] instead.
#' @keywords internal
#' @export
bonpow <- function(
Expand All @@ -251,7 +253,7 @@ bonpow <- function(
nodes = nodes,
loops = loops,
exponent = exponent,
rescale = rescale,
normalized = rescale,
tol = tol,
sparse = sparse
)
Expand Down Expand Up @@ -1749,7 +1751,7 @@ diversity <- function(
#' scores are the same as authority scores.
#'
#' @param graph The input graph.
#' @param scale Logical, whether to scale the result to have a maximum
#' @param normalized Logical, whether to scale the result to have a maximum
#' score of one. If no scaling is used then the result vector has unit length
#' in the Euclidean norm.
#' @param weights Optional positive weight vector for calculating weighted
Expand All @@ -1759,6 +1761,7 @@ diversity <- function(
#' edges are effectively added up.
#' @param options A named list, to override some ARPACK options. See
#' [arpack()] for details. The default `NULL` uses [arpack_defaults()].
#' @param scale `r lifecycle::badge("deprecated")` Use `normalized` instead.
#' @inheritParams rlang::args_dots_empty
#' @return A named list with members:
#' \describe{
Expand Down Expand Up @@ -1796,19 +1799,35 @@ diversity <- function(
hits_scores <- function(
graph,
...,
scale = TRUE,
normalized = TRUE,
weights = NULL,
options = NULL
options = NULL,
scale = deprecated()
) {
rlang::check_dots_empty()

if (lifecycle::is_present(scale)) {
if (!missing(normalized)) {
cli::cli_abort(c(
"Argument {.arg normalized} of {.fn hits_scores} was supplied more than once.",
i = "It was also supplied via its legacy name {.arg scale}."
))
}
lifecycle::deprecate_soft(
"3.0.0",
"hits_scores(scale = )",
"hits_scores(normalized = )"
)
normalized <- scale
}

if (is.null(options)) {
options <- arpack_defaults()
}

hub_and_authority_scores_impl(
graph = graph,
scale = scale,
scale = normalized,
weights = weights,
options = options
)
Expand Down Expand Up @@ -1840,7 +1859,7 @@ authority_score <- function(

scores <- hits_scores(
graph = graph,
scale = scale,
normalized = scale,
weights = weights,
options = options
)
Expand Down Expand Up @@ -1885,7 +1904,7 @@ hub_score <- function(

scores <- hits_scores(
graph = graph,
scale = scale,
normalized = scale,
weights = weights,
options = options
)
Expand Down Expand Up @@ -2309,7 +2328,7 @@ bonpow.sparse <- function(
#' loops. `loops` is `FALSE` by default.
#' @param exponent exponent (decay rate) for the Bonacich power centrality
#' score; can be negative
#' @param rescale if true, centrality scores are rescaled such that they sum to
#' @param normalized if true, centrality scores are rescaled such that they sum to
#' 1.
#' @param tol tolerance for near-singularities during matrix inversion (see
#' [Matrix::solve()])
Expand Down Expand Up @@ -2368,14 +2387,16 @@ power_centrality <- function(
...,
loops = FALSE,
exponent = 1,
rescale = FALSE,
normalized = FALSE,
tol = 1e-7,
sparse = TRUE,
weights = NULL
) {
# BEGIN GENERATED ARG_HANDLE: power_centrality, do not edit, see tools/generate-migrations.R
# fmt: skip
if (...length() > 0L) {
.arg_forbidden <- base::intersect(base::names(base::sys.call()), base::c("n", "no"))
if (base::length(.arg_forbidden) > 0L) cli::cli_abort(base::c("Argument {.arg {(.arg_forbidden)}} matches multiple formal arguments of {.fn power_centrality}.", i = "Spell out the full argument name."))
# Pre-3.0.0 signature: power_centrality(graph, nodes, loops, exponent, rescale, tol, sparse, weights)
.old_signature <- function(loops, exponent, rescale, tol, sparse, weights, ...) {
if (...length() > 0L) {
Expand All @@ -2387,7 +2408,7 @@ power_centrality <- function(
base::list(env = base::environment(), recovered = base::c(
if (!base::missing(loops)) base::c(loops = "loops"),
if (!base::missing(exponent)) base::c(exponent = "exponent"),
if (!base::missing(rescale)) base::c(rescale = "rescale"),
if (!base::missing(rescale)) base::c(normalized = "rescale"),
if (!base::missing(tol)) base::c(tol = "tol"),
if (!base::missing(sparse)) base::c(sparse = "sparse"),
if (!base::missing(weights)) base::c(weights = "weights")
Expand All @@ -2396,7 +2417,6 @@ power_centrality <- function(
.arg_given <- base::c(
if (!base::missing(loops)) "loops",
if (!base::missing(exponent)) "exponent",
if (!base::missing(rescale)) "rescale",
if (!base::missing(tol)) "tol",
if (!base::missing(sparse)) "sparse",
if (!base::missing(weights)) "weights"
Expand All @@ -2405,6 +2425,10 @@ power_centrality <- function(
.arg_recovered <- .arg_handle$recovered[!base::is.element(.arg_handle$recovered, .arg_given)]
if (base::length(.arg_recovered) > 0L) {
.arg_names <- base::names(.arg_recovered)
.arg_conflict <- base::intersect(.arg_names, base::c(
if (!base::missing(normalized)) "normalized"
))
if (base::length(.arg_conflict) > 0L) cli::cli_abort(base::c("Argument {.arg {(.arg_conflict)}} of {.fn power_centrality} was supplied more than once.", i = "Pass it exactly once, by its new name {.arg {(.arg_conflict)}}."))
for (.arg_i in base::seq_along(.arg_recovered)) base::do.call(base::delayedAssign, base::list(.arg_names[[.arg_i]], base::call("[[", .arg_handle$env, .arg_recovered[[.arg_i]]), base::baseenv(), base::environment()))
.arg_dots <- base::substitute(...())
.arg_tags <- base::as.character(base::names(.arg_dots))
Expand All @@ -2413,7 +2437,7 @@ power_centrality <- function(
.arg_shown <- base::ifelse(base::is.na(.arg_tag_of), .arg_recovered, base::paste0(.arg_tag_of, " = "))
lifecycle::deprecate_soft(
"3.0.0",
what = base::I("Calling `power_centrality()` with positional or abbreviated arguments"),
what = base::I("Calling `power_centrality()` with positional, abbreviated or renamed arguments"),
details = base::c(
i = base::paste0("Detected call: power_centrality(", base::paste(base::c("graph", "nodes", .arg_shown), collapse = ", "), ")"),
i = base::paste0("Use instead: power_centrality(", base::paste(base::c("graph", "nodes", base::paste0(.arg_names, " = ")), collapse = ", "), ")")
Expand All @@ -2434,7 +2458,7 @@ power_centrality <- function(
nodes,
loops,
exponent,
rescale,
normalized,
tol,
weights = weights
)
Expand All @@ -2444,7 +2468,7 @@ power_centrality <- function(
nodes,
loops,
exponent,
rescale,
normalized,
tol,
weights = weights
)
Expand Down
27 changes: 15 additions & 12 deletions R/tkplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ tkplot.off <- function() {
#' consistent API.
#' As [tkplot()] is defunct, neither function has a plot to act on.
#' @inheritParams tk_coords
#' @param norm `r lifecycle::badge("deprecated")` Use `normalized` in
#' [tk_coords()] instead.
#' @keywords internal
#' @export
tkplot.getcoords <- function(tkp.id, norm = FALSE) {
# nocov start
lifecycle::deprecate_warn("2.0.0", "tkplot.getcoords()", "tk_coords()")
tk_coords(tkp.id = tkp.id, norm = norm)
tk_coords(tkp.id = tkp.id, normalized = norm)
} # nocov end

#' Interactive plotting of graphs
Expand Down Expand Up @@ -228,7 +230,7 @@ assign(".next", 1, .tkplot.env)
#' @param width The width of the rectangle for generating new coordinates.
#' @param height The height of the rectangle for generating new coordinates.
#' @param newlayout The new layout, see the `layout` parameter of tkplot.
#' @param norm Logical, should we norm the coordinates.
#' @param normalized Logical, should we norm the coordinates.
#' @param coords Two-column numeric matrix, the new coordinates of the
#' vertices, in absolute coordinates.
#' @param degree The degree to rotate the plot.
Expand Down Expand Up @@ -661,7 +663,7 @@ tk_postscript <- function(tkp.id) {
tk_coords <- function(
tkp.id,
...,
norm = FALSE
normalized = FALSE
) {
# BEGIN GENERATED ARG_HANDLE: tk_coords, do not edit, see tools/generate-migrations.R
# fmt: skip
Expand All @@ -675,16 +677,17 @@ tk_coords <- function(
cli::cli_abort(base::c("Unexpected argument passed to {.fn tk_coords}: {.arg {(.arg_extra)}}.", i = "Arguments after {.arg ...} must be spelled out in full."), call = base::parent.frame())
}
base::list(env = base::environment(), recovered = base::c(
if (!base::missing(norm)) base::c(norm = "norm")
if (!base::missing(norm)) base::c(normalized = "norm")
))
}
.arg_given <- base::c(
if (!base::missing(norm)) "norm"
)
.arg_handle <- base::eval(base::as.call(base::c(base::quote(.old_signature), base::structure(base::rep(base::list(NULL), base::length(.arg_given)), names = .arg_given), base::quote(...))))
.arg_recovered <- .arg_handle$recovered[!base::is.element(.arg_handle$recovered, .arg_given)]
.arg_handle <- .old_signature(...)
.arg_recovered <- .arg_handle$recovered
if (base::length(.arg_recovered) > 0L) {
.arg_names <- base::names(.arg_recovered)
.arg_conflict <- base::intersect(.arg_names, base::c(
if (!base::missing(normalized)) "normalized"
))
if (base::length(.arg_conflict) > 0L) cli::cli_abort(base::c("Argument {.arg {(.arg_conflict)}} of {.fn tk_coords} was supplied more than once.", i = "Pass it exactly once, by its new name {.arg {(.arg_conflict)}}."))
for (.arg_i in base::seq_along(.arg_recovered)) base::do.call(base::delayedAssign, base::list(.arg_names[[.arg_i]], base::call("[[", .arg_handle$env, .arg_recovered[[.arg_i]]), base::baseenv(), base::environment()))
.arg_dots <- base::substitute(...())
.arg_tags <- base::as.character(base::names(.arg_dots))
Expand All @@ -693,7 +696,7 @@ tk_coords <- function(
.arg_shown <- base::ifelse(base::is.na(.arg_tag_of), .arg_recovered, base::paste0(.arg_tag_of, " = "))
lifecycle::deprecate_soft(
"3.0.0",
what = base::I("Calling `tk_coords()` with positional or abbreviated arguments"),
what = base::I("Calling `tk_coords()` with positional, abbreviated or renamed arguments"),
details = base::c(
i = base::paste0("Detected call: tk_coords(", base::paste(base::c("tkp.id", .arg_shown), collapse = ", "), ")"),
i = base::paste0("Use instead: tk_coords(", base::paste(base::c("tkp.id", base::paste0(.arg_names, " = ")), collapse = ", "), ")")
Expand All @@ -706,7 +709,7 @@ tk_coords <- function(
# nocov start
coords <- .tkplot.get(tkp.id, "coords")
coords[, 2] <- max(coords[, 2]) - coords[, 2]
if (norm) {
if (normalized) {
# Shift
coords[, 1] <- coords[, 1] - min(coords[, 1])
coords[, 2] <- coords[, 2] - min(coords[, 2])
Expand Down Expand Up @@ -1781,7 +1784,7 @@ tk_canvas <- function(tkp.id) {
layout$params[[i]]$type == "initial" &&
params[[i]]
) {
realparams[[i]] <- tk_coords(tkp.id, norm = TRUE)
realparams[[i]] <- tk_coords(tkp.id, normalized = TRUE)
}
}
if (as.logical(tcltk::tclvalue(save.default))) {
Expand Down
4 changes: 2 additions & 2 deletions man/bonpow.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions man/hits_scores.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/power_centrality.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/tkplot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/tkplot.getcoords.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions tests/testthat/_snaps/centrality.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,24 @@
i Please use `arpack_defaults()` instead.
i So the function arpack_defaults(), not an object called arpack_defaults.

# hits_scores(scale = ) is deprecated but still works

Code
res_legacy <- hits_scores(g, scale = FALSE)
Condition
Warning:
The `scale` argument of `hits_scores()` is deprecated as of igraph 3.0.0.
i Please use the `normalized` argument instead.

---

Code
hits_scores(g, normalized = FALSE, scale = FALSE)
Condition
Error in `hits_scores()`:
! Argument `normalized` of `hits_scores()` was supplied more than once.
i It was also supplied via its legacy name `scale`.

# eigen_centrality() deprecated scale argument

Code
Expand Down
Loading
Loading