diff --git a/R/centralization.R b/R/centralization.R index 5d9a3cd52c5..94734e09f3e 100644 --- a/R/centralization.R +++ b/R/centralization.R @@ -42,7 +42,7 @@ centralization.evcent.tmax <- function( ) centr_eigen_tmax( graph = graph, - nodes = nodes, + n = nodes, directed = directed, scale = scale ) @@ -98,7 +98,7 @@ centralization.degree.tmax <- function( "centralization.degree.tmax()", "centr_degree_tmax()" ) - centr_degree_tmax(graph = graph, nodes = nodes, mode = mode, loops = loops) + centr_degree_tmax(graph = graph, n = nodes, mode = mode, loops = loops) } # nocov end #' Centralize a graph according to the degrees of vertices @@ -152,7 +152,7 @@ centralization.closeness.tmax <- function( "centralization.closeness.tmax()", "centr_clo_tmax()" ) - centr_clo_tmax(graph = graph, nodes = nodes, mode = mode) + centr_clo_tmax(graph = graph, n = nodes, mode = mode) } # nocov end #' Centralize a graph according to the closeness of vertices @@ -200,7 +200,7 @@ centralization.betweenness.tmax <- function( "centralization.betweenness.tmax()", "centr_betw_tmax()" ) - centr_betw_tmax(graph = graph, nodes = nodes, directed = directed) + centr_betw_tmax(graph = graph, n = nodes, directed = directed) } # nocov end #' Centralize a graph according to the betweenness of vertices @@ -463,8 +463,10 @@ centr_degree <- function( #' #' See [centralize()] for a summary of graph centralization. #' -#' @param graph The input graph. It can also be `NULL` if `nodes` is given. -#' @param nodes The number of vertices. This is ignored if the graph is given. +#' @param graph The input graph. It can also be `NULL` if `n` is given. +#' @param n The number of vertices. This is ignored if the graph is given. +#' @param nodes `r lifecycle::badge("deprecated")` Use `n` instead. +#' @inheritParams rlang::args_dots_empty #' @param mode This is the same as the `mode` argument of `degree()`. Ignored #' if `graph` is given and the graph is undirected. #' @inheritParams centr_degree @@ -483,10 +485,64 @@ centr_degree <- function( #' centr_degree(g, normalized = TRUE)$centralization centr_degree_tmax <- function( graph = NULL, - nodes = 0, + n = 0, + ..., mode = c("all", "out", "in", "total"), - loops + loops, + nodes = deprecated() ) { + # BEGIN GENERATED ARG_HANDLE: centr_degree_tmax, do not edit, see tools/generate-migrations.R + # fmt: skip + if (...length() > 0L) { + # Pre-3.0.0 signature: centr_degree_tmax(graph, nodes, mode, loops) + .old_signature <- function(mode, loops, ...) { + if (...length() > 0L) { + .arg_extra <- base::names(base::substitute(...())) + .arg_extra <- .arg_extra[base::nzchar(.arg_extra)] + if (base::length(.arg_extra) == 0L) cli::cli_abort("Too many arguments passed to {.fn centr_degree_tmax}.", call = base::parent.frame()) + cli::cli_abort(base::c("Unexpected argument passed to {.fn centr_degree_tmax}: {.arg {(.arg_extra)}}.", i = "Arguments after {.arg ...} must be spelled out in full."), call = base::parent.frame()) + } + base::c( + if (!base::missing(mode)) base::list(mode = mode), + if (!base::missing(loops)) base::list(loops = loops) + ) + } + .arg_handle <- .old_signature(...) + if (base::length(.arg_handle) > 0L) { + .arg_names <- base::names(.arg_handle) + .arg_conflict <- base::intersect(.arg_names, base::c( + if (!base::missing(mode)) "mode", + if (!base::missing(loops)) "loops" + )) + if (base::length(.arg_conflict) > 0L) cli::cli_abort(base::c("Argument {.arg {(.arg_conflict)}} of {.fn centr_degree_tmax} was supplied more than once.", i = "Pass it exactly once, by its new name {.arg {(.arg_conflict)}}.")) + base::list2env(.arg_handle, base::environment()) + lifecycle::deprecate_soft( + "3.0.0", + what = base::I("Calling `centr_degree_tmax()` with positional or abbreviated arguments"), + details = base::c( + i = base::paste0("Detected call: centr_degree_tmax(", base::paste(base::c("graph", "n", .arg_names), collapse = ", "), ")"), + i = base::paste0("Use instead: centr_degree_tmax(", base::paste(base::c("graph", "n", base::paste0(.arg_names, " = ")), collapse = ", "), ")") + ) + ) + } + } + # END GENERATED ARG_HANDLE + + if (lifecycle::is_present(nodes)) { + if (!missing(n)) { + cli::cli_abort(c( + "Argument {.arg n} of {.fn centr_degree_tmax} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg nodes}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "centr_degree_tmax(nodes = )", + "centr_degree_tmax(n = )" + ) + n <- nodes + } + if (!lifecycle::is_present(loops)) { lifecycle::deprecate_stop( when = "2.0.0", @@ -498,14 +554,14 @@ centr_degree_tmax <- function( # Argument checks ensure_igraph(graph, optional = TRUE) - nodes <- as.numeric(nodes) + n <- as.numeric(n) loops <- as.logical(loops) # Function call res <- centralization_degree_tmax_impl( graph = graph, - nodes = nodes, + nodes = n, mode = mode, loops = loops ) @@ -615,9 +671,10 @@ centr_betw <- function( #' See [centralize()] for a summary of graph centralization. #' #' @param graph The input graph. It can also be `NULL` if -#' `nodes` and `directed` are both given. -#' @param nodes The number of vertices. This is ignored if the graph is +#' `n` and `directed` are both given. +#' @param n The number of vertices. This is ignored if the graph is #' given. +#' @param nodes `r lifecycle::badge("deprecated")` Use `n` instead. #' @inheritParams rlang::args_dots_empty #' @param directed Logical, whether to use directed shortest paths #' for calculating betweenness. Ignored if an undirected graph was @@ -638,9 +695,10 @@ centr_betw <- function( #' centr_betw(g, normalized = TRUE)$centralization centr_betw_tmax <- function( graph = NULL, - nodes = 0, + n = 0, ..., - directed = TRUE + directed = TRUE, + nodes = deprecated() ) { # BEGIN GENERATED ARG_HANDLE: centr_betw_tmax, do not edit, see tools/generate-migrations.R # fmt: skip @@ -669,17 +727,32 @@ centr_betw_tmax <- function( "3.0.0", what = base::I("Calling `centr_betw_tmax()` with positional or abbreviated arguments"), details = base::c( - i = base::paste0("Detected call: centr_betw_tmax(", base::paste(base::c("graph", "nodes", .arg_names), collapse = ", "), ")"), - i = base::paste0("Use instead: centr_betw_tmax(", base::paste(base::c("graph", "nodes", base::paste0(.arg_names, " = ")), collapse = ", "), ")") + i = base::paste0("Detected call: centr_betw_tmax(", base::paste(base::c("graph", "n", .arg_names), collapse = ", "), ")"), + i = base::paste0("Use instead: centr_betw_tmax(", base::paste(base::c("graph", "n", base::paste0(.arg_names, " = ")), collapse = ", "), ")") ) ) } } # END GENERATED ARG_HANDLE + if (lifecycle::is_present(nodes)) { + if (!missing(n)) { + cli::cli_abort(c( + "Argument {.arg n} of {.fn centr_betw_tmax} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg nodes}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "centr_betw_tmax(nodes = )", + "centr_betw_tmax(n = )" + ) + n <- nodes + } + centralization_betweenness_tmax_impl( graph = graph, - nodes = nodes, + nodes = n, directed = directed ) } @@ -776,9 +849,10 @@ centr_clo <- function( #' See [centralize()] for a summary of graph centralization. #' #' @param graph The input graph. It can also be `NULL` if -#' `nodes` is given. -#' @param nodes The number of vertices. This is ignored if the graph is +#' `n` is given. +#' @param n The number of vertices. This is ignored if the graph is #' given. +#' @param nodes `r lifecycle::badge("deprecated")` Use `n` instead. #' @inheritParams rlang::args_dots_empty #' @param mode This is the same as the `mode` argument of #' `closeness()`. Ignored if an undirected graph is given. @@ -798,9 +872,10 @@ centr_clo <- function( #' centr_clo(g, normalized = TRUE)$centralization centr_clo_tmax <- function( graph = NULL, - nodes = 0, + n = 0, ..., - mode = c("out", "in", "all", "total") + mode = c("out", "in", "all", "total"), + nodes = deprecated() ) { # BEGIN GENERATED ARG_HANDLE: centr_clo_tmax, do not edit, see tools/generate-migrations.R # fmt: skip @@ -829,17 +904,32 @@ centr_clo_tmax <- function( "3.0.0", what = base::I("Calling `centr_clo_tmax()` with positional or abbreviated arguments"), details = base::c( - i = base::paste0("Detected call: centr_clo_tmax(", base::paste(base::c("graph", "nodes", .arg_names), collapse = ", "), ")"), - i = base::paste0("Use instead: centr_clo_tmax(", base::paste(base::c("graph", "nodes", base::paste0(.arg_names, " = ")), collapse = ", "), ")") + i = base::paste0("Detected call: centr_clo_tmax(", base::paste(base::c("graph", "n", .arg_names), collapse = ", "), ")"), + i = base::paste0("Use instead: centr_clo_tmax(", base::paste(base::c("graph", "n", base::paste0(.arg_names, " = ")), collapse = ", "), ")") ) ) } } # END GENERATED ARG_HANDLE + if (lifecycle::is_present(nodes)) { + if (!missing(n)) { + cli::cli_abort(c( + "Argument {.arg n} of {.fn centr_clo_tmax} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg nodes}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "centr_clo_tmax(nodes = )", + "centr_clo_tmax(n = )" + ) + n <- nodes + } + centralization_closeness_tmax_impl( graph = graph, - nodes = nodes, + nodes = n, mode = mode ) } @@ -923,9 +1013,11 @@ centr_eigen <- function( #' See [centralize()] for a summary of graph centralization. #' #' @param graph The input graph. It can also be `NULL`, if -#' `nodes` is given. -#' @param nodes The number of vertices. This is ignored if the graph is +#' `n` is given. +#' @param n The number of vertices. This is ignored if the graph is #' given. +#' @param nodes `r lifecycle::badge("deprecated")` Use `n` instead. +#' @inheritParams rlang::args_dots_empty #' @param directed Logical, whether to consider edge directions #' during the calculation. Ignored in undirected graphs. #' @param scale `r lifecycle::badge("deprecated")` Ignored. Computing @@ -946,10 +1038,64 @@ centr_eigen <- function( #' centr_eigen(g, normalized = TRUE)$centralization centr_eigen_tmax <- function( graph = NULL, - nodes = 0, + n = 0, + ..., directed = FALSE, - scale = deprecated() + scale = deprecated(), + nodes = deprecated() ) { + # BEGIN GENERATED ARG_HANDLE: centr_eigen_tmax, do not edit, see tools/generate-migrations.R + # fmt: skip + if (...length() > 0L) { + # Pre-3.0.0 signature: centr_eigen_tmax(graph, nodes, directed, scale) + .old_signature <- function(directed, scale, ...) { + if (...length() > 0L) { + .arg_extra <- base::names(base::substitute(...())) + .arg_extra <- .arg_extra[base::nzchar(.arg_extra)] + if (base::length(.arg_extra) == 0L) cli::cli_abort("Too many arguments passed to {.fn centr_eigen_tmax}.", call = base::parent.frame()) + cli::cli_abort(base::c("Unexpected argument passed to {.fn centr_eigen_tmax}: {.arg {(.arg_extra)}}.", i = "Arguments after {.arg ...} must be spelled out in full."), call = base::parent.frame()) + } + base::c( + if (!base::missing(directed)) base::list(directed = directed), + if (!base::missing(scale)) base::list(scale = scale) + ) + } + .arg_handle <- .old_signature(...) + if (base::length(.arg_handle) > 0L) { + .arg_names <- base::names(.arg_handle) + .arg_conflict <- base::intersect(.arg_names, base::c( + if (!base::missing(directed)) "directed", + if (!base::missing(scale)) "scale" + )) + if (base::length(.arg_conflict) > 0L) cli::cli_abort(base::c("Argument {.arg {(.arg_conflict)}} of {.fn centr_eigen_tmax} was supplied more than once.", i = "Pass it exactly once, by its new name {.arg {(.arg_conflict)}}.")) + base::list2env(.arg_handle, base::environment()) + lifecycle::deprecate_soft( + "3.0.0", + what = base::I("Calling `centr_eigen_tmax()` with positional or abbreviated arguments"), + details = base::c( + i = base::paste0("Detected call: centr_eigen_tmax(", base::paste(base::c("graph", "n", .arg_names), collapse = ", "), ")"), + i = base::paste0("Use instead: centr_eigen_tmax(", base::paste(base::c("graph", "n", base::paste0(.arg_names, " = ")), collapse = ", "), ")") + ) + ) + } + } + # END GENERATED ARG_HANDLE + + if (lifecycle::is_present(nodes)) { + if (!missing(n)) { + cli::cli_abort(c( + "Argument {.arg n} of {.fn centr_eigen_tmax} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg nodes}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "centr_eigen_tmax(nodes = )", + "centr_eigen_tmax(n = )" + ) + n <- nodes + } + if (lifecycle::is_present(scale)) { lifecycle::deprecate_warn( "2.2.0", @@ -961,7 +1107,7 @@ centr_eigen_tmax <- function( centralization_eigenvector_centrality_tmax_impl( graph = graph, - nodes = nodes, + nodes = n, directed = directed, scale = TRUE ) diff --git a/R/foreign.R b/R/foreign.R index d0768024e41..52b7f517fe0 100644 --- a/R/foreign.R +++ b/R/foreign.R @@ -67,6 +67,8 @@ read.graph <- function( #' `graph.graphdb()` was renamed to [graph_from_graphdb()] to create a more #' consistent API. #' @inheritParams graph_from_graphdb +#' @param nodes `r lifecycle::badge("deprecated")` Use `n` in +#' [graph_from_graphdb()] instead. #' @keywords internal #' @export graph.graphdb <- function( @@ -86,7 +88,7 @@ graph.graphdb <- function( url = url, prefix = prefix, type = type, - nodes = nodes, + n = nodes, pair = pair, which = which, base = base, @@ -785,7 +787,7 @@ write.graph.dot <- function(graph, file) { #' [read_graph()] with the proper arguments to read the file. #' #' If `url` is `NULL`, and this is the default, then the filename is -#' assembled from the `base`, `prefix`, `type`, `nodes`, +#' assembled from the `base`, `prefix`, `type`, `n`, #' `pair` and `which` arguments. #' #' Unfortunately the original graph database homepage is now defunct, but see @@ -804,7 +806,7 @@ write.graph.dot <- function(graph, file) { #' `m3Dr4`, `m3Dr6`, `m4D`, `m4Dr2`, `m4Dr4`, #' `m4Dr6`, `b03`, `b03m`, `b06`, `b06m`, `b09`, #' `b09m`. -#' @param nodes The number of vertices in the graph. +#' @param n The number of vertices in the graph. #' @param pair Specifies which graph of the pair to read. Possible values: #' `A` and `B`. #' @param which Gives the number of the graph to read. For every graph type @@ -829,7 +831,7 @@ graph_from_graphdb <- function( ..., prefix = "iso", type = "r001", - nodes = NULL, + n = NULL, pair = "A", which = 0, base = "https://github.com/igraph/graphsdb/raw/refs/heads/main", @@ -852,7 +854,7 @@ graph_from_graphdb <- function( base::c( if (!base::missing(prefix)) base::list(prefix = prefix), if (!base::missing(type)) base::list(type = type), - if (!base::missing(nodes)) base::list(nodes = nodes), + if (!base::missing(nodes)) base::list(n = nodes), if (!base::missing(pair)) base::list(pair = pair), if (!base::missing(which)) base::list(which = which), if (!base::missing(base)) base::list(base = base), @@ -866,7 +868,7 @@ graph_from_graphdb <- function( .arg_conflict <- base::intersect(.arg_names, base::c( if (!base::missing(prefix)) "prefix", if (!base::missing(type)) "type", - if (!base::missing(nodes)) "nodes", + if (!base::missing(n)) "n", if (!base::missing(pair)) "pair", if (!base::missing(which)) "which", if (!base::missing(base)) "base", @@ -879,7 +881,7 @@ graph_from_graphdb <- function( "3.0.0", what = base::I("Calling `graph_from_graphdb()` with positional or abbreviated arguments"), details = base::c( - i = base::paste0("Detected call: graph_from_graphdb(", base::paste(base::c("url", .arg_names), collapse = ", "), ")"), + i = base::paste0("Detected call: graph_from_graphdb(", base::paste(base::c("url", base::c(prefix = "prefix", type = "type", n = "nodes", pair = "pair", which = "which", base = "base", compressed = "compressed", directed = "directed")[.arg_names]), collapse = ", "), ")"), i = base::paste0("Use instead: graph_from_graphdb(", base::paste(base::c("url", base::paste0(.arg_names, " = ")), collapse = ", "), ")") ) ) @@ -887,8 +889,8 @@ graph_from_graphdb <- function( } # END GENERATED ARG_HANDLE - if (is.null(nodes) && is.null(url)) { - cli::cli_abort("Either {.arg nodes}' or `{.arg url}' must be non-null.") + if (is.null(n) && is.null(url)) { + cli::cli_abort("Either {.arg n}' or `{.arg url}' must be non-null.") } if (is.null(url)) { @@ -917,9 +919,9 @@ graph_from_graphdb <- function( "b09", "b09m" ) - sizecode <- if (nodes <= 100) { + sizecode <- if (n <= 100) { "s" - } else if (nodes < 2000) { + } else if (n < 2000) { "m" } else { "l" @@ -958,7 +960,7 @@ graph_from_graphdb <- function( type, "_", sizecode, - nodes, + n, ".", pair, formatC(which, width = 2, flag = "0"), diff --git a/R/games.R b/R/games.R index eda1cb03a22..9eaf4e5b47a 100644 --- a/R/games.R +++ b/R/games.R @@ -150,7 +150,7 @@ preference.game <- function( # nocov start lifecycle::deprecate_warn("2.0.0", "preference.game()", "sample_pref()") sample_pref( - nodes = nodes, + n = nodes, types = types, type.dist = type.dist, fixed.sizes = fixed.sizes, @@ -252,7 +252,7 @@ interconnected.islands.game <- function( grg.game <- function(nodes, radius, torus = FALSE, coords = FALSE) { # nocov start lifecycle::deprecate_warn("2.0.0", "grg.game()", "sample_grg()") - sample_grg(nodes = nodes, radius = radius, torus = torus, coords = coords) + sample_grg(n = nodes, radius = radius, torus = torus, coords = coords) } # nocov end #' Growing random graph generation @@ -299,7 +299,7 @@ forest.fire.game <- function( "sample_forestfire()" ) sample_forestfire( - nodes = nodes, + n = nodes, fw.prob = fw.prob, bw.factor = bw.factor, ambs = ambs, @@ -328,7 +328,7 @@ establishment.game <- function( # nocov start lifecycle::deprecate_warn("2.0.0", "establishment.game()", "sample_traits()") sample_traits( - nodes = nodes, + n = nodes, types = types, k = k, type.dist = type.dist, @@ -470,7 +470,7 @@ callaway.traits.game <- function( "sample_traits_callaway()" ) sample_traits_callaway( - nodes = nodes, + n = nodes, types = types, edge.per.step = edge.per.step, type.dist = type.dist, @@ -605,7 +605,7 @@ asymmetric.preference.game <- function( "sample_asym_pref()" ) sample_asym_pref( - nodes = nodes, + n = nodes, types = types, type.dist.matrix = type.dist.matrix, pref.matrix = pref.matrix, @@ -2200,7 +2200,8 @@ pa_age <- function( #' depends on the types of the vertices involved and is taken from #' `pref.matrix`. #' -#' @param nodes The number of vertices in the graph. +#' @param n The number of vertices in the graph. +#' @param nodes `r lifecycle::badge("deprecated")` Use `n` instead. #' @param types The number of different vertex types. #' @inheritParams rlang::args_dots_empty #' @param edge.per.step The number of edges to add to the graph per time step. @@ -2222,13 +2223,14 @@ pa_age <- function( #' g1 <- sample_traits_callaway(1000, 2, pref.matrix = matrix(c(1, 0, 0, 1), ncol = 2)) #' g2 <- sample_traits(1000, 2, k = 2, pref.matrix = matrix(c(1, 0, 0, 1), ncol = 2)) sample_traits_callaway <- function( - nodes, + n, types, ..., edge.per.step = 1, type.dist = NULL, pref.matrix = NULL, - directed = FALSE + directed = FALSE, + nodes = deprecated() ) { # BEGIN GENERATED ARG_HANDLE: sample_traits_callaway, do not edit, see tools/generate-migrations.R # fmt: skip @@ -2265,14 +2267,29 @@ sample_traits_callaway <- function( "3.0.0", what = base::I("Calling `sample_traits_callaway()` with positional or abbreviated arguments"), details = base::c( - i = base::paste0("Detected call: sample_traits_callaway(", base::paste(base::c("nodes", "types", .arg_names), collapse = ", "), ")"), - i = base::paste0("Use instead: sample_traits_callaway(", base::paste(base::c("nodes", "types", base::paste0(.arg_names, " = ")), collapse = ", "), ")") + i = base::paste0("Detected call: sample_traits_callaway(", base::paste(base::c("n", "types", .arg_names), collapse = ", "), ")"), + i = base::paste0("Use instead: sample_traits_callaway(", base::paste(base::c("n", "types", base::paste0(.arg_names, " = ")), collapse = ", "), ")") ) ) } } # END GENERATED ARG_HANDLE + if (lifecycle::is_present(nodes)) { + if (!missing(n)) { + cli::cli_abort(c( + "Argument {.arg n} of {.fn sample_traits_callaway} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg nodes}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "sample_traits_callaway(nodes = )", + "sample_traits_callaway(n = )" + ) + n <- nodes + } + if (is.null(type.dist)) { type.dist <- rep(1, types) } @@ -2281,7 +2298,7 @@ sample_traits_callaway <- function( } res <- callaway_traits_game_impl( - nodes = nodes, + nodes = n, types = types, edges_per_step = edge.per.step, type_dist = type.dist, @@ -2306,13 +2323,14 @@ sample_traits_callaway <- function( #' @inheritParams rlang::args_dots_empty #' @export traits_callaway <- function( - nodes, + n, types, ..., edge.per.step = 1, type.dist = NULL, pref.matrix = NULL, - directed = FALSE + directed = FALSE, + nodes = deprecated() ) { # BEGIN GENERATED ARG_HANDLE: traits_callaway, do not edit, see tools/generate-migrations.R # fmt: skip @@ -2349,14 +2367,29 @@ traits_callaway <- function( "3.0.0", what = base::I("Calling `traits_callaway()` with positional or abbreviated arguments"), details = base::c( - i = base::paste0("Detected call: traits_callaway(", base::paste(base::c("nodes", "types", .arg_names), collapse = ", "), ")"), - i = base::paste0("Use instead: traits_callaway(", base::paste(base::c("nodes", "types", base::paste0(.arg_names, " = ")), collapse = ", "), ")") + i = base::paste0("Detected call: traits_callaway(", base::paste(base::c("n", "types", .arg_names), collapse = ", "), ")"), + i = base::paste0("Use instead: traits_callaway(", base::paste(base::c("n", "types", base::paste0(.arg_names, " = ")), collapse = ", "), ")") ) ) } } # END GENERATED ARG_HANDLE + if (lifecycle::is_present(nodes)) { + if (!missing(n)) { + cli::cli_abort(c( + "Argument {.arg n} of {.fn traits_callaway} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg nodes}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "traits_callaway(nodes = )", + "traits_callaway(n = )" + ) + n <- nodes + } + if (is.null(type.dist)) { type.dist <- rep(1, types) } @@ -2366,7 +2399,7 @@ traits_callaway <- function( constructor_spec( sample_traits_callaway, - nodes, + n, types, edge.per.step = edge.per.step, type.dist = type.dist, @@ -2379,13 +2412,14 @@ traits_callaway <- function( #' @inheritParams rlang::args_dots_empty #' @export sample_traits <- function( - nodes, + n, types, k = 1, ..., type.dist = NULL, pref.matrix = NULL, - directed = FALSE + directed = FALSE, + nodes = deprecated() ) { # BEGIN GENERATED ARG_HANDLE: sample_traits, do not edit, see tools/generate-migrations.R # fmt: skip @@ -2420,14 +2454,29 @@ sample_traits <- function( "3.0.0", what = base::I("Calling `sample_traits()` with positional or abbreviated arguments"), details = base::c( - i = base::paste0("Detected call: sample_traits(", base::paste(base::c("nodes", "types", "k", .arg_names), collapse = ", "), ")"), - i = base::paste0("Use instead: sample_traits(", base::paste(base::c("nodes", "types", "k", base::paste0(.arg_names, " = ")), collapse = ", "), ")") + i = base::paste0("Detected call: sample_traits(", base::paste(base::c("n", "types", "k", .arg_names), collapse = ", "), ")"), + i = base::paste0("Use instead: sample_traits(", base::paste(base::c("n", "types", "k", base::paste0(.arg_names, " = ")), collapse = ", "), ")") ) ) } } # END GENERATED ARG_HANDLE + if (lifecycle::is_present(nodes)) { + if (!missing(n)) { + cli::cli_abort(c( + "Argument {.arg n} of {.fn sample_traits} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg nodes}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "sample_traits(nodes = )", + "sample_traits(n = )" + ) + n <- nodes + } + if (is.null(type.dist)) { type.dist <- rep(1, types) } @@ -2436,7 +2485,7 @@ sample_traits <- function( } res <- establishment_game_impl( - nodes = nodes, + nodes = n, types = types, k = k, type_dist = type.dist, @@ -2457,13 +2506,14 @@ sample_traits <- function( #' @inheritParams rlang::args_dots_empty #' @export traits <- function( - nodes, + n, types, k = 1, ..., type.dist = NULL, pref.matrix = NULL, - directed = FALSE + directed = FALSE, + nodes = deprecated() ) { # BEGIN GENERATED ARG_HANDLE: traits, do not edit, see tools/generate-migrations.R # fmt: skip @@ -2498,14 +2548,29 @@ traits <- function( "3.0.0", what = base::I("Calling `traits()` with positional or abbreviated arguments"), details = base::c( - i = base::paste0("Detected call: traits(", base::paste(base::c("nodes", "types", "k", .arg_names), collapse = ", "), ")"), - i = base::paste0("Use instead: traits(", base::paste(base::c("nodes", "types", "k", base::paste0(.arg_names, " = ")), collapse = ", "), ")") + i = base::paste0("Detected call: traits(", base::paste(base::c("n", "types", "k", .arg_names), collapse = ", "), ")"), + i = base::paste0("Use instead: traits(", base::paste(base::c("n", "types", "k", base::paste0(.arg_names, " = ")), collapse = ", "), ")") ) ) } } # END GENERATED ARG_HANDLE + if (lifecycle::is_present(nodes)) { + if (!missing(n)) { + cli::cli_abort(c( + "Argument {.arg n} of {.fn traits} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg nodes}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "traits(nodes = )", + "traits(n = )" + ) + n <- nodes + } + if (is.null(type.dist)) { type.dist <- rep(1, types) } @@ -2515,7 +2580,7 @@ traits <- function( constructor_spec( sample_traits, - nodes, + n, types, k = k, type.dist = type.dist, @@ -2537,7 +2602,8 @@ traits <- function( #' Euclidean norm than a given radius. If the `torus` argument is #' `TRUE` then a unit area torus is used instead of a square. #' -#' @param nodes The number of vertices in the graph. +#' @param n The number of vertices in the graph. +#' @param nodes `r lifecycle::badge("deprecated")` Use `n` instead. #' @param radius The radius within which the vertices will be connected by an #' edge. #' @inheritParams rlang::args_dots_empty @@ -2557,11 +2623,12 @@ traits <- function( #' g2 <- sample_grg(1000, 0.05, torus = TRUE) #' sample_grg <- function( - nodes, + n, radius, ..., torus = FALSE, - coords = FALSE + coords = FALSE, + nodes = deprecated() ) { # BEGIN GENERATED ARG_HANDLE: sample_grg, do not edit, see tools/generate-migrations.R # fmt: skip @@ -2592,18 +2659,33 @@ sample_grg <- function( "3.0.0", what = base::I("Calling `sample_grg()` with positional or abbreviated arguments"), details = base::c( - i = base::paste0("Detected call: sample_grg(", base::paste(base::c("nodes", "radius", .arg_names), collapse = ", "), ")"), - i = base::paste0("Use instead: sample_grg(", base::paste(base::c("nodes", "radius", base::paste0(.arg_names, " = ")), collapse = ", "), ")") + i = base::paste0("Detected call: sample_grg(", base::paste(base::c("n", "radius", .arg_names), collapse = ", "), ")"), + i = base::paste0("Use instead: sample_grg(", base::paste(base::c("n", "radius", base::paste0(.arg_names, " = ")), collapse = ", "), ")") ) ) } } # END GENERATED ARG_HANDLE + if (lifecycle::is_present(nodes)) { + if (!missing(n)) { + cli::cli_abort(c( + "Argument {.arg n} of {.fn sample_grg} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg nodes}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "sample_grg(nodes = )", + "sample_grg(n = )" + ) + n <- nodes + } + on.exit(.Call(Rx_igraph_finalizer)) res <- .Call( Rx_igraph_grg_game, - as.double(nodes), + as.double(n), as.double(radius), as.logical(torus), as.logical(coords) @@ -2624,11 +2706,12 @@ sample_grg <- function( #' @inheritParams rlang::args_dots_empty #' @export grg <- function( - nodes, + n, radius, ..., torus = FALSE, - coords = FALSE + coords = FALSE, + nodes = deprecated() ) { # BEGIN GENERATED ARG_HANDLE: grg, do not edit, see tools/generate-migrations.R # fmt: skip @@ -2659,17 +2742,32 @@ grg <- function( "3.0.0", what = base::I("Calling `grg()` with positional or abbreviated arguments"), details = base::c( - i = base::paste0("Detected call: grg(", base::paste(base::c("nodes", "radius", .arg_names), collapse = ", "), ")"), - i = base::paste0("Use instead: grg(", base::paste(base::c("nodes", "radius", base::paste0(.arg_names, " = ")), collapse = ", "), ")") + i = base::paste0("Detected call: grg(", base::paste(base::c("n", "radius", .arg_names), collapse = ", "), ")"), + i = base::paste0("Use instead: grg(", base::paste(base::c("n", "radius", base::paste0(.arg_names, " = ")), collapse = ", "), ")") ) ) } } # END GENERATED ARG_HANDLE + if (lifecycle::is_present(nodes)) { + if (!missing(n)) { + cli::cli_abort(c( + "Argument {.arg n} of {.fn grg} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg nodes}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "grg(nodes = )", + "grg(n = )" + ) + n <- nodes + } + constructor_spec( sample_grg, - nodes = nodes, + n = n, radius = radius, torus = torus, coords = coords @@ -2700,7 +2798,8 @@ grg <- function( #' `type` vertex attribute for `sample_pref()` and from the #' `intype` and `outtype` vertex attribute for `sample_asym_pref()`. #' -#' @param nodes The number of vertices in the graphs. +#' @param n The number of vertices in the graphs. +#' @param nodes `r lifecycle::badge("deprecated")` Use `n` instead. #' @param types The number of different vertex types. #' @inheritParams rlang::args_dots_empty #' @param type.dist The distribution of the vertex types, a numeric vector of @@ -2740,14 +2839,15 @@ grg <- function( #' tkplot(g, layout = layout_in_circle) #' sample_pref <- function( - nodes, + n, types, ..., type.dist = NULL, fixed.sizes = FALSE, pref.matrix = NULL, directed = FALSE, - loops = FALSE + loops = FALSE, + nodes = deprecated() ) { # BEGIN GENERATED ARG_HANDLE: sample_pref, do not edit, see tools/generate-migrations.R # fmt: skip @@ -2786,14 +2886,29 @@ sample_pref <- function( "3.0.0", what = base::I("Calling `sample_pref()` with positional or abbreviated arguments"), details = base::c( - i = base::paste0("Detected call: sample_pref(", base::paste(base::c("nodes", "types", .arg_names), collapse = ", "), ")"), - i = base::paste0("Use instead: sample_pref(", base::paste(base::c("nodes", "types", base::paste0(.arg_names, " = ")), collapse = ", "), ")") + i = base::paste0("Detected call: sample_pref(", base::paste(base::c("n", "types", .arg_names), collapse = ", "), ")"), + i = base::paste0("Use instead: sample_pref(", base::paste(base::c("n", "types", base::paste0(.arg_names, " = ")), collapse = ", "), ")") ) ) } } # END GENERATED ARG_HANDLE + if (lifecycle::is_present(nodes)) { + if (!missing(n)) { + cli::cli_abort(c( + "Argument {.arg n} of {.fn sample_pref} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg nodes}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "sample_pref(nodes = )", + "sample_pref(n = )" + ) + n <- nodes + } + if (is.null(type.dist)) { type.dist <- rep(1, types) } @@ -2809,7 +2924,7 @@ sample_pref <- function( } res <- preference_game_impl( - nodes = nodes, + nodes = n, types = types, type_dist = type.dist, fixed_sizes = fixed.sizes, @@ -2833,14 +2948,15 @@ sample_pref <- function( #' @inheritParams rlang::args_dots_empty #' @export pref <- function( - nodes, + n, types, ..., type.dist = NULL, fixed.sizes = FALSE, pref.matrix = NULL, directed = FALSE, - loops = FALSE + loops = FALSE, + nodes = deprecated() ) { # BEGIN GENERATED ARG_HANDLE: pref, do not edit, see tools/generate-migrations.R # fmt: skip @@ -2879,14 +2995,29 @@ pref <- function( "3.0.0", what = base::I("Calling `pref()` with positional or abbreviated arguments"), details = base::c( - i = base::paste0("Detected call: pref(", base::paste(base::c("nodes", "types", .arg_names), collapse = ", "), ")"), - i = base::paste0("Use instead: pref(", base::paste(base::c("nodes", "types", base::paste0(.arg_names, " = ")), collapse = ", "), ")") + i = base::paste0("Detected call: pref(", base::paste(base::c("n", "types", .arg_names), collapse = ", "), ")"), + i = base::paste0("Use instead: pref(", base::paste(base::c("n", "types", base::paste0(.arg_names, " = ")), collapse = ", "), ")") ) ) } } # END GENERATED ARG_HANDLE + if (lifecycle::is_present(nodes)) { + if (!missing(n)) { + cli::cli_abort(c( + "Argument {.arg n} of {.fn pref} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg nodes}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "pref(nodes = )", + "pref(n = )" + ) + n <- nodes + } + if (is.null(type.dist)) { type.dist <- rep(1, types) } @@ -2896,7 +3027,7 @@ pref <- function( constructor_spec( sample_pref, - nodes, + n, types, type.dist = type.dist, fixed.sizes = fixed.sizes, @@ -2910,12 +3041,13 @@ pref <- function( #' @inheritParams rlang::args_dots_empty #' @export sample_asym_pref <- function( - nodes, + n, types, ..., type.dist.matrix = NULL, pref.matrix = NULL, - loops = FALSE + loops = FALSE, + nodes = deprecated() ) { # BEGIN GENERATED ARG_HANDLE: sample_asym_pref, do not edit, see tools/generate-migrations.R # fmt: skip @@ -2950,14 +3082,29 @@ sample_asym_pref <- function( "3.0.0", what = base::I("Calling `sample_asym_pref()` with positional or abbreviated arguments"), details = base::c( - i = base::paste0("Detected call: sample_asym_pref(", base::paste(base::c("nodes", "types", .arg_names), collapse = ", "), ")"), - i = base::paste0("Use instead: sample_asym_pref(", base::paste(base::c("nodes", "types", base::paste0(.arg_names, " = ")), collapse = ", "), ")") + i = base::paste0("Detected call: sample_asym_pref(", base::paste(base::c("n", "types", .arg_names), collapse = ", "), ")"), + i = base::paste0("Use instead: sample_asym_pref(", base::paste(base::c("n", "types", base::paste0(.arg_names, " = ")), collapse = ", "), ")") ) ) } } # END GENERATED ARG_HANDLE + if (lifecycle::is_present(nodes)) { + if (!missing(n)) { + cli::cli_abort(c( + "Argument {.arg n} of {.fn sample_asym_pref} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg nodes}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "sample_asym_pref(nodes = )", + "sample_asym_pref(n = )" + ) + n <- nodes + } + if (is.null(type.dist.matrix)) { type.dist.matrix <- matrix(1, types, types) } @@ -2979,7 +3126,7 @@ sample_asym_pref <- function( } res <- asymmetric_preference_game_impl( - nodes = nodes, + nodes = n, out_types = types, in_types = types, type_dist_matrix = type.dist.matrix, @@ -3003,12 +3150,13 @@ sample_asym_pref <- function( #' @inheritParams rlang::args_dots_empty #' @export asym_pref <- function( - nodes, + n, types, ..., type.dist.matrix = NULL, pref.matrix = NULL, - loops = FALSE + loops = FALSE, + nodes = deprecated() ) { # BEGIN GENERATED ARG_HANDLE: asym_pref, do not edit, see tools/generate-migrations.R # fmt: skip @@ -3043,14 +3191,29 @@ asym_pref <- function( "3.0.0", what = base::I("Calling `asym_pref()` with positional or abbreviated arguments"), details = base::c( - i = base::paste0("Detected call: asym_pref(", base::paste(base::c("nodes", "types", .arg_names), collapse = ", "), ")"), - i = base::paste0("Use instead: asym_pref(", base::paste(base::c("nodes", "types", base::paste0(.arg_names, " = ")), collapse = ", "), ")") + i = base::paste0("Detected call: asym_pref(", base::paste(base::c("n", "types", .arg_names), collapse = ", "), ")"), + i = base::paste0("Use instead: asym_pref(", base::paste(base::c("n", "types", base::paste0(.arg_names, " = ")), collapse = ", "), ")") ) ) } } # END GENERATED ARG_HANDLE + if (lifecycle::is_present(nodes)) { + if (!missing(n)) { + cli::cli_abort(c( + "Argument {.arg n} of {.fn asym_pref} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg nodes}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "asym_pref(nodes = )", + "asym_pref(n = )" + ) + n <- nodes + } + if (is.null(type.dist.matrix)) { type.dist.matrix <- matrix(1, types, types) } @@ -3060,7 +3223,7 @@ asym_pref <- function( constructor_spec( sample_asym_pref, - nodes, + n, types, type.dist.matrix = type.dist.matrix, pref.matrix = pref.matrix, @@ -4954,7 +5117,8 @@ sample_fitness_pl <- function( #' available then we cite all of them. \item The same procedure is applied to #' all the newly cited vertices. } #' -#' @param nodes The number of vertices in the graph. +#' @param n The number of vertices in the graph. +#' @param nodes `r lifecycle::badge("deprecated")` Use `n` instead. #' @param fw.prob The forward burning probability, see details below. #' @inheritParams rlang::args_dots_empty #' @param bw.factor The backward burning ratio. The backward burning @@ -4991,12 +5155,13 @@ sample_fitness_pl <- function( #' plot(seq(along.with = dd1) - 1, dd1, log = "xy") #' points(seq(along.with = dd2) - 1, dd2, col = 2, pch = 2) sample_forestfire <- function( - nodes, + n, fw.prob, ..., bw.factor = 1, ambs = 1, - directed = TRUE + directed = TRUE, + nodes = deprecated() ) { # BEGIN GENERATED ARG_HANDLE: sample_forestfire, do not edit, see tools/generate-migrations.R # fmt: skip @@ -5029,16 +5194,31 @@ sample_forestfire <- function( "3.0.0", what = base::I("Calling `sample_forestfire()` with positional or abbreviated arguments"), details = base::c( - i = base::paste0("Detected call: sample_forestfire(", base::paste(base::c("nodes", "fw.prob", .arg_names), collapse = ", "), ")"), - i = base::paste0("Use instead: sample_forestfire(", base::paste(base::c("nodes", "fw.prob", base::paste0(.arg_names, " = ")), collapse = ", "), ")") + i = base::paste0("Detected call: sample_forestfire(", base::paste(base::c("n", "fw.prob", .arg_names), collapse = ", "), ")"), + i = base::paste0("Use instead: sample_forestfire(", base::paste(base::c("n", "fw.prob", base::paste0(.arg_names, " = ")), collapse = ", "), ")") ) ) } } # END GENERATED ARG_HANDLE + if (lifecycle::is_present(nodes)) { + if (!missing(n)) { + cli::cli_abort(c( + "Argument {.arg n} of {.fn sample_forestfire} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg nodes}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "sample_forestfire(nodes = )", + "sample_forestfire(n = )" + ) + n <- nodes + } + res <- forest_fire_game_impl( - nodes = nodes, + nodes = n, fw_prob = fw.prob, bw_factor = bw.factor, ambs = ambs, diff --git a/man/asymmetric.preference.game.Rd b/man/asymmetric.preference.game.Rd index a25892561c8..59208d16a4a 100644 --- a/man/asymmetric.preference.game.Rd +++ b/man/asymmetric.preference.game.Rd @@ -13,7 +13,7 @@ asymmetric.preference.game( ) } \arguments{ -\item{nodes}{The number of vertices in the graphs.} +\item{nodes}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{n} instead.} \item{types}{The number of different vertex types.} diff --git a/man/callaway.traits.game.Rd b/man/callaway.traits.game.Rd index 487c8855995..06b6e30f608 100644 --- a/man/callaway.traits.game.Rd +++ b/man/callaway.traits.game.Rd @@ -14,7 +14,7 @@ callaway.traits.game( ) } \arguments{ -\item{nodes}{The number of vertices in the graph.} +\item{nodes}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{n} instead.} \item{types}{The number of different vertex types.} diff --git a/man/centr_betw_tmax.Rd b/man/centr_betw_tmax.Rd index 6da3968daf7..0b6e02683d5 100644 --- a/man/centr_betw_tmax.Rd +++ b/man/centr_betw_tmax.Rd @@ -4,13 +4,19 @@ \alias{centr_betw_tmax} \title{Theoretical maximum for betweenness centralization} \usage{ -centr_betw_tmax(graph = NULL, nodes = 0, ..., directed = TRUE) +centr_betw_tmax( + graph = NULL, + n = 0, + ..., + directed = TRUE, + nodes = deprecated() +) } \arguments{ \item{graph}{The input graph. It can also be \code{NULL} if -\code{nodes} and \code{directed} are both given.} +\code{n} and \code{directed} are both given.} -\item{nodes}{The number of vertices. This is ignored if the graph is +\item{n}{The number of vertices. This is ignored if the graph is given.} \item{...}{These dots are for future extensions and must be empty.} @@ -18,6 +24,8 @@ given.} \item{directed}{Logical, whether to use directed shortest paths for calculating betweenness. Ignored if an undirected graph was given.} + +\item{nodes}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{n} instead.} } \value{ Real scalar, the theoretical maximum (unnormalized) graph diff --git a/man/centr_clo_tmax.Rd b/man/centr_clo_tmax.Rd index 93fbe09cde8..c7c5b500a13 100644 --- a/man/centr_clo_tmax.Rd +++ b/man/centr_clo_tmax.Rd @@ -6,22 +6,25 @@ \usage{ centr_clo_tmax( graph = NULL, - nodes = 0, + n = 0, ..., - mode = c("out", "in", "all", "total") + mode = c("out", "in", "all", "total"), + nodes = deprecated() ) } \arguments{ \item{graph}{The input graph. It can also be \code{NULL} if -\code{nodes} is given.} +\code{n} is given.} -\item{nodes}{The number of vertices. This is ignored if the graph is +\item{n}{The number of vertices. This is ignored if the graph is given.} \item{...}{These dots are for future extensions and must be empty.} \item{mode}{This is the same as the \code{mode} argument of \code{closeness()}. Ignored if an undirected graph is given.} + +\item{nodes}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{n} instead.} } \value{ Real scalar, the theoretical maximum (unnormalized) graph diff --git a/man/centr_degree_tmax.Rd b/man/centr_degree_tmax.Rd index 7a6f8cae489..a5a22e4c863 100644 --- a/man/centr_degree_tmax.Rd +++ b/man/centr_degree_tmax.Rd @@ -6,21 +6,27 @@ \usage{ centr_degree_tmax( graph = NULL, - nodes = 0, + n = 0, + ..., mode = c("all", "out", "in", "total"), - loops + loops, + nodes = deprecated() ) } \arguments{ -\item{graph}{The input graph. It can also be \code{NULL} if \code{nodes} is given.} +\item{graph}{The input graph. It can also be \code{NULL} if \code{n} is given.} -\item{nodes}{The number of vertices. This is ignored if the graph is given.} +\item{n}{The number of vertices. This is ignored if the graph is given.} + +\item{...}{These dots are for future extensions and must be empty.} \item{mode}{This is the same as the \code{mode} argument of \code{degree()}. Ignored if \code{graph} is given and the graph is undirected.} \item{loops}{Logical, whether to consider loops edges when calculating the degree.} + +\item{nodes}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{n} instead.} } \value{ Real scalar, the theoretical maximum (unnormalized) graph degree diff --git a/man/centr_eigen_tmax.Rd b/man/centr_eigen_tmax.Rd index 86ce59f90da..c68f1151f1a 100644 --- a/man/centr_eigen_tmax.Rd +++ b/man/centr_eigen_tmax.Rd @@ -6,23 +6,29 @@ \usage{ centr_eigen_tmax( graph = NULL, - nodes = 0, + n = 0, + ..., directed = FALSE, - scale = deprecated() + scale = deprecated(), + nodes = deprecated() ) } \arguments{ \item{graph}{The input graph. It can also be \code{NULL}, if -\code{nodes} is given.} +\code{n} is given.} -\item{nodes}{The number of vertices. This is ignored if the graph is +\item{n}{The number of vertices. This is ignored if the graph is given.} +\item{...}{These dots are for future extensions and must be empty.} + \item{directed}{Logical, whether to consider edge directions during the calculation. Ignored in undirected graphs.} \item{scale}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Ignored. Computing eigenvector centralization requires normalized eigenvector centrality scores.} + +\item{nodes}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{n} instead.} } \value{ Real scalar, the theoretical maximum (unnormalized) graph diff --git a/man/centralization.betweenness.tmax.Rd b/man/centralization.betweenness.tmax.Rd index fb9bbfd5864..dcd8de0d6a8 100644 --- a/man/centralization.betweenness.tmax.Rd +++ b/man/centralization.betweenness.tmax.Rd @@ -8,10 +8,9 @@ centralization.betweenness.tmax(graph = NULL, nodes = 0, directed = TRUE) } \arguments{ \item{graph}{The input graph. It can also be \code{NULL} if -\code{nodes} and \code{directed} are both given.} +\code{n} and \code{directed} are both given.} -\item{nodes}{The number of vertices. This is ignored if the graph is -given.} +\item{nodes}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{n} instead.} \item{directed}{Logical, whether to use directed shortest paths for calculating betweenness. Ignored if an undirected graph was diff --git a/man/centralization.closeness.tmax.Rd b/man/centralization.closeness.tmax.Rd index e1560171fcd..7263c0ab325 100644 --- a/man/centralization.closeness.tmax.Rd +++ b/man/centralization.closeness.tmax.Rd @@ -12,10 +12,9 @@ centralization.closeness.tmax( } \arguments{ \item{graph}{The input graph. It can also be \code{NULL} if -\code{nodes} is given.} +\code{n} is given.} -\item{nodes}{The number of vertices. This is ignored if the graph is -given.} +\item{nodes}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{n} instead.} \item{mode}{This is the same as the \code{mode} argument of \code{closeness()}. Ignored if an undirected graph is given.} diff --git a/man/centralization.degree.tmax.Rd b/man/centralization.degree.tmax.Rd index 29d7b242e75..18095638185 100644 --- a/man/centralization.degree.tmax.Rd +++ b/man/centralization.degree.tmax.Rd @@ -12,9 +12,9 @@ centralization.degree.tmax( ) } \arguments{ -\item{graph}{The input graph. It can also be \code{NULL} if \code{nodes} is given.} +\item{graph}{The input graph. It can also be \code{NULL} if \code{n} is given.} -\item{nodes}{The number of vertices. This is ignored if the graph is given.} +\item{nodes}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{n} instead.} \item{mode}{This is the same as the \code{mode} argument of \code{degree()}. Ignored if \code{graph} is given and the graph is undirected.} diff --git a/man/centralization.evcent.tmax.Rd b/man/centralization.evcent.tmax.Rd index 7800a83252c..f03685e7972 100644 --- a/man/centralization.evcent.tmax.Rd +++ b/man/centralization.evcent.tmax.Rd @@ -13,10 +13,9 @@ centralization.evcent.tmax( } \arguments{ \item{graph}{The input graph. It can also be \code{NULL}, if -\code{nodes} is given.} +\code{n} is given.} -\item{nodes}{The number of vertices. This is ignored if the graph is -given.} +\item{nodes}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{n} instead.} \item{directed}{Logical, whether to consider edge directions during the calculation. Ignored in undirected graphs.} diff --git a/man/establishment.game.Rd b/man/establishment.game.Rd index c27ce60c400..aad71dc1eab 100644 --- a/man/establishment.game.Rd +++ b/man/establishment.game.Rd @@ -14,7 +14,7 @@ establishment.game( ) } \arguments{ -\item{nodes}{The number of vertices in the graph.} +\item{nodes}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{n} instead.} \item{types}{The number of different vertex types.} diff --git a/man/forest.fire.game.Rd b/man/forest.fire.game.Rd index 28aa158ba63..6acc3c63bf4 100644 --- a/man/forest.fire.game.Rd +++ b/man/forest.fire.game.Rd @@ -7,7 +7,7 @@ forest.fire.game(nodes, fw.prob, bw.factor = 1, ambs = 1, directed = TRUE) } \arguments{ -\item{nodes}{The number of vertices in the graph.} +\item{nodes}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{n} instead.} \item{fw.prob}{The forward burning probability, see details below.} diff --git a/man/graph.graphdb.Rd b/man/graph.graphdb.Rd index bc45919b8a4..309ad93fe87 100644 --- a/man/graph.graphdb.Rd +++ b/man/graph.graphdb.Rd @@ -30,7 +30,8 @@ values: \code{r001}, \code{r005}, \code{r01}, \code{r02}, \code{m2D}, \code{m4Dr6}, \code{b03}, \code{b03m}, \code{b06}, \code{b06m}, \code{b09}, \code{b09m}.} -\item{nodes}{The number of vertices in the graph.} +\item{nodes}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{n} in +\code{\link[=graph_from_graphdb]{graph_from_graphdb()}} instead.} \item{pair}{Specifies which graph of the pair to read. Possible values: \code{A} and \code{B}.} diff --git a/man/graph_from_graphdb.Rd b/man/graph_from_graphdb.Rd index 3b87c241a5c..b6218cef771 100644 --- a/man/graph_from_graphdb.Rd +++ b/man/graph_from_graphdb.Rd @@ -9,7 +9,7 @@ graph_from_graphdb( ..., prefix = "iso", type = "r001", - nodes = NULL, + n = NULL, pair = "A", which = 0, base = "https://github.com/igraph/graphsdb/raw/refs/heads/main", @@ -33,7 +33,7 @@ values: \code{r001}, \code{r005}, \code{r01}, \code{r02}, \code{m2D}, \code{m4Dr6}, \code{b03}, \code{b03m}, \code{b06}, \code{b06m}, \code{b09}, \code{b09m}.} -\item{nodes}{The number of vertices in the graph.} +\item{n}{The number of vertices in the graph.} \item{pair}{Specifies which graph of the pair to read. Possible values: \code{A} and \code{B}.} @@ -66,7 +66,7 @@ a local or remote graph database file. In this case we simply call \code{\link[=read_graph]{read_graph()}} with the proper arguments to read the file. If \code{url} is \code{NULL}, and this is the default, then the filename is -assembled from the \code{base}, \code{prefix}, \code{type}, \code{nodes}, +assembled from the \code{base}, \code{prefix}, \code{type}, \code{n}, \code{pair} and \code{which} arguments. Unfortunately the original graph database homepage is now defunct, but see diff --git a/man/grg.game.Rd b/man/grg.game.Rd index 22343e30481..f87b55774ca 100644 --- a/man/grg.game.Rd +++ b/man/grg.game.Rd @@ -7,7 +7,7 @@ grg.game(nodes, radius, torus = FALSE, coords = FALSE) } \arguments{ -\item{nodes}{The number of vertices in the graph.} +\item{nodes}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{n} instead.} \item{radius}{The radius within which the vertices will be connected by an edge.} diff --git a/man/preference.game.Rd b/man/preference.game.Rd index d55dea83770..4f269e429ee 100644 --- a/man/preference.game.Rd +++ b/man/preference.game.Rd @@ -15,7 +15,7 @@ preference.game( ) } \arguments{ -\item{nodes}{The number of vertices in the graphs.} +\item{nodes}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{n} instead.} \item{types}{The number of different vertex types.} diff --git a/man/sample_forestfire.Rd b/man/sample_forestfire.Rd index aeff07ef5f8..c15e7baebe5 100644 --- a/man/sample_forestfire.Rd +++ b/man/sample_forestfire.Rd @@ -5,16 +5,17 @@ \title{Forest Fire Network Model} \usage{ sample_forestfire( - nodes, + n, fw.prob, ..., bw.factor = 1, ambs = 1, - directed = TRUE + directed = TRUE, + nodes = deprecated() ) } \arguments{ -\item{nodes}{The number of vertices in the graph.} +\item{n}{The number of vertices in the graph.} \item{fw.prob}{The forward burning probability, see details below.} @@ -26,6 +27,8 @@ probability is calculated as \code{bw.factor*fw.prob}.} \item{ambs}{The number of ambassador vertices.} \item{directed}{Logical, whether to create a directed graph.} + +\item{nodes}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{n} instead.} } \value{ A simple graph, possibly directed if the \code{directed} argument is diff --git a/man/sample_grg.Rd b/man/sample_grg.Rd index 8b83e6b1402..72bf143bb03 100644 --- a/man/sample_grg.Rd +++ b/man/sample_grg.Rd @@ -5,12 +5,12 @@ \alias{grg} \title{Geometric random graphs} \usage{ -sample_grg(nodes, radius, ..., torus = FALSE, coords = FALSE) +sample_grg(n, radius, ..., torus = FALSE, coords = FALSE, nodes = deprecated()) -grg(nodes, radius, ..., torus = FALSE, coords = FALSE) +grg(n, radius, ..., torus = FALSE, coords = FALSE, nodes = deprecated()) } \arguments{ -\item{nodes}{The number of vertices in the graph.} +\item{n}{The number of vertices in the graph.} \item{radius}{The radius within which the vertices will be connected by an edge.} @@ -21,6 +21,8 @@ edge.} \item{coords}{Logical, whether to add the positions of the vertices as vertex attributes called \sQuote{\code{x}} and \sQuote{\code{y}}.} + +\item{nodes}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{n} instead.} } \value{ A graph object. If \code{coords} is \code{TRUE} then with vertex diff --git a/man/sample_pref.Rd b/man/sample_pref.Rd index 35b69cbd0d6..a26ffb9eb79 100644 --- a/man/sample_pref.Rd +++ b/man/sample_pref.Rd @@ -8,47 +8,51 @@ \title{Trait-based random generation} \usage{ sample_pref( - nodes, + n, types, ..., type.dist = NULL, fixed.sizes = FALSE, pref.matrix = NULL, directed = FALSE, - loops = FALSE + loops = FALSE, + nodes = deprecated() ) pref( - nodes, + n, types, ..., type.dist = NULL, fixed.sizes = FALSE, pref.matrix = NULL, directed = FALSE, - loops = FALSE + loops = FALSE, + nodes = deprecated() ) sample_asym_pref( - nodes, + n, types, ..., type.dist.matrix = NULL, pref.matrix = NULL, - loops = FALSE + loops = FALSE, + nodes = deprecated() ) asym_pref( - nodes, + n, types, ..., type.dist.matrix = NULL, pref.matrix = NULL, - loops = FALSE + loops = FALSE, + nodes = deprecated() ) } \arguments{ -\item{nodes}{The number of vertices in the graphs.} +\item{n}{The number of vertices in the graphs.} \item{types}{The number of different vertex types.} @@ -72,6 +76,8 @@ preferences to one.} \item{loops}{Logical, whether self-loops are allowed in the graph.} +\item{nodes}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{n} instead.} + \item{type.dist.matrix}{The joint distribution of the in- and out-vertex types. The default \code{NULL} gives a uniform distribution.} } diff --git a/man/sample_traits_callaway.Rd b/man/sample_traits_callaway.Rd index 29f831bc9b7..a86d5de32dd 100644 --- a/man/sample_traits_callaway.Rd +++ b/man/sample_traits_callaway.Rd @@ -8,47 +8,51 @@ \title{Graph generation based on different vertex types} \usage{ sample_traits_callaway( - nodes, + n, types, ..., edge.per.step = 1, type.dist = NULL, pref.matrix = NULL, - directed = FALSE + directed = FALSE, + nodes = deprecated() ) traits_callaway( - nodes, + n, types, ..., edge.per.step = 1, type.dist = NULL, pref.matrix = NULL, - directed = FALSE + directed = FALSE, + nodes = deprecated() ) sample_traits( - nodes, + n, types, k = 1, ..., type.dist = NULL, pref.matrix = NULL, - directed = FALSE + directed = FALSE, + nodes = deprecated() ) traits( - nodes, + n, types, k = 1, ..., type.dist = NULL, pref.matrix = NULL, - directed = FALSE + directed = FALSE, + nodes = deprecated() ) } \arguments{ -\item{nodes}{The number of vertices in the graph.} +\item{n}{The number of vertices in the graph.} \item{types}{The number of different vertex types.} @@ -65,6 +69,8 @@ The default \code{NULL} sets all preferences to one.} \item{directed}{Logical, whether to generate directed graphs.} +\item{nodes}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{n} instead.} + \item{k}{The number of trials per time step, see details below.} } \value{ diff --git a/tests/testthat/_snaps/foreign.md b/tests/testthat/_snaps/foreign.md index 412dbd28ffe..efa04eaf471 100644 --- a/tests/testthat/_snaps/foreign.md +++ b/tests/testthat/_snaps/foreign.md @@ -48,12 +48,12 @@ graph_from_graphdb() Condition Error in `graph_from_graphdb()`: - ! Either `nodes`' or ``url`' must be non-null. + ! Either `n`' or ``url`' must be non-null. --- Code - graph_from_graphdb(nodes = 10, prefix = "not_existing") + graph_from_graphdb(n = 10, prefix = "not_existing") Condition Error in `graph_from_graphdb()`: ! not_existing is not a valid prefix. @@ -62,7 +62,7 @@ --- Code - graph_from_graphdb(nodes = 10, type = "not_existing") + graph_from_graphdb(n = 10, type = "not_existing") Condition Error in `graph_from_graphdb()`: ! not_existing is not a valid graph type. diff --git a/tests/testthat/_snaps/games.md b/tests/testthat/_snaps/games.md index 56ba3f05339..77558b79c65 100644 --- a/tests/testthat/_snaps/games.md +++ b/tests/testthat/_snaps/games.md @@ -16,3 +16,21 @@ ! Cannot realize the given degree sequence as an undirected, simple graph. Invalid value Source: : +# sample_grg(nodes = ) is deprecated but still works + + Code + g <- sample_grg(nodes = 10, radius = 1) + Condition + Warning: + The `nodes` argument of `sample_grg()` is deprecated as of igraph 3.0.0. + i Please use the `n` argument instead. + +# sample_grg() rejects `n` supplied both directly and as `nodes` + + Code + sample_grg(10, radius = 1, nodes = 10) + Condition + Error in `sample_grg()`: + ! Argument `n` of `sample_grg()` was supplied more than once. + i It was also supplied via its legacy name `nodes`. + diff --git a/tests/testthat/test-centralization.R b/tests/testthat/test-centralization.R index 9161e1262e2..7fb01e91c6f 100644 --- a/tests/testthat/test-centralization.R +++ b/tests/testthat/test-centralization.R @@ -70,7 +70,7 @@ test_that("centr_betw_tmax() covers migrated tail args and positional recovery", # The graph form and the vertex-count form must agree. expect_equal(centr_betw_tmax(g, directed = FALSE), 24) - expect_equal(centr_betw_tmax(nodes = 5, directed = FALSE), 24) + expect_equal(centr_betw_tmax(n = 5, directed = FALSE), 24) # And they match what centr_betw() reports. expect_equal( centr_betw(g, directed = FALSE, normalized = FALSE)$theoretical_max, @@ -110,7 +110,7 @@ test_that("centr_clo_tmax() covers migrated tail args and positional recovery", # The graph form and the vertex-count form must agree. expect_equal(centr_clo_tmax(g, mode = "in"), 3.2) - expect_equal(centr_clo_tmax(nodes = 5, mode = "in"), 3.2) + expect_equal(centr_clo_tmax(n = 5, mode = "in"), 3.2) # And they match what centr_clo() reports. expect_equal( centr_clo(g, mode = "in", normalized = FALSE)$theoretical_max, @@ -136,3 +136,20 @@ test_that("centralize() covers migrated tail args and positional recovery", { ) expect_identical(res_legacy, centralize(scores, theoretical.max = 12)) }) + +# ---- nodes -> n rename ------------------------------------------------ + +test_that("centr_*_tmax(nodes = ) is deprecated but still works", { + lifecycle::expect_deprecated( + res_betw <- centr_betw_tmax(nodes = 5, directed = FALSE) + ) + expect_identical(res_betw, centr_betw_tmax(n = 5, directed = FALSE)) + + lifecycle::expect_deprecated( + res_degree <- centr_degree_tmax(nodes = 5, mode = "all", loops = TRUE) + ) + expect_identical( + res_degree, + centr_degree_tmax(n = 5, mode = "all", loops = TRUE) + ) +}) diff --git a/tests/testthat/test-foreign.R b/tests/testthat/test-foreign.R index 0332707c7e9..29e59cc6d51 100644 --- a/tests/testthat/test-foreign.R +++ b/tests/testthat/test-foreign.R @@ -66,13 +66,13 @@ test_that("graph_from_graphdb works", { # docker run --rm -ti -v $PWD:/rigraph -e MAKEFLAGS=-j4 ghcr.io/cynkra/r-debug/r-debug-csan-igraph:latest RDcsan -q -e 'filename <- "/rigraph/DESCRIPTION"; gz_file_con <- file(filename, open = "rb"); file_con <- gzcon(gz_file_con); close(file_con); gc()' skip_if(Sys.getenv("R_SANITIZER") == "true") - expect_silent(graph_from_graphdb(nodes = 1000)) + expect_silent(graph_from_graphdb(n = 1000)) expect_snapshot_igraph_error(graph_from_graphdb()) expect_snapshot_igraph_error( - graph_from_graphdb(nodes = 10, prefix = "not_existing") + graph_from_graphdb(n = 10, prefix = "not_existing") ) expect_snapshot_igraph_error( - graph_from_graphdb(nodes = 10, type = "not_existing") + graph_from_graphdb(n = 10, type = "not_existing") ) }) @@ -95,7 +95,7 @@ test_that("graph_from_graphdb() accepts every tail argument by name", { url = NULL, prefix = "iso", type = "r001", - nodes = 1000, + n = 1000, pair = "A", which = 0, base = "https://github.com/igraph/graphsdb/raw/refs/heads/main", @@ -120,7 +120,7 @@ test_that("graph_from_graphdb() wires up legacy positional recovery", { # a download. lifecycle::expect_deprecated( expect_error( - graph_from_graphdb(NULL, "not_existing", nodes = 10), + graph_from_graphdb(NULL, "not_existing", n = 10), regexp = "not a valid prefix" ) ) diff --git a/tests/testthat/test-games.R b/tests/testthat/test-games.R index f2034ffd21e..fdbb330e228 100644 --- a/tests/testthat/test-games.R +++ b/tests/testthat/test-games.R @@ -1702,3 +1702,43 @@ test_that("sample_correlated_gnp() recovers positional p", { sample_correlated_gnp(base_graph, 0.8, p = 0.3) ) }) + +# ---- nodes -> n rename ------------------------------------------------ + +test_that("sample_grg(nodes = ) is deprecated but still works", { + rlang::local_options(lifecycle_verbosity = "warning") + igraph_local_seed(42) + expected <- sample_grg(n = 10, radius = 1) + igraph_local_seed(42) + expect_snapshot( + g <- sample_grg(nodes = 10, radius = 1) + ) + expect_identical_graphs(g, expected) +}) + +test_that("sample_grg() rejects `n` supplied both directly and as `nodes`", { + rlang::local_options(lifecycle_verbosity = "warning") + expect_snapshot( + sample_grg(10, radius = 1, nodes = 10), + error = TRUE + ) +}) + +test_that("sample_pref(nodes = ) and sample_forestfire(nodes = ) are deprecated but still work", { + igraph_local_seed(1) + lifecycle::expect_deprecated( + g_pref_legacy <- sample_pref(nodes = 20, types = 2) + ) + igraph_local_seed(1) + expect_identical_graphs(g_pref_legacy, sample_pref(n = 20, types = 2)) + + igraph_local_seed(1) + lifecycle::expect_deprecated( + g_fire_legacy <- sample_forestfire(nodes = 30, fw.prob = 0.2) + ) + igraph_local_seed(1) + expect_identical_graphs( + g_fire_legacy, + sample_forestfire(n = 30, fw.prob = 0.2) + ) +}) diff --git a/tools/migrations/centralization.R b/tools/migrations/centralization.R index 0844a295b1b..019e811c216 100644 --- a/tools/migrations/centralization.R +++ b/tools/migrations/centralization.R @@ -18,9 +18,10 @@ migrations <- list( old = function(graph, nodes, directed) {}, new = function( graph = NULL, - nodes = 0, + n = 0, ..., - directed = TRUE + directed = TRUE, + nodes = deprecated() ) {}, when = "3.0.0" ), @@ -40,9 +41,10 @@ migrations <- list( old = function(graph, nodes, mode) {}, new = function( graph = NULL, - nodes = 0, + n = 0, ..., - mode = c("out", "in", "all", "total") + mode = c("out", "in", "all", "total"), + nodes = deprecated() ) {}, when = "3.0.0" ), @@ -59,6 +61,32 @@ migrations <- list( when = "3.0.0" ), + centr_degree_tmax = list( + old = function(graph, nodes, mode, loops) {}, + new = function( + graph = NULL, + n = 0, + ..., + mode = c("all", "out", "in", "total"), + loops, + nodes = deprecated() + ) {}, + when = "3.0.0" + ), + + centr_eigen_tmax = list( + old = function(graph, nodes, directed, scale) {}, + new = function( + graph = NULL, + n = 0, + ..., + directed = FALSE, + scale = deprecated(), + nodes = deprecated() + ) {}, + when = "3.0.0" + ), + centralize = list( old = function(scores, theoretical.max, normalized) {}, new = function( diff --git a/tools/migrations/games.R b/tools/migrations/games.R index 89d95e6fc17..d2e54ddbee7 100644 --- a/tools/migrations/games.R +++ b/tools/migrations/games.R @@ -6,12 +6,13 @@ migrations <- list( asym_pref = list( old = function(nodes, types, type.dist.matrix, pref.matrix, loops) {}, new = function( - nodes, + n, types, ..., type.dist.matrix = NULL, pref.matrix = NULL, - loops = FALSE + loops = FALSE, + nodes = deprecated() ) {}, when = "3.0.0" ), @@ -81,11 +82,12 @@ migrations <- list( grg = list( old = function(nodes, radius, torus, coords) {}, new = function( - nodes, + n, radius, ..., torus = FALSE, - coords = FALSE + coords = FALSE, + nodes = deprecated() ) {}, when = "3.0.0" ), @@ -180,14 +182,15 @@ migrations <- list( loops ) {}, new = function( - nodes, + n, types, ..., type.dist = NULL, fixed.sizes = FALSE, pref.matrix = NULL, directed = FALSE, - loops = FALSE + loops = FALSE, + nodes = deprecated() ) {}, when = "3.0.0" ), @@ -195,12 +198,13 @@ migrations <- list( sample_asym_pref = list( old = function(nodes, types, type.dist.matrix, pref.matrix, loops) {}, new = function( - nodes, + n, types, ..., type.dist.matrix = NULL, pref.matrix = NULL, - loops = FALSE + loops = FALSE, + nodes = deprecated() ) {}, when = "3.0.0" ), @@ -311,12 +315,13 @@ migrations <- list( sample_forestfire = list( old = function(nodes, fw.prob, bw.factor, ambs, directed) {}, new = function( - nodes, + n, fw.prob, ..., bw.factor = 1, ambs = 1, - directed = TRUE + directed = TRUE, + nodes = deprecated() ) {}, when = "3.0.0" ), @@ -348,11 +353,12 @@ migrations <- list( sample_grg = list( old = function(nodes, radius, torus, coords) {}, new = function( - nodes, + n, radius, ..., torus = FALSE, - coords = FALSE + coords = FALSE, + nodes = deprecated() ) {}, when = "3.0.0" ), @@ -463,14 +469,15 @@ migrations <- list( loops ) {}, new = function( - nodes, + n, types, ..., type.dist = NULL, fixed.sizes = FALSE, pref.matrix = NULL, directed = FALSE, - loops = FALSE + loops = FALSE, + nodes = deprecated() ) {}, when = "3.0.0" ), @@ -505,13 +512,14 @@ migrations <- list( sample_traits = list( old = function(nodes, types, k, type.dist, pref.matrix, directed) {}, new = function( - nodes, + n, types, k = 1, ..., type.dist = NULL, pref.matrix = NULL, - directed = FALSE + directed = FALSE, + nodes = deprecated() ) {}, when = "3.0.0" ), @@ -526,13 +534,14 @@ migrations <- list( directed ) {}, new = function( - nodes, + n, types, ..., edge.per.step = 1, type.dist = NULL, pref.matrix = NULL, - directed = FALSE + directed = FALSE, + nodes = deprecated() ) {}, when = "3.0.0" ), @@ -567,13 +576,14 @@ migrations <- list( traits = list( old = function(nodes, types, k, type.dist, pref.matrix, directed) {}, new = function( - nodes, + n, types, k = 1, ..., type.dist = NULL, pref.matrix = NULL, - directed = FALSE + directed = FALSE, + nodes = deprecated() ) {}, when = "3.0.0" ), @@ -588,13 +598,14 @@ migrations <- list( directed ) {}, new = function( - nodes, + n, types, ..., edge.per.step = 1, type.dist = NULL, pref.matrix = NULL, - directed = FALSE + directed = FALSE, + nodes = deprecated() ) {}, when = "3.0.0" ) diff --git a/tools/migrations/misc.R b/tools/migrations/misc.R index 471d08a71aa..dfb74867dd7 100644 --- a/tools/migrations/misc.R +++ b/tools/migrations/misc.R @@ -28,7 +28,7 @@ migrations <- list( url, prefix, type, - nodes, + nodes = n, pair, which, base, @@ -40,7 +40,7 @@ migrations <- list( ..., prefix = "iso", type = "r001", - nodes = NULL, + n = NULL, pair = "A", which = 0, base = "https://github.com/igraph/graphsdb/raw/refs/heads/main",