Skip to content

Commit

Permalink
chore!: remove deprecated neimode parameter from bfs / dfs; ori…
Browse files Browse the repository at this point in the history
…ginally planned for removal in 1.4.0
  • Loading branch information
maelle authored and krlmlr committed Nov 7, 2024
1 parent 30518c2 commit 5c9d6bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
10 changes: 2 additions & 8 deletions R/structural.properties.R
Original file line number Diff line number Diff line change
Expand Up @@ -2140,14 +2140,11 @@ bfs <- function(
ensure_igraph(graph)

if (lifecycle::is_present(neimode)) {
lifecycle::deprecate_warn(
lifecycle::deprecate_stop(
"1.3.0",
"bfs(neimode)",
"bfs(mode)"
)
if (missing(mode)) {
mode <- neimode
}
}

if (length(root) == 1) {
Expand Down Expand Up @@ -2315,14 +2312,11 @@ dfs <- function(graph, root, mode = c("out", "in", "all", "total"),
rho = parent.frame(), neimode = deprecated()) {
ensure_igraph(graph)
if (lifecycle::is_present(neimode)) {
lifecycle::deprecate_warn(
lifecycle::deprecate_stop(
"1.3.0",
"dfs(neimode)",
"dfs(mode)"
)
if (missing(mode)) {
mode <- neimode
}
}

root <- as_igraph_vs(graph, root) - 1
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/_snaps/structural.properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Code
d <- dfs(g, root = 2, unreachable = FALSE, neimode = "out")
Condition
Warning:
The `neimode` argument of `dfs()` is deprecated as of igraph 1.3.0.
Error:
! The `neimode` argument of `dfs()` was deprecated in igraph 1.3.0 and is now defunct.
i Please use the `mode` argument instead.

---
Expand All @@ -13,8 +13,8 @@
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.

# bfs() works
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-structural.properties.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test_that("dfs() does not pad order", {
test_that("bfs() deprecated argument", {
g <- make_star(3)

expect_snapshot({
expect_snapshot(error = TRUE, {
d <- dfs(
g,
root = 2,
Expand Down Expand Up @@ -199,7 +199,7 @@ test_that("bfs() works", {
test_that("bfs() deprecated argument", {
g <- graph_from_literal(a - +b - +c, z - +a, d)

expect_snapshot({
expect_snapshot(error = TRUE, {
b <- bfs(
g,
root = 2,
Expand Down

0 comments on commit 5c9d6bd

Please sign in to comment.