Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 8 additions & 15 deletions R/layout.R
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ layout.mds <- function(
) {
# nocov start
lifecycle::deprecate_warn("2.0.0", "layout.mds()", "layout_with_mds()")
layout_with_mds(graph = graph, dist = dist, dim = dim, options = options)
layout_with_mds(graph = graph, dist = dist, dim = dim)
} # nocov end

#' Simple grid layout
Expand Down Expand Up @@ -2733,8 +2733,9 @@ layout.lgl <- function(..., params = list()) {
#' minus one, but only if the graph is connected; for unconnected graphs, the
#' only possible value is 2. This is because `merge_coords()` only works in
#' 2D.
#' @param options This is currently ignored, as ARPACK is not used any more for
#' solving the eigenproblem
#' @param options `r lifecycle::badge("deprecated")` This argument is not
#' supported from igraph version 1.6.0, as ARPACK is not used any more for
#' solving the eigenproblem. Supplying it raises an error.
#' @return A numeric matrix with `dim` columns.
#' @author Tamas Nepusz \email{ntamas@@gmail.com} and Gabor Csardi
#' \email{csardi.gabor@@gmail.com}
Expand All @@ -2753,21 +2754,13 @@ layout_with_mds <- function(
graph,
dist = NULL,
dim = 2,
options = arpack_defaults()
options = deprecated()
) {
if (is.function(options)) {
lifecycle::deprecate_warn(
"1.6.0",
"layout_with_mds(options = 'must be a list')",
details = c(
"`arpack_defaults()` is now a function, use `options = arpack_defaults()` instead of `options = arpack_defaults`."
)
)
options <- options()
}

# Argument checks
ensure_igraph(graph)
if (lifecycle::is_present(options)) {
lifecycle::deprecate_stop("1.6.0", "layout_with_mds(options = )")
}
dist[] <- as.numeric(dist)
dim <- as.numeric(dim)

Expand Down
5 changes: 3 additions & 2 deletions man/layout.mds.Rd

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

7 changes: 4 additions & 3 deletions man/layout_with_mds.Rd

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

8 changes: 8 additions & 0 deletions tests/testthat/_snaps/layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
Error:
! The `niter` argument of `layout_with_kk()` was deprecated in igraph 0.8.0 and is now defunct.

# layout_with_mds() deprecated argument

Code
l <- layout_with_mds(g, options = arpack_defaults())
Condition
Error:
! The `options` argument of `layout_with_mds()` was deprecated in igraph 1.6.0 and is now defunct.

# layout_randomly() errors well

Code
Expand Down
9 changes: 6 additions & 3 deletions tests/testthat/test-layout.R
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,14 @@ test_that("`layout_with_mds()` works", {

out1 <- layout_with_mds(g)
expect_equal(out1, mymds(g))
})

test_that("layout_with_mds() deprecated argument", {
rlang::local_options(lifecycle_verbosity = "warning")

expect_warning(out2 <- layout_with_mds(g, options = arpack_defaults))
expect_equal(out2, out1)
g <- make_tree(10, 2, mode = "undirected")
expect_snapshot_igraph_error({
l <- layout_with_mds(g, options = arpack_defaults())
})
})

test_that("`layout_with_mds()` stress test, graph with multiple components", {
Expand Down
Loading