From 6430fe9240fbcc2665446f299eaf9302c030ad1a Mon Sep 17 00:00:00 2001 From: David Schoch Date: Thu, 15 Oct 2026 21:25:00 +0200 Subject: [PATCH 1/9] refactor: Rename `index` to `vertices`/`edges` in the attribute accessors `vertex_attr()`, `vertex_attr<-`, `set_vertex_attr()` and `set_vertex_attrs()` rename `index` to `vertices`; `edge_attr()`, `edge_attr<-` and `set_edge_attr()` rename it to `edges`. Named legacy calls are recovered with a soft-deprecation; positional selectors and positional `value` keep working. Part of #2788. Co-Authored-By: Claude Opus 5.5 (1M context) --- R/attributes.R | 247 +++++++++++++++++++----- tests/testthat/_snaps/attributes.md | 18 ++ tests/testthat/test-attributes.R | 57 +++++- tests/testthat/test-constant-defaults.R | 4 +- 4 files changed, 269 insertions(+), 57 deletions(-) diff --git a/R/attributes.R b/R/attributes.R index 051f570ff6..f62651eef6 100644 --- a/R/attributes.R +++ b/R/attributes.R @@ -432,8 +432,9 @@ graph.attributes <- function(graph) { #' @param graph The graph. #' @param name Name of the attribute to query. If missing, then #' all vertex attributes are returned in a list. -#' @param index An optional vertex sequence to query the attribute only +#' @param vertices An optional vertex sequence to query the attribute only #' for these vertices. The default `NULL` selects all vertices. +#' @param index `r lifecycle::badge("deprecated")` Use `vertices` instead. #' @return The value of the vertex attribute, or the list of #' all vertex attributes, if `name` is missing. #' @@ -448,18 +449,33 @@ graph.attributes <- function(graph) { #' vertex_attr(g, "label") #' vertex_attr(g) #' plot(g) -vertex_attr <- function(graph, name, index = NULL) { +vertex_attr <- function(graph, name, vertices = NULL, index = deprecated()) { + if (lifecycle::is_present(index)) { + if (!missing(vertices)) { + cli::cli_abort(c( + "Argument {.arg vertices} of {.fn vertex_attr} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg index}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "vertex_attr(index = )", + "vertex_attr(vertices = )" + ) + vertices <- index + } + ensure_igraph(graph) if (missing(name)) { - if (is.null(index)) { + if (is.null(vertices)) { return(vertex.attributes(graph)) } - return(vertex.attributes(graph, index = index)) + return(vertex.attributes(graph, index = vertices)) } check_string(name) - if (is.null(index)) { - index <- V(graph) + if (is.null(vertices)) { + vertices <- V(graph) } myattr <- .Call( @@ -468,11 +484,11 @@ vertex_attr <- function(graph, name, index = NULL) { igraph_t_idx_attr, igraph_attr_idx_vertex )[[name]] - if (is_complete_iterator(index)) { + if (is_complete_iterator(vertices)) { return(myattr) } - index <- as_igraph_vs(graph, index) - myattr[index] + vertices <- as_igraph_vs(graph, vertices) + myattr[vertices] } #' Set one or more vertex attributes @@ -481,10 +497,11 @@ vertex_attr <- function(graph, name, index = NULL) { #' @param name The name of the vertex attribute to set. If missing, #' then `value` must be a named list, and its entries are #' set as vertex attributes. -#' @param index An optional vertex sequence to set the attributes +#' @param vertices An optional vertex sequence to set the attributes #' of a subset of vertices. The default `NULL` selects all vertices. +#' @param index `r lifecycle::badge("deprecated")` Use `vertices` instead. #' @param value The new value of the attribute(s) for all -#' (or `index`) vertices. +#' (or `vertices`) vertices. #' @return The graph, with the vertex attribute(s) added or set. #' #' @aliases vertex.attributes<- @@ -500,15 +517,36 @@ vertex_attr <- function(graph, name, index = NULL) { #' vertex_attr(g, "label") <- V(g)$name #' g #' plot(g) -`vertex_attr<-` <- function(graph, name, index = NULL, value) { - if (is.null(index)) { - index <- V(graph) +`vertex_attr<-` <- function( + graph, + name, + vertices = NULL, + index = deprecated(), + value +) { + if (lifecycle::is_present(index)) { + if (!missing(vertices)) { + cli::cli_abort(c( + "Argument {.arg vertices} of {.fn vertex_attr<-} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg index}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "`vertex_attr<-`(index = )", + "`vertex_attr<-`(vertices = )" + ) + vertices <- index + } + + if (is.null(vertices)) { + vertices <- V(graph) } if (missing(name)) { - `vertex.attributes<-`(graph, index = index, value = value) + `vertex.attributes<-`(graph, index = vertices, value = value) } else { check_string(name) - set_vertex_attr(graph, name = name, index = index, value = value) + set_vertex_attr(graph, name = name, vertices = vertices, value = value) } } @@ -517,9 +555,10 @@ vertex_attr <- function(graph, name, index = NULL) { #' #' @param graph The graph. #' @param name The name of the attribute to set. -#' @param index An optional vertex sequence to set the attributes +#' @param vertices An optional vertex sequence to set the attributes #' of a subset of vertices. The default `NULL` selects all vertices. -#' @param value The new value of the attribute for all (or `index`) +#' @param index `r lifecycle::badge("deprecated")` Use `vertices` instead. +#' @param value The new value of the attribute for all (or `vertices`) #' vertices. #' If `NULL`, the input is returned unchanged. #' @return The graph, with the vertex attribute added or set. @@ -532,15 +571,36 @@ vertex_attr <- function(graph, name, index = NULL) { #' set_vertex_attr("label", value = LETTERS[1:10]) #' g #' plot(g) -set_vertex_attr <- function(graph, name, index = NULL, value) { +set_vertex_attr <- function( + graph, + name, + vertices = NULL, + value, + index = deprecated() +) { + if (lifecycle::is_present(index)) { + if (!missing(vertices)) { + cli::cli_abort(c( + "Argument {.arg vertices} of {.fn set_vertex_attr} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg index}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "set_vertex_attr(index = )", + "set_vertex_attr(vertices = )" + ) + vertices <- index + } + call <- rlang::current_env() check_string(name) - if (is.null(index)) { - index <- V(graph) + if (is.null(vertices)) { + vertices <- V(graph) } - if (is_complete_iterator(index)) { + if (is_complete_iterator(vertices)) { return(i_set_vertex_attr( graph = graph, name = name, @@ -553,7 +613,7 @@ set_vertex_attr <- function(graph, name, index = NULL, value) { i_set_vertex_attr( graph = graph, name = name, - index = index, + index = vertices, value = value, call = call ) @@ -563,8 +623,9 @@ set_vertex_attr <- function(graph, name, index = NULL, value) { #' #' @param graph The graph. #' @param ... <[`dynamic-dots`][rlang::dyn-dots]> Named arguments, where the names are the attributes -#' @param index An optional vertex sequence to set the attributes +#' @param vertices An optional vertex sequence to set the attributes #' of a subset of vertices. The default `NULL` selects all vertices. +#' @param index `r lifecycle::badge("deprecated")` Use `vertices` instead. #' @return The graph, with the vertex attributes added or set. #' #' @family attributes @@ -576,9 +637,29 @@ set_vertex_attr <- function(graph, name, index = NULL, value) { #' # use splicing if suplying a list #' x <- list(color = "red", name = LETTERS[1:10]) #' set_vertex_attrs(g, !!!x) -#' # to set an attribute named "index" use `:=` -#' set_vertex_attrs(g, color = "blue", index := 10, name = LETTERS[1:10]) -set_vertex_attrs <- function(graph, ..., index = NULL) { +#' # to set an attribute named "vertices" use `:=` +#' set_vertex_attrs(g, color = "blue", vertices := 10, name = LETTERS[1:10]) +set_vertex_attrs <- function( + graph, + ..., + vertices = NULL, + index = deprecated() +) { + if (lifecycle::is_present(index)) { + if (!missing(vertices)) { + cli::cli_abort(c( + "Argument {.arg vertices} of {.fn set_vertex_attrs} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg index}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "set_vertex_attrs(index = )", + "set_vertex_attrs(vertices = )" + ) + vertices <- index + } + call <- rlang::current_env() dots <- rlang::list2(...) @@ -586,8 +667,8 @@ set_vertex_attrs <- function(graph, ..., index = NULL) { cli::cli_abort("All arguments in `...` must be named.") } - if (is.null(index)) { - index <- V(graph) + if (is.null(vertices)) { + vertices <- V(graph) } for (attr_name in names(dots)) { @@ -595,7 +676,7 @@ set_vertex_attrs <- function(graph, ..., index = NULL) { graph <- i_set_vertex_attr( graph, name = attr_name, - index = index, + index = vertices, value = attr_value, call = call ) @@ -756,8 +837,9 @@ set_value_at <- function(value, idx, length_out) { #' @param graph The graph #' @param name The name of the attribute to query. If missing, then #' all edge attributes are returned in a list. -#' @param index An optional edge sequence to query edge attributes +#' @param edges An optional edge sequence to query edge attributes #' for a subset of edges. The default `NULL` selects all edges. +#' @param index `r lifecycle::badge("deprecated")` Use `edges` instead. #' @return The value of the edge attribute, or the list of all #' edge attributes if `name` is missing. #' @@ -771,19 +853,34 @@ set_value_at <- function(value, idx, length_out) { #' set_edge_attr("color", value = "red") #' g #' plot(g, edge.width = E(g)$weight) -edge_attr <- function(graph, name, index = NULL) { +edge_attr <- function(graph, name, edges = NULL, index = deprecated()) { + if (lifecycle::is_present(index)) { + if (!missing(edges)) { + cli::cli_abort(c( + "Argument {.arg edges} of {.fn edge_attr} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg index}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "edge_attr(index = )", + "edge_attr(edges = )" + ) + edges <- index + } + ensure_igraph(graph) if (missing(name)) { - if (is.null(index)) { + if (is.null(edges)) { edge.attributes(graph) } else { - edge.attributes(graph, index = index) + edge.attributes(graph, index = edges) } } else { check_string(name) - if (is.null(index)) { - index <- E(graph) + if (is.null(edges)) { + edges <- E(graph) } myattr <- .Call( Rx_igraph_mybracket2, @@ -791,11 +888,11 @@ edge_attr <- function(graph, name, index = NULL) { igraph_t_idx_attr, igraph_attr_idx_edge )[[name]] - if (is_complete_iterator(index)) { + if (is_complete_iterator(edges)) { myattr } else { - index <- as_igraph_es(graph, index) - myattr[index] + edges <- as_igraph_es(graph, edges) + myattr[edges] } } } @@ -806,10 +903,11 @@ edge_attr <- function(graph, name, index = NULL) { #' @param name The name of the edge attribute to set. If missing, #' then `value` must be a named list, and its entries are #' set as edge attributes. -#' @param index An optional edge sequence to set the attributes +#' @param edges An optional edge sequence to set the attributes #' of a subset of edges. The default `NULL` selects all edges. +#' @param index `r lifecycle::badge("deprecated")` Use `edges` instead. #' @param value The new value of the attribute(s) for all -#' (or `index`) edges. +#' (or `edges`) edges. #' @return The graph, with the edge attribute(s) added or set. #' #' @aliases edge.attributes<- @@ -825,15 +923,36 @@ edge_attr <- function(graph, name, index = NULL) { #' edge_attr(g, "label") <- E(g)$name #' g #' plot(g) -`edge_attr<-` <- function(graph, name, index = NULL, value) { - if (is.null(index)) { - index <- E(graph) +`edge_attr<-` <- function( + graph, + name, + edges = NULL, + index = deprecated(), + value +) { + if (lifecycle::is_present(index)) { + if (!missing(edges)) { + cli::cli_abort(c( + "Argument {.arg edges} of {.fn edge_attr<-} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg index}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "`edge_attr<-`(index = )", + "`edge_attr<-`(edges = )" + ) + edges <- index + } + + if (is.null(edges)) { + edges <- E(graph) } if (missing(name)) { - `edge.attributes<-`(graph, index = index, value = value) + `edge.attributes<-`(graph, index = edges, value = value) } else { check_string(name) - set_edge_attr(graph, name = name, index = index, value = value) + set_edge_attr(graph, name = name, edges = edges, value = value) } } @@ -841,9 +960,10 @@ edge_attr <- function(graph, name, index = NULL) { #' #' @param graph The graph #' @param name The name of the attribute to set. -#' @param index An optional edge sequence to set the attributes of +#' @param edges An optional edge sequence to set the attributes of #' a subset of edges. The default `NULL` selects all edges. -#' @param value The new value of the attribute for all (or `index`) +#' @param index `r lifecycle::badge("deprecated")` Use `edges` instead. +#' @param value The new value of the attribute for all (or `edges`) #' edges. #' If `NULL`, the input is returned unchanged. #' @return The graph, with the edge attribute added or set. @@ -856,13 +976,34 @@ edge_attr <- function(graph, name, index = NULL) { #' set_edge_attr("label", value = LETTERS[1:10]) #' g #' plot(g) -set_edge_attr <- function(graph, name, index = NULL, value) { +set_edge_attr <- function( + graph, + name, + edges = NULL, + value, + index = deprecated() +) { + if (lifecycle::is_present(index)) { + if (!missing(edges)) { + cli::cli_abort(c( + "Argument {.arg edges} of {.fn set_edge_attr} was supplied more than once.", + i = "It was also supplied via its legacy name {.arg index}." + )) + } + lifecycle::deprecate_soft( + "3.0.0", + "set_edge_attr(index = )", + "set_edge_attr(edges = )" + ) + edges <- index + } + call <- rlang::current_env() check_string(name) - if (is.null(index)) { - index <- E(graph) + if (is.null(edges)) { + edges <- E(graph) } - if (is_complete_iterator(index)) { + if (is_complete_iterator(edges)) { i_set_edge_attr( graph = graph, name = name, @@ -874,7 +1015,7 @@ set_edge_attr <- function(graph, name, index = NULL, value) { i_set_edge_attr( graph = graph, name = name, - index = index, + index = edges, value = value, call = call ) diff --git a/tests/testthat/_snaps/attributes.md b/tests/testthat/_snaps/attributes.md index 69827e34ec..0bc345619b 100644 --- a/tests/testthat/_snaps/attributes.md +++ b/tests/testthat/_snaps/attributes.md @@ -128,3 +128,21 @@ Error in `set_vertex_attrs()`: ! All arguments in `...` must be named. +# attribute accessors with `index = ` are deprecated but still work + + Code + res <- vertex_attr(g, "name", index = 2:3) + Condition + Warning: + The `index` argument of `vertex_attr()` is deprecated as of igraph 3.0.0. + i Please use the `vertices` argument instead. + +--- + + Code + vertex_attr(g, "name", vertices = 1, index = 2) + Condition + Error in `vertex_attr()`: + ! Argument `vertices` of `vertex_attr()` was supplied more than once. + i It was also supplied via its legacy name `index`. + diff --git a/tests/testthat/test-attributes.R b/tests/testthat/test-attributes.R index f74392fc90..8f6dcb2593 100644 --- a/tests/testthat/test-attributes.R +++ b/tests/testthat/test-attributes.R @@ -156,7 +156,7 @@ test_that("we can set all attributes on some vertices/edges", { g2 <- make_graph(c(2, 1, 3, 1, 4, 1, 2, 5, 3, 6)) - vertex_attr(g2, index = c(1, 2, 4, 5)) <- vertex_attr(g) + vertex_attr(g2, vertices = c(1, 2, 4, 5)) <- vertex_attr(g) expect_equal( vertex_attr(g2), list( @@ -179,7 +179,7 @@ test_that("we can set all attributes on some vertices/edges", { ) ) - edge_attr(g2, index = c(1, 3, 5)) <- edge_attr(g) + edge_attr(g2, edges = c(1, 3, 5)) <- edge_attr(g) expect_equal( edge_attr(g2), list( @@ -569,3 +569,56 @@ test_that("set_vertex_attrs() works", { expect_equal(V(g)$age, rep(42, vcount(g))) expect_equal(V(g)$gender, rep("F", vcount(g))) }) + +test_that("attribute accessors with `index = ` are deprecated but still work", { + rlang::local_options(lifecycle_verbosity = "warning") + g <- make_ring(5) + V(g)$name <- letters[1:5] + E(g)$weight <- 1:5 + + expect_snapshot_igraph(res <- vertex_attr(g, "name", index = 2:3)) + expect_equal(res, vertex_attr(g, "name", vertices = 2:3)) + lifecycle::expect_deprecated(res <- edge_attr(g, "weight", index = 2:3)) + expect_equal(res, edge_attr(g, "weight", edges = 2:3)) + + lifecycle::expect_deprecated( + g2 <- set_vertex_attr(g, "x", index = 1:2, value = 1) + ) + expect_identical_graphs( + g2, + set_vertex_attr(g, "x", vertices = 1:2, value = 1) + ) + lifecycle::expect_deprecated( + g2 <- set_edge_attr(g, "x", index = 1:2, value = 1) + ) + expect_identical_graphs(g2, set_edge_attr(g, "x", edges = 1:2, value = 1)) + lifecycle::expect_deprecated(g2 <- set_vertex_attrs(g, x = 1, index = 1:2)) + expect_identical_graphs(g2, set_vertex_attrs(g, x = 1, vertices = 1:2)) + + g2 <- g + lifecycle::expect_deprecated(vertex_attr(g2, "x", index = 1:2) <- 1) + g3 <- g + vertex_attr(g3, "x", vertices = 1:2) <- 1 + expect_identical_graphs(g2, g3) + + g2 <- g + lifecycle::expect_deprecated(edge_attr(g2, "x", index = 1:2) <- 1) + g3 <- g + edge_attr(g3, "x", edges = 1:2) <- 1 + expect_identical_graphs(g2, g3) + + expect_snapshot_igraph_error(vertex_attr(g, "name", vertices = 1, index = 2)) +}) + +test_that("attribute accessors keep positional selectors", { + g <- make_ring(5) + V(g)$name <- letters[1:5] + expect_equal(vertex_attr(g, "name", 2:3), c("b", "c")) + g2 <- set_vertex_attr(g, "x", 1:2, value = 1) + expect_equal(V(g2)$x, c(1, 1, NA, NA, NA)) + # `value` also stays positional + g2 <- set_vertex_attr(g, "x", 1:2, 1) + expect_equal(V(g2)$x, c(1, 1, NA, NA, NA)) + g2 <- set_edge_attr(g, "x", 1:2, 1) + expect_equal(E(g2)$x, c(1, 1, NA, NA, NA)) +}) diff --git a/tests/testthat/test-constant-defaults.R b/tests/testthat/test-constant-defaults.R index 06f3fbcc34..6699870ba1 100644 --- a/tests/testthat/test-constant-defaults.R +++ b/tests/testthat/test-constant-defaults.R @@ -43,9 +43,9 @@ test_that("NULL selector defaults of round-2 functions select the full set", { expect_identical_graphs(reverse_edges(g, edges = NULL), reverse_edges(g)) V(g)$name <- letters[1:5] - expect_identical(vertex_attr(g, "name", index = NULL), vertex_attr(g, "name")) + expect_identical(vertex_attr(g, "name", vertices = NULL), vertex_attr(g, "name")) expect_identical(vertex.attributes(g, index = NULL), vertex.attributes(g)) - g2 <- set_vertex_attr(g, "x", index = NULL, value = 1) + g2 <- set_vertex_attr(g, "x", vertices = NULL, value = 1) expect_identical(vertex_attr(g2, "x"), rep(1, 5)) }) From cc0436be2704c3dcddc4e83d0c24e725877bf650 Mon Sep 17 00:00:00 2001 From: krlmlr Date: Sun, 18 Oct 2026 09:52:42 +0000 Subject: [PATCH 2/9] chore: Auto-update from GitHub Actions Run: https://github.com/igraph/rigraph/actions/runs/39115844224 --- man/betweenness.Rd | 9 ++++++--- man/count.multiple.Rd | 3 +-- man/edge.betweenness.Rd | 3 +-- man/edge_attr-set.Rd | 8 +++++--- man/edge_attr.Rd | 6 ++++-- man/ends.Rd | 6 ++++-- man/estimate_edge_betweenness.Rd | 3 +-- man/get.edge.attribute.Rd | 3 +-- man/get.vertex.attribute.Rd | 3 +-- man/head_of.Rd | 6 ++++-- man/incident.Rd | 12 ++++++++++-- man/is.loop.Rd | 3 +-- man/is.multiple.Rd | 3 +-- man/is.mutual.Rd | 3 +-- man/neighbors.Rd | 12 ++++++++++-- man/reverse_edges.Rd | 8 +++++--- man/sample_spanning_tree.Rd | 4 ++-- man/set.edge.attribute.Rd | 5 ++--- man/set.vertex.attribute.Rd | 5 ++--- man/set_edge_attr.Rd | 8 +++++--- man/set_vertex_attr.Rd | 8 +++++--- man/set_vertex_attrs.Rd | 10 ++++++---- man/subcomponent.Rd | 20 ++++++++++++++------ man/subgraph.Rd | 14 +++++++++++--- man/subgraph.edges.Rd | 4 ++-- man/tail_of.Rd | 6 ++++-- man/vertex_attr-set.Rd | 8 +++++--- man/vertex_attr.Rd | 6 ++++-- man/which_multiple.Rd | 10 ++++++---- man/which_mutual.Rd | 6 ++++-- tests/testthat/test-centrality.R | 7 ++++++- tests/testthat/test-constant-defaults.R | 5 ++++- 32 files changed, 138 insertions(+), 79 deletions(-) diff --git a/man/betweenness.Rd b/man/betweenness.Rd index c0a9ef9979..bf6ecae18f 100644 --- a/man/betweenness.Rd +++ b/man/betweenness.Rd @@ -20,11 +20,12 @@ betweenness( edge_betweenness( graph, - e = NULL, + edges = NULL, ..., directed = TRUE, weights = NULL, - cutoff = -1 + cutoff = -1, + e = deprecated() ) } \arguments{ @@ -60,8 +61,10 @@ betweenness. If negative, then there is no such limit.} \item{v}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{vertices} instead.} -\item{e}{The edges for which the edge betweenness will be calculated. +\item{edges}{The edges for which the edge betweenness will be calculated. The default \code{NULL} selects all edges.} + +\item{e}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{edges} instead.} } \value{ A numeric vector with the betweenness score for each vertex in diff --git a/man/count.multiple.Rd b/man/count.multiple.Rd index a4e624fe0c..d97bbb990f 100644 --- a/man/count.multiple.Rd +++ b/man/count.multiple.Rd @@ -9,8 +9,7 @@ count.multiple(graph, eids = E(graph)) \arguments{ \item{graph}{The input graph.} -\item{eids}{The edges to which the query is restricted. The default -\code{NULL} selects all edges.} +\item{eids}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{edges} instead.} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/edge.betweenness.Rd b/man/edge.betweenness.Rd index a98737cf18..0ec479ca94 100644 --- a/man/edge.betweenness.Rd +++ b/man/edge.betweenness.Rd @@ -15,8 +15,7 @@ edge.betweenness( \arguments{ \item{graph}{The graph to analyze.} -\item{e}{The edges for which the edge betweenness will be calculated. -The default \code{NULL} selects all edges.} +\item{e}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{edges} instead.} \item{directed}{Logical, whether directed paths should be considered while determining the shortest paths.} diff --git a/man/edge_attr-set.Rd b/man/edge_attr-set.Rd index e25638f33e..d46617dbe0 100644 --- a/man/edge_attr-set.Rd +++ b/man/edge_attr-set.Rd @@ -5,7 +5,7 @@ \alias{edge.attributes<-} \title{Set one or more edge attributes} \usage{ -edge_attr(graph, name, index = NULL) <- value +edge_attr(graph, name, edges = NULL, index = deprecated()) <- value } \arguments{ \item{graph}{The graph.} @@ -14,11 +14,13 @@ edge_attr(graph, name, index = NULL) <- value then \code{value} must be a named list, and its entries are set as edge attributes.} -\item{index}{An optional edge sequence to set the attributes +\item{edges}{An optional edge sequence to set the attributes of a subset of edges. The default \code{NULL} selects all edges.} +\item{index}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{edges} instead.} + \item{value}{The new value of the attribute(s) for all -(or \code{index}) edges.} +(or \code{edges}) edges.} } \value{ The graph, with the edge attribute(s) added or set. diff --git a/man/edge_attr.Rd b/man/edge_attr.Rd index d1a412dc8d..3fca9d6cff 100644 --- a/man/edge_attr.Rd +++ b/man/edge_attr.Rd @@ -5,7 +5,7 @@ \alias{edge.attributes} \title{Query edge attributes of a graph} \usage{ -edge_attr(graph, name, index = NULL) +edge_attr(graph, name, edges = NULL, index = deprecated()) } \arguments{ \item{graph}{The graph} @@ -13,8 +13,10 @@ edge_attr(graph, name, index = NULL) \item{name}{The name of the attribute to query. If missing, then all edge attributes are returned in a list.} -\item{index}{An optional edge sequence to query edge attributes +\item{edges}{An optional edge sequence to query edge attributes for a subset of edges. The default \code{NULL} selects all edges.} + +\item{index}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{edges} instead.} } \value{ The value of the edge attribute, or the list of all diff --git a/man/ends.Rd b/man/ends.Rd index be8c438198..2fb27f521b 100644 --- a/man/ends.Rd +++ b/man/ends.Rd @@ -5,17 +5,19 @@ \alias{get.edges} \title{Incident vertices of some graph edges} \usage{ -ends(graph, es, ..., names = TRUE) +ends(graph, edges, ..., names = TRUE, es = deprecated()) } \arguments{ \item{graph}{The input graph} -\item{es}{The sequence of edges to query} +\item{edges}{The sequence of edges to query} \item{...}{These dots are for future extensions and must be empty.} \item{names}{Whether to return vertex names or numeric vertex IDs. By default vertex names are used.} + +\item{es}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{edges} instead.} } \value{ A two column matrix of vertex names or vertex IDs. diff --git a/man/estimate_edge_betweenness.Rd b/man/estimate_edge_betweenness.Rd index acd055427c..e04e407f35 100644 --- a/man/estimate_edge_betweenness.Rd +++ b/man/estimate_edge_betweenness.Rd @@ -15,8 +15,7 @@ estimate_edge_betweenness( \arguments{ \item{graph}{The graph to analyze.} -\item{e}{The edges for which the edge betweenness will be calculated. -The default \code{NULL} selects all edges.} +\item{e}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{edges} instead.} \item{directed}{Logical, whether directed paths should be considered while determining the shortest paths.} diff --git a/man/get.edge.attribute.Rd b/man/get.edge.attribute.Rd index 5fc746f899..d98c7469be 100644 --- a/man/get.edge.attribute.Rd +++ b/man/get.edge.attribute.Rd @@ -12,8 +12,7 @@ get.edge.attribute(graph, name, index = E(graph)) \item{name}{The name of the attribute to query. If missing, then all edge attributes are returned in a list.} -\item{index}{An optional edge sequence to query edge attributes -for a subset of edges. The default \code{NULL} selects all edges.} +\item{index}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{edges} instead.} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/get.vertex.attribute.Rd b/man/get.vertex.attribute.Rd index b13e8f4446..21fa5e84a5 100644 --- a/man/get.vertex.attribute.Rd +++ b/man/get.vertex.attribute.Rd @@ -12,8 +12,7 @@ get.vertex.attribute(graph, name, index = V(graph)) \item{name}{Name of the attribute to query. If missing, then all vertex attributes are returned in a list.} -\item{index}{An optional vertex sequence to query the attribute only -for these vertices. The default \code{NULL} selects all vertices.} +\item{index}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{vertices} instead.} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/head_of.Rd b/man/head_of.Rd index 4e916b2631..eb29264e59 100644 --- a/man/head_of.Rd +++ b/man/head_of.Rd @@ -4,12 +4,14 @@ \alias{head_of} \title{Head of the edge(s) in a graph} \usage{ -head_of(graph, es) +head_of(graph, edges, es = deprecated()) } \arguments{ \item{graph}{The input graph.} -\item{es}{The edges to query.} +\item{edges}{The edges to query.} + +\item{es}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{edges} instead.} } \value{ A vertex sequence with the head(s) of the edge(s). diff --git a/man/incident.Rd b/man/incident.Rd index c0833e4639..d63f30112e 100644 --- a/man/incident.Rd +++ b/man/incident.Rd @@ -4,18 +4,26 @@ \alias{incident} \title{Incident edges of a vertex in a graph} \usage{ -incident(graph, v, ..., mode = c("all", "out", "in", "total")) +incident( + graph, + vertex, + ..., + mode = c("all", "out", "in", "total"), + v = deprecated() +) } \arguments{ \item{graph}{The input graph.} -\item{v}{The vertex of which the incident edges are queried.} +\item{vertex}{The vertex of which the incident edges are queried.} \item{...}{These dots are for future extensions and must be empty.} \item{mode}{Whether to query outgoing (\sQuote{out}), incoming (\sQuote{in}) edges, or both types (\sQuote{all}). This is ignored for undirected graphs.} + +\item{v}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{vertex} instead.} } \value{ An edge sequence containing the incident edges of diff --git a/man/is.loop.Rd b/man/is.loop.Rd index ce99c88946..6edd60a140 100644 --- a/man/is.loop.Rd +++ b/man/is.loop.Rd @@ -9,8 +9,7 @@ is.loop(graph, eids = E(graph)) \arguments{ \item{graph}{The input graph.} -\item{eids}{The edges to which the query is restricted. The default -\code{NULL} selects all edges.} +\item{eids}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{edges} instead.} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/is.multiple.Rd b/man/is.multiple.Rd index 8ea9bd2d76..c3c4ddc8cd 100644 --- a/man/is.multiple.Rd +++ b/man/is.multiple.Rd @@ -9,8 +9,7 @@ is.multiple(graph, eids = E(graph)) \arguments{ \item{graph}{The input graph.} -\item{eids}{The edges to which the query is restricted. The default -\code{NULL} selects all edges.} +\item{eids}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{edges} instead.} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/is.mutual.Rd b/man/is.mutual.Rd index 321108ac67..37b1dc1cf7 100644 --- a/man/is.mutual.Rd +++ b/man/is.mutual.Rd @@ -9,8 +9,7 @@ is.mutual(graph, eids = E(graph), loops = TRUE) \arguments{ \item{graph}{The input graph.} -\item{eids}{Edge sequence, the edges that will be probed. The default -\code{NULL} includes all edges in the order of their IDs.} +\item{eids}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{edges} instead.} \item{loops}{Logical, whether to consider directed self-loops to be mutual.} } diff --git a/man/neighbors.Rd b/man/neighbors.Rd index 7ddf86de6c..40d37357bf 100644 --- a/man/neighbors.Rd +++ b/man/neighbors.Rd @@ -4,18 +4,26 @@ \alias{neighbors} \title{Neighboring (adjacent) vertices in a graph} \usage{ -neighbors(graph, v, ..., mode = c("out", "in", "all", "total")) +neighbors( + graph, + vertex, + ..., + mode = c("out", "in", "all", "total"), + v = deprecated() +) } \arguments{ \item{graph}{The input graph.} -\item{v}{The vertex of which the adjacent vertices are queried.} +\item{vertex}{The vertex of which the adjacent vertices are queried.} \item{...}{These dots are for future extensions and must be empty.} \item{mode}{Whether to query outgoing (\sQuote{out}), incoming (\sQuote{in}) edges, or both types (\sQuote{all}). This is ignored for undirected graphs.} + +\item{v}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{vertex} instead.} } \value{ A vertex sequence containing the neighbors of the input vertex. diff --git a/man/reverse_edges.Rd b/man/reverse_edges.Rd index f4d0cd085f..08488ebddf 100644 --- a/man/reverse_edges.Rd +++ b/man/reverse_edges.Rd @@ -5,16 +5,18 @@ \alias{t.igraph} \title{Reverse edges in a graph} \usage{ -reverse_edges(graph, eids = NULL) +reverse_edges(graph, edges = NULL, eids = deprecated()) \method{t}{igraph}(x) } \arguments{ \item{graph}{The input graph.} -\item{eids}{The edge IDs of the edges to reverse. The default \code{NULL} +\item{edges}{The edge IDs of the edges to reverse. The default \code{NULL} reverses all edges.} +\item{eids}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{edges} instead.} + \item{x}{The input graph.} } \value{ @@ -24,7 +26,7 @@ IDs are reversed \description{ The new graph will contain the same vertices, edges and attributes as the original graph, except that the direction of the edges selected by -their edge IDs in the \code{eids} argument will be reversed. When reversing +their edge IDs in the \code{edges} argument will be reversed. When reversing all edges, this operation is also known as graph transpose. } \section{Related documentation in the C library}{ diff --git a/man/sample_spanning_tree.Rd b/man/sample_spanning_tree.Rd index a6b5665dbb..d6d02f4603 100644 --- a/man/sample_spanning_tree.Rd +++ b/man/sample_spanning_tree.Rd @@ -4,7 +4,7 @@ \alias{sample_spanning_tree} \title{Samples from the spanning trees of a graph randomly and uniformly} \usage{ -sample_spanning_tree(graph, ..., vid = 0) +sample_spanning_tree(graph, ..., vertex = 0) } \arguments{ \item{graph}{The input graph to sample from. Edge directions are ignored if @@ -12,7 +12,7 @@ the graph is directed.} \item{...}{These dots are for future extensions and must be empty.} -\item{vid}{When the graph is disconnected, this argument specifies how to +\item{vertex}{When the graph is disconnected, this argument specifies how to handle the situation. When the argument is zero (the default), the sampling will be performed component-wise, and the result will be a spanning forest. When the argument contains a vertex ID, only the component containing the diff --git a/man/set.edge.attribute.Rd b/man/set.edge.attribute.Rd index d88601f71b..a637b18480 100644 --- a/man/set.edge.attribute.Rd +++ b/man/set.edge.attribute.Rd @@ -11,10 +11,9 @@ set.edge.attribute(graph, name, index = E(graph), value) \item{name}{The name of the attribute to set.} -\item{index}{An optional edge sequence to set the attributes of -a subset of edges. The default \code{NULL} selects all edges.} +\item{index}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{edges} instead.} -\item{value}{The new value of the attribute for all (or \code{index}) +\item{value}{The new value of the attribute for all (or \code{edges}) edges. If \code{NULL}, the input is returned unchanged.} } diff --git a/man/set.vertex.attribute.Rd b/man/set.vertex.attribute.Rd index f24c2f3077..df64d5bb10 100644 --- a/man/set.vertex.attribute.Rd +++ b/man/set.vertex.attribute.Rd @@ -11,10 +11,9 @@ set.vertex.attribute(graph, name, index = V(graph), value) \item{name}{The name of the attribute to set.} -\item{index}{An optional vertex sequence to set the attributes -of a subset of vertices. The default \code{NULL} selects all vertices.} +\item{index}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{vertices} instead.} -\item{value}{The new value of the attribute for all (or \code{index}) +\item{value}{The new value of the attribute for all (or \code{vertices}) vertices. If \code{NULL}, the input is returned unchanged.} } diff --git a/man/set_edge_attr.Rd b/man/set_edge_attr.Rd index ab5dd24576..0b9e87d89c 100644 --- a/man/set_edge_attr.Rd +++ b/man/set_edge_attr.Rd @@ -4,19 +4,21 @@ \alias{set_edge_attr} \title{Set edge attributes} \usage{ -set_edge_attr(graph, name, index = NULL, value) +set_edge_attr(graph, name, edges = NULL, value, index = deprecated()) } \arguments{ \item{graph}{The graph} \item{name}{The name of the attribute to set.} -\item{index}{An optional edge sequence to set the attributes of +\item{edges}{An optional edge sequence to set the attributes of a subset of edges. The default \code{NULL} selects all edges.} -\item{value}{The new value of the attribute for all (or \code{index}) +\item{value}{The new value of the attribute for all (or \code{edges}) edges. If \code{NULL}, the input is returned unchanged.} + +\item{index}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{edges} instead.} } \value{ The graph, with the edge attribute added or set. diff --git a/man/set_vertex_attr.Rd b/man/set_vertex_attr.Rd index 5d315ad020..86902da258 100644 --- a/man/set_vertex_attr.Rd +++ b/man/set_vertex_attr.Rd @@ -4,19 +4,21 @@ \alias{set_vertex_attr} \title{Set vertex attributes} \usage{ -set_vertex_attr(graph, name, index = NULL, value) +set_vertex_attr(graph, name, vertices = NULL, value, index = deprecated()) } \arguments{ \item{graph}{The graph.} \item{name}{The name of the attribute to set.} -\item{index}{An optional vertex sequence to set the attributes +\item{vertices}{An optional vertex sequence to set the attributes of a subset of vertices. The default \code{NULL} selects all vertices.} -\item{value}{The new value of the attribute for all (or \code{index}) +\item{value}{The new value of the attribute for all (or \code{vertices}) vertices. If \code{NULL}, the input is returned unchanged.} + +\item{index}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{vertices} instead.} } \value{ The graph, with the vertex attribute added or set. diff --git a/man/set_vertex_attrs.Rd b/man/set_vertex_attrs.Rd index ca504251f0..f6f03577c2 100644 --- a/man/set_vertex_attrs.Rd +++ b/man/set_vertex_attrs.Rd @@ -4,15 +4,17 @@ \alias{set_vertex_attrs} \title{Set multiple vertex attributes} \usage{ -set_vertex_attrs(graph, ..., index = NULL) +set_vertex_attrs(graph, ..., vertices = NULL, index = deprecated()) } \arguments{ \item{graph}{The graph.} \item{...}{<\code{\link[rlang:dyn-dots]{dynamic-dots}}> Named arguments, where the names are the attributes} -\item{index}{An optional vertex sequence to set the attributes +\item{vertices}{An optional vertex sequence to set the attributes of a subset of vertices. The default \code{NULL} selects all vertices.} + +\item{index}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{vertices} instead.} } \value{ The graph, with the vertex attributes added or set. @@ -30,8 +32,8 @@ set_vertex_attrs(g, color = "blue", size = 10, name = LETTERS[1:10]) # use splicing if suplying a list x <- list(color = "red", name = LETTERS[1:10]) set_vertex_attrs(g, !!!x) -# to set an attribute named "index" use `:=` -set_vertex_attrs(g, color = "blue", index := 10, name = LETTERS[1:10]) +# to set an attribute named "vertices" use `:=` +set_vertex_attrs(g, color = "blue", vertices := 10, name = LETTERS[1:10]) } \seealso{ Vertex, edge and graph attributes: diff --git a/man/subcomponent.Rd b/man/subcomponent.Rd index cd4092391c..4a0c9f63b2 100644 --- a/man/subcomponent.Rd +++ b/man/subcomponent.Rd @@ -4,31 +4,39 @@ \alias{subcomponent} \title{In- or out- component of a vertex} \usage{ -subcomponent(graph, v, ..., mode = c("all", "out", "in")) +subcomponent( + graph, + vertex, + ..., + mode = c("all", "out", "in"), + v = deprecated() +) } \arguments{ \item{graph}{The graph to analyze.} -\item{v}{The vertex to start the search from.} +\item{vertex}{The vertex to start the search from.} \item{...}{These dots are for future extensions and must be empty.} \item{mode}{Character string, either \dQuote{in}, \dQuote{out} or -\dQuote{all}. If \dQuote{in} all vertices from which \code{v} is reachable -are listed. If \dQuote{out} all vertices reachable from \code{v} are +\dQuote{all}. If \dQuote{in} all vertices from which \code{vertex} is reachable +are listed. If \dQuote{out} all vertices reachable from \code{vertex} are returned. If \dQuote{all} returns the union of these. It is ignored for undirected graphs.} + +\item{v}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{vertex} instead.} } \value{ Numeric vector, the IDs of the vertices in the same component as -\code{v}. +\code{vertex}. } \description{ Finds all vertices reachable from a given vertex, or the opposite: all vertices from which a given vertex is reachable via a directed path. } \details{ -A breadth-first search is conducted starting from vertex \code{v}. +A breadth-first search is conducted starting from vertex \code{vertex}. } \section{Related documentation in the C library}{ \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}} diff --git a/man/subgraph.Rd b/man/subgraph.Rd index 3dd9858bb6..41ece1613b 100644 --- a/man/subgraph.Rd +++ b/man/subgraph.Rd @@ -16,7 +16,13 @@ induced_subgraph( vids = deprecated() ) -subgraph_from_edges(graph, eids, ..., delete.vertices = TRUE) +subgraph_from_edges( + graph, + edges, + ..., + delete.vertices = TRUE, + eids = deprecated() +) } \arguments{ \item{graph}{The original graph.} @@ -37,10 +43,12 @@ scratch. \sQuote{\code{auto}} chooses between the two implementations automatically, using heuristics based on the size of the original and the result graph.} -\item{eids}{The edge IDs of the edges that will be kept in the result graph.} +\item{edges}{The edge IDs of the edges that will be kept in the result graph.} \item{delete.vertices}{Logical, whether to remove vertices that do -not have any adjacent edges in \code{eids}.} +not have any adjacent edges in \code{edges}.} + +\item{eids}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{edges} instead.} } \value{ A new graph object. diff --git a/man/subgraph.edges.Rd b/man/subgraph.edges.Rd index 903f76914b..9b5d74bf5d 100644 --- a/man/subgraph.edges.Rd +++ b/man/subgraph.edges.Rd @@ -9,10 +9,10 @@ subgraph.edges(graph, eids, delete.vertices = TRUE) \arguments{ \item{graph}{The original graph.} -\item{eids}{The edge IDs of the edges that will be kept in the result graph.} +\item{eids}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{edges} instead.} \item{delete.vertices}{Logical, whether to remove vertices that do -not have any adjacent edges in \code{eids}.} +not have any adjacent edges in \code{edges}.} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/tail_of.Rd b/man/tail_of.Rd index 91f16cab2a..fb176dde06 100644 --- a/man/tail_of.Rd +++ b/man/tail_of.Rd @@ -4,12 +4,14 @@ \alias{tail_of} \title{Tails of the edge(s) in a graph} \usage{ -tail_of(graph, es) +tail_of(graph, edges, es = deprecated()) } \arguments{ \item{graph}{The input graph.} -\item{es}{The edges to query.} +\item{edges}{The edges to query.} + +\item{es}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{edges} instead.} } \value{ A vertex sequence with the tail(s) of the edge(s). diff --git a/man/vertex_attr-set.Rd b/man/vertex_attr-set.Rd index 817c5abfe5..febd48feac 100644 --- a/man/vertex_attr-set.Rd +++ b/man/vertex_attr-set.Rd @@ -5,7 +5,7 @@ \alias{vertex.attributes<-} \title{Set one or more vertex attributes} \usage{ -vertex_attr(graph, name, index = NULL) <- value +vertex_attr(graph, name, vertices = NULL, index = deprecated()) <- value } \arguments{ \item{graph}{The graph.} @@ -14,11 +14,13 @@ vertex_attr(graph, name, index = NULL) <- value then \code{value} must be a named list, and its entries are set as vertex attributes.} -\item{index}{An optional vertex sequence to set the attributes +\item{vertices}{An optional vertex sequence to set the attributes of a subset of vertices. The default \code{NULL} selects all vertices.} +\item{index}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{vertices} instead.} + \item{value}{The new value of the attribute(s) for all -(or \code{index}) vertices.} +(or \code{vertices}) vertices.} } \value{ The graph, with the vertex attribute(s) added or set. diff --git a/man/vertex_attr.Rd b/man/vertex_attr.Rd index 5a864092fe..72075de771 100644 --- a/man/vertex_attr.Rd +++ b/man/vertex_attr.Rd @@ -5,7 +5,7 @@ \alias{vertex.attributes} \title{Query vertex attributes of a graph} \usage{ -vertex_attr(graph, name, index = NULL) +vertex_attr(graph, name, vertices = NULL, index = deprecated()) } \arguments{ \item{graph}{The graph.} @@ -13,8 +13,10 @@ vertex_attr(graph, name, index = NULL) \item{name}{Name of the attribute to query. If missing, then all vertex attributes are returned in a list.} -\item{index}{An optional vertex sequence to query the attribute only +\item{vertices}{An optional vertex sequence to query the attribute only for these vertices. The default \code{NULL} selects all vertices.} + +\item{index}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{vertices} instead.} } \value{ The value of the vertex attribute, or the list of diff --git a/man/which_multiple.Rd b/man/which_multiple.Rd index 4d166b4a5a..8fa03ad52c 100644 --- a/man/which_multiple.Rd +++ b/man/which_multiple.Rd @@ -9,13 +9,13 @@ \alias{count_loops} \title{Find the multiple or loop edges in a graph} \usage{ -which_multiple(graph, eids = NULL) +which_multiple(graph, edges = NULL, eids = deprecated()) any_multiple(graph) -count_multiple(graph, eids = NULL) +count_multiple(graph, edges = NULL, eids = deprecated()) -which_loop(graph, eids = NULL) +which_loop(graph, edges = NULL, eids = deprecated()) any_loop(graph) @@ -24,8 +24,10 @@ count_loops(graph) \arguments{ \item{graph}{The input graph.} -\item{eids}{The edges to which the query is restricted. The default +\item{edges}{The edges to which the query is restricted. The default \code{NULL} selects all edges.} + +\item{eids}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{edges} instead.} } \value{ \code{any_loop()} and \code{any_multiple()} return a Logical. diff --git a/man/which_mutual.Rd b/man/which_mutual.Rd index 46346529c7..a9ed74426e 100644 --- a/man/which_mutual.Rd +++ b/man/which_mutual.Rd @@ -4,17 +4,19 @@ \alias{which_mutual} \title{Find mutual edges in a directed graph} \usage{ -which_mutual(graph, eids = NULL, ..., loops = TRUE) +which_mutual(graph, edges = NULL, ..., loops = TRUE, eids = deprecated()) } \arguments{ \item{graph}{The input graph.} -\item{eids}{Edge sequence, the edges that will be probed. The default +\item{edges}{Edge sequence, the edges that will be probed. The default \code{NULL} includes all edges in the order of their IDs.} \item{...}{These dots are for future extensions and must be empty.} \item{loops}{Logical, whether to consider directed self-loops to be mutual.} + +\item{eids}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{edges} instead.} } \value{ A logical vector of the same length as the number of edges supplied. diff --git a/tests/testthat/test-centrality.R b/tests/testthat/test-centrality.R index 9330f768c3..30ccc0b138 100644 --- a/tests/testthat/test-centrality.R +++ b/tests/testthat/test-centrality.R @@ -1039,7 +1039,12 @@ test_that("edge_betweenness() covers migrated tail args and positional recovery" expect_equal(res, rep(3, 3)) # With a cutoff of 1 each edge only carries the path of its endpoints. expect_equal( - edge_betweenness(ring, edges = E(ring)[1:3], weights = rep(1, 5), cutoff = 1), + edge_betweenness( + ring, + edges = E(ring)[1:3], + weights = rep(1, 5), + cutoff = 1 + ), rep(1, 3) ) diff --git a/tests/testthat/test-constant-defaults.R b/tests/testthat/test-constant-defaults.R index 6699870ba1..e09d12e6b9 100644 --- a/tests/testthat/test-constant-defaults.R +++ b/tests/testthat/test-constant-defaults.R @@ -43,7 +43,10 @@ test_that("NULL selector defaults of round-2 functions select the full set", { expect_identical_graphs(reverse_edges(g, edges = NULL), reverse_edges(g)) V(g)$name <- letters[1:5] - expect_identical(vertex_attr(g, "name", vertices = NULL), vertex_attr(g, "name")) + expect_identical( + vertex_attr(g, "name", vertices = NULL), + vertex_attr(g, "name") + ) expect_identical(vertex.attributes(g, index = NULL), vertex.attributes(g)) g2 <- set_vertex_attr(g, "x", vertices = NULL, value = 1) expect_identical(vertex_attr(g2, "x"), rep(1, 5)) From 4f731520ef16ff73a496e3954f94898b0da8a458 Mon Sep 17 00:00:00 2001 From: David Schoch Date: Wed, 2 Dec 2026 18:11:15 +0100 Subject: [PATCH 3/9] test: Use `vertices` in the `V<-` protocol test Co-Authored-By: Claude Opus 5.5 --- tests/testthat/test-iterators.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-iterators.R b/tests/testthat/test-iterators.R index 6e313aafed..2b920fe61f 100644 --- a/tests/testthat/test-iterators.R +++ b/tests/testthat/test-iterators.R @@ -629,7 +629,7 @@ test_that("custom replacement functions following the `V<-` protocol work", { set_vertex_attr( x, attr(value, "name"), - index = value, + vertices = value, value = attr(value, "value") ) } From 1510ef120476751fbe906d6bba2be4f1d7966d8c Mon Sep 17 00:00:00 2001 From: schochastics Date: Thu, 3 Dec 2026 09:12:46 +0000 Subject: [PATCH 4/9] chore: Auto-update from GitHub Actions Run: https://github.com/igraph/rigraph/actions/runs/47071148767 --- .../testthat/_snaps/structural-properties.md | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/testthat/_snaps/structural-properties.md b/tests/testthat/_snaps/structural-properties.md index ff1dd3e447..b40a478dae 100644 --- a/tests/testthat/_snaps/structural-properties.md +++ b/tests/testthat/_snaps/structural-properties.md @@ -86,6 +86,22 @@ The `normalized` argument of `laplacian_matrix()` is deprecated as of igraph 2.0.3. i Please use the `normalization` argument instead. +# shortest_paths() returns inbound edges as an edge sequence + + Code + print(res$inbound_edges) + Output + + 5/5 edges: + [1] NA->NA 1-> 2 2-> 3 NA->NA NA->NA + +--- + + Code + print(res$inbound_edges) + Output + -- 5/5 --------------------------------------------------------- + [1] NA 1 -> 2 2 -> 3 NA NA + # degree(v = ) is deprecated but still works Code @@ -113,19 +129,3 @@ The `eids` argument of `which_multiple()` is deprecated as of igraph 3.0.0. i Please use the `edges` argument instead. -# shortest_paths() returns inbound edges as an edge sequence - - Code - print(res$inbound_edges) - Output - + 5/5 edges: - [1] NA->NA 1-> 2 2-> 3 NA->NA NA->NA - ---- - - Code - print(res$inbound_edges) - Output - -- 5/5 --------------------------------------------------------- - [1] NA 1 -> 2 2 -> 3 NA NA - From c057c929334ebc8244fe886258b5523056a05a06 Mon Sep 17 00:00:00 2001 From: David Schoch Date: Thu, 3 Dec 2026 11:22:54 +0100 Subject: [PATCH 5/9] test: Drop the duplicated inbound-edges snapshot Co-Authored-By: Claude Opus 5.5 --- .../testthat/_snaps/structural-properties.md | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/tests/testthat/_snaps/structural-properties.md b/tests/testthat/_snaps/structural-properties.md index 569531513f..fae4bfac75 100644 --- a/tests/testthat/_snaps/structural-properties.md +++ b/tests/testthat/_snaps/structural-properties.md @@ -128,23 +128,5 @@ Warning: The `eids` argument of `which_multiple()` is deprecated as of igraph 3.0.0. i Please use the `edges` argument instead. - - -# shortest_paths() returns inbound edges as an edge sequence - - Code - print(res$inbound_edges) - Output - + 5/5 edges: - [1] NA->NA 1-> 2 2-> 3 NA->NA NA->NA - ---- - - Code - print(res$inbound_edges) - Output - -- 5/5 --------------------------------------------------------- - [1] NA 1 -> 2 2 -> 3 NA NA - - + From 5be4794e40b96c6f92b3330edee54ad3f2f2c68d Mon Sep 17 00:00:00 2001 From: David Schoch Date: Thu, 3 Dec 2026 11:24:01 +0100 Subject: [PATCH 6/9] test: Drop a stray blank line from the structural-properties snapshots Co-Authored-By: Claude Opus 5.5 --- tests/testthat/_snaps/structural-properties.md | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/testthat/_snaps/structural-properties.md b/tests/testthat/_snaps/structural-properties.md index fae4bfac75..b40a478dae 100644 --- a/tests/testthat/_snaps/structural-properties.md +++ b/tests/testthat/_snaps/structural-properties.md @@ -128,5 +128,4 @@ Warning: The `eids` argument of `which_multiple()` is deprecated as of igraph 3.0.0. i Please use the `edges` argument instead. - From 9ca0c03c072a0cdb84c891eda0c1d61849492a65 Mon Sep 17 00:00:00 2001 From: David Schoch Date: Thu, 3 Dec 2026 15:42:36 +0100 Subject: [PATCH 7/9] refactor: Let the generator own the remaining renames that positional values follow These functions had hand-written bridges for their old argument names, so a call naming the old one and passing the next argument positionally failed with "supplied more than once". Their registry entries now let the generator re-match such calls against the old signature. Co-Authored-By: Claude Opus 5.5 --- R/attributes.R | 156 ++++++++++++++++++++++++---------- tools/migrations/attributes.R | 29 +++++++ 2 files changed, 141 insertions(+), 44 deletions(-) create mode 100644 tools/migrations/attributes.R diff --git a/R/attributes.R b/R/attributes.R index 46b60f28df..9d248c97ee 100644 --- a/R/attributes.R +++ b/R/attributes.R @@ -529,20 +529,37 @@ vertex_attr <- function(graph, name, vertices = NULL, index = deprecated()) { index = deprecated(), value ) { - if (lifecycle::is_present(index)) { - if (!missing(vertices)) { - cli::cli_abort(c( - "Argument {.arg vertices} of {.fn vertex_attr<-} was supplied more than once.", - i = "It was also supplied via its legacy name {.arg index}." + # BEGIN GENERATED ARG_HANDLE: vertex_attr<-, do not edit, see tools/generate-migrations.R + # fmt: skip + if (!base::missing(index)) { + # Pre-3.0.0 signature: vertex_attr<-(graph, name, index, value) + .old_signature <- function(graph, name, index, value, ...) { + base::list(env = base::environment(), n_extra = ...length(), extra = base::as.character(base::names(base::substitute(...()))), recovered = base::c( + if (!base::missing(graph)) base::c(graph = "graph"), + if (!base::missing(name)) base::c(name = "name"), + if (!base::missing(index)) base::c(vertices = "index"), + if (!base::missing(value)) base::c(value = "value") )) } - lifecycle::deprecate_soft( - "3.0.0", - "`vertex_attr<-`(index = )", - "`vertex_attr<-`(vertices = )" - ) - vertices <- index + .arg_call <- base::sys.call() + .arg_call[[1L]] <- .old_signature + .arg_handle <- base::eval(.arg_call, base::parent.frame()) + .arg_extra <- .arg_handle$extra + if (.arg_handle$n_extra > base::sum(base::nzchar(.arg_extra))) cli::cli_abort("Too many arguments passed to {.fn vertex_attr<-}.") + .arg_explicit <- base::c("graph", "name", "vertices", "value", "index")[base::pmatch(.arg_extra, base::c("graph", "name", "vertices", "value", "index"), duplicates.ok = TRUE)] + if (base::anyNA(.arg_explicit)) cli::cli_abort("Unexpected argument passed to {.fn vertex_attr<-}: {.arg {(.arg_extra[base::is.na(.arg_explicit)])}}.") + .arg_recovered <- .arg_handle$recovered + .arg_names <- base::names(.arg_recovered) + .arg_conflict <- base::intersect(.arg_names, .arg_explicit) + if (base::length(.arg_conflict) > 0L) { + .arg_conflict <- .arg_conflict[[1L]] + .arg_via <- .arg_recovered[[.arg_conflict]] + cli::cli_abort(base::c("Argument {.arg {(.arg_conflict)}} of {.fn vertex_attr<-} was supplied more than once.", i = if (base::is.element(.arg_via, base::names(.arg_call))) "It was also supplied via its legacy name {.arg {(.arg_via)}}." else "It was also passed by position, as {.arg {(.arg_via)}} of the old signature.")) + } + 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())) + if (!base::missing(index)) lifecycle::deprecate_soft("3.0.0", "`vertex_attr<-`(index = )", "`vertex_attr<-`(vertices = )") } + # END GENERATED ARG_HANDLE if (is.null(vertices)) { vertices <- V(graph) @@ -583,20 +600,37 @@ set_vertex_attr <- function( value, index = deprecated() ) { - if (lifecycle::is_present(index)) { - if (!missing(vertices)) { - cli::cli_abort(c( - "Argument {.arg vertices} of {.fn set_vertex_attr} was supplied more than once.", - i = "It was also supplied via its legacy name {.arg index}." + # BEGIN GENERATED ARG_HANDLE: set_vertex_attr, do not edit, see tools/generate-migrations.R + # fmt: skip + if (!base::missing(index)) { + # Pre-3.0.0 signature: set_vertex_attr(graph, name, index, value) + .old_signature <- function(graph, name, index, value, ...) { + base::list(env = base::environment(), n_extra = ...length(), extra = base::as.character(base::names(base::substitute(...()))), recovered = base::c( + if (!base::missing(graph)) base::c(graph = "graph"), + if (!base::missing(name)) base::c(name = "name"), + if (!base::missing(index)) base::c(vertices = "index"), + if (!base::missing(value)) base::c(value = "value") )) } - lifecycle::deprecate_soft( - "3.0.0", - "set_vertex_attr(index = )", - "set_vertex_attr(vertices = )" - ) - vertices <- index + .arg_call <- base::sys.call() + .arg_call[[1L]] <- .old_signature + .arg_handle <- base::eval(.arg_call, base::parent.frame()) + .arg_extra <- .arg_handle$extra + if (.arg_handle$n_extra > base::sum(base::nzchar(.arg_extra))) cli::cli_abort("Too many arguments passed to {.fn set_vertex_attr}.") + .arg_explicit <- base::c("graph", "name", "vertices", "value", "index")[base::pmatch(.arg_extra, base::c("graph", "name", "vertices", "value", "index"), duplicates.ok = TRUE)] + if (base::anyNA(.arg_explicit)) cli::cli_abort("Unexpected argument passed to {.fn set_vertex_attr}: {.arg {(.arg_extra[base::is.na(.arg_explicit)])}}.") + .arg_recovered <- .arg_handle$recovered + .arg_names <- base::names(.arg_recovered) + .arg_conflict <- base::intersect(.arg_names, .arg_explicit) + if (base::length(.arg_conflict) > 0L) { + .arg_conflict <- .arg_conflict[[1L]] + .arg_via <- .arg_recovered[[.arg_conflict]] + cli::cli_abort(base::c("Argument {.arg {(.arg_conflict)}} of {.fn set_vertex_attr} was supplied more than once.", i = if (base::is.element(.arg_via, base::names(.arg_call))) "It was also supplied via its legacy name {.arg {(.arg_via)}}." else "It was also passed by position, as {.arg {(.arg_via)}} of the old signature.")) + } + 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())) + if (!base::missing(index)) lifecycle::deprecate_soft("3.0.0", "set_vertex_attr(index = )", "set_vertex_attr(vertices = )") } + # END GENERATED ARG_HANDLE call <- rlang::current_env() check_string(name) @@ -940,20 +974,37 @@ edge_attr <- function(graph, name, edges = NULL, index = deprecated()) { index = deprecated(), value ) { - if (lifecycle::is_present(index)) { - if (!missing(edges)) { - cli::cli_abort(c( - "Argument {.arg edges} of {.fn edge_attr<-} was supplied more than once.", - i = "It was also supplied via its legacy name {.arg index}." + # BEGIN GENERATED ARG_HANDLE: edge_attr<-, do not edit, see tools/generate-migrations.R + # fmt: skip + if (!base::missing(index)) { + # Pre-3.0.0 signature: edge_attr<-(graph, name, index, value) + .old_signature <- function(graph, name, index, value, ...) { + base::list(env = base::environment(), n_extra = ...length(), extra = base::as.character(base::names(base::substitute(...()))), recovered = base::c( + if (!base::missing(graph)) base::c(graph = "graph"), + if (!base::missing(name)) base::c(name = "name"), + if (!base::missing(index)) base::c(edges = "index"), + if (!base::missing(value)) base::c(value = "value") )) } - lifecycle::deprecate_soft( - "3.0.0", - "`edge_attr<-`(index = )", - "`edge_attr<-`(edges = )" - ) - edges <- index + .arg_call <- base::sys.call() + .arg_call[[1L]] <- .old_signature + .arg_handle <- base::eval(.arg_call, base::parent.frame()) + .arg_extra <- .arg_handle$extra + if (.arg_handle$n_extra > base::sum(base::nzchar(.arg_extra))) cli::cli_abort("Too many arguments passed to {.fn edge_attr<-}.") + .arg_explicit <- base::c("graph", "name", "edges", "value", "index")[base::pmatch(.arg_extra, base::c("graph", "name", "edges", "value", "index"), duplicates.ok = TRUE)] + if (base::anyNA(.arg_explicit)) cli::cli_abort("Unexpected argument passed to {.fn edge_attr<-}: {.arg {(.arg_extra[base::is.na(.arg_explicit)])}}.") + .arg_recovered <- .arg_handle$recovered + .arg_names <- base::names(.arg_recovered) + .arg_conflict <- base::intersect(.arg_names, .arg_explicit) + if (base::length(.arg_conflict) > 0L) { + .arg_conflict <- .arg_conflict[[1L]] + .arg_via <- .arg_recovered[[.arg_conflict]] + cli::cli_abort(base::c("Argument {.arg {(.arg_conflict)}} of {.fn edge_attr<-} was supplied more than once.", i = if (base::is.element(.arg_via, base::names(.arg_call))) "It was also supplied via its legacy name {.arg {(.arg_via)}}." else "It was also passed by position, as {.arg {(.arg_via)}} of the old signature.")) + } + 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())) + if (!base::missing(index)) lifecycle::deprecate_soft("3.0.0", "`edge_attr<-`(index = )", "`edge_attr<-`(edges = )") } + # END GENERATED ARG_HANDLE if (is.null(edges)) { edges <- E(graph) @@ -993,20 +1044,37 @@ set_edge_attr <- function( value, index = deprecated() ) { - if (lifecycle::is_present(index)) { - if (!missing(edges)) { - cli::cli_abort(c( - "Argument {.arg edges} of {.fn set_edge_attr} was supplied more than once.", - i = "It was also supplied via its legacy name {.arg index}." + # BEGIN GENERATED ARG_HANDLE: set_edge_attr, do not edit, see tools/generate-migrations.R + # fmt: skip + if (!base::missing(index)) { + # Pre-3.0.0 signature: set_edge_attr(graph, name, index, value) + .old_signature <- function(graph, name, index, value, ...) { + base::list(env = base::environment(), n_extra = ...length(), extra = base::as.character(base::names(base::substitute(...()))), recovered = base::c( + if (!base::missing(graph)) base::c(graph = "graph"), + if (!base::missing(name)) base::c(name = "name"), + if (!base::missing(index)) base::c(edges = "index"), + if (!base::missing(value)) base::c(value = "value") )) } - lifecycle::deprecate_soft( - "3.0.0", - "set_edge_attr(index = )", - "set_edge_attr(edges = )" - ) - edges <- index + .arg_call <- base::sys.call() + .arg_call[[1L]] <- .old_signature + .arg_handle <- base::eval(.arg_call, base::parent.frame()) + .arg_extra <- .arg_handle$extra + if (.arg_handle$n_extra > base::sum(base::nzchar(.arg_extra))) cli::cli_abort("Too many arguments passed to {.fn set_edge_attr}.") + .arg_explicit <- base::c("graph", "name", "edges", "value", "index")[base::pmatch(.arg_extra, base::c("graph", "name", "edges", "value", "index"), duplicates.ok = TRUE)] + if (base::anyNA(.arg_explicit)) cli::cli_abort("Unexpected argument passed to {.fn set_edge_attr}: {.arg {(.arg_extra[base::is.na(.arg_explicit)])}}.") + .arg_recovered <- .arg_handle$recovered + .arg_names <- base::names(.arg_recovered) + .arg_conflict <- base::intersect(.arg_names, .arg_explicit) + if (base::length(.arg_conflict) > 0L) { + .arg_conflict <- .arg_conflict[[1L]] + .arg_via <- .arg_recovered[[.arg_conflict]] + cli::cli_abort(base::c("Argument {.arg {(.arg_conflict)}} of {.fn set_edge_attr} was supplied more than once.", i = if (base::is.element(.arg_via, base::names(.arg_call))) "It was also supplied via its legacy name {.arg {(.arg_via)}}." else "It was also passed by position, as {.arg {(.arg_via)}} of the old signature.")) + } + 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())) + if (!base::missing(index)) lifecycle::deprecate_soft("3.0.0", "set_edge_attr(index = )", "set_edge_attr(edges = )") } + # END GENERATED ARG_HANDLE call <- rlang::current_env() check_string(name) diff --git a/tools/migrations/attributes.R b/tools/migrations/attributes.R new file mode 100644 index 0000000000..6293e04d45 --- /dev/null +++ b/tools/migrations/attributes.R @@ -0,0 +1,29 @@ +# Argument-signature migrations: attributes +# Schema: see tools/migrations/README.md. Regenerate with: +# Rscript tools/generate-migrations.R + +migrations <- list( + # `index` became `vertices`/`edges` in its slot. A legacy call naming + # `index` and passing the value positionally, + # `set_vertex_attr(g, "x", index = i, v)`, keeps giving `v` to `value`. + set_vertex_attr = list( + old = function(graph, name, index, value) {}, + new = function(graph, name, vertices = NULL, value, index = deprecated()) {}, + when = "3.0.0" + ), + set_edge_attr = list( + old = function(graph, name, index, value) {}, + new = function(graph, name, edges = NULL, value, index = deprecated()) {}, + when = "3.0.0" + ), + `vertex_attr<-` = list( + old = function(graph, name, index, value) {}, + new = function(graph, name, vertices = NULL, index = deprecated(), value) {}, + when = "3.0.0" + ), + `edge_attr<-` = list( + old = function(graph, name, index, value) {}, + new = function(graph, name, edges = NULL, index = deprecated(), value) {}, + when = "3.0.0" + ) +) From 64e4550ea248d00e33197970aeb931ce9f981fad Mon Sep 17 00:00:00 2001 From: schochastics Date: Thu, 3 Dec 2026 17:29:38 +0000 Subject: [PATCH 8/9] chore: Auto-update from GitHub Actions Run: https://github.com/igraph/rigraph/actions/runs/47161142686 --- tools/migrations/attributes.R | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/migrations/attributes.R b/tools/migrations/attributes.R index 6293e04d45..c9fad72b20 100644 --- a/tools/migrations/attributes.R +++ b/tools/migrations/attributes.R @@ -8,7 +8,13 @@ migrations <- list( # `set_vertex_attr(g, "x", index = i, v)`, keeps giving `v` to `value`. set_vertex_attr = list( old = function(graph, name, index, value) {}, - new = function(graph, name, vertices = NULL, value, index = deprecated()) {}, + new = function( + graph, + name, + vertices = NULL, + value, + index = deprecated() + ) {}, when = "3.0.0" ), set_edge_attr = list( @@ -18,7 +24,13 @@ migrations <- list( ), `vertex_attr<-` = list( old = function(graph, name, index, value) {}, - new = function(graph, name, vertices = NULL, index = deprecated(), value) {}, + new = function( + graph, + name, + vertices = NULL, + index = deprecated(), + value + ) {}, when = "3.0.0" ), `edge_attr<-` = list( From bd227687059a024326efb12d37150ab4ebf848f5 Mon Sep 17 00:00:00 2001 From: David Schoch Date: Thu, 3 Dec 2026 18:33:03 +0100 Subject: [PATCH 9/9] chore: Trigger CI after the formatting update Co-Authored-By: Claude Opus 5.5