diff --git a/NEWS.md b/NEWS.md index 63acb03..6995a57 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,6 +8,7 @@ * added divided edge bundling for directed graphs via `edge_bundle_force(directed = TRUE)` (Selassie et al. 2011): edges running in opposite directions are kept in separate lanes * `edge_bundle_hammer()` is now a native C++ implementation of KDE edge bundling (Hurter et al. 2012) and no longer depends on Python/`reticulate`/datashader. `reticulate` was dropped from Imports and `install_bundle_py()` was removed. Bundling output differs from the datashader-based version * added `edge_bundle_mingle()`, multilevel agglomerative edge bundling (Gansner et al. 2011) +* `metro_multicriteria()` is deprecated in favour of `graphlayouts::layout_as_metromap()` and will be removed in a future release # edgebundle 0.4.2 diff --git a/R/metro_multicriteria.R b/R/metro_multicriteria.R index 8480170..643f559 100644 --- a/R/metro_multicriteria.R +++ b/R/metro_multicriteria.R @@ -1,5 +1,7 @@ -#' @title Metro Map Layout -#' @description Metro map layout based on multicriteria optimization +#' @title Metro Map Layout (deprecated) +#' @description Metro map layout based on multicriteria optimization. +#' **Deprecated**: use `graphlayouts::layout_as_metromap()` instead, which now +#' provides this layout. #' @param object original graph #' @param xy initial layout of the original graph #' @param l desired multiple of grid point spacing. (l*gr determines desired edge length) @@ -27,6 +29,9 @@ #' xy_new <- metro_multicriteria(g, xy, l = 2, gr = 0.5, w = c(100, 100, 1, 1, 100), bsize = 35) #' @export metro_multicriteria <- function(object, xy, l = 2, gr = 0.0025, w = rep(1, 5), bsize = 5) { + .Deprecated("graphlayouts::layout_as_metromap", + msg = "metro_multicriteria() is deprecated; use graphlayouts::layout_as_metromap() instead." + ) adj <- as_adj_list1(object) adj <- lapply(adj, function(x) x - 1) adj_deg2 <- adj[unlist(lapply(adj, length)) == 2] diff --git a/man/metro_multicriteria.Rd b/man/metro_multicriteria.Rd index 2a49531..2bff02e 100644 --- a/man/metro_multicriteria.Rd +++ b/man/metro_multicriteria.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/metro_multicriteria.R \name{metro_multicriteria} \alias{metro_multicriteria} -\title{Metro Map Layout} +\title{Metro Map Layout (deprecated)} \usage{ metro_multicriteria(object, xy, l = 2, gr = 0.0025, w = rep(1, 5), bsize = 5) } @@ -23,7 +23,9 @@ metro_multicriteria(object, xy, l = 2, gr = 0.0025, w = rep(1, 5), bsize = 5) new coordinates for stations } \description{ -Metro map layout based on multicriteria optimization +Metro map layout based on multicriteria optimization. +\strong{Deprecated}: use \code{graphlayouts::layout_as_metromap()} instead, which now +provides this layout. } \details{ The function optimizes the following five criteria using a hill climbing algorithm: diff --git a/tests/testthat/test-metro.R b/tests/testthat/test-metro.R index bdf483c..65f0f73 100644 --- a/tests/testthat/test-metro.R +++ b/tests/testthat/test-metro.R @@ -1,7 +1,10 @@ -test_that("metro_multicriteria returns new station coordinates", { +test_that("metro_multicriteria returns new station coordinates and is deprecated", { g <- igraph::simplify(metro_berlin) xy <- cbind(igraph::V(g)$lon, igraph::V(g)$lat) * 100 - xy_new <- metro_multicriteria(g, xy, l = 2, gr = 0.5, w = c(100, 100, 1, 1, 100), bsize = 5) + expect_warning( + xy_new <- metro_multicriteria(g, xy, l = 2, gr = 0.5, w = c(100, 100, 1, 1, 100), bsize = 5), + "deprecated" + ) expect_true(is.matrix(xy_new)) expect_equal(dim(xy_new), dim(xy)) expect_false(anyNA(xy_new)) diff --git a/tests/testthat/test-no-deprecation.R b/tests/testthat/test-no-deprecation.R index 39fac29..697363b 100644 --- a/tests/testthat/test-no-deprecation.R +++ b/tests/testthat/test-no-deprecation.R @@ -10,13 +10,9 @@ test_that("edge bundlers run without warnings", { expect_no_warning(edge_bundle_path(px$g, px$xy)) }) -test_that("flow map and metro run without warnings", { +test_that("flow map functions run without warnings", { fx <- tnss_fixture() d <- tnss_dummies(fx$xy, root = fx$root) g <- expect_no_warning(tnss_tree(cali2010, fx$xy, d, root = fx$root, order = "near")) expect_no_warning(tnss_smooth(g, bw = 10, n = 10)) - - mg <- igraph::simplify(metro_berlin) - xy <- cbind(igraph::V(mg)$lon, igraph::V(mg)$lat) * 100 - expect_no_warning(metro_multicriteria(mg, xy, l = 2, gr = 0.5, w = c(100, 100, 1, 1, 100), bsize = 5)) })