From e5e828b3f1d5571e59e4d2b35bab4cd19cfe3531 Mon Sep 17 00:00:00 2001 From: schochastics Date: Fri, 17 Jan 2025 19:46:41 +0100 Subject: [PATCH] replaced clean_indices with as_igraph_vs --- R/indexing.R | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/R/indexing.R b/R/indexing.R index a17607dc85..0bb7962a84 100644 --- a/R/indexing.R +++ b/R/indexing.R @@ -169,24 +169,6 @@ get_submatrix <- function(x, i, j, attr = NULL, sparse = TRUE) { res } -clean_indices <- function(x, indices) { - if (is.character(indices)) { - return(match(indices, V(x)$name)) - } - if (is.logical(indices)) { - if (length(indices) != vcount(x)) { - indices <- which(rep(indices, length.out = vcount(x))) - } else { - indices <- which(indices) - } - return(indices) - } - if (all(indices < 0)) { - return(seq_len(vcount(x))[indices]) - } - indices -} - #' Query and manipulate a graph as it were an adjacency matrix #' #' @details @@ -328,10 +310,10 @@ clean_indices <- function(x, indices) { # convert logical, character or negative i/j to proper vertex ids if (!missing(i)) { - i <- clean_indices(x, i) + i <- as_igraph_vs(x, i) } if (!missing(j)) { - j <- clean_indices(x, j) + j <- as_igraph_vs(x, j) } if (missing(i) && missing(j)) {