From 8885e9d216e0c4b7c9ea649e3dbd87e98aa671f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Mon, 23 Sep 2024 15:43:37 +0200 Subject: [PATCH 1/7] chore: use 'parent' instead of 'father' in `bfs()` and `dfs()` --- R/structural.properties.R | 76 +++++++++++++------ man/bfs.Rd | 18 +++-- man/dfs.Rd | 17 +++-- src/rinterface_extra.c | 36 ++++----- .../testthat/_snaps/structural.properties.md | 37 +++++---- tests/testthat/test-structural.properties.R | 9 ++- 6 files changed, 122 insertions(+), 71 deletions(-) diff --git a/R/structural.properties.R b/R/structural.properties.R index d765c2fc22f..9917acefa49 100644 --- a/R/structural.properties.R +++ b/R/structural.properties.R @@ -293,12 +293,13 @@ graph.knn <- function(graph, vids = V(graph), mode = c("all", "out", "in", "tota #' #' `graph.dfs()` was renamed to `dfs()` to create a more #' consistent API. +#' @param father Logical scalar, whether to return the father of the vertices. #' @inheritParams dfs #' @keywords internal #' @export graph.dfs <- function(graph, root, mode = c("out", "in", "all", "total"), unreachable = TRUE, order = TRUE, order.out = FALSE, father = FALSE, dist = FALSE, in.callback = NULL, out.callback = NULL, extra = NULL, rho = parent.frame(), neimode) { # nocov start lifecycle::deprecate_soft("2.0.0", "graph.dfs()", "dfs()") - dfs(graph = graph, root = root, mode = mode, unreachable = unreachable, order = order, order.out = order.out, father = father, dist = dist, in.callback = in.callback, out.callback = out.callback, extra = extra, rho = rho, neimode = neimode) + dfs(graph = graph, root = root, mode = mode, unreachable = unreachable, order = order, order.out = order.out, parent = father, dist = dist, in.callback = in.callback, out.callback = out.callback, extra = extra, rho = rho, neimode = neimode) } # nocov end #' Graph density @@ -339,11 +340,12 @@ graph.coreness <- function(graph, mode = c("all", "out", "in")) { # nocov start #' `graph.bfs()` was renamed to `bfs()` to create a more #' consistent API. #' @inheritParams bfs +#' @param father Logical scalar, whether to return the father of the vertices. #' @keywords internal #' @export graph.bfs <- function(graph, root, mode = c("out", "in", "all", "total"), unreachable = TRUE, restricted = NULL, order = TRUE, rank = FALSE, father = FALSE, pred = FALSE, succ = FALSE, dist = FALSE, callback = NULL, extra = NULL, rho = parent.frame(), neimode) { # nocov start lifecycle::deprecate_soft("2.0.0", "graph.bfs()", "bfs()") - bfs(graph = graph, root = root, mode = mode, unreachable = unreachable, restricted = restricted, order = order, rank = rank, father = father, pred = pred, succ = succ, dist = dist, callback = callback, extra = extra, rho = rho, neimode = neimode) + bfs(graph = graph, root = root, mode = mode, unreachable = unreachable, restricted = restricted, order = order, rank = rank, parent = father, pred = pred, succ = succ, dist = dist, callback = callback, extra = extra, rho = rho, neimode = neimode) } # nocov end #' Diameter of a graph @@ -2054,7 +2056,8 @@ any_loop <- has_loop_impl #' given vertices. #' @param order Logical scalar, whether to return the ordering of the vertices. #' @param rank Logical scalar, whether to return the rank of the vertices. -#' @param father Logical scalar, whether to return the father of the vertices. +#' @param father `r lifecycle::badge("deprecated")` Use `parent` instead. +#' @param parent Logical scalar, whether to return the parent of the vertices. #' @param pred Logical scalar, whether to return the predecessors of the #' vertices. #' @param succ Logical scalar, whether to return the successors of the @@ -2076,8 +2079,9 @@ any_loop <- has_loop_impl #' \item{order}{Numeric vector. The #' vertex ids, in the order in which they were visited by the search.} #' \item{rank}{Numeric vector. The rank for each vertex, zero for unreachable vertices.} -#' \item{father}{Numeric -#' vector. The father of each vertex, i.e. the vertex it was discovered from.} +#' \item{parent}{Numeric +#' vector. The parent of each vertex, i.e. the vertex it was discovered from.} +#' \item{father}{Like parent, kept for compatibility for now.} #' \item{pred}{Numeric vector. The previously visited vertex for each vertex, #' or 0 if there was no such vertex.} #' \item{succ}{Numeric vector. The next @@ -2087,7 +2091,7 @@ any_loop <- has_loop_impl #' root of the search tree. Unreachable vertices have a negative distance #' as of igraph 1.6.0, this used to be `NaN`.} #' -#' Note that `order`, `rank`, `father`, `pred`, `succ` +#' Note that `order`, `rank`, `parent`, `pred`, `succ` #' and `dist` might be `NULL` if their corresponding argument is #' `FALSE`, i.e. if their calculation is not requested. #' @author Gabor Csardi \email{csardi.gabor@@gmail.com} @@ -2100,7 +2104,7 @@ any_loop <- has_loop_impl #' ## Two rings #' bfs(make_ring(10) %du% make_ring(10), #' root = 1, "out", -#' order = TRUE, rank = TRUE, father = TRUE, pred = TRUE, +#' order = TRUE, rank = TRUE, parent = TRUE, pred = TRUE, #' succ = TRUE, dist = TRUE #' ) #' @@ -2129,14 +2133,15 @@ bfs <- function( restricted = NULL, order = TRUE, rank = FALSE, - father = FALSE, + parent = FALSE, pred = FALSE, succ = FALSE, dist = FALSE, callback = NULL, extra = NULL, rho = parent.frame(), - neimode = deprecated()) { + neimode = deprecated(), + father = deprecated()) { ensure_igraph(graph) if (lifecycle::is_present(neimode)) { @@ -2150,6 +2155,13 @@ bfs <- function( } } + if (lifecycle::is_present(father)) { + lifecycle::deprecate_warn("2.0.4", "bfs(father)", "bfs(parent)") + if (missing(parent)) { + parent <- father + } + } + if (length(root) == 1) { root <- as_igraph_vs(graph, root) - 1 roots <- NULL @@ -2175,7 +2187,7 @@ bfs <- function( res <- .Call( R_igraph_bfs, graph, root, roots, mode, unreachable, restricted, - as.logical(order), as.logical(rank), as.logical(father), + as.logical(order), as.logical(rank), as.logical(parent), as.logical(pred), as.logical(succ), as.logical(dist), callback, extra, rho ) @@ -2185,13 +2197,13 @@ bfs <- function( if (order) res$order <- res$order + 1 if (rank) res$rank <- res$rank + 1 - if (father) res$father <- res$father + 1 + if (parent) res$parent <- res$parent + 1 if (pred) res$pred <- res$pred + 1 if (succ) res$succ <- res$succ + 1 if (igraph_opt("return.vs.es")) { if (order) res$order <- V(graph)[.env$res$order, na_ok = TRUE] - if (father) res$father <- create_vs(graph, res$father, na_ok = TRUE) + if (parent) res$parent <- create_vs(graph, res$parent, na_ok = TRUE) if (pred) res$pred <- create_vs(graph, res$pred, na_ok = TRUE) if (succ) res$succ <- create_vs(graph, res$succ, na_ok = TRUE) } else { @@ -2200,7 +2212,7 @@ bfs <- function( if (igraph_opt("add.vertex.names") && is_named(graph)) { if (rank) names(res$rank) <- V(graph)$name - if (father) names(res$father) <- V(graph)$name + if (parent) names(res$parent) <- V(graph)$name if (pred) names(res$pred) <- V(graph)$name if (succ) names(res$succ) <- V(graph)$name if (dist) names(res$dist) <- V(graph)$name @@ -2214,6 +2226,9 @@ bfs <- function( res$dist[is.nan(res$dist)] <- -3 } + # Remove this later? + res$father <- res$parent + res } @@ -2246,7 +2261,8 @@ bfs <- function( #' vertices. #' @param order.out Logical scalar, whether to return the ordering based on #' leaving the subtree of the vertex. -#' @param father Logical scalar, whether to return the father of the vertices. +#' @param father `r lifecycle::badge("deprecated")`, use `parent` instead. +#' @param parent Logical scalar, whether to return the parent of the vertices. #' @param dist Logical scalar, whether to return the distance from the root of #' the search tree. #' @param in.callback If not `NULL`, then it must be callback function. @@ -2265,11 +2281,13 @@ bfs <- function( #' irrespectively of the supplied value.} \item{order}{Numeric vector. The #' vertex ids, in the order in which they were visited by the search.} #' \item{order.out}{Numeric vector, the vertex ids, in the order of the -#' completion of their subtree.} \item{father}{Numeric vector. The father of -#' each vertex, i.e. the vertex it was discovered from.} \item{dist}{Numeric +#' completion of their subtree.} \item{parent}{Numeric vector. The parent of +#' each vertex, i.e. the vertex it was discovered from.} +#' \item{father}{Like parent, kept for compatibility for now.} +#' \item{dist}{Numeric #' vector, for each vertex its distance from the root of the search tree.} #' -#' Note that `order`, `order.out`, `father`, and `dist` +#' Note that `order`, `order.out`, `parent`, and `dist` #' might be `NULL` if their corresponding argument is `FALSE`, i.e. #' if their calculation is not requested. #' @author Gabor Csardi \email{csardi.gabor@@gmail.com} @@ -2310,9 +2328,11 @@ bfs <- function( #' dfs <- function(graph, root, mode = c("out", "in", "all", "total"), unreachable = TRUE, - order = TRUE, order.out = FALSE, father = FALSE, dist = FALSE, + order = TRUE, order.out = FALSE, + parent = FALSE, dist = FALSE, in.callback = NULL, out.callback = NULL, extra = NULL, - rho = parent.frame(), neimode = deprecated()) { + rho = parent.frame(), neimode = deprecated(), + father = deprecated()) { ensure_igraph(graph) if (lifecycle::is_present(neimode)) { lifecycle::deprecate_warn( @@ -2325,6 +2345,13 @@ dfs <- function(graph, root, mode = c("out", "in", "all", "total"), } } + if (lifecycle::is_present(father)) { + lifecycle::deprecate_warn("2.0.4", "dfs(father)", "dfs(parent)") + if (missing(parent)) { + parent <- father + } + } + root <- as_igraph_vs(graph, root) - 1 mode <- switch(igraph.match.arg(mode), "out" = 1, @@ -2343,7 +2370,7 @@ dfs <- function(graph, root, mode = c("out", "in", "all", "total"), on.exit(.Call(R_igraph_finalizer)) res <- .Call( R_igraph_dfs, graph, root, mode, unreachable, - as.logical(order), as.logical(order.out), as.logical(father), + as.logical(order), as.logical(order.out), as.logical(parent), as.logical(dist), in.callback, out.callback, extra, rho ) @@ -2352,22 +2379,25 @@ dfs <- function(graph, root, mode = c("out", "in", "all", "total"), if (order) res$order <- res$order + 1 if (order.out) res$order.out <- res$order.out + 1 - if (father) res$father <- res$father + 1 + if (parent) res$parent <- res$parent + 1 if (igraph_opt("return.vs.es")) { if (order) res$order <- V(graph)[.env$res$order, na_ok = TRUE] if (order.out) res$order.out <- V(graph)[.env$res$order.out, na_ok = TRUE] - if (father) res$father <- create_vs(graph, res$father, na_ok = TRUE) + if (parent) res$parent <- create_vs(graph, res$parent, na_ok = TRUE) } else { if (order) res$order <- res$order[res$order != 0] if (order.out) res$order.out <- res$order.out[res$order.out != 0] } if (igraph_opt("add.vertex.names") && is_named(graph)) { - if (father) names(res$father) <- V(graph)$name + if (parent) names(res$parent) <- V(graph)$name if (dist) names(res$dist) <- V(graph)$name } + # Remove this later? + res$father <- res$parent + res } diff --git a/man/bfs.Rd b/man/bfs.Rd index 17046dd69f5..d94d3bb6117 100644 --- a/man/bfs.Rd +++ b/man/bfs.Rd @@ -12,14 +12,15 @@ bfs( restricted = NULL, order = TRUE, rank = FALSE, - father = FALSE, + parent = FALSE, pred = FALSE, succ = FALSE, dist = FALSE, callback = NULL, extra = NULL, rho = parent.frame(), - neimode = deprecated() + neimode = deprecated(), + father = deprecated() ) } \arguments{ @@ -46,7 +47,7 @@ given vertices.} \item{rank}{Logical scalar, whether to return the rank of the vertices.} -\item{father}{Logical scalar, whether to return the father of the vertices.} +\item{parent}{Logical scalar, whether to return the parent of the vertices.} \item{pred}{Logical scalar, whether to return the predecessors of the vertices.} @@ -66,6 +67,8 @@ is called whenever a vertex is visited. See details below.} \item{neimode}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} This argument is deprecated from igraph 1.3.0; use \code{mode} instead.} + +\item{father}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{parent} instead.} } \value{ A named list with the following entries: @@ -77,8 +80,9 @@ irrespectively of the supplied value.} \item{order}{Numeric vector. The vertex ids, in the order in which they were visited by the search.} \item{rank}{Numeric vector. The rank for each vertex, zero for unreachable vertices.} -\item{father}{Numeric -vector. The father of each vertex, i.e. the vertex it was discovered from.} +\item{parent}{Numeric +vector. The parent of each vertex, i.e. the vertex it was discovered from.} +\item{father}{Like parent, kept for compatibility for now.} \item{pred}{Numeric vector. The previously visited vertex for each vertex, or 0 if there was no such vertex.} \item{succ}{Numeric vector. The next @@ -88,7 +92,7 @@ vertex.} root of the search tree. Unreachable vertices have a negative distance as of igraph 1.6.0, this used to be \code{NaN}.} -Note that \code{order}, \code{rank}, \code{father}, \code{pred}, \code{succ} +Note that \code{order}, \code{rank}, \code{parent}, \code{pred}, \code{succ} and \code{dist} might be \code{NULL} if their corresponding argument is \code{FALSE}, i.e. if their calculation is not requested. } @@ -118,7 +122,7 @@ use the callback function. ## Two rings bfs(make_ring(10) \%du\% make_ring(10), root = 1, "out", - order = TRUE, rank = TRUE, father = TRUE, pred = TRUE, + order = TRUE, rank = TRUE, parent = TRUE, pred = TRUE, succ = TRUE, dist = TRUE ) diff --git a/man/dfs.Rd b/man/dfs.Rd index 7c72023e08c..3b626d8e267 100644 --- a/man/dfs.Rd +++ b/man/dfs.Rd @@ -11,13 +11,14 @@ dfs( unreachable = TRUE, order = TRUE, order.out = FALSE, - father = FALSE, + parent = FALSE, dist = FALSE, in.callback = NULL, out.callback = NULL, extra = NULL, rho = parent.frame(), - neimode = deprecated() + neimode = deprecated(), + father = deprecated() ) } \arguments{ @@ -41,7 +42,7 @@ vertices.} \item{order.out}{Logical scalar, whether to return the ordering based on leaving the subtree of the vertex.} -\item{father}{Logical scalar, whether to return the father of the vertices.} +\item{parent}{Logical scalar, whether to return the parent of the vertices.} \item{dist}{Logical scalar, whether to return the distance from the root of the search tree.} @@ -59,6 +60,8 @@ algorithm. See details below.} \item{neimode}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} This argument is deprecated from igraph 1.3.0; use \code{mode} instead.} + +\item{father}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}, use \code{parent} instead.} } \value{ A named list with the following entries: \item{root}{Numeric scalar. @@ -68,11 +71,13 @@ call. Note that for undirected graphs this is always \sQuote{all}, irrespectively of the supplied value.} \item{order}{Numeric vector. The vertex ids, in the order in which they were visited by the search.} \item{order.out}{Numeric vector, the vertex ids, in the order of the -completion of their subtree.} \item{father}{Numeric vector. The father of -each vertex, i.e. the vertex it was discovered from.} \item{dist}{Numeric +completion of their subtree.} \item{parent}{Numeric vector. The parent of +each vertex, i.e. the vertex it was discovered from.} +\item{father}{Like parent, kept for compatibility for now.} +\item{dist}{Numeric vector, for each vertex its distance from the root of the search tree.} -Note that \code{order}, \code{order.out}, \code{father}, and \code{dist} +Note that \code{order}, \code{order.out}, \code{parent}, and \code{dist} might be \code{NULL} if their corresponding argument is \code{FALSE}, i.e. if their calculation is not requested. } diff --git a/src/rinterface_extra.c b/src/rinterface_extra.c index 4734d69da2b..80e5a5b61d5 100644 --- a/src/rinterface_extra.c +++ b/src/rinterface_extra.c @@ -7273,7 +7273,7 @@ igraph_error_t R_igraph_bfshandler(const igraph_t *graph, SEXP R_igraph_bfs(SEXP graph, SEXP proot, SEXP proots, SEXP pmode, SEXP punreachable, SEXP prestricted, - SEXP porder, SEXP prank, SEXP pfather, + SEXP porder, SEXP prank, SEXP pparent, SEXP ppred, SEXP psucc, SEXP pdist, SEXP pcallback, SEXP pextra, SEXP prho) { @@ -7285,8 +7285,8 @@ SEXP R_igraph_bfs(SEXP graph, SEXP proot, SEXP proots, SEXP pmode, igraph_bool_t unreachable=LOGICAL(punreachable)[0]; igraph_vector_int_t restricted; igraph_neimode_t mode=(igraph_neimode_t) Rf_asInteger(pmode); - igraph_vector_int_t order, rank, father, pred, succ, dist; - igraph_vector_int_t *p_order=0, *p_rank=0, *p_father=0, *p_pred=0, + igraph_vector_int_t order, rank, parent, pred, succ, dist; + igraph_vector_int_t *p_order=0, *p_rank=0, *p_parent=0, *p_pred=0, *p_succ=0, *p_dist=0; igraph_bfshandler_t *callback=0; R_igraph_i_bfs_data_t cb_data, *p_cb_data=0; @@ -7314,9 +7314,9 @@ SEXP R_igraph_bfs(SEXP graph, SEXP proot, SEXP proots, SEXP pmode, igraph_vector_int_init(&rank, 0); IGRAPH_FINALLY(igraph_vector_int_destroy, &rank); p_rank=&rank; } - if (LOGICAL(pfather)[0]) { - igraph_vector_int_init(&father, 0); IGRAPH_FINALLY(igraph_vector_int_destroy, &father); - p_father=&father; + if (LOGICAL(pparent)[0]) { + igraph_vector_int_init(&parent, 0); IGRAPH_FINALLY(igraph_vector_int_destroy, &parent); + p_parent=&parent; } if (LOGICAL(ppred)[0]) { igraph_vector_int_init(&pred, 0); IGRAPH_FINALLY(igraph_vector_int_destroy, &pred); @@ -7340,7 +7340,7 @@ SEXP R_igraph_bfs(SEXP graph, SEXP proot, SEXP proots, SEXP pmode, p_cb_data = &cb_data; } - IGRAPH_R_CHECK(igraph_bfs(&g, root, Rf_isNull(proots) ? 0 : &roots, mode, unreachable, Rf_isNull(prestricted) ? 0 : &restricted, p_order, p_rank, p_father, p_pred, p_succ, p_dist, (igraph_bfshandler_t*) callback, p_cb_data)); + IGRAPH_R_CHECK(igraph_bfs(&g, root, Rf_isNull(proots) ? 0 : &roots, mode, unreachable, Rf_isNull(prestricted) ? 0 : &restricted, p_order, p_rank, p_parent, p_pred, p_succ, p_dist, (igraph_bfshandler_t*) callback, p_cb_data)); PROTECT(result=NEW_LIST(8)); PROTECT(names=NEW_CHARACTER(8)); @@ -7363,8 +7363,8 @@ SEXP R_igraph_bfs(SEXP graph, SEXP proot, SEXP proots, SEXP pmode, SET_VECTOR_ELT(result, 2, R_igraph_0orvector_int_to_SEXP_d(p_order)); SET_STRING_ELT(names, 3, Rf_mkChar("rank")); SET_VECTOR_ELT(result, 3, R_igraph_0orvector_int_to_SEXP_d(p_rank)); - SET_STRING_ELT(names, 4, Rf_mkChar("father")); - SET_VECTOR_ELT(result, 4, R_igraph_0orvector_int_to_SEXP_d(p_father)); + SET_STRING_ELT(names, 4, Rf_mkChar("parent")); + SET_VECTOR_ELT(result, 4, R_igraph_0orvector_int_to_SEXP_d(p_parent)); SET_STRING_ELT(names, 5, Rf_mkChar("pred")); SET_VECTOR_ELT(result, 5, R_igraph_0orvector_int_to_SEXP_d(p_pred)); SET_STRING_ELT(names, 6, Rf_mkChar("succ")); @@ -7384,7 +7384,7 @@ SEXP R_igraph_bfs(SEXP graph, SEXP proot, SEXP proots, SEXP pmode, if (p_dist) { igraph_vector_int_destroy(p_dist); IGRAPH_FINALLY_CLEAN(1); p_dist = 0; } if (p_succ) { igraph_vector_int_destroy(p_succ); IGRAPH_FINALLY_CLEAN(1); p_succ = 0; } if (p_pred) { igraph_vector_int_destroy(p_pred); IGRAPH_FINALLY_CLEAN(1); p_pred = 0; } - if (p_father) { igraph_vector_int_destroy(p_father); IGRAPH_FINALLY_CLEAN(1); p_father = 0; } + if (p_parent) { igraph_vector_int_destroy(p_parent); IGRAPH_FINALLY_CLEAN(1); p_parent = 0; } if (p_rank) { igraph_vector_int_destroy(p_rank); IGRAPH_FINALLY_CLEAN(1); p_rank = 0; } if (p_order) { igraph_vector_int_destroy(p_order); IGRAPH_FINALLY_CLEAN(1); p_order = 0; } @@ -7440,7 +7440,7 @@ igraph_error_t R_igraph_dfshandler_out(const igraph_t *graph, } SEXP R_igraph_dfs(SEXP graph, SEXP proot, SEXP pmode, SEXP punreachable, - SEXP porder, SEXP porder_out, SEXP pfather, SEXP pdist, + SEXP porder, SEXP porder_out, SEXP pparent, SEXP pdist, SEXP pin_callback, SEXP pout_callback, SEXP pextra, SEXP prho) { @@ -7450,8 +7450,8 @@ SEXP R_igraph_dfs(SEXP graph, SEXP proot, SEXP pmode, SEXP punreachable, igraph_integer_t root=(igraph_integer_t) REAL(proot)[0]; igraph_neimode_t mode=(igraph_neimode_t) Rf_asInteger(pmode); igraph_bool_t unreachable=LOGICAL(punreachable)[0]; - igraph_vector_int_t order, order_out, father, dist; - igraph_vector_int_t *p_order=0, *p_order_out=0, *p_father=0, *p_dist=0; + igraph_vector_int_t order, order_out, parent, dist; + igraph_vector_int_t *p_order=0, *p_order_out=0, *p_parent=0, *p_dist=0; igraph_dfshandler_t *in_callback=0, *out_callback=0; R_igraph_i_dfs_data_t cb_data, *p_cb_data=0; @@ -7463,8 +7463,8 @@ SEXP R_igraph_dfs(SEXP graph, SEXP proot, SEXP pmode, SEXP punreachable, if (LOGICAL(porder_out)[0]) { igraph_vector_int_init(&order_out, 0); p_order_out=&order_out; } - if (LOGICAL(pfather)[0]) { - igraph_vector_int_init(&father, 0); p_father=&father; + if (LOGICAL(pparent)[0]) { + igraph_vector_int_init(&parent, 0); p_parent=&parent; } if (LOGICAL(pdist)[0]) { igraph_vector_int_init(&dist, 0); p_dist=&dist; @@ -7485,7 +7485,7 @@ SEXP R_igraph_dfs(SEXP graph, SEXP proot, SEXP pmode, SEXP punreachable, out_callback=R_igraph_dfshandler_out; } - IGRAPH_R_CHECK(igraph_dfs(&g, root, mode, unreachable, p_order, p_order_out, p_father, p_dist, (igraph_dfshandler_t*) in_callback, (igraph_dfshandler_t*) out_callback, p_cb_data)); + IGRAPH_R_CHECK(igraph_dfs(&g, root, mode, unreachable, p_order, p_order_out, p_parent, p_dist, (igraph_dfshandler_t*) in_callback, (igraph_dfshandler_t*) out_callback, p_cb_data)); PROTECT(result=NEW_LIST(6)); PROTECT(names=NEW_CHARACTER(6)); @@ -7508,8 +7508,8 @@ SEXP R_igraph_dfs(SEXP graph, SEXP proot, SEXP pmode, SEXP punreachable, SET_VECTOR_ELT(result, 2, R_igraph_0orvector_int_to_SEXP_d(p_order)); SET_STRING_ELT(names, 3, Rf_mkChar("order.out")); SET_VECTOR_ELT(result, 3, R_igraph_0orvector_int_to_SEXP_d(p_order_out)); - SET_STRING_ELT(names, 4, Rf_mkChar("father")); - SET_VECTOR_ELT(result, 4, R_igraph_0orvector_int_to_SEXP_d(p_father)); + SET_STRING_ELT(names, 4, Rf_mkChar("parent")); + SET_VECTOR_ELT(result, 4, R_igraph_0orvector_int_to_SEXP_d(p_parent)); SET_STRING_ELT(names, 5, Rf_mkChar("dist")); SET_VECTOR_ELT(result, 5, R_igraph_0orvector_int_to_SEXP_d(p_dist)); diff --git a/tests/testthat/_snaps/structural.properties.md b/tests/testthat/_snaps/structural.properties.md index d8f926aeba1..6ef67139b2e 100644 --- a/tests/testthat/_snaps/structural.properties.md +++ b/tests/testthat/_snaps/structural.properties.md @@ -1,28 +1,21 @@ -# bfs() deprecated argument +# dfs() deprecated arguments Code - d <- dfs(g, root = 2, unreachable = FALSE, neimode = "out") + d <- dfs(g, root = 2, unreachable = FALSE, neimode = "out", father = TRUE) Condition Warning: The `neimode` argument of `dfs()` is deprecated as of igraph 1.3.0. i Please use the `mode` argument instead. - ---- - - Code - b <- bfs(g, root = 2, neimode = "out", unreachable = FALSE, order = TRUE, rank = TRUE, - father = TRUE, pred = TRUE, succ = TRUE, dist = TRUE) - Condition Warning: - The `neimode` argument of `bfs()` is deprecated as of igraph 1.3.0. - i Please use the `mode` argument instead. + The `father` argument of `dfs()` is deprecated as of igraph 2.0.4. + i Please use the `parent` argument instead. # bfs() works Code g <- graph_from_literal(a - +b - +c, z - +a, d) bfs(g, root = 2, mode = "out", unreachable = FALSE, order = TRUE, rank = TRUE, - father = TRUE, pred = TRUE, succ = TRUE, dist = TRUE) + parent = TRUE, pred = TRUE, succ = TRUE, dist = TRUE) Output $root [1] 2 @@ -38,7 +31,7 @@ a b c z d 0 1 2 0 0 - $father + $parent + 5/5 vertices, named: a b c z d b @@ -60,4 +53,22 @@ $neimode [1] "out" + $father + + 5/5 vertices, named: + a b c z d + b + + +# bfs() deprecated arguments + + Code + b <- bfs(g, root = 2, neimode = "out", unreachable = FALSE, order = TRUE, rank = TRUE, + father = TRUE, pred = TRUE, succ = TRUE, dist = TRUE) + Condition + Warning: + The `neimode` argument of `bfs()` is deprecated as of igraph 1.3.0. + i Please use the `mode` argument instead. + Warning: + The `father` argument of `bfs()` is deprecated as of igraph 2.0.4. + i Please use the `parent` argument instead. diff --git a/tests/testthat/test-structural.properties.R b/tests/testthat/test-structural.properties.R index 96cc76b1558..5733766983a 100644 --- a/tests/testthat/test-structural.properties.R +++ b/tests/testthat/test-structural.properties.R @@ -12,7 +12,7 @@ test_that("dfs() does not pad order", { expect_equal(as.numeric(dfs(g, root = 2, unreachable = FALSE, order.out = TRUE)$order.out), c(1, 2)) }) -test_that("bfs() deprecated argument", { +test_that("dfs() deprecated arguments", { g <- make_star(3) expect_snapshot({ @@ -20,7 +20,8 @@ test_that("bfs() deprecated argument", { g, root = 2, unreachable = FALSE, - neimode = "out" + neimode = "out", + father = TRUE ) }) }) @@ -188,7 +189,7 @@ test_that("bfs() works", { unreachable = FALSE, order = TRUE, rank = TRUE, - father = TRUE, + parent = TRUE, pred = TRUE, succ = TRUE, dist = TRUE @@ -196,7 +197,7 @@ test_that("bfs() works", { }) }) -test_that("bfs() deprecated argument", { +test_that("bfs() deprecated arguments", { g <- graph_from_literal(a - +b - +c, z - +a, d) expect_snapshot({ From a9d032e05b42e1d69ad908a37980a3816cb19767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Thu, 28 Nov 2024 10:49:04 +0100 Subject: [PATCH 2/7] refactor: add ellipsis --- R/structural.properties.R | 10 ++++++++++ man/bfs.Rd | 3 +++ man/dfs.Rd | 3 +++ 3 files changed, 16 insertions(+) diff --git a/R/structural.properties.R b/R/structural.properties.R index 9917acefa49..26fe9967b00 100644 --- a/R/structural.properties.R +++ b/R/structural.properties.R @@ -2070,6 +2070,7 @@ any_loop <- has_loop_impl #' @param rho The environment in which the callback function is evaluated. #' @param neimode `r lifecycle::badge("deprecated")` This argument is deprecated #' from igraph 1.3.0; use `mode` instead. +#' @inheritParams rlang::args_dots_empty #' @return A named list with the following entries: #' \item{root}{Numeric scalar. #' The root vertex that was used as the starting point of the search.} @@ -2129,6 +2130,7 @@ bfs <- function( graph, root, mode = c("out", "in", "all", "total"), + ..., unreachable = TRUE, restricted = NULL, order = TRUE, @@ -2142,6 +2144,9 @@ bfs <- function( rho = parent.frame(), neimode = deprecated(), father = deprecated()) { + + rlang::check_dots_empty() + ensure_igraph(graph) if (lifecycle::is_present(neimode)) { @@ -2274,6 +2279,7 @@ bfs <- function( #' @param rho The environment in which the callback function is evaluated. #' @param neimode `r lifecycle::badge("deprecated")` This argument is deprecated from igraph 1.3.0; use #' `mode` instead. +#' @inheritParams rlang::args_dots_empty #' @return A named list with the following entries: \item{root}{Numeric scalar. #' The root vertex that was used as the starting point of the search.} #' \item{neimode}{Character scalar. The `mode` argument of the function @@ -2327,12 +2333,16 @@ bfs <- function( #' ) #' dfs <- function(graph, root, mode = c("out", "in", "all", "total"), + ..., unreachable = TRUE, order = TRUE, order.out = FALSE, parent = FALSE, dist = FALSE, in.callback = NULL, out.callback = NULL, extra = NULL, rho = parent.frame(), neimode = deprecated(), father = deprecated()) { + + rlang::check_dots_empty() + ensure_igraph(graph) if (lifecycle::is_present(neimode)) { lifecycle::deprecate_warn( diff --git a/man/bfs.Rd b/man/bfs.Rd index d94d3bb6117..dcc31680390 100644 --- a/man/bfs.Rd +++ b/man/bfs.Rd @@ -8,6 +8,7 @@ bfs( graph, root, mode = c("out", "in", "all", "total"), + ..., unreachable = TRUE, restricted = NULL, order = TRUE, @@ -34,6 +35,8 @@ vertices to start the search from.} ignores edge directions completely. \sQuote{total} is a synonym for \sQuote{all}. This argument is ignored for undirected graphs.} +\item{...}{These dots are for future extensions and must be empty.} + \item{unreachable}{Logical scalar, whether the search should visit the vertices that are unreachable from the given root vertex (or vertices). If \code{TRUE}, then additional searches are performed until all vertices are diff --git a/man/dfs.Rd b/man/dfs.Rd index 3b626d8e267..bf560f40007 100644 --- a/man/dfs.Rd +++ b/man/dfs.Rd @@ -8,6 +8,7 @@ dfs( graph, root, mode = c("out", "in", "all", "total"), + ..., unreachable = TRUE, order = TRUE, order.out = FALSE, @@ -31,6 +32,8 @@ dfs( ignores edge directions completely. \sQuote{total} is a synonym for \sQuote{all}. This argument is ignored for undirected graphs.} +\item{...}{These dots are for future extensions and must be empty.} + \item{unreachable}{Logical scalar, whether the search should visit the vertices that are unreachable from the given root vertex (or vertices). If \code{TRUE}, then additional searches are performed until all vertices are From 9957dcdd7e8ffcd436fefe2c69ca979a771782bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Thu, 28 Nov 2024 10:52:13 +0100 Subject: [PATCH 3/7] chore: update version for deprecation --- R/structural.properties.R | 8 ++++---- tests/testthat/_snaps/structural.properties.md | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/R/structural.properties.R b/R/structural.properties.R index 26fe9967b00..70c395d5480 100644 --- a/R/structural.properties.R +++ b/R/structural.properties.R @@ -2161,7 +2161,7 @@ bfs <- function( } if (lifecycle::is_present(father)) { - lifecycle::deprecate_warn("2.0.4", "bfs(father)", "bfs(parent)") + lifecycle::deprecate_warn("2.1.2", "bfs(father)", "bfs(parent)") if (missing(parent)) { parent <- father } @@ -2231,7 +2231,7 @@ bfs <- function( res$dist[is.nan(res$dist)] <- -3 } - # Remove this later? + # Remove this later? https://github.com/igraph/rigraph/issues/1576 res$father <- res$parent res @@ -2356,7 +2356,7 @@ dfs <- function(graph, root, mode = c("out", "in", "all", "total"), } if (lifecycle::is_present(father)) { - lifecycle::deprecate_warn("2.0.4", "dfs(father)", "dfs(parent)") + lifecycle::deprecate_warn("2.1.2", "dfs(father)", "dfs(parent)") if (missing(parent)) { parent <- father } @@ -2405,7 +2405,7 @@ dfs <- function(graph, root, mode = c("out", "in", "all", "total"), if (dist) names(res$dist) <- V(graph)$name } - # Remove this later? + # Remove this later? https://github.com/igraph/rigraph/issues/1576 res$father <- res$parent res diff --git a/tests/testthat/_snaps/structural.properties.md b/tests/testthat/_snaps/structural.properties.md index 6ef67139b2e..515bbcfb485 100644 --- a/tests/testthat/_snaps/structural.properties.md +++ b/tests/testthat/_snaps/structural.properties.md @@ -7,7 +7,7 @@ The `neimode` argument of `dfs()` is deprecated as of igraph 1.3.0. i Please use the `mode` argument instead. Warning: - The `father` argument of `dfs()` is deprecated as of igraph 2.0.4. + The `father` argument of `dfs()` is deprecated as of igraph 2.1.2. i Please use the `parent` argument instead. # bfs() works @@ -69,6 +69,6 @@ The `neimode` argument of `bfs()` is deprecated as of igraph 1.3.0. i Please use the `mode` argument instead. Warning: - The `father` argument of `bfs()` is deprecated as of igraph 2.0.4. + The `father` argument of `bfs()` is deprecated as of igraph 2.1.2. i Please use the `parent` argument instead. From 82fb8e2ac781fec6eed311369fe5b5c636b52e0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Thu, 28 Nov 2024 10:54:48 +0100 Subject: [PATCH 4/7] chore: fix lifecycle syntax --- R/structural.properties.R | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/R/structural.properties.R b/R/structural.properties.R index 70c395d5480..c04da600d3a 100644 --- a/R/structural.properties.R +++ b/R/structural.properties.R @@ -2152,8 +2152,8 @@ bfs <- function( if (lifecycle::is_present(neimode)) { lifecycle::deprecate_warn( "1.3.0", - "bfs(neimode)", - "bfs(mode)" + "bfs(neimode = )", + "bfs(mode = )" ) if (missing(mode)) { mode <- neimode @@ -2161,7 +2161,7 @@ bfs <- function( } if (lifecycle::is_present(father)) { - lifecycle::deprecate_warn("2.1.2", "bfs(father)", "bfs(parent)") + lifecycle::deprecate_warn("2.1.2", "bfs(father = )", "bfs(parent = )") if (missing(parent)) { parent <- father } @@ -2347,8 +2347,8 @@ dfs <- function(graph, root, mode = c("out", "in", "all", "total"), if (lifecycle::is_present(neimode)) { lifecycle::deprecate_warn( "1.3.0", - "dfs(neimode)", - "dfs(mode)" + "dfs(neimode = )", + "dfs(mode = )" ) if (missing(mode)) { mode <- neimode @@ -2356,7 +2356,7 @@ dfs <- function(graph, root, mode = c("out", "in", "all", "total"), } if (lifecycle::is_present(father)) { - lifecycle::deprecate_warn("2.1.2", "dfs(father)", "dfs(parent)") + lifecycle::deprecate_warn("2.1.2", "dfs(father = )", "dfs(parent = )") if (missing(parent)) { parent <- father } From 52f4ea51899f7a9f60c168315f28c08e4a737cb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 30 Nov 2024 17:01:49 +0100 Subject: [PATCH 5/7] Results --- revdep/README.md | 26 +++-- revdep/cran.md | 26 ++--- revdep/problems.md | 281 ++++++++++++++++++++++----------------------- 3 files changed, 163 insertions(+), 170 deletions(-) diff --git a/revdep/README.md b/revdep/README.md index ff107590b45..75a14fe2098 100644 --- a/revdep/README.md +++ b/revdep/README.md @@ -1,18 +1,20 @@ # Revdeps -## Failed to check (3) +## Failed to check (7) -|package |version |error |warning |note | -|:---------|:-------|:-----|:-------|:----| -|bnlearn |5.0.1 |1 | | | -|datapack |1.4.1 |1 | | | -|streamDAG |? | | | | +|package |version |error |warning |note | +|:---------------|:-------|:-----|:-------|:----| +|bnlearn |5.0.1 |1 | | | +|dataone |2.2.2 |1 | | | +|datapack |1.4.1 |1 | | | +|FAIRmaterials |0.4.2.1 |1 | | | +|multinma |0.7.2 |1 | | | +|randomForestSRC |? | | | | +|streamDAG |? | | | | -## New problems (3) +## New problems (1) -|package |version |error |warning |note | -|:---------|:-------|:------|:-------|:----| -|[manynet](problems.md#manynet)|1.2.6 |__+1__ | |3 | -|[simcausal](problems.md#simcausal)|0.5.6 |__+1__ |1 | | -|[skynet](problems.md#skynet)|1.4.3 |__+1__ | |1 | +|package |version |error |warning |note | +|:-------|:-------|:------|:-------|:----| +|[pomdp](problems.md#pomdp)|1.2.3 |__+3__ | |1 | diff --git a/revdep/cran.md b/revdep/cran.md index d15a90e3e3e..bd85c049521 100644 --- a/revdep/cran.md +++ b/revdep/cran.md @@ -1,26 +1,26 @@ ## revdepcheck results -We checked 7 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. +We checked 2118 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. - * We saw 3 new problems - * We failed to check 3 packages + * We saw 1 new problems + * We failed to check 7 packages Issues with CRAN packages are summarised below. ### New problems (This reports the first line of each new failure) -* manynet - checking tests ... ERROR - -* simcausal - checking tests ... ERROR - -* skynet +* pomdp + checking examples ... ERROR checking tests ... ERROR + checking re-building of vignette outputs ... ERROR ### Failed to check -* bnlearn (NA) -* datapack (NA) -* streamDAG (NA) +* bnlearn (NA) +* dataone (NA) +* datapack (NA) +* FAIRmaterials (NA) +* multinma (NA) +* randomForestSRC (NA) +* streamDAG (NA) diff --git a/revdep/problems.md b/revdep/problems.md index 4e4b620628b..b02d5bc32f6 100644 --- a/revdep/problems.md +++ b/revdep/problems.md @@ -1,178 +1,169 @@ -# manynet +# pomdp
-* Version: 1.2.6 -* GitHub: https://github.com/stocnet/manynet -* Source code: https://github.com/cran/manynet -* Date/Publication: 2024-10-05 16:40:01 UTC -* Number of recursive dependencies: 146 +* Version: 1.2.3 +* GitHub: https://github.com/mhahsler/pomdp +* Source code: https://github.com/cran/pomdp +* Date/Publication: 2024-05-05 21:10:06 UTC +* Number of recursive dependencies: 70 -Run `revdepcheck::cloud_details(, "manynet")` for more info +Run `revdepcheck::cloud_details(, "pomdp")` for more info
## Newly broken -* checking tests ... ERROR - ``` - Running ‘testthat.R’ - Running the tests in ‘tests/testthat.R’ failed. - Complete output: - > library(testthat) - > library(manynet) - > - > test_check("manynet") - Starting 2 test processes - [ FAIL 7 | WARN 18643 | SKIP 21 | PASS 558 ] - - ... - `expected`: 0.2 0.1 0.1 - ── Failure ('test-measure_centrality.R:79:3'): two mode eigenvector centrality calculated correctly ── - top3(node_eigenvector(test_igr, normalized = TRUE)) (`actual`) not equal to c(0.4505, 0.4248, 0.5) (`expected`). - - `actual`: 1.3 1.2 1.4 - `expected`: 0.5 0.4 0.5 - - [ FAIL 7 | WARN 18643 | SKIP 21 | PASS 558 ] - Error: Test failures - Execution halted - ``` - -## In both - -* checking package dependencies ... NOTE - ``` - Package which this enhances but not available for checking: ‘Rgraphviz’ +* checking examples ... ERROR ``` - -* checking installed package size ... NOTE - ``` - installed size is 5.2Mb - sub-directories of 1Mb or more: - R 1.5Mb - tutorials 1.8Mb - ``` - -* checking data for non-ASCII characters ... NOTE - ``` - Note: found 7 marked UTF-8 strings - ``` - -# simcausal - -
- -* Version: 0.5.6 -* GitHub: https://github.com/osofr/simcausal -* Source code: https://github.com/cran/simcausal -* Date/Publication: 2022-10-28 11:52:27 UTC -* Number of recursive dependencies: 83 - -Run `revdepcheck::cloud_details(, "simcausal")` for more info - -
- -## Newly broken - -* checking tests ... ERROR - ``` - Running ‘test-all.R’ - Running the tests in ‘tests/test-all.R’ failed. - Complete output: - > ## unit tests will not be done if RUnit is not available - > # setwd("..") - > # getwd() - > # library(RUnit) - > if(require("RUnit", quietly=TRUE)) { - + ## --- Setup --- - + - ... - ℹ Please use `as_directed()` instead. - 2: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : - RNGkind: Marsaglia-Multicarry has poor statistical properties - 3: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : - RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry - 4: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : - RNGkind: Marsaglia-Multicarry has poor statistical properties - 5: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : - RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry - Execution halted - ``` - -## In both - -* checking re-building of vignette outputs ... WARNING - ``` - Error(s) in re-building vignettes: - ... - --- re-building ‘simcausal_vignette.Rnw’ using knitr - Error: processing vignette 'simcausal_vignette.Rnw' failed with diagnostics: - Running 'texi2dvi' on 'simcausal_vignette.tex' failed. - LaTeX errors: - ! LaTeX Error: File `colortbl.sty' not found. + Running examples in ‘pomdp-Ex.R’ failed + The error most likely occurred in: + + > ### Name: RussianTiger + > ### Title: Russian Tiger Problem POMDP Specification + > ### Aliases: RussianTiger + > ### Keywords: datasets + > + > ### ** Examples + > + > data("RussianTiger") + > RussianTiger + POMDP, list - Russian Tiger Problem + Discount factor: 1 + Horizon: Inf epochs + Size: 3 states / 4 actions / 3 obs. + Start: 0.5, 0.5, 0 + Solved: FALSE + + List components: ‘name’, ‘discount’, ‘horizon’, ‘states’, ‘actions’, + ‘observations’, ‘transition_prob’, ‘observation_prob’, ‘reward’, + ‘start’, ‘terminal_values’, ‘info’ + > + > # states, actions, and observations + > RussianTiger$states + [1] "tiger-left" "tiger-right" "done" + > RussianTiger$actions + [1] "listen" "open-left" "open-right" "nothing" + > RussianTiger$observations + [1] "tiger-left" "tiger-right" "done" + > + > # reward (-Inf indicates unavailable actions) + > RussianTiger$reward + action start.state end.state observation value + 1 listen -1 + 2 nothing -Inf + 3 done -Inf + 4 nothing done 0 + 5 open-left tiger-left -1000 + 6 open-right tiger-right -1000 + 7 open-left tiger-right 10 + 8 open-right tiger-left 10 + > + > sapply(RussianTiger$states, FUN = function(s) actions(RussianTiger, s)) + $`tiger-left` + [1] "listen" "open-left" "open-right" - Type X to quit or to proceed, - or enter new name. (Default extension: sty) - ... - l.55 \RequirePackage - [T1]{fontenc}^^M - ! ==> Fatal error occurred, no output PDF file produced! - --- failed re-building ‘simcausal_vignette.Rnw’ + $`tiger-right` + [1] "listen" "open-left" "open-right" - SUMMARY: processing the following file failed: - ‘simcausal_vignette.Rnw’ + $done + [1] "nothing" - Error: Vignette re-building failed. + > + > plot_transition_graph(RussianTiger, vertex.size = 30, edge.arrow.size = .3, margin = .5) + > + > # absorbing states + > absorbing_states(RussianTiger) + tiger-left tiger-right done + FALSE FALSE TRUE + > + > # solve the problem. + > sol <- solve_POMDP(RussianTiger) + > policy(sol) + tiger-left tiger-right done action + 1 -1000.000000 10.000000 -2000.00 open-left + 2 -176.217714 8.567046 -15695.15 listen + 3 -29.667899 7.113638 -25560.42 listen + 4 -2.629696 5.544325 -31493.06 listen + 5 0.000000 0.000000 0.00 nothing + 6 3.318222 3.318222 -33493.06 listen + 7 5.544325 -2.629696 -31493.06 listen + 8 7.113638 -29.667899 -25560.42 listen + 9 8.567046 -176.217714 -15695.15 listen + 10 10.000000 -1000.000000 -2000.00 open-right + > plot_policy_graph(sol) + Error in `igraph::dfs()`: + ! `...` must be empty. + ✖ Problematic argument: + • unreach = FALSE + Backtrace: + ▆ + 1. └─pomdp::plot_policy_graph(sol) + 2. └─pomdp:::.plot.igraph(...) + 3. └─pomdp::policy_graph(...) + 4. └─pomdp:::.policy_graph(...) + 5. ├─igraph::delete_vertices(...) + 6. │ └─igraph:::as_igraph_vs(graph, v) + 7. ├─base::setdiff(...) + 8. │ └─base::as.vector(y) + 9. └─igraph::dfs(policy_graph, root = initial_pg_node, unreach = FALSE) + 10. └─rlang::check_dots_empty() + 11. └─rlang:::action_dots(...) + 12. ├─base (local) try_dots(...) + 13. └─rlang (local) action(...) Execution halted ``` -# skynet - -
- -* Version: 1.4.3 -* GitHub: https://github.com/ropensci/skynet -* Source code: https://github.com/cran/skynet -* Date/Publication: 2022-06-17 13:00:02 UTC -* Number of recursive dependencies: 98 - -Run `revdepcheck::cloud_details(, "skynet")` for more info - -
- -## Newly broken - * checking tests ... ERROR ``` Running ‘testthat.R’ Running the tests in ‘tests/testthat.R’ failed. Complete output: - > library(testthat) - > library(skynet) + > library("testthat") + > library("pomdp") > - > test_check("skynet") - [ FAIL 1 | WARN 25 | SKIP 4 | PASS 69 ] + > test_check("pomdp") + [ FAIL 1 | WARN 0 | SKIP 0 | PASS 104 ] - ══ Skipped tests (4) ═══════════════════════════════════════════════════════════ - ... - 14. │ └─base::lapply(args, rlang::eval_tidy, data = data_mask) - 15. │ └─rlang (local) FUN(X[[i]], ...) - 16. └─igraph (local) from(V(x)[y]) - 17. └─lifecycle::deprecate_stop("2.1.0", "from()", ".from()") - 18. └─lifecycle:::deprecate_stop0(msg) - 19. └─rlang::cnd_signal(...) + ══ Failed tests ════════════════════════════════════════════════════════════════ + ── Error ('test-solve_POMDP.R:9:1'): (code run outside of `test_that()`) ─────── + + Error in `igraph::dfs(policy_graph, root = initial_pg_node, unreach = FALSE)`: `...` must be empty. + ✖ Problematic argument: + • unreach = FALSE + Backtrace: + ▆ + 1. └─pomdp::plot_policy_graph(sol) at test-solve_POMDP.R:9:1 + 2. └─pomdp:::.plot.igraph(...) + 3. └─pomdp::policy_graph(...) + 4. └─pomdp:::.policy_graph(...) + 5. ├─igraph::delete_vertices(...) + 6. │ └─igraph:::as_igraph_vs(graph, v) + 7. ├─base::setdiff(...) + 8. │ └─base::as.vector(y) + 9. └─igraph::dfs(policy_graph, root = initial_pg_node, unreach = FALSE) + 10. └─rlang::check_dots_empty() + 11. └─rlang:::action_dots(...) + 12. ├─base (local) try_dots(...) + 13. └─rlang (local) action(...) - [ FAIL 1 | WARN 25 | SKIP 4 | PASS 69 ] + [ FAIL 1 | WARN 0 | SKIP 0 | PASS 104 ] Error: Test failures Execution halted ``` +* checking re-building of vignette outputs ... ERROR + ``` + Error(s) in re-building vignettes: + --- re-building ‘gridworlds.Rmd’ using rmarkdown + ``` + ## In both -* checking dependencies in R code ... NOTE +* checking installed package size ... NOTE ``` - Namespace in Imports field not imported from: ‘maps’ - All declared Imports should be used. + installed size is 7.3Mb + sub-directories of 1Mb or more: + libs 5.7Mb ``` From df7edff60a75fe1ad92799eb3e4ae746857feda2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Tue, 3 Dec 2024 10:23:36 +0100 Subject: [PATCH 6/7] docs: fix example for `dfs()` as arguments after the dots must be named --- R/structural.properties.R | 18 ++++++++++++------ man/dfs.Rd | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/R/structural.properties.R b/R/structural.properties.R index 14765f8e5f0..5a22305da37 100644 --- a/R/structural.properties.R +++ b/R/structural.properties.R @@ -2304,9 +2304,13 @@ bfs <- function( #' @examples #' #' ## A graph with two separate trees -#' dfs(make_tree(10) %du% make_tree(10), -#' root = 1, "out", -#' TRUE, TRUE, TRUE, TRUE +#' dfs( +#' graph = make_tree(10) %du% make_tree(10), +#' root = 1, mode = "out", +#' unreachable = TRUE, +#' order = TRUE, +#' order.out = TRUE, +#' parent = TRUE #' ) #' #' ## How to use a callback @@ -2318,8 +2322,9 @@ bfs <- function( #' cat("out:", paste(collapse = ", ", data), "\n") #' FALSE #' } -#' tmp <- dfs(make_tree(10), -#' root = 1, "out", +#' tmp <- dfs( +#' graph = make_tree(10), +#' root = 1, mode = "out", #' in.callback = f.in, out.callback = f.out #' ) #' @@ -2327,7 +2332,8 @@ bfs <- function( #' f.out <- function(graph, data, extra) { #' data["vid"] == 1 #' } -#' tmp <- dfs(make_tree(10) %du% make_tree(10), +#' tmp <- dfs( +#' graph = make_tree(10) %du% make_tree(10), #' root = 1, #' out.callback = f.out #' ) diff --git a/man/dfs.Rd b/man/dfs.Rd index bf560f40007..9b013096827 100644 --- a/man/dfs.Rd +++ b/man/dfs.Rd @@ -100,9 +100,13 @@ to terminate it. See examples below on how to use the callback functions. \examples{ ## A graph with two separate trees -dfs(make_tree(10) \%du\% make_tree(10), - root = 1, "out", - TRUE, TRUE, TRUE, TRUE +dfs( + graph = make_tree(10) \%du\% make_tree(10), + root = 1, mode = "out", + unreachable = TRUE, + order = TRUE, + order.out = TRUE, + parent = TRUE ) ## How to use a callback @@ -114,8 +118,9 @@ f.out <- function(graph, data, extra) { cat("out:", paste(collapse = ", ", data), "\n") FALSE } -tmp <- dfs(make_tree(10), - root = 1, "out", +tmp <- dfs( + graph = make_tree(10), + root = 1, mode = "out", in.callback = f.in, out.callback = f.out ) @@ -123,7 +128,8 @@ tmp <- dfs(make_tree(10), f.out <- function(graph, data, extra) { data["vid"] == 1 } -tmp <- dfs(make_tree(10) \%du\% make_tree(10), +tmp <- dfs( + graph = make_tree(10) \%du\% make_tree(10), root = 1, out.callback = f.out ) From fc2530bc805e4b96775d451cfaeabed8313a9a91 Mon Sep 17 00:00:00 2001 From: maelle <8360597+maelle@users.noreply.github.com> Date: Thu, 13 Feb 2025 11:48:30 +0000 Subject: [PATCH 7/7] [create-pull-request] automated change --- .../testthat/_snaps/structural.properties.md | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/tests/testthat/_snaps/structural.properties.md b/tests/testthat/_snaps/structural.properties.md index 0991cb34f8c..bf700e475e7 100644 --- a/tests/testthat/_snaps/structural.properties.md +++ b/tests/testthat/_snaps/structural.properties.md @@ -6,19 +6,6 @@ Error: ! The `neimode` argument of `dfs()` was deprecated in igraph 1.3.0 and is now defunct. i Please use the `mode` argument instead. - Warning: - The `father` argument of `dfs()` is deprecated as of igraph 2.1.2. - i Please use the `parent` argument instead. - ---- - - Code - b <- bfs(g, root = 2, neimode = "out", unreachable = FALSE, order = TRUE, rank = TRUE, - father = TRUE, pred = TRUE, succ = TRUE, dist = TRUE) - Condition - Error: - ! The `neimode` argument of `bfs()` was deprecated in igraph 1.3.0 and is now defunct. - i Please use the `mode` argument instead. # bfs() works @@ -75,10 +62,7 @@ b <- bfs(g, root = 2, neimode = "out", unreachable = FALSE, order = TRUE, rank = TRUE, father = TRUE, pred = TRUE, succ = TRUE, dist = TRUE) Condition - Warning: - The `neimode` argument of `bfs()` is deprecated as of igraph 1.3.0. + Error: + ! The `neimode` argument of `bfs()` was deprecated in igraph 1.3.0 and is now defunct. i Please use the `mode` argument instead. - Warning: - The `father` argument of `bfs()` is deprecated as of igraph 2.1.2. - i Please use the `parent` argument instead.