Skip to content
Merged
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
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 7 additions & 2 deletions R/metro_multicriteria.R
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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]
Expand Down
6 changes: 4 additions & 2 deletions man/metro_multicriteria.Rd

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

7 changes: 5 additions & 2 deletions tests/testthat/test-metro.R
Original file line number Diff line number Diff line change
@@ -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))
Expand Down
6 changes: 1 addition & 5 deletions tests/testthat/test-no-deprecation.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
})
Loading