From f1f845e4cd916d38424323eb5b1e800a01acac04 Mon Sep 17 00:00:00 2001 From: see24 Date: Wed, 13 Mar 2024 15:47:13 -0400 Subject: [PATCH] update deprecated igraph function names --- DESCRIPTION | 2 +- R/mstList.R | 2 +- R/shortestPaths.R | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index c93ee02..1c3a1dd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -38,7 +38,7 @@ Encoding: UTF-8 LazyData: true Imports: dplyr, - igraph, + igraph (>= 2.0.3), data.table, sf, units, diff --git a/R/mstList.R b/R/mstList.R index 66a4f12..b18274f 100644 --- a/R/mstList.R +++ b/R/mstList.R @@ -50,7 +50,7 @@ mstList<- function(sim){ mst.paths <- igraph::mst(mst.g, weighted=TRUE) # get raster indexs for mst vertices - paths.matrix <- igraph::get.edgelist(mst.paths, names=TRUE) + paths.matrix <- igraph::as_edgelist(mst.paths, names=TRUE) paths.matrix <- matrix(as.numeric(paths.matrix), ncol = 2) diff --git a/R/shortestPaths.R b/R/shortestPaths.R index 6be96da..aeb625c 100644 --- a/R/shortestPaths.R +++ b/R/shortestPaths.R @@ -23,7 +23,7 @@ shortestPaths<- function(sim){ #create a list of shortest paths paths <- unlist(lapply(sim$paths.list, function(x){ - igraph::get.shortest.paths(sim$g, x[1], + igraph::shortest_paths(sim$g, x[1], x[2], out = "both") } )) @@ -66,7 +66,7 @@ iterativeShortestPaths<- function(sim){ for (i in seq_along(sim$paths.list)) { path.list <- sim$paths.list[[i]] - path <- igraph::get.shortest.paths(sim$g, path.list[1], path.list[2], out = "both") + path <- igraph::shortest_paths(sim$g, path.list[1], path.list[2], out = "both") path <- unlist(path)